2014-02-17 03:41:53 +05:30
|
|
|
package gpio
|
|
|
|
|
|
|
|
type Direction int
|
|
|
|
|
|
|
|
const (
|
2014-02-27 04:24:53 +05:30
|
|
|
In Direction = iota
|
|
|
|
Out
|
2014-02-17 03:41:53 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2014-02-27 04:24:53 +05:30
|
|
|
Low int = iota
|
2014-02-17 03:41:53 +05:30
|
|
|
High
|
|
|
|
)
|
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
type DigitalPin interface {
|
|
|
|
Write(val int) error
|
|
|
|
Read() (int, error)
|
2014-02-17 03:41:53 +05:30
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
SetDir(dir Direction) error
|
|
|
|
ActiveLow(b bool) error
|
2014-02-17 03:41:53 +05:30
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
Close() error
|
2014-02-17 03:41:53 +05:30
|
|
|
}
|
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
type GPIO interface {
|
|
|
|
DigitalPin(key interface{}) (DigitalPin, error)
|
2014-02-17 03:41:53 +05:30
|
|
|
|
2014-02-27 04:24:53 +05:30
|
|
|
Close() error
|
2014-02-17 03:41:53 +05:30
|
|
|
}
|