mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-10 01:43:40 +00:00
Replace Safe functions with legacy.PinOutput
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
//go:build !(baremetal && tinygo)
|
||||
|
||||
package legacy
|
||||
|
||||
import "tinygo.org/x/drivers"
|
||||
|
||||
func PinOutput(pin drivers.PinOutput) drivers.PinOutput {
|
||||
return pin
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//go:build baremetal && tinygo
|
||||
|
||||
package legacy
|
||||
|
||||
import (
|
||||
"machine"
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
)
|
||||
|
||||
func PinOutput(pin drivers.PinOutput) drivers.PinOutput {
|
||||
if p, ok := pin.(machine.Pin); ok {
|
||||
p.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||
}
|
||||
return pin
|
||||
}
|
||||
Reference in New Issue
Block a user