mirror of
https://github.com/kidoman/embd
synced 2024-12-22 12:50:19 +01:00
move the Register calls to the bottom
This commit is contained in:
parent
ea3afb8538
commit
9210e4ef1a
28
bbb.go
28
bbb.go
@ -19,20 +19,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Register(HostBBB, func(rev int) *Descriptor {
|
||||
return &Descriptor{
|
||||
GPIODriver: func() GPIODriver {
|
||||
return newGPIODriver(bbbPins, newDigitalPin, newBBBAnalogPin, newBBBPWMPin)
|
||||
},
|
||||
I2CDriver: newI2CDriver,
|
||||
LEDDriver: func() LEDDriver {
|
||||
return newLEDDriver(bbbLEDMap)
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var bbbPins = PinMap{
|
||||
&PinDesc{ID: "P8_07", Aliases: []string{"66", "GPIO_66", "Caps: TIMER4"}, Caps: CapDigital | CapGPMC, DigitalLogical: 66},
|
||||
&PinDesc{ID: "P8_08", Aliases: []string{"67", "GPIO_67", "TIMER7"}, Caps: CapDigital | CapGPMC, DigitalLogical: 67},
|
||||
@ -438,3 +424,17 @@ func (p *bbbPWMPin) Close() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
Register(HostBBB, func(rev int) *Descriptor {
|
||||
return &Descriptor{
|
||||
GPIODriver: func() GPIODriver {
|
||||
return newGPIODriver(bbbPins, newDigitalPin, newBBBAnalogPin, newBBBPWMPin)
|
||||
},
|
||||
I2CDriver: newI2CDriver,
|
||||
LEDDriver: func() LEDDriver {
|
||||
return newLEDDriver(bbbLEDMap)
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
32
rpi.go
32
rpi.go
@ -6,22 +6,6 @@
|
||||
|
||||
package embd
|
||||
|
||||
func init() {
|
||||
Register(HostRPi, func(rev int) *Descriptor {
|
||||
var pins = rpiRev1Pins
|
||||
if rev > 1 {
|
||||
pins = rpiRev2Pins
|
||||
}
|
||||
|
||||
return &Descriptor{
|
||||
GPIODriver: func() GPIODriver {
|
||||
return newGPIODriver(pins, newDigitalPin, nil, nil)
|
||||
},
|
||||
I2CDriver: newI2CDriver,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var rpiRev1Pins = PinMap{
|
||||
&PinDesc{ID: "P1_3", Aliases: []string{"0", "GPIO_0", "SDA", "I2C0_SDA"}, Caps: CapDigital | CapI2C, DigitalLogical: 0},
|
||||
&PinDesc{ID: "P1_5", Aliases: []string{"1", "GPIO_1", "SCL", "I2C0_SCL"}, Caps: CapDigital | CapI2C, DigitalLogical: 1},
|
||||
@ -61,3 +45,19 @@ var rpiRev2Pins = PinMap{
|
||||
&PinDesc{ID: "P1_24", Aliases: []string{"8", "GPIO_8", "CE0", "SPI0_CE0_N"}, Caps: CapDigital | CapSPI, DigitalLogical: 8},
|
||||
&PinDesc{ID: "P1_26", Aliases: []string{"7", "GPIO_7", "CE1", "SPI0_CE1_N"}, Caps: CapDigital | CapSPI, DigitalLogical: 7},
|
||||
}
|
||||
|
||||
func init() {
|
||||
Register(HostRPi, func(rev int) *Descriptor {
|
||||
var pins = rpiRev1Pins
|
||||
if rev > 1 {
|
||||
pins = rpiRev2Pins
|
||||
}
|
||||
|
||||
return &Descriptor{
|
||||
GPIODriver: func() GPIODriver {
|
||||
return newGPIODriver(pins, newDigitalPin, nil, nil)
|
||||
},
|
||||
I2CDriver: newI2CDriver,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user