summaryrefslogtreecommitdiff
path: root/examples/host/cdc_msc_hid_freertos/src/main.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-11-20 22:09:38 +0700
committerhathach <[email protected]>2023-11-20 22:09:38 +0700
commit86f6588c3f5d682ca6d94064b5817a8a463fd23b (patch)
tree22908b0028ec9b13bf19c00f62885b32579c3ca2 /examples/host/cdc_msc_hid_freertos/src/main.c
parent1f71625a32a77d5fe243f71f9e8be03c9bbc41d1 (diff)
update example to work with featherwing max3421, set max3421 GPIO0 for vbus
tested with feather nrf52840, m0, m4
Diffstat (limited to 'examples/host/cdc_msc_hid_freertos/src/main.c')
-rw-r--r--examples/host/cdc_msc_hid_freertos/src/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/host/cdc_msc_hid_freertos/src/main.c b/examples/host/cdc_msc_hid_freertos/src/main.c
index 691ff3e29..069cbdc90 100644
--- a/examples/host/cdc_msc_hid_freertos/src/main.c
+++ b/examples/host/cdc_msc_hid_freertos/src/main.c
@@ -83,6 +83,12 @@ extern void cdc_app_init(void);
extern void hid_app_init(void);
extern void msc_app_init(void);
+#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
+// API to read/rite MAX3421's register. Implemented by TinyUSB
+extern uint8_t tuh_max3421_reg_read(uint8_t rhport, uint8_t reg, bool in_isr);
+extern bool tuh_max3421_reg_write(uint8_t rhport, uint8_t reg, uint8_t data, bool in_isr);
+#endif
+
/*------------- MAIN -------------*/
int main(void) {
board_init();
@@ -126,6 +132,12 @@ static void usb_host_task(void *param) {
board_init_after_tusb();
}
+#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
+ // FeatherWing MAX3421E use MAX3421E's GPIO0 for VBUS enable
+ enum { IOPINS1_ADDR = 20u << 3, /* 0xA0 */ };
+ tuh_max3421_reg_write(BOARD_TUH_RHPORT, IOPINS1_ADDR, 0x01, false);
+#endif
+
cdc_app_init();
hid_app_init();
msc_app_init();