drivers: adc: nrfx: Use SAADC HAL for setting the burst mode
Replaces direct accesses to the peripheral registers structure with the proper SAADC HAL function that appeared recently in nrfx. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
11716e4664
commit
7ed7d535e9
|
@ -245,15 +245,6 @@ static int check_buffer_size(const struct adc_sequence *sequence,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Move to <hal/nrf_saadc.h>. */
|
|
||||||
static void _nrf_saadc_burst_set(uint8_t channel,
|
|
||||||
nrf_saadc_burst_t burst)
|
|
||||||
{
|
|
||||||
NRF_SAADC->CH[channel].CONFIG =
|
|
||||||
(NRF_SAADC->CH[channel].CONFIG & ~SAADC_CH_CONFIG_BURST_Msk) |
|
|
||||||
(burst << SAADC_CH_CONFIG_BURST_Pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int start_read(struct device *dev, const struct adc_sequence *sequence)
|
static int start_read(struct device *dev, const struct adc_sequence *sequence)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
@ -295,7 +286,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence)
|
||||||
* is not used (hence, the multiple channel sampling is
|
* is not used (hence, the multiple channel sampling is
|
||||||
* possible), the burst mode have to be deactivated.
|
* possible), the burst mode have to be deactivated.
|
||||||
*/
|
*/
|
||||||
_nrf_saadc_burst_set(channel_id,
|
nrf_saadc_burst_set(channel_id,
|
||||||
(sequence->oversampling != 0 ?
|
(sequence->oversampling != 0 ?
|
||||||
NRF_SAADC_BURST_ENABLED :
|
NRF_SAADC_BURST_ENABLED :
|
||||||
NRF_SAADC_BURST_DISABLED));
|
NRF_SAADC_BURST_DISABLED));
|
||||||
|
|
Loading…
Reference in New Issue