Loading...
Searching...
No Matches

USBUS HID IO interface module. More...

Detailed Description

USBUS HID IO interface module.

Files

file  hid_io.h
 USB HID callback and read/write functions.
 

Typedefs

typedef void(* usb_hid_io_cb_t) (void *)
 USBUS HID IO RX callback function.
 

Functions

void usb_hid_io_set_rx_cb (usb_hid_io_cb_t cb, void *arg)
 Set USBUS HID IO RX callback.
 
void usb_hid_io_write (const void *buffer, size_t len)
 Write data to USB HID IN endpoint buffer.
 
int usb_hid_io_read (void *buffer, size_t len)
 Read data from USB HID OUT endpoint (blocking)
 
int usb_hid_io_read_timeout (void *buffer, size_t len, uint32_t timeout)
 Read data from USB HID OUT endpoint (with timeout, blocking)
 
void usb_hid_io_init (usbus_t *usbus, const uint8_t *report_desc, size_t report_desc_size)
 Initialize an USB HID IO interface.
 

Typedef Documentation

◆ usb_hid_io_cb_t

typedef void(* usb_hid_io_cb_t) (void *)

USBUS HID IO RX callback function.

Definition at line 37 of file hid_io.h.

Function Documentation

◆ usb_hid_io_init()

void usb_hid_io_init ( usbus_t usbus,
const uint8_t *  report_desc,
size_t  report_desc_size 
)

Initialize an USB HID IO interface.

Parameters
[in]usbusUSBUS context
[in]report_descUSB_HID report descriptor
[in]report_desc_sizesize of USB_HID report descriptor

◆ usb_hid_io_read()

int usb_hid_io_read ( void *  buffer,
size_t  len 
)

Read data from USB HID OUT endpoint (blocking)

Wrapper for isrpipe_read

Precondition
buffer != NULL
Parameters
[out]bufferbuffer to read data into
[in]lenlength of buffer
Returns
Number of bytes read

◆ usb_hid_io_read_timeout()

int usb_hid_io_read_timeout ( void *  buffer,
size_t  len,
uint32_t  timeout 
)

Read data from USB HID OUT endpoint (with timeout, blocking)

Wrapper for isrpipe_read_timeout

Precondition
buffer != NULL
Parameters
[out]bufferbuffer to read data into
[in]lenlength of buffer
[in]timeouttimeout in microseconds
Returns
Number of bytes read

◆ usb_hid_io_set_rx_cb()

void usb_hid_io_set_rx_cb ( usb_hid_io_cb_t  cb,
void *  arg 
)

Set USBUS HID IO RX callback.

Parameters
[in]cbcallback function to use
[in]argargument that will be passed to cb

◆ usb_hid_io_write()

void usb_hid_io_write ( const void *  buffer,
size_t  len 
)

Write data to USB HID IN endpoint buffer.

Precondition
buffer != NULL
Parameters
[in]bufferbuffer containing data to write
[in]lenlength of buffer