Lines Matching refs:sequence
70 static int adc_ambiq_slot_config(const struct device *dev, const struct adc_sequence *sequence, in adc_ambiq_slot_config() argument
76 if (adc_ambiq_set_resolution(&ADCSlotConfig.ePrecisionMode, sequence->resolution) != 0) { in adc_ambiq_slot_config()
77 LOG_ERR("unsupported resolution %d", sequence->resolution); in adc_ambiq_slot_config()
127 static int adc_ambiq_check_buffer_size(const struct adc_sequence *sequence, uint8_t active_channels) in adc_ambiq_check_buffer_size() argument
133 if (sequence->options) { in adc_ambiq_check_buffer_size()
134 needed_buffer_size *= (1 + sequence->options->extra_samplings); in adc_ambiq_check_buffer_size()
137 if (sequence->buffer_size < needed_buffer_size) { in adc_ambiq_check_buffer_size()
138 LOG_DBG("Provided buffer is too small (%u/%u)", sequence->buffer_size, in adc_ambiq_check_buffer_size()
146 static int adc_ambiq_start_read(const struct device *dev, const struct adc_sequence *sequence) in adc_ambiq_start_read() argument
157 if (sequence->channels & ~BIT_MASK(cfg->num_channels)) { in adc_ambiq_start_read()
158 LOG_ERR("Incorrect channels, bitmask 0x%x", sequence->channels); in adc_ambiq_start_read()
162 if (sequence->channels == 0UL) { in adc_ambiq_start_read()
167 error = adc_ambiq_check_buffer_size(sequence, active_channels); in adc_ambiq_start_read()
172 active_channels = POPCOUNT(sequence->channels); in adc_ambiq_start_read()
178 channels = sequence->channels; in adc_ambiq_start_read()
181 error = adc_ambiq_slot_config(dev, sequence, channel_id, slot_index); in adc_ambiq_start_read()
190 data->buffer = sequence->buffer; in adc_ambiq_start_read()
192 adc_context_start_read(&data->ctx, sequence); in adc_ambiq_start_read()
198 static int adc_ambiq_read(const struct device *dev, const struct adc_sequence *sequence) in adc_ambiq_read() argument
209 error = adc_ambiq_start_read(dev, sequence); in adc_ambiq_read()
331 static int adc_ambiq_read_async(const struct device *dev, const struct adc_sequence *sequence, in adc_ambiq_read_async() argument
343 error = adc_ambiq_start_read(dev, sequence); in adc_ambiq_read_async()