1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 11:57:38 +02:00

spi: got rid of shouldInitialize arg in spibus (redundant).

This commit is contained in:
kunalpowar 2014-05-22 01:21:09 +05:30
parent f80e6f624d
commit 454eca42d0
4 changed files with 23 additions and 31 deletions

View file

@ -2,12 +2,11 @@ package embd
import "sync"
type spiBusFactory func(byte, byte, byte, int, int, int, bool, func() error) SPIBus
type spiBusFactory func(byte, byte, byte, int, int, int, func() error) SPIBus
type spiDriver struct {
spiDevMinor byte
shouldInitialize bool
initializer func() error
spiDevMinor byte
initializer func() error
busMap map[byte]SPIBus
busMapLock sync.Mutex
@ -15,12 +14,11 @@ type spiDriver struct {
sbf spiBusFactory
}
func NewSPIDriver(spiDevMinor byte, sbf spiBusFactory, shouldInitialize bool, i func() error) SPIDriver {
func NewSPIDriver(spiDevMinor byte, sbf spiBusFactory, i func() error) SPIDriver {
return &spiDriver{
spiDevMinor: spiDevMinor,
sbf: sbf,
shouldInitialize: shouldInitialize,
initializer: i,
spiDevMinor: spiDevMinor,
sbf: sbf,
initializer: i,
}
}
@ -28,7 +26,7 @@ func (s *spiDriver) Bus(mode, channel byte, speed, bpw, delay int) SPIBus {
s.busMapLock.Lock()
defer s.busMapLock.Unlock()
b := s.sbf(s.spiDevMinor, mode, channel, speed, bpw, delay, s.shouldInitialize, s.initializer)
b := s.sbf(s.spiDevMinor, mode, channel, speed, bpw, delay, s.initializer)
s.busMap = make(map[byte]SPIBus)
s.busMap[channel] = b
return b