mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
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:
committed by
Ron Evans
parent
c8719f8d14
commit
15d3f5f609
@@ -58,7 +58,8 @@ func (p Pin) Set(high bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// Get returns the current value of a GPIO pin.
|
||||
// Get returns the current value of a GPIO pin when configured as an input or as
|
||||
// an output.
|
||||
func (p Pin) Get() bool {
|
||||
return (sam.PORT.IN0.Get()>>uint8(p))&1 > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user