mirror of
https://github.com/kidoman/embd
synced 2025-07-03 11:57:38 +02:00
spi: use a initializer if required by any host
This commit is contained in:
parent
faa686f01c
commit
42033238e2
4 changed files with 38 additions and 15 deletions
|
@ -155,6 +155,13 @@ func ensureFeatureDisabled(id string) error {
|
|||
return fmt.Errorf("embd: could not disable feature %q", id)
|
||||
}
|
||||
|
||||
func spiInitializer() error {
|
||||
if err := ensureFeatureEnabled("BB-SPIDEV0"); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
embd.Register(embd.HostBBB, func(rev int) *embd.Descriptor {
|
||||
return &embd.Descriptor{
|
||||
|
@ -168,7 +175,7 @@ func init() {
|
|||
return embd.NewLEDDriver(ledMap, generic.NewLED)
|
||||
},
|
||||
SPIDriver: func() embd.SPIDriver {
|
||||
return embd.NewSPIDriver(spiDeviceMinor, generic.NewSPIBus)
|
||||
return embd.NewSPIDriver(spiDeviceMinor, generic.NewSPIBus, true, spiInitializer)
|
||||
},
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue