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

rpi: led support

this adds support for controlling the green LED (the one next to the red
power LED)
This commit is contained in:
Karan Misra 2014-04-11 09:12:45 +05:30
parent 859a6619f8
commit 9ac0872493

View File

@ -4,6 +4,7 @@
GPIO (digital (rw)) GPIO (digital (rw))
I²C I²C
LED
*/ */
package rpi package rpi
@ -52,6 +53,10 @@ var rev2Pins = embd.PinMap{
&embd.PinDesc{ID: "P1_26", Aliases: []string{"7", "GPIO_7", "CE1", "SPI0_CE1_N"}, Caps: embd.CapDigital | embd.CapSPI, DigitalLogical: 7}, &embd.PinDesc{ID: "P1_26", Aliases: []string{"7", "GPIO_7", "CE1", "SPI0_CE1_N"}, Caps: embd.CapDigital | embd.CapSPI, DigitalLogical: 7},
} }
var ledMap = embd.LEDMap{
"led0": []string{"0", "led0", "LED0"},
}
func init() { func init() {
embd.Register(embd.HostRPi, func(rev int) *embd.Descriptor { embd.Register(embd.HostRPi, func(rev int) *embd.Descriptor {
var pins = rev1Pins var pins = rev1Pins
@ -66,6 +71,9 @@ func init() {
I2CDriver: func() embd.I2CDriver { I2CDriver: func() embd.I2CDriver {
return embd.NewI2CDriver(generic.NewI2CBus) return embd.NewI2CDriver(generic.NewI2CBus)
}, },
LEDDriver: func() embd.LEDDriver {
return embd.NewLEDDriver(ledMap, generic.NewLED)
},
} }
}) })
} }