mirror of
https://github.com/kidoman/embd
synced 2025-07-03 11:57:38 +02:00
simplify package structure
This commit is contained in:
parent
3cae4064dc
commit
36f2c0486d
41 changed files with 736 additions and 885 deletions
|
@ -1,45 +0,0 @@
|
|||
package rpi
|
||||
|
||||
import (
|
||||
"github.com/kidoman/embd/driver/linux/gpio"
|
||||
)
|
||||
|
||||
var rev1Pins = gpio.PinMap{
|
||||
&gpio.PinDesc{0, []string{"P1_3", "GPIO_0", "SDA", "I2C0_SDA"}, gpio.Normal | gpio.I2C},
|
||||
&gpio.PinDesc{1, []string{"P1_5", "GPIO_1", "SCL", "I2C0_SCL"}, gpio.Normal | gpio.I2C},
|
||||
&gpio.PinDesc{4, []string{"P1_7", "GPIO_4", "GPCLK0"}, gpio.Normal},
|
||||
&gpio.PinDesc{14, []string{"P1_8", "GPIO_14", "TXD", "UART0_TXD"}, gpio.Normal | gpio.UART},
|
||||
&gpio.PinDesc{15, []string{"P1_10", "GPIO_15", "RXD", "UART0_RXD"}, gpio.Normal | gpio.UART},
|
||||
&gpio.PinDesc{17, []string{"P1_11", "GPIO_17"}, gpio.Normal},
|
||||
&gpio.PinDesc{18, []string{"P1_12", "GPIO_18", "PCM_CLK"}, gpio.Normal},
|
||||
&gpio.PinDesc{21, []string{"P1_13", "GPIO_21"}, gpio.Normal},
|
||||
&gpio.PinDesc{22, []string{"P1_15", "GPIO_22"}, gpio.Normal},
|
||||
&gpio.PinDesc{23, []string{"P1_16", "GPIO_23"}, gpio.Normal},
|
||||
&gpio.PinDesc{24, []string{"P1_18", "GPIO_24"}, gpio.Normal},
|
||||
&gpio.PinDesc{10, []string{"P1_19", "GPIO_10", "MOSI", "SPI0_MOSI"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{9, []string{"P1_21", "GPIO_9", "MISO", "SPI0_MISO"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{25, []string{"P1_22", "GPIO_25"}, gpio.Normal},
|
||||
&gpio.PinDesc{11, []string{"P1_23", "GPIO_11", "SCLK", "SPI0_SCLK"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{8, []string{"P1_24", "GPIO_8", "CE0", "SPI0_CE0_N"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{7, []string{"P1_26", "GPIO_7", "CE1", "SPI0_CE1_N"}, gpio.Normal | gpio.SPI},
|
||||
}
|
||||
|
||||
var rev2Pins = gpio.PinMap{
|
||||
&gpio.PinDesc{2, []string{"P1_3", "GPIO_2", "SDA", "I2C1_SDA"}, gpio.Normal | gpio.I2C},
|
||||
&gpio.PinDesc{3, []string{"P1_5", "GPIO_3", "SCL", "I2C1_SCL"}, gpio.Normal | gpio.I2C},
|
||||
&gpio.PinDesc{4, []string{"P1_7", "GPIO_4", "GPCLK0"}, gpio.Normal},
|
||||
&gpio.PinDesc{14, []string{"P1_8", "GPIO_14", "TXD", "UART0_TXD"}, gpio.Normal | gpio.UART},
|
||||
&gpio.PinDesc{15, []string{"P1_10", "GPIO_15", "RXD", "UART0_RXD"}, gpio.Normal | gpio.UART},
|
||||
&gpio.PinDesc{17, []string{"P1_11", "GPIO_17"}, gpio.Normal},
|
||||
&gpio.PinDesc{18, []string{"P1_12", "GPIO_18", "PCM_CLK"}, gpio.Normal},
|
||||
&gpio.PinDesc{27, []string{"P1_13", "GPIO_27"}, gpio.Normal},
|
||||
&gpio.PinDesc{22, []string{"P1_15", "GPIO_22"}, gpio.Normal},
|
||||
&gpio.PinDesc{23, []string{"P1_16", "GPIO_23"}, gpio.Normal},
|
||||
&gpio.PinDesc{24, []string{"P1_18", "GPIO_24"}, gpio.Normal},
|
||||
&gpio.PinDesc{10, []string{"P1_19", "GPIO_10", "MOSI", "SPI0_MOSI"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{9, []string{"P1_21", "GPIO_9", "MISO", "SPI0_MISO"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{25, []string{"P1_22", "GPIO_25"}, gpio.Normal},
|
||||
&gpio.PinDesc{11, []string{"P1_23", "GPIO_11", "SCLK", "SPI0_SCLK"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{8, []string{"P1_24", "GPIO_8", "CE0", "SPI0_CE0_N"}, gpio.Normal | gpio.SPI},
|
||||
&gpio.PinDesc{7, []string{"P1_26", "GPIO_7", "CE1", "SPI0_CE1_N"}, gpio.Normal | gpio.SPI},
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package rpi
|
||||
|
||||
import (
|
||||
lgpio "github.com/kidoman/embd/driver/linux/gpio"
|
||||
li2c "github.com/kidoman/embd/driver/linux/i2c"
|
||||
"github.com/kidoman/embd/host"
|
||||
)
|
||||
|
||||
func init() {
|
||||
host.Describers[host.RPi] = describer
|
||||
}
|
||||
|
||||
func describer(rev int) *host.Descriptor {
|
||||
var pins = rev1Pins
|
||||
if rev > 1 {
|
||||
pins = rev2Pins
|
||||
}
|
||||
|
||||
return &host.Descriptor{
|
||||
GPIO: func() interface{} {
|
||||
return lgpio.New(pins)
|
||||
},
|
||||
I2C: func() interface{} {
|
||||
return li2c.New()
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue