machine/hifive1: add GPIO Get() implementation and update other implementation to match latest SVD wrappers

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans
2019-10-08 20:22:53 +02:00
committed by Ayke
parent 92e07ec8af
commit 2168b1b516
3 changed files with 38 additions and 8 deletions
+7
View File
@@ -30,6 +30,13 @@ func (p Pin) Set(high bool) {
}
}
// Get returns the current value of a GPIO pin.
func (p Pin) Get() bool {
val := sifive.GPIO0.VALUE.Get() & (1 << uint8(p))
println(sifive.GPIO0.VALUE.Get())
return (val > 0)
}
type UART struct {
Bus *sifive.UART_Type
Buffer *RingBuffer