1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 21:00:05 +01:00

move the Register calls to the bottom

This commit is contained in:
Karan Misra 2014-03-30 04:14:33 +05:30
parent ea3afb8538
commit 9210e4ef1a
2 changed files with 30 additions and 30 deletions

28
bbb.go
View File

@ -19,20 +19,6 @@ import (
"time" "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{ var bbbPins = PinMap{
&PinDesc{ID: "P8_07", Aliases: []string{"66", "GPIO_66", "Caps: TIMER4"}, Caps: CapDigital | CapGPMC, DigitalLogical: 66}, &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}, &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 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
View File

@ -6,22 +6,6 @@
package embd 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{ var rpiRev1Pins = PinMap{
&PinDesc{ID: "P1_3", Aliases: []string{"0", "GPIO_0", "SDA", "I2C0_SDA"}, Caps: CapDigital | CapI2C, DigitalLogical: 0}, &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}, &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_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}, &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,
}
})
}