mirror of
https://github.com/kidoman/embd
synced 2025-07-03 03:47:33 +02:00
us020: client should ensure rpio is initialised before using
This commit is contained in:
parent
96a92383e2
commit
d2ffacd22c
2 changed files with 4 additions and 5 deletions
|
@ -61,10 +61,6 @@ func (d *US020) setup() (err error) {
|
|||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
|
||||
if err = rpio.Open(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
d.echoPin = rpio.Pin(d.EchoPinNumber) // ECHO port on the US020
|
||||
d.triggerPin = rpio.Pin(d.TriggerPinNumber) // TRIGGER port on the US020
|
||||
|
||||
|
@ -134,5 +130,4 @@ func (d *US020) Distance() (distance float64, err error) {
|
|||
// Close.
|
||||
func (d *US020) Close() {
|
||||
d.echoPin.Output()
|
||||
rpio.Close()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue