Documentation
¶
Overview ¶
package hid is for USB Human Interface Devices.
Index ¶
Constants ¶
View Source
const ( REPORT_TYPE_INPUT = 1 REPORT_TYPE_OUTPUT = 2 REPORT_TYPE_FEATURE = 3 )
Variables ¶
View Source
var ( ErrHIDInvalidPort = errors.New("invalid USB port") ErrHIDInvalidCore = errors.New("invalid USB core") ErrHIDReportTransfer = errors.New("failed to transfer HID report") )
from usb-hid.go
View Source
var DefaultSetupHandler = setupHandler
Functions ¶
func SetHandler ¶ added in v0.25.0
func SetHandler(d hidDevicer)
SetHandler sets the handler. Only the first time it is called, it calls machine.EnableHID for USB configuration
Types ¶
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is ring buffer implementation inspired by post at https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
func (*RingBuffer) Clear ¶
func (rb *RingBuffer) Clear()
Clear resets the head and tail pointer to zero.
func (*RingBuffer) Get ¶
func (rb *RingBuffer) Get() ([]byte, bool)
Get returns a byte from the buffer. If the buffer is empty, the method will return a false as the second value.
func (*RingBuffer) Put ¶
func (rb *RingBuffer) Put(val []byte) bool
Put stores a byte in the buffer. If the buffer is already full, the method will return false.
func (*RingBuffer) Used ¶
func (rb *RingBuffer) Used() uint8
Used returns how many bytes in buffer have been used.
Click to show internal directories.
Click to hide internal directories.