mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 03:03:27 +00:00
esp32c3: add support for input pin
This commit is contained in:
@@ -95,6 +95,13 @@ func (p Pin) Set(value bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get returns the current value of a GPIO pin when configured as an input or as
|
||||||
|
// an output.
|
||||||
|
func (p Pin) Get() bool {
|
||||||
|
reg := &esp.GPIO.IN
|
||||||
|
return (reg.Get()>>p)&1 > 0
|
||||||
|
}
|
||||||
|
|
||||||
// Return the register and mask to enable a given GPIO pin. This can be used to
|
// Return the register and mask to enable a given GPIO pin. This can be used to
|
||||||
// implement bit-banged drivers.
|
// implement bit-banged drivers.
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user