Skip to content

Commit 277852a

Browse files
committed
fix esp32 msc example
1 parent 10abece commit 277852a

File tree

7 files changed

+151
-176
lines changed

7 files changed

+151
-176
lines changed

examples/host/cdc_msc_hid_freertos/src/cdc_app.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
3232
//--------------------------------------------------------------------+
3333

34-
35-
//------------- IMPLEMENTATION -------------//
36-
34+
// helper
3735
size_t get_console_inputs(uint8_t *buf, size_t bufsize) {
3836
size_t count = 0;
3937
while (count < bufsize) {
@@ -47,6 +45,10 @@ size_t get_console_inputs(uint8_t *buf, size_t bufsize) {
4745
return count;
4846
}
4947

48+
void cdc_app_init(void) {
49+
// nothing to do
50+
}
51+
5052
void cdc_app_task(void* param) {
5153
(void) param;
5254

examples/host/cdc_msc_hid_freertos/src/hid_app.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ static void process_kbd_report(hid_keyboard_report_t const *report);
4848
static void process_mouse_report(hid_mouse_report_t const *report);
4949
static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len);
5050

51+
void hid_app_init(void) {
52+
// nothing to do
53+
}
54+
5155
//--------------------------------------------------------------------+
5256
// TinyUSB Callbacks
5357
//--------------------------------------------------------------------+

examples/host/cdc_msc_hid_freertos/src/main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@ StaticTask_t cdc_taskdef;
8282
TimerHandle_t blinky_tm;
8383

8484
static void led_blinky_cb(TimerHandle_t xTimer);
85-
static void usb_host_task(void* param);
85+
extern void cdc_app_init(void);
86+
extern void hid_app_init(void);
87+
extern void msc_app_init(void);
8688

89+
static void usb_host_task(void* param);
8790
extern void cdc_app_task(void* param);
8891

92+
93+
8994
/*------------- MAIN -------------*/
9095
int main(void) {
9196
board_init();
@@ -131,6 +136,10 @@ static void usb_host_task(void *param) {
131136
board_init_after_tusb();
132137
}
133138

139+
cdc_app_init();
140+
hid_app_init();
141+
msc_app_init();
142+
134143
// RTOS forever loop
135144
while (1) {
136145
// put this thread to waiting state until there is new events
@@ -154,7 +163,6 @@ void tuh_umount_cb(uint8_t dev_addr) {
154163
printf("A device with address %d is unmounted \r\n", dev_addr);
155164
}
156165

157-
158166
//--------------------------------------------------------------------+
159167
// BLINKING TASK
160168
//--------------------------------------------------------------------+

examples/host/cdc_msc_hid_freertos/src/msc_app.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525

2626
#include "tusb.h"
2727

28-
#if CFG_TUH_MSC
29-
3028
static scsi_inquiry_resp_t inquiry_resp;
3129

30+
void msc_app_init(void) {
31+
// nothing to do
32+
}
33+
3234
bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const *cb_data) {
3335
msc_cbw_t const *cbw = cb_data->cbw;
3436
msc_csw_t const *csw = cb_data->csw;
@@ -63,5 +65,3 @@ void tuh_msc_umount_cb(uint8_t dev_addr) {
6365
(void) dev_addr;
6466
printf("A MassStorage device is unmounted\r\n");
6567
}
66-
67-
#endif

0 commit comments

Comments
 (0)