mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 06:53:40 +00:00
fe310: support GPIO PinInput
This is needed to support switching between input and output.
This commit is contained in:
committed by
Ron Evans
parent
a191326ea8
commit
bcfe751f62
@@ -26,6 +26,8 @@ const (
|
|||||||
func (p Pin) Configure(config PinConfig) {
|
func (p Pin) Configure(config PinConfig) {
|
||||||
sifive.GPIO0.INPUT_EN.SetBits(1 << uint8(p))
|
sifive.GPIO0.INPUT_EN.SetBits(1 << uint8(p))
|
||||||
switch config.Mode {
|
switch config.Mode {
|
||||||
|
case PinInput:
|
||||||
|
sifive.GPIO0.OUTPUT_EN.ClearBits(1 << uint8(p))
|
||||||
case PinOutput:
|
case PinOutput:
|
||||||
sifive.GPIO0.OUTPUT_EN.SetBits(1 << uint8(p))
|
sifive.GPIO0.OUTPUT_EN.SetBits(1 << uint8(p))
|
||||||
case PinPWM:
|
case PinPWM:
|
||||||
|
|||||||
Reference in New Issue
Block a user