Loading...
Searching...
No Matches
hid.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Nils Ollrogge
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for
6 * more details.
7 */
8
27#ifndef USB_USBUS_HID_H
28#define USB_USBUS_HID_H
29
30#include <stdint.h>
31
32#include "usb/usbus.h"
33#include "usb/hid.h"
34#include "mutex.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
43#ifndef CONFIG_USBUS_HID_INTERRUPT_EP_SIZE
44#define CONFIG_USBUS_HID_INTERRUPT_EP_SIZE 0x40
45#endif
46
51
61typedef void (*usbus_hid_cb_t)(usbus_hid_device_t *hid, uint8_t *data,
62 size_t len);
63
91
102 usbus_hid_cb_t cb, const uint8_t *report_desc,
103 size_t report_desc_size);
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif /* USB_USBUS_HID_H */
#define usbdev_ep_buf_t
Instantiation type for usbdev endpoint buffers.
Definition usbdev.h:126
void(* usbus_hid_cb_t)(usbus_hid_device_t *hid, uint8_t *data, size_t len)
HID data callback.
Definition hid.h:61
#define CONFIG_USBUS_HID_INTERRUPT_EP_SIZE
USB HID interrupt endpoint size.
Definition hid.h:44
void usbus_hid_init(usbus_t *usbus, usbus_hid_device_t *hid, usbus_hid_cb_t cb, const uint8_t *report_desc, size_t report_desc_size)
Initialize an USBUS HID interface.
Definition for USB HID interfaces.
Mutex for thread synchronization.
event structure
Definition event.h:148
Mutex structure.
Definition mutex.h:146
USBUS descriptor generator.
Definition usbus.h:298
USBUS endpoint context.
Definition usbus.h:308
USBUS handler struct.
Definition usbus.h:436
USBUS HID context struct.
Definition hid.h:67
usbus_descr_gen_t hid_descr
HID descriptor generator.
Definition hid.h:72
event_t tx_ready
Transmit ready event.
Definition hid.h:78
usbus_endpoint_t * ep_in
IN endpoint.
Definition hid.h:71
size_t report_desc_size
report descriptor size
Definition hid.h:74
usbus_hid_cb_t cb
Callback for data handlers.
Definition hid.h:77
usbus_handler_t handler_ctrl
control handler
Definition hid.h:68
usbus_interface_t iface
HID interface.
Definition hid.h:69
usbus_t * usbus
USBUS reference.
Definition hid.h:75
size_t occupied
Number of bytes for the host.
Definition hid.h:76
const uint8_t * report_desc
report descriptor reference
Definition hid.h:73
mutex_t in_lock
mutex used for locking hid send
Definition hid.h:79
usbus_endpoint_t * ep_out
OUT endpoint.
Definition hid.h:70
usbdev_ep_buf_t in_buf[CONFIG_USBUS_HID_INTERRUPT_EP_SIZE]
Device to host data buffer.
Definition hid.h:89
usbdev_ep_buf_t out_buf[CONFIG_USBUS_HID_INTERRUPT_EP_SIZE]
Host to device data buffer.
Definition hid.h:84
USBUS interface.
Definition usbus.h:353
USBUS context struct.
Definition usbus.h:448
USBUS basic interface.