Documentation ¶
Overview ¶
Package gpio implements a gpio/adc based input.Controller.
Index ¶
- func NewGPIOController(ctx context.Context, deps registry.Dependencies, config config.Component, ...) (interface{}, error)
- type AxisConfig
- type ButtonConfig
- type Config
- type Controller
- func (c *Controller) Close()
- func (c *Controller) GetControls(ctx context.Context) ([]input.Control, error)
- func (c *Controller) GetEvents(ctx context.Context) (map[input.Control]input.Event, error)
- func (c *Controller) RegisterControlCallback(ctx context.Context, control input.Control, triggers []input.EventType, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AxisConfig ¶
type AxisConfig struct { Control input.Control `json:"control"` Min int `json:"min"` Max int `json:"max"` Bidirectional bool `json:"bidirectional"` Deadzone int `json:"deadzone"` MinChange int `json:"min_change"` PollHz float64 `json:"poll_hz"` Invert bool `json:"invert"` }
AxisConfig is a subconfig for axes.
type ButtonConfig ¶
type ButtonConfig struct { Control input.Control `json:"control"` Invert bool `json:"invert"` DebounceMs int `json:"debounce_ms"` // set to -1 to disable, default=5 }
ButtonConfig is a subconfig for buttons.
type Config ¶
type Config struct { Board string `json:"board"` Buttons map[string]ButtonConfig `json:"buttons"` Axes map[string]AxisConfig `json:"axes"` }
Config is the overall config.
type Controller ¶
type Controller struct { generic.Unimplemented // contains filtered or unexported fields }
A Controller creates an input.Controller from DigitalInterrupts and AnalogReaders.
func (*Controller) GetControls ¶
GetControls lists the inputs.
func (*Controller) GetEvents ¶
GetEvents returns the last input.Event (the current state) of each control.
func (*Controller) RegisterControlCallback ¶
func (c *Controller) RegisterControlCallback( ctx context.Context, control input.Control, triggers []input.EventType, ctrlFunc input.ControlFunction, ) error
RegisterControlCallback registers a callback function to be executed on the specified trigger Event.
Click to show internal directories.
Click to hide internal directories.