Skip to content

Commit 10e6124

Browse files
committed
chore(src/machine/nrf52xxx/adc): fix typo and formatting
Signed-off-by: Paul Schroeder <milkpirate@users.noreply.github.com>
1 parent ac8ca36 commit 10e6124

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/machine/machine_nrf52xxx.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (a *ADC) Configure(config ADCConfig) {
4949
case 3600: // 3.6V
5050
configVal |= nrf.SAADC_CH_CONFIG_GAIN_Gain1_6 << nrf.SAADC_CH_CONFIG_GAIN_Pos
5151
default:
52-
// TODO: return an error
52+
// TODO: return an error, will that interfere with any interfaced if one will be?
5353
}
5454

5555
// Source resistance, according to table 89 on page 364 of the nrf52832 datasheet.
@@ -100,36 +100,28 @@ func (a *ADC) Configure(config ADCConfig) {
100100
nrf.SAADC.CH[0].CONFIG.Set(configVal)
101101
}
102102

103-
// Get returns the current value of a ADC pin in the range 0..0xffff.
104103
func (a ADC) Get() uint16 {
104+
// Get returns the current value of an ADC pin in the range 0..0xffff.
105105
var pwmPin uint32
106106
var rawValue volatile.Register16
107107

108108
switch a.Pin {
109109
case 2:
110110
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput0
111-
112111
case 3:
113112
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput1
114-
115113
case 4:
116114
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput2
117-
118115
case 5:
119116
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput3
120-
121117
case 28:
122118
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput4
123-
124119
case 29:
125120
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput5
126-
127121
case 30:
128122
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput6
129-
130123
case 31:
131124
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput7
132-
133125
default:
134126
return 0
135127
}
@@ -194,7 +186,7 @@ type SPIConfig struct {
194186
Mode uint8
195187
}
196188

197-
// Configure is intended to setup the SPI interface.
189+
// Configure is intended to set up the SPI interface.
198190
func (spi SPI) Configure(config SPIConfig) error {
199191
// Disable bus to configure it
200192
spi.Bus.ENABLE.Set(nrf.SPIM_ENABLE_ENABLE_Disabled)

0 commit comments

Comments
 (0)