99
1010const deviceName = py32 .Device
1111
12- // Peripheral port offsets. Keep the same spacing used on other MCUs so helpers
13- // like Pin.getPort can keep using simple division by 16 even though PY32 ports
14- // only expose 8 pins each .
12+ // Peripheral port offsets.
13+ // Keep the same spacing used on other MCUs so helpers like Pin.getPortNumber
14+ // can keep using simple division by 16 .
1515const (
1616 portA Pin = iota * 16
1717 portB
@@ -21,7 +21,6 @@ const (
2121 portF
2222)
2323
24- // Port A pins.
2524const (
2625 PA0 Pin = portA + iota
2726 PA1
@@ -41,7 +40,6 @@ const (
4140 PA15
4241)
4342
44- // Port B pins.
4543const (
4644 PB0 Pin = portB + iota
4745 PB1
@@ -61,7 +59,6 @@ const (
6159 PB15
6260)
6361
64- // Port C pins.
6562const (
6663 PC0 Pin = portC + iota
6764 PC1
@@ -81,7 +78,6 @@ const (
8178 PC15
8279)
8380
84- // Port D pins.
8581const (
8682 PD0 Pin = portD + iota
8783 PD1
@@ -101,7 +97,6 @@ const (
10197 PD15
10298)
10399
104- // Port E pins.
105100const (
106101 PE0 Pin = portE + iota
107102 PE1
@@ -121,7 +116,6 @@ const (
121116 PE15
122117)
123118
124- // Port F pins.
125119const (
126120 PF0 Pin = portF + iota
127121 PF1
@@ -141,7 +135,6 @@ const (
141135 PF15
142136)
143137
144- // PinMode values specific to PY32: only GPIO direction and pull configuration.
145138const (
146139 PinOutput PinMode = iota
147140 PinInputFloating
@@ -151,7 +144,6 @@ const (
151144)
152145const PinInput PinMode = PinInputFloating
153146
154- // Internal helpers for GPIO configuration.
155147const (
156148 gpioModeInput = 0
157149 gpioModeOutput = 1
@@ -167,11 +159,6 @@ const (
167159 gpioOutputSpeedMask = 0x3
168160)
169161
170- // // CPUFrequency returns the core clock frequency.
171- // func CPUFrequency() uint32 {
172- // return 48_000_000
173- // }
174-
175162func (p Pin ) getPortNumber () uint8 {
176163 return uint8 (p ) >> 4
177164
0 commit comments