Lines Matching full:adc
10 #include <zephyr/drivers/adc.h>
13 #include <reg/adc.h>
22 /* ADC Register base address */
23 struct adc_regs *adc; member
36 /* ADC local functions */
61 /* ADC Sample Flow (by using adc_context.h api function)
62 * 1. Start ADC sampling (set up flag ctx->sync)
64 * 2. Wait ADC sample finish (by monitor flag ctx->sync)
66 * 3. Finish ADC sample (isr clear flag ctx->sync)
76 LOG_ERR("Invalid ADC channels."); in adc_kb1200_start_read()
79 /* Fixed 10 bit resolution of ene ADC */ in adc_kb1200_start_read()
81 LOG_ERR("Unfixed 10 bit ADC resolution."); in adc_kb1200_start_read()
86 LOG_ERR("ADC buffer size too small."); in adc_kb1200_start_read()
95 /* Inform adc start sampling */ in adc_kb1200_start_read()
97 /* Since kb1200 adc has no irq. So need polling the adc conversion in adc_kb1200_start_read()
98 * flag to be valid, then record adc value. in adc_kb1200_start_read()
100 uint32_t channels = (config->adc->ADCCFG & ADC_CHANNEL_BIT_MASK) >> ADC_CHANNEL_BIT_POS; in adc_kb1200_start_read()
109 while (config->adc->ADCDAT[ch_num] & ADC_INVALID_VALUE) { in adc_kb1200_start_read()
113 LOG_ERR("ADC busy timeout..."); in adc_kb1200_start_read()
118 /* check buffer size is enough then record adc value */ in adc_kb1200_start_read()
120 *data->buffer = (uint16_t)(config->adc->ADCDAT[ch_num]); in adc_kb1200_start_read()
130 /* Besause polling the adc conversion flag. don't need wait_for_completion*/ in adc_kb1200_start_read()
132 /* Inform adc sampling is done */ in adc_kb1200_start_read()
137 /* ADC api functions */
165 LOG_DBG("ADC channel %d configured.", channel_cfg->channel_id); in adc_kb1200_channel_setup()
196 /* ADC api function (using by adc_context.H function) */
204 config->adc->ADCCFG = (config->adc->ADCCFG & ~ADC_CHANNEL_BIT_MASK) | in adc_context_start_sampling()
206 config->adc->ADCCFG |= ADC_FUNCTION_ENABLE; in adc_context_start_sampling()
218 static DEVICE_API(adc, adc_kb1200_api) = {
234 /* Configure pin-mux for ADC device */ in adc_kb1200_init()
237 LOG_ERR("ADC pinctrl setup failed (%d).", ret); in adc_kb1200_init()
252 .adc = (struct adc_regs *)DT_INST_REG_ADDR(inst), \