mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
nrf: fix adc read near zero
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user