Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PinNotFound = errors.New("Pin not found")
Functions ¶
This section is empty.
Types ¶
type PulseAcceptorConfig ¶
type PulseAcceptorConfig struct { // The pulse pin. PulsePin string `yaml:"pulse_pin"` // The duration of pause width. You might want to add up an error margin on top of this value. Debounce time.Duration // The duration of pulse width. You might want to add up an error margin on top of this value. Denoise time.Duration // After how long of a pause, consider counting for this coin/bill done. Timeout time.Duration // Edge poll frequency Freq int `yaml:"poll_frequency"` // Print pulse and pause width/count logs Debug bool }
type PulseAcceptorDevice ¶
type PulseAcceptorDevice struct { gpio.PinIO // Marks end of coin or bill insertion. Timeout time.Duration // contains filtered or unexported fields }
func Init ¶
func Init(conf *PulseAcceptorConfig) (*PulseAcceptorDevice, error)
Returns a new device with a denoised and debounced input pin.
func (*PulseAcceptorDevice) Count ¶
func (d *PulseAcceptorDevice) Count() (pulses int64)
Count pulses and return whenever the current wave of pulses ends. The debounce duration is used as the timeout value.
func (*PulseAcceptorDevice) CountWithHandler ¶
func (d *PulseAcceptorDevice) CountWithHandler(ch chan<- int64)
Count pulses and shove them down a channel when activity occurs.
Click to show internal directories.
Click to hide internal directories.