nrf: rename pwmPin to adcPin

Just a small refactor, to fix the naming.
This commit is contained in:
Ayke van Laethem
2025-11-30 11:14:11 +01:00
committed by Ron Evans
parent 7863bdb484
commit b1083d78c7
+10 -10
View File
@@ -116,32 +116,32 @@ func (a *ADC) Configure(config ADCConfig) {
// Get returns the current value of an ADC pin in the range 0..0xffff. // Get returns the current value of an ADC pin in the range 0..0xffff.
func (a *ADC) Get() uint16 { func (a *ADC) Get() uint16 {
var pwmPin uint32 var adcPin uint32
var rawValue volatile.Register16 var rawValue volatile.Register16
switch a.Pin { switch a.Pin {
case 2: case 2:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput0 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput0
case 3: case 3:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput1 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput1
case 4: case 4:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput2 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput2
case 5: case 5:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput3 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput3
case 28: case 28:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput4 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput4
case 29: case 29:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput5 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput5
case 30: case 30:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput6 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput6
case 31: case 31:
pwmPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput7 adcPin = nrf.SAADC_CH_PSELP_PSELP_AnalogInput7
default: default:
return 0 return 0
} }
// Set pin to read. // Set pin to read.
nrf.SAADC.CH[0].PSELP.Set(pwmPin) nrf.SAADC.CH[0].PSELP.Set(adcPin)
// Destination for sample result. // Destination for sample result.
// Note: rawValue doesn't need to be kept alive for the GC, since the // Note: rawValue doesn't need to be kept alive for the GC, since the