mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-11 18:33:43 +00:00
feature: some additional changes to drivers.Pin HAL for clarity and readability.
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
+3
-4
@@ -9,20 +9,19 @@ import (
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
"tinygo.org/x/drivers/internal/legacy"
|
||||
"tinygo.org/x/drivers/internal/pin"
|
||||
)
|
||||
|
||||
const TIMEOUT = 23324 // max sensing distance (4m)
|
||||
|
||||
// Device holds the pins
|
||||
type Device struct {
|
||||
trigger drivers.PinOutput
|
||||
echo drivers.PinInput
|
||||
trigger drivers.PinOutputFunc
|
||||
echo drivers.PinInputFunc
|
||||
configurePins func()
|
||||
}
|
||||
|
||||
// New returns a new ultrasonic driver given 2 pins
|
||||
func New(trigger pin.Output, echo pin.Input) Device {
|
||||
func New(trigger drivers.PinOutput, echo drivers.PinInput) Device {
|
||||
return Device{
|
||||
trigger: trigger.Set,
|
||||
echo: echo.Get,
|
||||
|
||||
Reference in New Issue
Block a user