aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-10-21 12:01:04 +0200
committerRon Evans <[email protected]>2024-10-21 18:30:31 +0100
commitbcfe751f62302cbb17f11236dc03775122ab6974 (patch)
tree43711d9c7ad4d215dcdac79bd188028e65095ea3
parenta191326ea8c2fd054d46e278731e1ec99a098ad2 (diff)
downloadtinygo-bcfe751f62302cbb17f11236dc03775122ab6974.tar.gz
tinygo-bcfe751f62302cbb17f11236dc03775122ab6974.zip
fe310: support GPIO PinInput
This is needed to support switching between input and output.
-rw-r--r--src/machine/machine_fe310.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/machine/machine_fe310.go b/src/machine/machine_fe310.go
index 37f3ee07e..4a15ad76e 100644
--- a/src/machine/machine_fe310.go
+++ b/src/machine/machine_fe310.go
@@ -26,6 +26,8 @@ const (
func (p Pin) Configure(config PinConfig) {
sifive.GPIO0.INPUT_EN.SetBits(1 << uint8(p))
switch config.Mode {
+ case PinInput:
+ sifive.GPIO0.OUTPUT_EN.ClearBits(1 << uint8(p))
case PinOutput:
sifive.GPIO0.OUTPUT_EN.SetBits(1 << uint8(p))
case PinPWM: