diff --git a/experimental/devices/ads1x15/ads1x15.go b/experimental/devices/ads1x15/ads1x15.go index c169930..0bb5985 100644 --- a/experimental/devices/ads1x15/ads1x15.go +++ b/experimental/devices/ads1x15/ads1x15.go @@ -424,7 +424,7 @@ func (p *analogPin) ReadContinuous() <-chan analog.Sample { } reading := make(chan analog.Sample, 16) p.stop = make(chan struct{}) - t := time.NewTicker(p.requestedFrequency.Duration()) + t := time.NewTicker(p.requestedFrequency.Period()) go func(s <-chan struct{}) { defer t.Stop() diff --git a/experimental/devices/bitbang/i2c.go b/experimental/devices/bitbang/i2c.go index cd62f5c..56c9585 100644 --- a/experimental/devices/bitbang/i2c.go +++ b/experimental/devices/bitbang/i2c.go @@ -52,7 +52,7 @@ func New(clk gpio.PinIO, data gpio.PinIO, f physic.Frequency) (*I2C, error) { i := &I2C{ scl: clk, sda: data, - halfCycle: f.Duration() / 2, + halfCycle: f.Period() / 2, } return i, nil } @@ -126,7 +126,7 @@ func (i *I2C) Tx(addr uint16, w, r []byte) error { func (i *I2C) SetSpeed(f physic.Frequency) error { i.mu.Lock() defer i.mu.Unlock() - i.halfCycle = f.Duration() / 2 + i.halfCycle = f.Period() / 2 return nil } diff --git a/experimental/devices/bitbang/spi.go b/experimental/devices/bitbang/spi.go index 04d1278..c6a2813 100644 --- a/experimental/devices/bitbang/spi.go +++ b/experimental/devices/bitbang/spi.go @@ -73,7 +73,7 @@ func (s *SPI) Connect(f physic.Frequency, mode spi.Mode, bits int) (spi.Conn, er defer s.spiConn.mu.Unlock() s.spiConn.freqDev = f if s.spiConn.freqDev != 0 && (s.spiConn.freqPort == 0 || s.spiConn.freqDev < s.spiConn.freqPort) { - s.spiConn.halfCycle = f.Duration() / 2 + s.spiConn.halfCycle = f.Period() / 2 } s.spiConn.mode = mode s.spiConn.bits = bits @@ -101,7 +101,7 @@ func (s *SPI) LimitSpeed(f physic.Frequency) error { defer s.spiConn.mu.Unlock() s.spiConn.freqPort = f if s.spiConn.freqDev == 0 || s.spiConn.freqPort < s.spiConn.freqDev { - s.spiConn.halfCycle = f.Duration() / 2 + s.spiConn.halfCycle = f.Period() / 2 } return nil }