Lines Matching refs:sequence
108 static uint32_t samples_to_bytes(const struct adc_sequence *sequence, uint16_t number_of_samples) in samples_to_bytes() argument
110 if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && sequence->resolution == 8) { in samples_to_bytes()
320 if (ctx->sequence.calibrate) { in adc_context_start_sampling()
337 samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); in adc_context_update_buffer_pointer()
341 samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); in adc_context_update_buffer_pointer()
347 static int set_resolution(const struct adc_sequence *sequence) in set_resolution() argument
351 switch (sequence->resolution) { in set_resolution()
366 sequence->resolution); in set_resolution()
374 static int set_oversampling(const struct adc_sequence *sequence, in set_oversampling() argument
379 if ((active_channels > 1) && (sequence->oversampling > 0)) { in set_oversampling()
385 switch (sequence->oversampling) { in set_oversampling()
415 sequence->oversampling); in set_oversampling()
423 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
428 needed_buffer_size = samples_to_bytes(sequence, active_channels); in check_buffer_size()
430 if (sequence->options) { in check_buffer_size()
431 needed_buffer_size *= (1 + sequence->options->extra_samplings); in check_buffer_size()
434 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
436 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
443 static bool has_single_ended(const struct adc_sequence *sequence) in has_single_ended() argument
445 return sequence->channels & m_data.single_ended_channels; in has_single_ended()
448 static void correct_single_ended(const struct adc_sequence *sequence) in correct_single_ended() argument
451 uint8_t selected_channels = sequence->channels; in correct_single_ended()
469 const struct adc_sequence *sequence) in start_read() argument
472 uint32_t selected_channels = sequence->channels; in start_read()
473 uint8_t resolution = sequence->resolution; in start_read()
528 (sequence->oversampling != 0U ? in start_read()
553 error = set_resolution(sequence); in start_read()
558 error = set_oversampling(sequence, active_channels); in start_read()
563 error = check_buffer_size(sequence, active_channels); in start_read()
569 m_data.user_buffer = sequence->buffer; in start_read()
577 (nrf_saadc_value_t *)sequence->buffer, in start_read()
581 adc_context_start_read(&m_data.ctx, sequence); in start_read()
588 const struct adc_sequence *sequence) in adc_nrfx_read() argument
593 error = start_read(dev, sequence); in adc_nrfx_read()
602 const struct adc_sequence *sequence, in adc_nrfx_read_async() argument
608 error = start_read(dev, sequence); in adc_nrfx_read_async()
623 if (has_single_ended(&m_data.ctx.sequence)) { in saadc_irq_handler()
624 correct_single_ended(&m_data.ctx.sequence); in saadc_irq_handler()
629 samples_to_bytes(&m_data.ctx.sequence, m_data.active_channels)); in saadc_irq_handler()