From c6b47fe6a0d201f8ac018a3134de619deb13a28a Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 29 Jun 2025 20:20:58 +0200 Subject: [PATCH] rp2: use the correct channel mask for rp2350 ADC; hold lock during read (#4938) --- src/machine/machine_rp2_adc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/machine/machine_rp2_adc.go b/src/machine/machine_rp2_adc.go index fc9a8268e..d5f21b1aa 100644 --- a/src/machine/machine_rp2_adc.go +++ b/src/machine/machine_rp2_adc.go @@ -73,14 +73,15 @@ func (c ADCChannel) Configure(config ADCConfig) error { func (c ADCChannel) getOnce() uint16 { // Make it safe to sample multiple ADC channels in separate go routines. adcLock.Lock() - rp.ADC.CS.ReplaceBits(uint32(c), 0b111, rp.ADC_CS_AINSEL_Pos) + rp.ADC.CS.ReplaceBits(uint32(c)<