nrf: fix adc read near zero

This commit is contained in:
Yurii Soldak
2025-01-21 11:33:12 +01:00
committed by Ron Evans
parent 7417c14c2d
commit b7fcf6ad68
+6 -1
View File
@@ -183,7 +183,12 @@ func (a *ADC) Get() uint16 {
resolutionAdjustment = 4 // 12bit
}
return rawValue.Get() << resolutionAdjustment
value := int16(rawValue.Get())
if value < 0 {
value = 0
}
return uint16(value << resolutionAdjustment)
}
// SPI on the NRF.