GPIO
import "mind/core/framework/drivers/gpio"
gpio provides API to interact with GPIO pins on Cerebrum.
Example:
gpio.Start()
err := Output(3, true)
val, err := gpio.High(3)
gpio.Close()
Usage
func Available
func Available() bool
Available returns whether driver is available or not.
func Close
func Close() (err error)
Close makes sure GPIO Driver is closed.
func High
func High(pin int) (high bool, err error)
High returns whether output voltage is high or low on pin within range 0-3. Only accurate when pin is connected.
func Output
func Output(pin int, high bool) (err error)
Output high or low voltage to pin within range 0-3.
func Start
func Start() (err error)
Start makes sure GPIO Driver is ready.
func Watch
func Watch(pin int) (high bool, err error)
Watch returns whether output voltage is high(true) or low(false) on pin within range 0-3, it'll be blocked until the voltage of specified pin changed after being called.