Lines Matching +full:sample +full:- +full:time +full:- +full:us
4 * SPDX-License-Identifier: Apache-2.0
39 /** Internal sample time unit conversion entry. */
45 /** Maps standard unit sample times (us) to internal (raw hal_ti register) values */
85 data->repeat_buffer = data->buffer; in adc_context_start_sampling()
87 AUXADCEnableSync(data->ref_source, data->sample_time, AUXADC_TRIGGER_MANUAL); in adc_context_start_sampling()
98 data->buffer = data->repeat_buffer; in adc_context_update_buffer_pointer()
100 data->buffer++; in adc_context_update_buffer_pointer()
106 struct adc_cc13xx_cc26xx_data *data = dev->data; in adc_cc13xx_cc26xx_init()
107 const struct adc_cc13xx_cc26xx_cfg *config = dev->config; in adc_cc13xx_cc26xx_init()
109 data->dev = dev; in adc_cc13xx_cc26xx_init()
116 config->irq_cfg_func(); in adc_cc13xx_cc26xx_init()
118 adc_context_unlock_unconditionally(&data->ctx); in adc_cc13xx_cc26xx_init()
125 struct adc_cc13xx_cc26xx_data *data = dev->data; in adc_cc13xx_cc26xx_channel_setup()
126 const uint8_t ch = channel_cfg->channel_id; in adc_cc13xx_cc26xx_channel_setup()
132 return -EINVAL; in adc_cc13xx_cc26xx_channel_setup()
135 switch (ADC_ACQ_TIME_UNIT(channel_cfg->acquisition_time)) { in adc_cc13xx_cc26xx_channel_setup()
137 data->sample_time = (uint16_t)ADC_ACQ_TIME_VALUE(channel_cfg->acquisition_time); in adc_cc13xx_cc26xx_channel_setup()
140 sample_time_us = (uint16_t)ADC_ACQ_TIME_VALUE(channel_cfg->acquisition_time); in adc_cc13xx_cc26xx_channel_setup()
144 ADC_ACQ_TIME_VALUE(channel_cfg->acquisition_time) * 1000); in adc_cc13xx_cc26xx_channel_setup()
147 data->sample_time = AUXADC_SAMPLE_TIME_170_US; in adc_cc13xx_cc26xx_channel_setup()
151 /* choose the nearest sample time configuration */ in adc_cc13xx_cc26xx_channel_setup()
152 data->sample_time = adc_cc13xx_sample_times[0].reg_value; in adc_cc13xx_cc26xx_channel_setup()
157 data->sample_time = adc_cc13xx_sample_times[i].reg_value; in adc_cc13xx_cc26xx_channel_setup()
160 LOG_ERR("Acquisition time is not valid"); in adc_cc13xx_cc26xx_channel_setup()
161 return -EINVAL; in adc_cc13xx_cc26xx_channel_setup()
165 if (channel_cfg->differential) { in adc_cc13xx_cc26xx_channel_setup()
167 return -EINVAL; in adc_cc13xx_cc26xx_channel_setup()
170 if (channel_cfg->gain != ADC_GAIN_1) { in adc_cc13xx_cc26xx_channel_setup()
172 return -EINVAL; in adc_cc13xx_cc26xx_channel_setup()
175 if (channel_cfg->reference == ADC_REF_INTERNAL) { in adc_cc13xx_cc26xx_channel_setup()
176 data->ref_source = AUXADC_REF_FIXED; in adc_cc13xx_cc26xx_channel_setup()
177 } else if (channel_cfg->reference == ADC_REF_VDD_1) { in adc_cc13xx_cc26xx_channel_setup()
178 data->ref_source = AUXADC_REF_VDDS_REL; in adc_cc13xx_cc26xx_channel_setup()
181 return -EINVAL; in adc_cc13xx_cc26xx_channel_setup()
184 LOG_DBG("Setup %d acq time %d", ch, data->sample_time); in adc_cc13xx_cc26xx_channel_setup()
196 struct adc_cc13xx_cc26xx_data *data = dev->data; in cc13xx_cc26xx_read()
200 if (sequence->resolution != 12) { in cc13xx_cc26xx_read()
202 sequence->resolution); in cc13xx_cc26xx_read()
203 return -EINVAL; in cc13xx_cc26xx_read()
207 if (sequence->options) { in cc13xx_cc26xx_read()
208 exp_size *= (1 + sequence->options->extra_samplings); in cc13xx_cc26xx_read()
211 if (sequence->buffer_size < exp_size) { in cc13xx_cc26xx_read()
213 exp_size, sequence->buffer_size); in cc13xx_cc26xx_read()
214 return -ENOMEM; in cc13xx_cc26xx_read()
217 data->buffer = sequence->buffer; in cc13xx_cc26xx_read()
219 adc_context_lock(&data->ctx, asynchronous, sig); in cc13xx_cc26xx_read()
220 adc_context_start_read(&data->ctx, sequence); in cc13xx_cc26xx_read()
221 rv = adc_context_wait_for_completion(&data->ctx); in cc13xx_cc26xx_read()
222 adc_context_release(&data->ctx, rv); in cc13xx_cc26xx_read()
243 * - conversion complete or DMA done (if used);
244 * - FIFO underflow or overflow;
248 struct adc_cc13xx_cc26xx_data *data = dev->data; in adc_cc13xx_cc26xx_isr()
257 /* clear the AUXADC-related event flags */ in adc_cc13xx_cc26xx_isr()
270 LOG_DBG("ADC buf %04X val %d", (unsigned int)data->buffer, adc_value); in adc_cc13xx_cc26xx_isr()
271 *data->buffer = adc_value; in adc_cc13xx_cc26xx_isr()
274 adc_context_on_sampling_done(&data->ctx, dev); in adc_cc13xx_cc26xx_isr()