arm/nrf52,nrf53: fix SAADC channel limit register value

CHLIMIT was written with (limith < 16) | limith, which put the high
limit into the low field and a boolean into bit 0. Shift the high
limit to bits 16-31 and the low limit to bits 0-15.

Assisted-by: Claude Code
Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
raiden00pl 2026-09-24 15:32:29 +02:00 • committed by Xiang Xiao
parent 574bbf618f
commit 058da97e95
2 changed files with 2 additions and 2 deletions

View file

@ -767,7 +767,7 @@ static int nrf52_adc_chancfg(struct nrf52_adc_s *priv, uint8_t chan,
#ifdef CONFIG_NRF52_SAADC_LIMITS
/* Configure limits */
regval = (cfg->limith < 16) | (cfg->limith << 0);
regval = ((uint32_t)cfg->limith << 16) | ((uint32_t)cfg->limitl << 0);
nrf52_adc_putreg(priv, NRF52_SAADC_CHLIMIT_OFFSET(chan), regval);
#endif

View file

@ -670,7 +670,7 @@ static int nrf53_adc_chancfg(struct nrf53_adc_s *priv, uint8_t chan,
#ifdef CONFIG_NRF53_SAADC_LIMITS
/* Configure limits */
regval = (cfg->limith < 16) | (cfg->limith << 0);
regval = ((uint32_t)cfg->limith << 16) | ((uint32_t)cfg->limitl << 0);
nrf53_adc_putreg(priv, NRF53_SAADC_CHLIMIT_OFFSET(chan), regval);
#endif