Skip to content

Commit d64c208

Browse files
committed
[nrf fromlist] drivers: adc: nrf: align to channel-wide burst configuration
Some nRF devices allow to configure burst setting per channel while others globally. Upstream PR #: 90944 Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent 3ba522f commit d64c208

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/adc/adc_nrfx_saadc.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ static int start_read(const struct device *dev,
530530
uint8_t resolution = sequence->resolution;
531531
uint8_t active_channels;
532532
uint8_t channel_id;
533+
nrf_saadc_burst_t burst;
533534

534535
/* Signal an error if channel selection is invalid (no channels or
535536
* a non-existing one is selected).
@@ -581,10 +582,13 @@ static int start_read(const struct device *dev,
581582
* is not used (hence, the multiple channel sampling is
582583
* possible), the burst mode have to be deactivated.
583584
*/
584-
nrf_saadc_burst_set(NRF_SAADC, channel_id,
585-
(sequence->oversampling != 0U ?
586-
NRF_SAADC_BURST_ENABLED :
587-
NRF_SAADC_BURST_DISABLED));
585+
burst = (sequence->oversampling != 0U ?
586+
NRF_SAADC_BURST_ENABLED : NRF_SAADC_BURST_DISABLED);
587+
#if NRF_SAADC_HAS_CH_BURST
588+
nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst);
589+
#else
590+
nrf_saadc_burst_set(NRF_SAADC, burst);
591+
#endif
588592
nrf_saadc_channel_pos_input_set(
589593
NRF_SAADC,
590594
channel_id,
@@ -596,10 +600,12 @@ static int start_read(const struct device *dev,
596600
);
597601
++active_channels;
598602
} else {
599-
nrf_saadc_burst_set(
600-
NRF_SAADC,
601-
channel_id,
602-
NRF_SAADC_BURST_DISABLED);
603+
burst = NRF_SAADC_BURST_DISABLED;
604+
#if NRF_SAADC_HAS_CH_BURST
605+
nrf_saadc_channel_burst_set(NRF_SAADC, channel_id, burst);
606+
#else
607+
nrf_saadc_burst_set(NRF_SAADC, burst);
608+
#endif
603609
nrf_saadc_channel_pos_input_set(
604610
NRF_SAADC,
605611
channel_id,

0 commit comments

Comments
 (0)