machine: support Pin.Get() function when the pin is configured as output

To my surprise, this is supported on all the devices I could test so
therefore it makes sense to change the API to allow this.
This commit is contained in:
Ayke van Laethem
2021-10-20 17:19:43 +02:00
committed by Ron Evans
parent c8719f8d14
commit 15d3f5f609
9 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ func (p Pin) portMaskClear() (*volatile.Register32, uint32) {
}
// Get returns the current value of a GPIO pin when the pin is configured as an
// input.
// input or as an output.
func (p Pin) Get() bool {
if p < 32 {
return esp.GPIO.IN.Get()&(1<<p) != 0