machine: add I2C pin comments

Similar to PWM, I2C can only be used on some pins. To automatically
generate this information per board, we need to add extra comments that
can then be interpreted by doc-gen for the tinygo.org website.
This commit is contained in:
Ayke van Laethem
2025-07-10 08:39:24 +02:00
committed by Ron Evans
parent e454ad1b61
commit b3da00ac1f
7 changed files with 84 additions and 80 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ const (
PC1 = portC + 1
PC2 = portC + 2
PC3 = portC + 3
PC4 = portC + 4
PC5 = portC + 5
PC4 = portC + 4 // peripherals: I2C0 SDA
PC5 = portC + 5 // peripherals: I2C0 SCL
PC6 = portC + 6
PC7 = portC + 7
PD0 = portD + 0
+4 -4
View File
@@ -28,8 +28,8 @@ const (
PC1 = portC + 1
PC2 = portC + 2
PC3 = portC + 3
PC4 = portC + 4
PC5 = portC + 5
PC4 = portC + 4 // peripherals: I2C0 SDA
PC5 = portC + 5 // peripherals: I2C0 SCL
PC6 = portC + 6
PC7 = portC + 7
PD0 = portD + 0
@@ -40,8 +40,8 @@ const (
PD5 = portD + 5 // peripherals: Timer0 channel B
PD6 = portD + 6 // peripherals: Timer0 channel A
PD7 = portD + 7
PE0 = portE + 0
PE1 = portE + 1
PE0 = portE + 0 // peripherals: I2C1 SDA
PE1 = portE + 1 // peripherals: I2C1 SCL
PE2 = portE + 2
PE3 = portE + 3
PE4 = portE + 4
+24 -20
View File
@@ -7,32 +7,36 @@ func CPUFrequency() uint32 {
return 48000000
}
// Note that the below pins have a few I2C pins listed that according to the
// datasheet don't support I2C yet they are used in practice on boards from
// Adafruit and Arduino. See machine_atsamd21_simulator.go for details.
// Hardware pins
const (
PA00 Pin = 0 // peripherals: TCC2 channel 0
PA01 Pin = 1 // peripherals: TCC2 channel 1
PA00 Pin = 0 // peripherals: TCC2 channel 0, sercomI2CM1 SDA
PA01 Pin = 1 // peripherals: TCC2 channel 1, sercomI2CM1 SCL
PA02 Pin = 2
PA03 Pin = 3
PA04 Pin = 4 // peripherals: TCC0 channel 0
PA05 Pin = 5 // peripherals: TCC0 channel 1
PA06 Pin = 6 // peripherals: TCC1 channel 0
PA07 Pin = 7 // peripherals: TCC1 channel 1
PA08 Pin = 8 // peripherals: TCC0 channel 0, TCC1 channel 2
PA09 Pin = 9 // peripherals: TCC0 channel 1, TCC1 channel 3
PA08 Pin = 8 // peripherals: TCC0 channel 0, TCC1 channel 2, sercomI2CM0 SDA, sercomI2CM2 SDA
PA09 Pin = 9 // peripherals: TCC0 channel 1, TCC1 channel 3, sercomI2CM0 SCL, sercomI2CM2 SCL
PA10 Pin = 10 // peripherals: TCC1 channel 0, TCC0 channel 2
PA11 Pin = 11 // peripherals: TCC1 channel 1, TCC0 channel 3
PA12 Pin = 12 // peripherals: TCC2 channel 0, TCC0 channel 2
PA13 Pin = 13 // peripherals: TCC2 channel 1, TCC0 channel 3
PA12 Pin = 12 // peripherals: TCC2 channel 0, TCC0 channel 2, sercomI2CM2 SDA, sercomI2CM4 SDA
PA13 Pin = 13 // peripherals: TCC2 channel 1, TCC0 channel 3, sercomI2CM2 SCL, sercomI2CM4 SCL
PA14 Pin = 14 // peripherals: TCC0 channel 0
PA15 Pin = 15 // peripherals: TCC0 channel 1
PA16 Pin = 16 // peripherals: TCC2 channel 0, TCC0 channel 2
PA17 Pin = 17 // peripherals: TCC2 channel 1, TCC0 channel 3
PA16 Pin = 16 // peripherals: TCC2 channel 0, TCC0 channel 2, sercomI2CM1 SDA, sercomI2CM3 SDA
PA17 Pin = 17 // peripherals: TCC2 channel 1, TCC0 channel 3, sercomI2CM1 SCL, sercomI2CM3 SCL
PA18 Pin = 18 // peripherals: TCC0 channel 2
PA19 Pin = 19 // peripherals: TCC0 channel 3
PA20 Pin = 20 // peripherals: TCC0 channel 2
PA21 Pin = 21 // peripherals: TCC0 channel 3
PA22 Pin = 22 // peripherals: TCC0 channel 0
PA23 Pin = 23 // peripherals: TCC0 channel 1
PA22 Pin = 22 // peripherals: TCC0 channel 0, sercomI2CM3 SDA, sercomI2CM5 SDA
PA23 Pin = 23 // peripherals: TCC0 channel 1, sercomI2CM3 SCL, sercomI2CM5 SCL
PA24 Pin = 24 // peripherals: TCC1 channel 2
PA25 Pin = 25 // peripherals: TCC1 channel 3
PA26 Pin = 26
@@ -43,22 +47,22 @@ const (
PA31 Pin = 31 // peripherals: TCC1 channel 1
PB00 Pin = 32
PB01 Pin = 33
PB02 Pin = 34
PB03 Pin = 35
PB02 Pin = 34 // peripherals: sercomI2CM5 SDA
PB03 Pin = 35 // peripherals: sercomI2CM5 SCL
PB04 Pin = 36
PB05 Pin = 37
PB06 Pin = 38
PB07 Pin = 39
PB08 Pin = 40
PB09 Pin = 41
PB08 Pin = 40 // peripherals: sercomI2CM4 SDA
PB09 Pin = 41 // peripherals: sercomI2CM4 SCL
PB10 Pin = 42 // peripherals: TCC0 channel 0
PB11 Pin = 43 // peripherals: TCC0 channel 1
PB12 Pin = 44 // peripherals: TCC0 channel 2
PB13 Pin = 45 // peripherals: TCC0 channel 3
PB12 Pin = 44 // peripherals: TCC0 channel 2, sercomI2CM4 SDA
PB13 Pin = 45 // peripherals: TCC0 channel 3, sercomI2CM4 SCL
PB14 Pin = 46
PB15 Pin = 47
PB16 Pin = 48 // peripherals: TCC0 channel 0
PB17 Pin = 49 // peripherals: TCC0 channel 1
PB16 Pin = 48 // peripherals: TCC0 channel 0, sercomI2CM5 SDA
PB17 Pin = 49 // peripherals: TCC0 channel 1, sercomI2CM5 SCL
PB18 Pin = 50
PB19 Pin = 51
PB20 Pin = 52
@@ -71,6 +75,6 @@ const (
PB27 Pin = 59
PB28 Pin = 60
PB29 Pin = 61
PB30 Pin = 62 // peripherals: TCC0 channel 0, TCC1 channel 2
PB31 Pin = 63 // peripherals: TCC0 channel 1, TCC1 channel 3
PB30 Pin = 62 // peripherals: TCC0 channel 0, TCC1 channel 2, sercomI2CM5 SDA
PB31 Pin = 63 // peripherals: TCC0 channel 1, TCC1 channel 3, sercomI2CM5 SCL
)
+2 -2
View File
@@ -49,8 +49,8 @@ const (
PC5 = portC + 5
PC6 = portC + 6
PC7 = portC + 7
PD0 = portD + 0
PD1 = portD + 1
PD0 = portD + 0 // peripherals: I2C0 SCL
PD1 = portD + 1 // peripherals: I2C0 SDA
PD2 = portD + 2
PD3 = portD + 3
PD7 = portD + 7
+10 -10
View File
@@ -81,22 +81,22 @@ const (
PA05 Pin = 5
PA06 Pin = 6
PA07 Pin = 7
PA08 Pin = 8 // peripherals: TCC0 channel 0, TCC1 channel 4
PA09 Pin = 9 // peripherals: TCC0 channel 1, TCC1 channel 5
PA08 Pin = 8 // peripherals: TCC0 channel 0, TCC1 channel 4, sercomI2CM0 SDA, sercomI2CM2 SDA
PA09 Pin = 9 // peripherals: TCC0 channel 1, TCC1 channel 5, sercomI2CM0 SCL, sercomI2CM2 SCL
PA10 Pin = 10 // peripherals: TCC0 channel 2, TCC1 channel 6
PA11 Pin = 11 // peripherals: TCC0 channel 3, TCC1 channel 7
PA12 Pin = 12 // peripherals: TCC0 channel 6, TCC1 channel 2
PA13 Pin = 13 // peripherals: TCC0 channel 7, TCC1 channel 3
PA12 Pin = 12 // peripherals: TCC0 channel 6, TCC1 channel 2, sercomI2CM2 SDA, sercomI2CM4 SDA
PA13 Pin = 13 // peripherals: TCC0 channel 7, TCC1 channel 3, sercomI2CM2 SCL, sercomI2CM4 SCL
PA14 Pin = 14 // peripherals: TCC2 channel 0, TCC1 channel 2
PA15 Pin = 15 // peripherals: TCC2 channel 1, TCC1 channel 3
PA16 Pin = 16 // peripherals: TCC1 channel 0, TCC0 channel 4
PA17 Pin = 17 // peripherals: TCC1 channel 1, TCC0 channel 5
PA16 Pin = 16 // peripherals: TCC1 channel 0, TCC0 channel 4, sercomI2CM1 SDA, sercomI2CM3 SDA
PA17 Pin = 17 // peripherals: TCC1 channel 1, TCC0 channel 5, sercomI2CM1 SCL, sercomI2CM3 SCL
PA18 Pin = 18 // peripherals: TCC1 channel 2, TCC0 channel 6
PA19 Pin = 19 // peripherals: TCC1 channel 3, TCC0 channel 7
PA20 Pin = 20 // peripherals: TCC1 channel 4, TCC0 channel 0
PA21 Pin = 21 // peripherals: TCC1 channel 5, TCC0 channel 1
PA22 Pin = 22 // peripherals: TCC1 channel 6, TCC0 channel 2
PA23 Pin = 23 // peripherals: TCC1 channel 7, TCC0 channel 3
PA22 Pin = 22 // peripherals: TCC1 channel 6, TCC0 channel 2, sercomI2CM3 SDA, sercomI2CM5 SDA
PA23 Pin = 23 // peripherals: TCC1 channel 7, TCC0 channel 3, sercomI2CM3 SCL, sercomI2CM5 SCL
PA24 Pin = 24 // peripherals: TCC2 channel 2
PA25 Pin = 25 // peripherals: TCC2 channel 3
PA26 Pin = 26
@@ -177,8 +177,8 @@ const (
PD05 Pin = 101
PD06 Pin = 102
PD07 Pin = 103
PD08 Pin = 104 // peripherals: TCC0 channel 1
PD09 Pin = 105 // peripherals: TCC0 channel 2
PD08 Pin = 104 // peripherals: TCC0 channel 1, sercomI2CM6 SDA, sercomI2CM7 SDA
PD09 Pin = 105 // peripherals: TCC0 channel 2, sercomI2CM6 SCL, sercomI2CM7 SCL
PD10 Pin = 106 // peripherals: TCC0 channel 3
PD11 Pin = 107 // peripherals: TCC0 channel 4
PD12 Pin = 108 // peripherals: TCC0 channel 5
+18 -18
View File
@@ -5,24 +5,24 @@ package machine
// RP2350B has additional pins.
const (
GPIO30 Pin = 30 // peripherals: PWM7 channel A
GPIO31 Pin = 31 // peripherals: PWM7 channel B
GPIO32 Pin = 32 // peripherals: PWM8 channel A
GPIO33 Pin = 33 // peripherals: PWM8 channel B
GPIO34 Pin = 34 // peripherals: PWM9 channel A
GPIO35 Pin = 35 // peripherals: PWM9 channel B
GPIO36 Pin = 36 // peripherals: PWM10 channel A
GPIO37 Pin = 37 // peripherals: PWM10 channel B
GPIO38 Pin = 38 // peripherals: PWM11 channel A
GPIO39 Pin = 39 // peripherals: PWM11 channel B
GPIO40 Pin = 40 // peripherals: PWM8 channel A
GPIO41 Pin = 41 // peripherals: PWM8 channel B
GPIO42 Pin = 42 // peripherals: PWM9 channel A
GPIO43 Pin = 43 // peripherals: PWM9 channel B
GPIO44 Pin = 44 // peripherals: PWM10 channel A
GPIO45 Pin = 45 // peripherals: PWM10 channel B
GPIO46 Pin = 46 // peripherals: PWM11 channel A
GPIO47 Pin = 47 // peripherals: PWM11 channel B
GPIO30 Pin = 30 // peripherals: PWM7 channel A, I2C1 SDA
GPIO31 Pin = 31 // peripherals: PWM7 channel B, I2C1 SCL
GPIO32 Pin = 32 // peripherals: PWM8 channel A, I2C0 SDA
GPIO33 Pin = 33 // peripherals: PWM8 channel B, I2C0 SCL
GPIO34 Pin = 34 // peripherals: PWM9 channel A, I2C1 SDA
GPIO35 Pin = 35 // peripherals: PWM9 channel B, I2C1 SCL
GPIO36 Pin = 36 // peripherals: PWM10 channel A, I2C0 SDA
GPIO37 Pin = 37 // peripherals: PWM10 channel B, I2C0 SCL
GPIO38 Pin = 38 // peripherals: PWM11 channel A, I2C1 SDA
GPIO39 Pin = 39 // peripherals: PWM11 channel B, I2C1 SCL
GPIO40 Pin = 40 // peripherals: PWM8 channel A, I2C0 SDA
GPIO41 Pin = 41 // peripherals: PWM8 channel B, I2C0 SCL
GPIO42 Pin = 42 // peripherals: PWM9 channel A, I2C1 SDA
GPIO43 Pin = 43 // peripherals: PWM9 channel B, I2C1 SCL
GPIO44 Pin = 44 // peripherals: PWM10 channel A, I2C0 SDA
GPIO45 Pin = 45 // peripherals: PWM10 channel B, I2C0 SCL
GPIO46 Pin = 46 // peripherals: PWM11 channel A, I2C1 SDA
GPIO47 Pin = 47 // peripherals: PWM11 channel B, I2C1 SCL
)
// Analog pins on 2350b.
+24 -24
View File
@@ -4,34 +4,34 @@ package machine
const (
// GPIO pins
GPIO0 Pin = 0 // peripherals: PWM0 channel A
GPIO1 Pin = 1 // peripherals: PWM0 channel B
GPIO2 Pin = 2 // peripherals: PWM1 channel A
GPIO3 Pin = 3 // peripherals: PWM1 channel B
GPIO4 Pin = 4 // peripherals: PWM2 channel A
GPIO5 Pin = 5 // peripherals: PWM2 channel B
GPIO6 Pin = 6 // peripherals: PWM3 channel A
GPIO7 Pin = 7 // peripherals: PWM3 channel B
GPIO8 Pin = 8 // peripherals: PWM4 channel A
GPIO9 Pin = 9 // peripherals: PWM4 channel B
GPIO10 Pin = 10 // peripherals: PWM5 channel A
GPIO11 Pin = 11 // peripherals: PWM5 channel B
GPIO12 Pin = 12 // peripherals: PWM6 channel A
GPIO13 Pin = 13 // peripherals: PWM6 channel B
GPIO14 Pin = 14 // peripherals: PWM7 channel A
GPIO15 Pin = 15 // peripherals: PWM7 channel B
GPIO16 Pin = 16 // peripherals: PWM0 channel A
GPIO17 Pin = 17 // peripherals: PWM0 channel B
GPIO18 Pin = 18 // peripherals: PWM1 channel A
GPIO19 Pin = 19 // peripherals: PWM1 channel B
GPIO20 Pin = 20 // peripherals: PWM2 channel A
GPIO21 Pin = 21 // peripherals: PWM2 channel B
GPIO0 Pin = 0 // peripherals: PWM0 channel A, I2C0 SDA
GPIO1 Pin = 1 // peripherals: PWM0 channel B, I2C0 SCL
GPIO2 Pin = 2 // peripherals: PWM1 channel A, I2C1 SDA
GPIO3 Pin = 3 // peripherals: PWM1 channel B, I2C1 SCL
GPIO4 Pin = 4 // peripherals: PWM2 channel A, I2C0 SDA
GPIO5 Pin = 5 // peripherals: PWM2 channel B, I2C0 SCL
GPIO6 Pin = 6 // peripherals: PWM3 channel A, I2C1 SDA
GPIO7 Pin = 7 // peripherals: PWM3 channel B, I2C1 SCL
GPIO8 Pin = 8 // peripherals: PWM4 channel A, I2C0 SDA
GPIO9 Pin = 9 // peripherals: PWM4 channel B, I2C0 SCL
GPIO10 Pin = 10 // peripherals: PWM5 channel A, I2C1 SDA
GPIO11 Pin = 11 // peripherals: PWM5 channel B, I2C1 SCL
GPIO12 Pin = 12 // peripherals: PWM6 channel A, I2C0 SDA
GPIO13 Pin = 13 // peripherals: PWM6 channel B, I2C0 SCL
GPIO14 Pin = 14 // peripherals: PWM7 channel A, I2C1 SDA
GPIO15 Pin = 15 // peripherals: PWM7 channel B, I2C1 SCL
GPIO16 Pin = 16 // peripherals: PWM0 channel A, I2C0 SDA
GPIO17 Pin = 17 // peripherals: PWM0 channel B, I2C0 SCL
GPIO18 Pin = 18 // peripherals: PWM1 channel A, I2C1 SDA
GPIO19 Pin = 19 // peripherals: PWM1 channel B, I2C1 SCL
GPIO20 Pin = 20 // peripherals: PWM2 channel A, I2C0 SDA
GPIO21 Pin = 21 // peripherals: PWM2 channel B, I2C0 SCL
GPIO22 Pin = 22 // peripherals: PWM3 channel A
GPIO23 Pin = 23 // peripherals: PWM3 channel B
GPIO24 Pin = 24 // peripherals: PWM4 channel A
GPIO25 Pin = 25 // peripherals: PWM4 channel B
GPIO26 Pin = 26 // peripherals: PWM5 channel A
GPIO27 Pin = 27 // peripherals: PWM5 channel B
GPIO26 Pin = 26 // peripherals: PWM5 channel A, I2C1 SDA
GPIO27 Pin = 27 // peripherals: PWM5 channel B, I2C1 SCL
GPIO28 Pin = 28 // peripherals: PWM6 channel A
GPIO29 Pin = 29 // peripherals: PWM6 channel B
)