diff --git a/bbb.go b/bbb.go index 91cc6ce..47c837c 100644 --- a/bbb.go +++ b/bbb.go @@ -12,60 +12,60 @@ func init() { } var bbbPins = PinMap{ - &PinDesc{66, []string{"P8_07", "GPIO_66", "TIMER4"}, CapNormal | CapGPMC}, - &PinDesc{67, []string{"P8_08", "GPIO_67", "TIMER7"}, CapNormal | CapGPMC}, - &PinDesc{69, []string{"P8_09", "GPIO_69", "TIMER5"}, CapNormal | CapGPMC}, - &PinDesc{68, []string{"P8_10", "GPIO_68", "TIMER6"}, CapNormal | CapGPMC}, - &PinDesc{45, []string{"P8_11", "GPIO_45"}, CapNormal | CapGPMC}, - &PinDesc{44, []string{"P8_12", "GPIO_44"}, CapNormal | CapGPMC}, - &PinDesc{23, []string{"P8_13", "GPIO_23", "EHRPWM2B"}, CapNormal | CapGPMC}, - &PinDesc{26, []string{"P8_14", "GPIO_26"}, CapNormal | CapGPMC}, - &PinDesc{47, []string{"P8_15", "GPIO_47"}, CapNormal | CapGPMC}, - &PinDesc{46, []string{"P8_16", "GPIO_46"}, CapNormal | CapGPMC}, - &PinDesc{27, []string{"P8_17", "GPIO_27"}, CapNormal | CapGPMC}, - &PinDesc{65, []string{"P8_18", "GPIO_65"}, CapNormal | CapGPMC}, - &PinDesc{22, []string{"P8_19", "GPIO_22", "EHRPWM2A"}, CapNormal | CapGPMC}, - &PinDesc{61, []string{"P8_26", "GPIO_61"}, CapNormal | CapGPMC}, - &PinDesc{86, []string{"P8_27", "GPIO_86"}, CapNormal | CapLCD}, - &PinDesc{88, []string{"P8_28", "GPIO_88"}, CapNormal | CapLCD}, - &PinDesc{87, []string{"P8_29", "GPIO_87"}, CapNormal | CapLCD}, - &PinDesc{89, []string{"P8_30", "GPIO_89"}, CapNormal | CapLCD}, - &PinDesc{10, []string{"P8_31", "GPIO_10", "UART5_CTSN"}, CapNormal | CapLCD}, - &PinDesc{11, []string{"P8_32", "GPIO_11", "UART5_RTSN"}, CapNormal | CapLCD}, - &PinDesc{9, []string{"P8_33", "GPIO_9 ", "UART4_RTSN"}, CapNormal | CapLCD}, - &PinDesc{81, []string{"P8_34", "GPIO_81", "UART3_RTSN"}, CapNormal | CapLCD}, - &PinDesc{8, []string{"P8_35", "GPIO_8 ", "UART4_CTSN"}, CapNormal | CapLCD}, - &PinDesc{80, []string{"P8_36", "GPIO_80", "UART3_CTSN"}, CapNormal | CapLCD}, - &PinDesc{78, []string{"P8_37", "GPIO_78", "UART5_TXD"}, CapNormal | CapLCD}, - &PinDesc{79, []string{"P8_38", "GPIO_79", "UART5_RXD"}, CapNormal | CapLCD}, - &PinDesc{76, []string{"P8_39", "GPIO_76"}, CapNormal | CapLCD}, - &PinDesc{77, []string{"P8_40", "GPIO_77"}, CapNormal | CapLCD}, - &PinDesc{74, []string{"P8_41", "GPIO_74"}, CapNormal | CapLCD}, - &PinDesc{75, []string{"P8_42", "GPIO_75"}, CapNormal | CapLCD}, - &PinDesc{72, []string{"P8_43", "GPIO_72"}, CapNormal | CapLCD}, - &PinDesc{73, []string{"P8_44", "GPIO_73"}, CapNormal | CapLCD}, - &PinDesc{70, []string{"P8_45", "GPIO_70"}, CapNormal | CapLCD}, - &PinDesc{71, []string{"P8_46", "GPIO_71"}, CapNormal | CapLCD}, + &PinDesc{ID: "P8_07", Aliases: []string{"66", "GPIO_66", "Caps: TIMER4"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_08", Aliases: []string{"67", "GPIO_67", "TIMER7"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_09", Aliases: []string{"69", "GPIO_69", "TIMER5"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_10", Aliases: []string{"68", "GPIO_68", "TIMER6"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_11", Aliases: []string{"45", "GPIO_45"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_12", Aliases: []string{"44", "GPIO_44"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_13", Aliases: []string{"23", "GPIO_23", "EHRPWM2B"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_14", Aliases: []string{"26", "GPIO_26"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_15", Aliases: []string{"47", "GPIO_47"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_16", Aliases: []string{"46", "GPIO_46"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_17", Aliases: []string{"27", "GPIO_27"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_18", Aliases: []string{"65", "GPIO_65"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_19", Aliases: []string{"22", "GPIO_22", "EHRPWM2A"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_26", Aliases: []string{"61", "GPIO_61"}, Caps: CapNormal | CapGPMC}, + &PinDesc{ID: "P8_27", Aliases: []string{"86", "GPIO_86"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_28", Aliases: []string{"88", "GPIO_88"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_29", Aliases: []string{"87", "GPIO_87"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_30", Aliases: []string{"89", "GPIO_89"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_31", Aliases: []string{"10", "GPIO_10", "UART5_CTSN"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_32", Aliases: []string{"11", "GPIO_11", "UART5_RTSN"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_33", Aliases: []string{"9", "GPIO_9 ", "UART4_RTSN"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_34", Aliases: []string{"81", "GPIO_81", "UART3_RTSN"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_35", Aliases: []string{"8", "GPIO_8 ", "UART4_CTSN"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_36", Aliases: []string{"80", "GPIO_80", "UART3_CTSN"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_37", Aliases: []string{"78", "GPIO_78", "UART5_TXD"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_38", Aliases: []string{"79", "GPIO_79", "UART5_RXD"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_39", Aliases: []string{"76", "GPIO_76"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_40", Aliases: []string{"77", "GPIO_77"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_41", Aliases: []string{"74", "GPIO_74"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_42", Aliases: []string{"75", "GPIO_75"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_43", Aliases: []string{"72", "GPIO_72"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_44", Aliases: []string{"73", "GPIO_73"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_45", Aliases: []string{"70", "GPIO_70"}, Caps: CapNormal | CapLCD}, + &PinDesc{ID: "P8_46", Aliases: []string{"71", "GPIO_71"}, Caps: CapNormal | CapLCD}, - &PinDesc{30, []string{"P9_11", "GPIO_30", "UART4_RXD"}, CapNormal | CapUART}, - &PinDesc{60, []string{"P9_12", "GPIO_60", "GPIO1_28"}, CapNormal}, - &PinDesc{31, []string{"P9_13", "GPIO_31", "UART4_TXD"}, CapNormal | CapUART}, - &PinDesc{50, []string{"P9_14", "GPIO_50", "EHRPWM1A"}, CapNormal | CapPWM}, - &PinDesc{48, []string{"P9_15", "GPIO_48", "GPIO1_16"}, CapNormal}, - &PinDesc{51, []string{"P9_16", "GPIO_51", "EHRPWM1B"}, CapNormal | CapPWM}, - &PinDesc{5, []string{"P9_17", "GPIO_5", "I2C1_SCL"}, CapNormal | CapI2C}, - &PinDesc{4, []string{"P9_18", "GPIO_4", "I2C1_SDA"}, CapNormal | CapI2C}, - &PinDesc{13, []string{"P9_19", "GPIO_13", "I2C2_SCL"}, CapNormal | CapI2C}, - &PinDesc{12, []string{"P9_20", "GPIO_12", "I2C2_SDA"}, CapNormal | CapI2C}, - &PinDesc{3, []string{"P9_21", "GPIO_3", "UART2_TXD"}, CapNormal | CapUART}, - &PinDesc{2, []string{"P9_22", "GPIO_2", "UART2_RXD"}, CapNormal | CapUART}, - &PinDesc{49, []string{"P9_23", "GPIO_49", "GPIO1_17"}, CapNormal}, - &PinDesc{15, []string{"P9_24", "GPIO_15", "UART1_TXD"}, CapNormal | CapUART}, - &PinDesc{117, []string{"P9_25", "GPIO_117", "GPIO3_21"}, CapNormal}, - &PinDesc{14, []string{"P9_26", "GPIO_14", "UART1_RXD"}, CapNormal | CapUART}, - &PinDesc{115, []string{"P9_27", "GPIO_115", "GPIO3_19"}, CapNormal}, - &PinDesc{113, []string{"P9_28", "GPIO_113", "SPI1_CS0"}, CapNormal | CapSPI}, - &PinDesc{111, []string{"P9_29", "GPIO_111", "SPI1_D0"}, CapNormal | CapSPI}, - &PinDesc{112, []string{"P9_30", "GPIO_112", "SPI1_D1"}, CapNormal | CapSPI}, - &PinDesc{110, []string{"P9_31", "GPIO_110", "SPI1_SCLK"}, CapNormal | CapSPI}, + &PinDesc{ID: "P9_11", Aliases: []string{"30", "GPIO_30", "UART4_RXD"}, Caps: CapNormal | CapUART}, + &PinDesc{ID: "P9_12", Aliases: []string{"60", "GPIO_60", "GPIO1_28"}, Caps: CapNormal}, + &PinDesc{ID: "P9_13", Aliases: []string{"31", "GPIO_31", "UART4_TXD"}, Caps: CapNormal | CapUART}, + &PinDesc{ID: "P9_14", Aliases: []string{"50", "GPIO_50", "EHRPWM1A"}, Caps: CapNormal | CapPWM}, + &PinDesc{ID: "P9_15", Aliases: []string{"48", "GPIO_48", "GPIO1_16"}, Caps: CapNormal}, + &PinDesc{ID: "P9_16", Aliases: []string{"51", "GPIO_51", "EHRPWM1B"}, Caps: CapNormal | CapPWM}, + &PinDesc{ID: "P9_17", Aliases: []string{"5", "GPIO_5", "I2C1_SCL"}, Caps: CapNormal | CapI2C}, + &PinDesc{ID: "P9_18", Aliases: []string{"4", "GPIO_4", "I2C1_SDA"}, Caps: CapNormal | CapI2C}, + &PinDesc{ID: "P9_19", Aliases: []string{"13", "GPIO_13", "I2C2_SCL"}, Caps: CapNormal | CapI2C}, + &PinDesc{ID: "P9_20", Aliases: []string{"12", "GPIO_12", "I2C2_SDA"}, Caps: CapNormal | CapI2C}, + &PinDesc{ID: "P9_21", Aliases: []string{"3", "GPIO_3", "UART2_TXD"}, Caps: CapNormal | CapUART}, + &PinDesc{ID: "P9_22", Aliases: []string{"2", "GPIO_2", "UART2_RXD"}, Caps: CapNormal | CapUART}, + &PinDesc{ID: "P9_23", Aliases: []string{"49", "GPIO_49", "GPIO1_17"}, Caps: CapNormal}, + &PinDesc{ID: "P9_24", Aliases: []string{"15", "GPIO_15", "UART1_TXD"}, Caps: CapNormal | CapUART}, + &PinDesc{ID: "P9_25", Aliases: []string{"117", "GPIO_117", "GPIO3_21"}, Caps: CapNormal}, + &PinDesc{ID: "P9_26", Aliases: []string{"14", "GPIO_14", "UART1_RXD"}, Caps: CapNormal | CapUART}, + &PinDesc{ID: "P9_27", Aliases: []string{"115", "GPIO_115", "GPIO3_19"}, Caps: CapNormal}, + &PinDesc{ID: "P9_28", Aliases: []string{"113", "GPIO_113", "SPI1_CS0"}, Caps: CapNormal | CapSPI}, + &PinDesc{ID: "P9_29", Aliases: []string{"111", "GPIO_111", "SPI1_D0"}, Caps: CapNormal | CapSPI}, + &PinDesc{ID: "P9_30", Aliases: []string{"112", "GPIO_112", "SPI1_D1"}, Caps: CapNormal | CapSPI}, + &PinDesc{ID: "P9_31", Aliases: []string{"110", "GPIO_110", "SPI1_SCLK"}, Caps: CapNormal | CapSPI}, } diff --git a/gpiogeneric.go b/gpiogeneric.go index 6730133..0548ff5 100644 --- a/gpiogeneric.go +++ b/gpiogeneric.go @@ -12,13 +12,13 @@ type pin interface { type gpioDriver struct { pinMap PinMap - initializedPins map[int]pin + initializedPins map[string]pin } func newGPIODriver(pinMap PinMap) *gpioDriver { return &gpioDriver{ pinMap: pinMap, - initializedPins: map[int]pin{}, + initializedPins: map[string]pin{}, } } @@ -32,9 +32,9 @@ func (io *gpioDriver) digitalPin(key interface{}) (*digitalPin, error) { return nil, fmt.Errorf("gpio: could not find pin matching %q", key) } - n := pd.N + id := pd.ID - p, ok := io.initializedPins[n] + p, ok := io.initializedPins[id] if ok { dp, ok := p.(*digitalPin) if !ok { @@ -51,8 +51,8 @@ func (io *gpioDriver) digitalPin(key interface{}) (*digitalPin, error) { glog.Infof("gpio: pin %q is not a dedicated digital io pin. please refer to the system reference manual for more details", key) } - dp := newDigitalPin(n) - io.initializedPins[n] = dp + dp := newDigitalPin(pd.DigitalLogical) + io.initializedPins[id] = dp return dp, nil } diff --git a/pin.go b/pin.go index 831a909..cf1e756 100644 --- a/pin.go +++ b/pin.go @@ -1,5 +1,10 @@ package embd +import ( + "fmt" + "strconv" +) + const ( CapNormal int = 1 << iota CapI2C @@ -11,27 +16,38 @@ const ( ) type PinDesc struct { - N int - IDs []string - Caps int + ID string + Aliases []string + Caps int + + DigitalLogical int } type PinMap []*PinDesc func (m PinMap) Lookup(k interface{}) (*PinDesc, bool) { + var ks string switch key := k.(type) { case int: - for i := range m { - if m[i].N == key { - return m[i], true - } - } + ks = strconv.Itoa(key) case string: - for i := range m { - for j := range m[i].IDs { - if m[i].IDs[j] == key { - return m[i], true - } + ks = key + case fmt.Stringer: + ks = key.String() + default: + return nil, false + } + + for i := range m { + pd := m[i] + + if pd.ID == ks { + return pd, true + } + + for j := range pd.Aliases { + if pd.Aliases[j] == ks { + return pd, true } } } diff --git a/pin_test.go b/pin_test.go new file mode 100644 index 0000000..f96e894 --- /dev/null +++ b/pin_test.go @@ -0,0 +1,29 @@ +package embd + +import "testing" + +func TestPinMapLookup(t *testing.T) { + var tests = []struct { + key interface{} + id string + }{ + {"10", "P1_1"}, + {10, "P1_1"}, + {"P1_2", "P1_2"}, + {"GPIO10", "P1_2"}, + } + var pinMap = PinMap{ + &PinDesc{ID: "P1_1", Aliases: []string{"AN1", "10"}}, + &PinDesc{ID: "P1_2", Aliases: []string{"GPIO10"}}, + } + for _, test := range tests { + pd, found := pinMap.Lookup(test.key) + if !found { + t.Errorf("Could not find a descriptor for %q", test.key) + continue + } + if pd.ID != test.id { + t.Errorf("Looking up %q: got %v, want %v", test.key, pd.ID, test.id) + } + } +} diff --git a/rpi.go b/rpi.go index c9c97aa..709842b 100644 --- a/rpi.go +++ b/rpi.go @@ -17,41 +17,41 @@ func init() { } var rpiRev1Pins = PinMap{ - &PinDesc{0, []string{"P1_3", "GPIO_0", "SDA", "I2C0_SDA"}, CapNormal | CapI2C}, - &PinDesc{1, []string{"P1_5", "GPIO_1", "SCL", "I2C0_SCL"}, CapNormal | CapI2C}, - &PinDesc{4, []string{"P1_7", "GPIO_4", "GPCLK0"}, CapNormal}, - &PinDesc{14, []string{"P1_8", "GPIO_14", "TXD", "UART0_TXD"}, CapNormal | CapUART}, - &PinDesc{15, []string{"P1_10", "GPIO_15", "RXD", "UART0_RXD"}, CapNormal | CapUART}, - &PinDesc{17, []string{"P1_11", "GPIO_17"}, CapNormal}, - &PinDesc{18, []string{"P1_12", "GPIO_18", "PCM_CLK"}, CapNormal}, - &PinDesc{21, []string{"P1_13", "GPIO_21"}, CapNormal}, - &PinDesc{22, []string{"P1_15", "GPIO_22"}, CapNormal}, - &PinDesc{23, []string{"P1_16", "GPIO_23"}, CapNormal}, - &PinDesc{24, []string{"P1_18", "GPIO_24"}, CapNormal}, - &PinDesc{10, []string{"P1_19", "GPIO_10", "MOSI", "SPI0_MOSI"}, CapNormal | CapSPI}, - &PinDesc{9, []string{"P1_21", "GPIO_9", "MISO", "SPI0_MISO"}, CapNormal | CapSPI}, - &PinDesc{25, []string{"P1_22", "GPIO_25"}, CapNormal}, - &PinDesc{11, []string{"P1_23", "GPIO_11", "SCLK", "SPI0_SCLK"}, CapNormal | CapSPI}, - &PinDesc{8, []string{"P1_24", "GPIO_8", "CE0", "SPI0_CE0_N"}, CapNormal | CapSPI}, - &PinDesc{7, []string{"P1_26", "GPIO_7", "CE1", "SPI0_CE1_N"}, CapNormal | CapSPI}, + &PinDesc{ID: "P1_3", Aliases: []string{"0", "GPIO_0", "SDA", "I2C0_SDA"}, Caps: CapNormal | CapI2C, DigitalLogical: 0}, + &PinDesc{ID: "P1_5", Aliases: []string{"1", "GPIO_1", "SCL", "I2C0_SCL"}, Caps: CapNormal | CapI2C, DigitalLogical: 1}, + &PinDesc{ID: "P1_7", Aliases: []string{"4", "GPIO_4", "GPCLK0"}, Caps: CapNormal, DigitalLogical: 4}, + &PinDesc{ID: "P1_8", Aliases: []string{"14", "GPIO_14", "TXD", "UART0_TXD"}, Caps: CapNormal | CapUART, DigitalLogical: 14}, + &PinDesc{ID: "P1_10", Aliases: []string{"15", "GPIO_15", "RXD", "UART0_RXD"}, Caps: CapNormal | CapUART, DigitalLogical: 15}, + &PinDesc{ID: "P1_11", Aliases: []string{"17", "GPIO_17"}, Caps: CapNormal, DigitalLogical: 17}, + &PinDesc{ID: "P1_12", Aliases: []string{"18", "GPIO_18", "PCM_CLK"}, Caps: CapNormal, DigitalLogical: 18}, + &PinDesc{ID: "P1_13", Aliases: []string{"21", "GPIO_21"}, Caps: CapNormal, DigitalLogical: 21}, + &PinDesc{ID: "P1_15", Aliases: []string{"22", "GPIO_22"}, Caps: CapNormal, DigitalLogical: 22}, + &PinDesc{ID: "P1_16", Aliases: []string{"23", "GPIO_23"}, Caps: CapNormal, DigitalLogical: 23}, + &PinDesc{ID: "P1_18", Aliases: []string{"24", "GPIO_24"}, Caps: CapNormal, DigitalLogical: 24}, + &PinDesc{ID: "P1_19", Aliases: []string{"10", "GPIO_10", "MOSI", "SPI0_MOSI"}, Caps: CapNormal | CapSPI, DigitalLogical: 10}, + &PinDesc{ID: "P1_21", Aliases: []string{"9", "GPIO_9", "MISO", "SPI0_MISO"}, Caps: CapNormal | CapSPI, DigitalLogical: 9}, + &PinDesc{ID: "P1_22", Aliases: []string{"25", "GPIO_25"}, Caps: CapNormal, DigitalLogical: 25}, + &PinDesc{ID: "P1_23", Aliases: []string{"11", "GPIO_11", "SCLK", "SPI0_SCLK"}, Caps: CapNormal | CapSPI, DigitalLogical: 11}, + &PinDesc{ID: "P1_24", Aliases: []string{"8", "GPIO_8", "CE0", "SPI0_CE0_N"}, Caps: CapNormal | CapSPI, DigitalLogical: 8}, + &PinDesc{ID: "P1_26", Aliases: []string{"7", "GPIO_7", "CE1", "SPI0_CE1_N"}, Caps: CapNormal | CapSPI, DigitalLogical: 7}, } var rpiRev2Pins = PinMap{ - &PinDesc{2, []string{"P1_3", "GPIO_2", "SDA", "I2C1_SDA"}, CapNormal | CapI2C}, - &PinDesc{3, []string{"P1_5", "GPIO_3", "SCL", "I2C1_SCL"}, CapNormal | CapI2C}, - &PinDesc{4, []string{"P1_7", "GPIO_4", "GPCLK0"}, CapNormal}, - &PinDesc{14, []string{"P1_8", "GPIO_14", "TXD", "UART0_TXD"}, CapNormal | CapUART}, - &PinDesc{15, []string{"P1_10", "GPIO_15", "RXD", "UART0_RXD"}, CapNormal | CapUART}, - &PinDesc{17, []string{"P1_11", "GPIO_17"}, CapNormal}, - &PinDesc{18, []string{"P1_12", "GPIO_18", "PCM_CLK"}, CapNormal}, - &PinDesc{27, []string{"P1_13", "GPIO_27"}, CapNormal}, - &PinDesc{22, []string{"P1_15", "GPIO_22"}, CapNormal}, - &PinDesc{23, []string{"P1_16", "GPIO_23"}, CapNormal}, - &PinDesc{24, []string{"P1_18", "GPIO_24"}, CapNormal}, - &PinDesc{10, []string{"P1_19", "GPIO_10", "MOSI", "SPI0_MOSI"}, CapNormal | CapSPI}, - &PinDesc{9, []string{"P1_21", "GPIO_9", "MISO", "SPI0_MISO"}, CapNormal | CapSPI}, - &PinDesc{25, []string{"P1_22", "GPIO_25"}, CapNormal}, - &PinDesc{11, []string{"P1_23", "GPIO_11", "SCLK", "SPI0_SCLK"}, CapNormal | CapSPI}, - &PinDesc{8, []string{"P1_24", "GPIO_8", "CE0", "SPI0_CE0_N"}, CapNormal | CapSPI}, - &PinDesc{7, []string{"P1_26", "GPIO_7", "CE1", "SPI0_CE1_N"}, CapNormal | CapSPI}, + &PinDesc{ID: "P1_3", Aliases: []string{"2", "GPIO_2", "SDA", "I2C1_SDA"}, Caps: CapNormal | CapI2C, DigitalLogical: 2}, + &PinDesc{ID: "P1_5", Aliases: []string{"3", "GPIO_3", "SCL", "I2C1_SCL"}, Caps: CapNormal | CapI2C, DigitalLogical: 3}, + &PinDesc{ID: "P1_7", Aliases: []string{"4", "GPIO_4", "GPCLK0"}, Caps: CapNormal, DigitalLogical: 4}, + &PinDesc{ID: "P1_8", Aliases: []string{"14", "GPIO_14", "TXD", "UART0_TXD"}, Caps: CapNormal | CapUART, DigitalLogical: 14}, + &PinDesc{ID: "P1_10", Aliases: []string{"15", "GPIO_15", "RXD", "UART0_RXD"}, Caps: CapNormal | CapUART, DigitalLogical: 15}, + &PinDesc{ID: "P1_11", Aliases: []string{"17", "GPIO_17"}, Caps: CapNormal, DigitalLogical: 17}, + &PinDesc{ID: "P1_12", Aliases: []string{"18", "GPIO_18", "PCM_CLK"}, Caps: CapNormal, DigitalLogical: 18}, + &PinDesc{ID: "P1_13", Aliases: []string{"27", "GPIO_27"}, Caps: CapNormal, DigitalLogical: 27}, + &PinDesc{ID: "P1_15", Aliases: []string{"22", "GPIO_22"}, Caps: CapNormal, DigitalLogical: 22}, + &PinDesc{ID: "P1_16", Aliases: []string{"23", "GPIO_23"}, Caps: CapNormal, DigitalLogical: 23}, + &PinDesc{ID: "P1_18", Aliases: []string{"24", "GPIO_24"}, Caps: CapNormal, DigitalLogical: 24}, + &PinDesc{ID: "P1_19", Aliases: []string{"10", "GPIO_10", "MOSI", "SPI0_MOSI"}, Caps: CapNormal | CapSPI, DigitalLogical: 10}, + &PinDesc{ID: "P1_21", Aliases: []string{"9", "GPIO_9", "MISO", "SPI0_MISO"}, Caps: CapNormal | CapSPI, DigitalLogical: 9}, + &PinDesc{ID: "P1_22", Aliases: []string{"25", "GPIO_25"}, Caps: CapNormal, DigitalLogical: 25}, + &PinDesc{ID: "P1_23", Aliases: []string{"11", "GPIO_11", "SCLK", "SPI0_SCLK"}, Caps: CapNormal | CapSPI, DigitalLogical: 11}, + &PinDesc{ID: "P1_24", Aliases: []string{"8", "GPIO_8", "CE0", "SPI0_CE0_N"}, Caps: CapNormal | CapSPI, DigitalLogical: 8}, + &PinDesc{ID: "P1_26", Aliases: []string{"7", "GPIO_7", "CE1", "SPI0_CE1_N"}, Caps: CapNormal | CapSPI, DigitalLogical: 7}, }