buttons

package
v0.0.0-...-f92ff75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2023 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ButtonEventChanSize = 16

Variables

View Source
var DefaultButtonMultiConfig = &ButtonConfig{
	activeHigh:        false,
	multiClicks:       true,
	filterSize:        1,
	actFinishCnt:      5,
	repeatDetectCnt:   0,
	repeatSkip:        2,
	longDetectCnt:     15,
	longLongDetectCnt: 39,
}
View Source
var DefaultButtonSingleConfig = &ButtonConfig{
	activeHigh:        false,
	multiClicks:       false,
	filterSize:        1,
	actFinishCnt:      0,
	repeatDetectCnt:   0,
	repeatSkip:        0,
	longDetectCnt:     0,
	longLongDetectCnt: 0,
}
View Source
var DefaultButtonSingleRepeatConfig = &ButtonConfig{
	activeHigh:        false,
	multiClicks:       false,
	filterSize:        1,
	actFinishCnt:      0,
	repeatDetectCnt:   10,
	repeatSkip:        2,
	longDetectCnt:     0,
	longLongDetectCnt: 0,
}

Functions

func ScanPeriodic

func ScanPeriodic(buttons *Buttons)

Types

type Button

type Button struct {
	// contains filtered or unexported fields
}

func NewButton

func NewButton(name string, pin Pin, config *ButtonConfig) *Button

type ButtonConfig

type ButtonConfig struct {
	// contains filtered or unexported fields
}

func NewButtonConfig

func NewButtonConfig(
	activeHigh, multiClicks bool,
	filterSize, actFinishCnt, repeatDetectCnt, repeatSkip, longDetectCnt, longLongDetectCnt uint8,
) *ButtonConfig

type ButtonEvent

type ButtonEvent struct {
	ButtonName  string
	Type        ButtonEventType
	ClickCount  uint8
	RepeatCount uint8
}

type ButtonEventType

type ButtonEventType int
const (
	EVT_NONE ButtonEventType = iota
	EVT_SINGLE
	EVT_MULTI
	EVT_LONG
	EVT_LONG_LONG
)

type Buttons

type Buttons struct {
	// contains filtered or unexported fields
}

func New

func New(name string, button ...*Button) *Buttons

func (*Buttons) GetEvent

func (buttons *Buttons) GetEvent() *ButtonEvent

func (*Buttons) GetName

func (buttons *Buttons) GetName() string

func (*Buttons) SetScanSkip

func (buttons *Buttons) SetScanSkip(scanSkip uint8)

type Pin

type Pin interface {
	Get() bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL