mirror of
https://github.com/kidoman/embd
synced 2024-12-22 21:00:05 +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:
parent
859a6619f8
commit
9ac0872493
@ -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)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user