Closed 1995parham closed 3 years ago
What kind of new feature are you looking for?
func PulseIn(pin gpio.PinIn, lvl gpio.Level, t time.Duration) (time.Duration, error) { var e1, e2 gpio.Edge if lvl == gpio.High { e1 = gpio.RisingEdge e2 = gpio.FallingEdge } else { e1 = gpio.FallingEdge e2 = gpio.RisingEdge } if err := pin.In(gpio.PullNoChange, e1); err != nil { return 0, fmt.Errorf("pin %s in setup failed %w", pin, err) } pin.WaitForEdge(t) now := time.Now() if err := pin.In(gpio.PullNoChange, e2); err != nil { return 0, fmt.Errorf("pin %s in setup failed %w", pin, err) } pin.WaitForEdge(t) return time.Since(now), nil }
Do you plan to:
if you agree with the function existence in gpioutil I can contribute and add it.
gpioutil
Ok. No need to wrap the error, you can return the pin.In() error as-is.
Thanks for the point, so I will create a PR for this.
What kind of new feature are you looking for?
Do you plan to:
if you agree with the function existence in
gpioutil
I can contribute and add it.