@@ -49,7 +49,7 @@ func (a *ADC) Configure(config ADCConfig) {
49
49
case 3600 : // 3.6V
50
50
configVal |= nrf .SAADC_CH_CONFIG_GAIN_Gain1_6 << nrf .SAADC_CH_CONFIG_GAIN_Pos
51
51
default :
52
- // TODO: return an error
52
+ // TODO: return an error, will that interfere with any interfaced if one will be?
53
53
}
54
54
55
55
// Source resistance, according to table 89 on page 364 of the nrf52832 datasheet.
@@ -100,36 +100,28 @@ func (a *ADC) Configure(config ADCConfig) {
100
100
nrf .SAADC .CH [0 ].CONFIG .Set (configVal )
101
101
}
102
102
103
- // Get returns the current value of a ADC pin in the range 0..0xffff.
104
103
func (a ADC ) Get () uint16 {
104
+ // Get returns the current value of an ADC pin in the range 0..0xffff.
105
105
var pwmPin uint32
106
106
var rawValue volatile.Register16
107
107
108
108
switch a .Pin {
109
109
case 2 :
110
110
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput0
111
-
112
111
case 3 :
113
112
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput1
114
-
115
113
case 4 :
116
114
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput2
117
-
118
115
case 5 :
119
116
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput3
120
-
121
117
case 28 :
122
118
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput4
123
-
124
119
case 29 :
125
120
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput5
126
-
127
121
case 30 :
128
122
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput6
129
-
130
123
case 31 :
131
124
pwmPin = nrf .SAADC_CH_PSELP_PSELP_AnalogInput7
132
-
133
125
default :
134
126
return 0
135
127
}
@@ -194,7 +186,7 @@ type SPIConfig struct {
194
186
Mode uint8
195
187
}
196
188
197
- // Configure is intended to setup the SPI interface.
189
+ // Configure is intended to set up the SPI interface.
198
190
func (spi SPI ) Configure (config SPIConfig ) error {
199
191
// Disable bus to configure it
200
192
spi .Bus .ENABLE .Set (nrf .SPIM_ENABLE_ENABLE_Disabled )
0 commit comments