Skip to content

Commit

Permalink
chore(review): honor
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Schroeder <[email protected]>
  • Loading branch information
milkpirate committed Jan 18, 2025
1 parent de4ef7a commit 46150cd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/machine/machine_nrf52xxx.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func InitADC() {
// SampleTime will be ceiled to 3(default), 5, 10, 15, 20 or 40(max) µS respectively
// Samples can be 1(default), 2, 4, 8, 16, 32, 64, 128, 256 samples
func (a *ADC) Configure(config ADCConfig) {

var configVal uint32 = nrf.SAADC_CH_CONFIG_RESP_Bypass<<nrf.SAADC_CH_CONFIG_RESP_Pos |
nrf.SAADC_CH_CONFIG_RESP_Bypass<<nrf.SAADC_CH_CONFIG_RESN_Pos |
nrf.SAADC_CH_CONFIG_REFSEL_Internal<<nrf.SAADC_CH_CONFIG_REFSEL_Pos |
Expand Down Expand Up @@ -169,7 +168,22 @@ func (a *ADC) Get() uint16 {
}
nrf.SAADC.EVENTS_STOPPED.Set(0)

return rawValue.Get()
rawValue := rawValue.Get()

Check failure on line 171 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

no new variables on left side of :=

Check failure on line 171 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

cannot use rawValue.Get() (value of type uint16) as volatile.Register16 value in assignment

Check failure on line 171 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

no new variables on left side of :=

Check failure on line 171 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

cannot use rawValue.Get() (value of type uint16) as volatile.Register16 value in assignment
// convert to 16 bit resolution/value
switch nrf.SAADC.RESOLUTION.Get() {
case nrf.SAADC_RESOLUTION_VAL_8bit:
rawValue <<= 8

Check failure on line 175 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer

Check failure on line 175 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer
case nrf.SAADC_RESOLUTION_VAL_10bit:
rawValue <<= 6

Check failure on line 177 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer

Check failure on line 177 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer
case nrf.SAADC_RESOLUTION_VAL_12bit:
rawValue <<= 4

Check failure on line 179 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer

Check failure on line 179 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer
case nrf.SAADC_RESOLUTION_VAL_14bit:
rawValue <<= 2

Check failure on line 181 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer

Check failure on line 181 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer
default:
rawValue <<= 4 // 12bit

Check failure on line 183 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer

Check failure on line 183 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

invalid operation: shifted operand rawValue (variable of type volatile.Register16) must be integer
}

return rawValue

Check failure on line 186 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

cannot use rawValue (variable of type volatile.Register16) as uint16 value in return statement

Check failure on line 186 in src/machine/machine_nrf52xxx.go

View workflow job for this annotation

GitHub Actions / assert-test-linux

cannot use rawValue (variable of type volatile.Register16) as uint16 value in return statement
}

// SPI on the NRF.
Expand Down

0 comments on commit 46150cd

Please sign in to comment.