mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-08 17:03:39 +00:00
finish rewrites!
This commit is contained in:
@@ -63,6 +63,13 @@ func ConfigurePinInputPullup(pi PinInput) {
|
||||
configurePinInputPullup(pi)
|
||||
}
|
||||
|
||||
// PinIsNoPin returns true if the argument is a machine.Pin type and is the machine.NoPin predeclared type.
|
||||
//
|
||||
// Deprecated: Drivers do not require pin knowledge from now on.
|
||||
func PinIsNoPin(pin any) bool {
|
||||
return pinIsNoPin(pin)
|
||||
}
|
||||
|
||||
var (
|
||||
ErrConfigBeforeInstantiated = errors.New("device must be instantiated with New before calling Configure method")
|
||||
)
|
||||
|
||||
@@ -20,6 +20,11 @@ func configurePinInputPullup(p PinInput) {
|
||||
configurePin(p, machine.PinInputPullup)
|
||||
}
|
||||
|
||||
func pinIsNoPin(a any) bool {
|
||||
p, ok := a.(machine.Pin)
|
||||
return ok && p == machine.NoPin
|
||||
}
|
||||
|
||||
func configurePin(p any, mode machine.PinMode) {
|
||||
machinePin, ok := p.(machine.Pin)
|
||||
if ok {
|
||||
|
||||
@@ -6,3 +6,4 @@ func configurePinOut(p PinOutput) {}
|
||||
func configurePinInput(p PinInput) {}
|
||||
func configurePinInputPulldown(p PinInput) {}
|
||||
func configurePinInputPullup(p PinInput) {}
|
||||
func pinIsNoPin(a any) bool { return false }
|
||||
|
||||
Reference in New Issue
Block a user