feature: some additional changes to drivers.Pin HAL for clarity and readability.

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2025-09-20 08:29:32 +02:00
parent 97ed81556b
commit d224b5d648
33 changed files with 139 additions and 171 deletions
+3 -4
View File
@@ -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,