summaryrefslogtreecommitdiff
path: root/src/device/usbd.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-04-19 00:49:32 +0700
committerGitHub <[email protected]>2019-04-19 00:49:32 +0700
commitee3504fdb06ad83a0d4896b56a4181c114fda703 (patch)
treeb88a4144ee3fc2799268e6f51869756eea18ba23 /src/device/usbd.h
parent074898099da6bfd8784019d97c64712f73b779b0 (diff)
parent6796026476e14fc82402cdbd2dc4418f51240ae5 (diff)
Merge pull request #56 from hathach/develop
refactor hid device, remove auto descriptor, update example
Diffstat (limited to 'src/device/usbd.h')
-rw-r--r--src/device/usbd.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/device/usbd.h b/src/device/usbd.h
index 13c282e91..9525e2e6c 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -45,15 +45,11 @@ typedef struct {
uint8_t const** string_arr; ///< a array of pointers to string descriptors
uint16_t string_count;
- struct {
- uint8_t const* generic;
- uint8_t const* boot_keyboard;
- uint8_t const* boot_mouse;
- } hid_report;
+ uint8_t const* hid_report;
}tud_desc_set_t;
-// Must be defined by application
+// Descriptor collection set, must be defined by application
extern tud_desc_set_t tud_desc_set;
//--------------------------------------------------------------------+
@@ -95,6 +91,13 @@ ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en);
// Invoked when usb bus is resumed
ATTR_WEAK void tud_resume_cb(void);
+//--------------------------------------------------------------------+
+// Interface Descriptor Template
+//--------------------------------------------------------------------+
+
+#define TUD_CONFIG_DESCRIPTOR(_itfcount, _stridx, _total_len, _attribute, _power_ma) \
+ 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, 1, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2
+
#ifdef __cplusplus
}
#endif