Documentation ¶
Overview ¶
Package gpio provides a user space interface to GPIO pins.
Index ¶
- Constants
- func WriteFile(path string, format string, args ...interface{}) error
- type Edge
- type IRQEvent
- type Mode
- type Pin
- func (p *Pin) BeginWatch(edge Edge, callback IRQEvent) error
- func (p *Pin) Clear()
- func (p *Pin) Close() error
- func (p *Pin) EndWatch() error
- func (p *Pin) Err() error
- func (p *Pin) Get() bool
- func (p *Pin) GetMode() Mode
- func (p *Pin) Mode() Mode
- func (p *Pin) Set()
- func (p *Pin) SetMode(mode Mode)
- func (p *Pin) Wait(condition bool)
- type Pinner
Constants ¶
View Source
const ( GPIO0 = 0 GPIO1 = 1 GPIO2 = 2 GPIO3 = 3 GPIO4 = 4 GPIO7 = 7 GPIO8 = 8 GPIO9 = 9 GPIO10 = 10 GPIO11 = 11 GPIO17 = 17 GPIO18 = 18 GPIO22 = 22 GPIO23 = 23 GPIO24 = 24 GPIO25 = 25 GPIOCount = 16 // the number of GPIO pins available )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IRQEvent ¶
type IRQEvent func()
IRQEvent defines the callback function used to inform the caller of an interrupt.
type Pin ¶
type Pin struct { Number int // the pin number ModePath string // the path to the /direction FD to avoid string joining each time EdgePath string // the path to the /edge FD to avoid string joining each time ValueFile *os.File // the file handle for the value file Initial bool // is this the initial epoll trigger? // contains filtered or unexported fields }
Pin represents a GPIO pin.
type Pinner ¶
type Pinner interface { Mode() Mode // gets the current pin mode SetMode(Mode) // set the current pin mode Set() // sets the pin state high Clear() // sets the pin state low Close() error // if applicable, closes the pin Get() bool // returns the current pin state BeginWatch(Edge, IRQEvent) error // calls the function argument when an edge trigger event occurs EndWatch() error // stops watching the pin Wait(bool) // wait for pin state to match boolean argument Err() error // returns the last error state }
Pinner represents a GPIO pin.
Click to show internal directories.
Click to hide internal directories.