18#ifndef __VSF_USBD_HID_H__
19#define __VSF_USBD_HID_H__
25#if VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_HID == ENABLED
27#include "../../../common/class/HID/vsf_usb_HID.h"
30#if defined(__VSF_USBD_HID_CLASS_IMPLEMENT)
31# undef __VSF_USBD_HID_CLASS_IMPLEMENT
32# define __VSF_CLASS_IMPLEMENT__
33#elif defined(__VSF_USBD_HID_CLASS_INHERIT__)
34# undef __VSF_USBD_HID_CLASS_INHERIT__
35# define __VSF_CLASS_INHERIT__
45#define USB_HID_PARAM(__IN_EP, __OUT_EP, \
46 __REPORT_NUM, __REPORTS, __HAS_REPORT_ID, \
48 __RX_BUFF, __RX_BUFF_SIZE, \
49 __NOTIFY_EDA, __NOTIFIER) \
50 .ep_out = (__OUT_EP), \
52 .num_of_report = (__REPORT_NUM), \
53 .reports = (__REPORTS), \
54 .has_report_id = (__HAS_REPORT_ID), \
55 .desc_num = (__DESC_NUM), \
56 .desc = (vk_usbd_desc_t *)(__DESC), \
57 .rx_buffer.buffer = (__RX_BUFF), \
58 .rx_buffer.size = (__RX_BUFF_SIZE), \
59 .notify_eda = (__NOTIFY_EDA), \
60 .notifier = (__NOTIFIER),
62#define USB_HID_IFS_NUM 1
63#define USB_HID_IFS(__HID_PARAM) USB_IFS(&vk_usbd_hid, &(__HID_PARAM))
66#define __usbd_hid_desc(__name, __ifs, __i_func, __subclass, __protocol, \
67 __version_bcd, __country_code, __report_desc_len, \
68 __ep_in, __ep_in_size, __ep_in_interval, \
69 __ep_out, __ep_out_size, __ep_out_interval) \
70 USB_DESC_HID((__ifs), 4 + (__i_func), (__subclass), (__protocol), \
71 (__version_bcd), (__country_code), (__report_desc_len), \
72 (__ep_in), (__ep_in_size), (__ep_in_interval), \
73 (__ep_out), (__ep_out_size), (__ep_out_interval) \
75#define __usbd_hid_desc_iad(__name, __ifs, __i_func, __subclass, __protocol, \
76 __version_bcd, __country_code, __report_desc_len, \
77 __ep_in, __ep_in_size, __ep_in_interval, \
78 __ep_out, __ep_out_size, __ep_out_interval) \
79 USB_DESC_HID_IAD((__ifs), 4 + (__i_func), (__subclass), (__protocol),\
80 (__version_bcd), (__country_code), (__report_desc_len), \
81 (__ep_in), (__ep_in_size), (__ep_in_interval), \
82 (__ep_out), (__ep_out_size), (__ep_out_interval) \
85#define __usbd_hid_func(__name, __func_id, \
86 __in_ep, __out_ep, __out_ep_size, \
87 __report_num, __reports, __has_report_id, \
88 __report_desc, __report_desc_len, \
89 __notify_eda, __notifier) \
90 uint8_t __##__name##_HID##_rx_buffer[__out_ep_size]; \
91 const vk_usbd_desc_t __##__name##_HID##__desc[1] = { \
92 VSF_USBD_DESC_HID_REPORT((__report_desc), (__report_desc_len)), \
94 vk_usbd_hid_t __##__name##_HID##__func_id = { \
95 USB_HID_PARAM((__in_ep), (__out_ep), \
96 (__report_num), (__reports), (__has_report_id), \
97 dimof(__##__name##_HID##__desc), (__##__name##_HID##__desc),\
98 __##__name##_HID##_rx_buffer, __out_ep_size, \
99 __notify_eda, __notifier) \
102#define __usbd_hid_ifs(__name, __func_id) \
103 USB_HID_IFS(__##__name##_HID##__func_id)
105#define usbd_hid_desc(__name, __ifs, __i_func, \
106 __subclass, __protocol, \
107 __version_bcd, __country_code, __report_desc_len, \
108 __ep_in, __ep_in_size, __ep_in_interval, \
109 __ep_out, __ep_out_size, __ep_out_interval) \
110 __usbd_hid_desc(__name, (__ifs), (__i_func), \
111 (__subclass), (__protocol), \
112 (__version_bcd), (__country_code), (__report_desc_len), \
113 (__ep_in), (__ep_in_size), (__ep_in_interval), \
114 (__ep_out), (__ep_out_size), (__ep_out_interval))
115#define usbd_hid_desc_iad(__name, __ifs, __i_func, \
116 __subclass, __protocol, \
117 __version_bcd, __country_code, __report_desc_len, \
118 __ep_in, __ep_in_size, __ep_in_interval, \
119 __ep_out, __ep_out_size, __ep_out_interval) \
120 __usbd_hid_desc_iad(__name, (__ifs), (__i_func), \
121 (__subclass), (__protocol), \
122 (__version_bcd), (__country_code), (__report_desc_len), \
123 (__ep_in), (__ep_in_size), (__ep_in_interval), \
124 (__ep_out), (__ep_out_size), (__ep_out_interval))
125#define usbd_hid_desc_table(__name, __func_id) \
126 usbd_func_str_desc_table(__name, __func_id)
128#define usbd_hid_func(__name, __func_id, \
129 __in_ep, __out_ep, __out_ep_size, \
130 __report_num, __reports, __has_report_id, \
131 __report_desc, __report_desc_size, \
132 __notify_eda, __notifier) \
133 __usbd_hid_func(__name, __func_id, \
134 (__in_ep), (__out_ep), (__out_ep_size), \
135 (__report_num), (__reports), (__has_report_id), \
136 (__report_desc), (__report_desc_size), \
137 (__notify_eda), (__notifier))
138#define usbd_hid_ifs(__name, __func_id) \
139 __usbd_hid_ifs(__name, __func_id)
141#define VSF_USBD_DESC_HID_REPORT(__PTR, __SIZE) \
142 {USB_HID_DT_REPORT, 0, 0, (__SIZE), (uint8_t*)(__PTR)}
143#define VSF_USBD_HID_REPORT(__TYPE, __ID, __BUFFER, __SIZE, __IDLE) \
144 {(__TYPE), {(__BUFFER), (__SIZE)}, (__ID), (__IDLE)}
192 uint8_t report_from_control : 1;
vsf_err_t
Definition __type.h:42
Definition vsf_usbd_HID.h:149
Definition vsf_usbd_HID.h:164
Definition vsf_usbd.h:402
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_usbd.h:379
Definition vsf_utilities.h:51
vk_av_control_type_t type
Definition vsf_audio.h:170
usb_hid_report_type_t
Definition vsf_usb_HID.h:49
bool vk_usbd_hid_in_report_can_update(vk_usbd_hid_report_t *report)
void vk_usbd_hid_out_report_processed(vk_usbd_hid_t *hid, vk_usbd_hid_report_t *report)
void vk_usbd_hid_in_report_changed(vk_usbd_hid_t *hid, vk_usbd_hid_report_t *report)
const vk_usbd_class_op_t vk_usbd_hid
vk_input_notifier_t notifier
Definition vsf_xboot.c:31