We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7417c14 commit b7fcf6aCopy full SHA for b7fcf6a
src/machine/machine_nrf52xxx.go
@@ -183,7 +183,12 @@ func (a *ADC) Get() uint16 {
183
resolutionAdjustment = 4 // 12bit
184
}
185
186
- return rawValue.Get() << resolutionAdjustment
+ value := int16(rawValue.Get())
187
+ if value < 0 {
188
+ value = 0
189
+ }
190
+
191
+ return uint16(value << resolutionAdjustment)
192
193
194
// SPI on the NRF.
0 commit comments