finish rewrites!

This commit is contained in:
soypat
2025-07-08 21:11:46 -03:00
committed by deadprogram
parent cd37668592
commit 67b669f192
16 changed files with 283 additions and 727 deletions
+7
View File
@@ -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")
)
+5
View File
@@ -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 {
+1
View File
@@ -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 }