i2c and spi: clarify with SetSpeed vs LimitSpeed.

Otherwise when reading code is it very unclear if it may be slower or not.

Yet another breaking change.
pull/1/head
Marc-Antoine Ruel 9 years ago
parent 2dfb12af03
commit aff3ae8a77

@ -88,8 +88,8 @@ func (i *I2C) Tx(addr uint16, w, r []byte) error {
return nil return nil
} }
// Speed implements i2c.Bus. // SetSpeed implements i2c.Bus.
func (i *I2C) Speed(hz int64) error { func (i *I2C) SetSpeed(hz int64) error {
i.mu.Lock() i.mu.Lock()
defer i.mu.Unlock() defer i.mu.Unlock()
i.halfCycle = time.Second / time.Duration(hz) / time.Duration(2) i.halfCycle = time.Second / time.Duration(hz) / time.Duration(2)

@ -53,8 +53,8 @@ func (s *SPI) Duplex() conn.Duplex {
return conn.Full return conn.Full
} }
// Speed implements spi.ConnCloser. // LimitSpeed implements spi.ConnCloser.
func (s *SPI) Speed(maxHz int64) error { func (s *SPI) LimitSpeed(maxHz int64) error {
if maxHz <= 0 { if maxHz <= 0 {
return errors.New("bitbang-spi: invalid maxHz") return errors.New("bitbang-spi: invalid maxHz")
} }

Loading…
Cancel
Save