@@ -34,12 +34,6 @@ extern "C" {
34
34
//--------------------------------------------------------------------
35
35
#define CFG_TUSB_MCU OPT_MCU_NRF5X
36
36
37
- #ifdef USE_TINYUSB
38
- #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
39
- #else
40
- #define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE
41
- #endif
42
-
43
37
#define CFG_TUSB_OS OPT_OS_FREERTOS
44
38
#define CFG_TUSB_MEM_SECTION
45
39
#define CFG_TUSB_MEM_ALIGN __attribute__((aligned(4)))
@@ -48,6 +42,19 @@ extern "C" {
48
42
#define CFG_TUSB_DEBUG 0
49
43
#endif
50
44
45
+ #ifdef USE_TINYUSB
46
+ // Enable device stack
47
+ #define CFG_TUD_ENABLED 1
48
+
49
+ // Enable host stack with MAX3421E (host shield)
50
+ #define CFG_TUH_ENABLED 1
51
+ #define CFG_TUH_MAX3421 1
52
+
53
+ #else
54
+ #define CFG_TUD_ENABLED 0
55
+ #define CFG_TUH_ENABLED 0
56
+ #endif
57
+
51
58
//--------------------------------------------------------------------
52
59
// DEVICE CONFIGURATION
53
60
//--------------------------------------------------------------------
@@ -79,10 +86,54 @@ extern "C" {
79
86
#ifndef CFG_TUD_VENDOR_RX_BUFSIZE
80
87
#define CFG_TUD_VENDOR_RX_BUFSIZE 64
81
88
#endif
89
+
82
90
#ifndef CFG_TUD_VENDOR_TX_BUFSIZE
83
91
#define CFG_TUD_VENDOR_TX_BUFSIZE 64
84
92
#endif
85
93
94
+ //--------------------------------------------------------------------
95
+ // Host Configuration
96
+ //--------------------------------------------------------------------
97
+
98
+ // Size of buffer to hold descriptors and other data used for enumeration
99
+ #define CFG_TUH_ENUMERATION_BUFSIZE 256
100
+
101
+ // Number of hub devices
102
+ #define CFG_TUH_HUB 1
103
+
104
+ // max device support (excluding hub device): 1 hub typically has 4 ports
105
+ #define CFG_TUH_DEVICE_MAX (3 * CFG_TUH_HUB + 1)
106
+
107
+ // Enable tuh_edpt_xfer() API
108
+ // #define CFG_TUH_API_EDPT_XFER 1
109
+
110
+ // Number of mass storage
111
+ #define CFG_TUH_MSC 1
112
+
113
+ // Number of HIDs
114
+ // typical keyboard + mouse device can have 3,4 HID interfaces
115
+ #define CFG_TUH_HID (3 * CFG_TUH_DEVICE_MAX)
116
+
117
+ // Number of CDC interfaces
118
+ // FTDI and CP210x are not part of CDC class, only to re-use CDC driver API
119
+ #define CFG_TUH_CDC 1
120
+ #define CFG_TUH_CDC_FTDI 1
121
+ #define CFG_TUH_CDC_CP210X 1
122
+
123
+ // RX & TX fifo size
124
+ #define CFG_TUH_CDC_RX_BUFSIZE 64
125
+ #define CFG_TUH_CDC_TX_BUFSIZE 64
126
+
127
+ // Set Line Control state on enumeration/mounted:
128
+ // DTR ( bit 0), RTS (bit 1)
129
+ #define CFG_TUH_CDC_LINE_CONTROL_ON_ENUM 0x03
130
+
131
+ // Set Line Coding on enumeration/mounted, value for cdc_line_coding_t
132
+ // bit rate = 115200, 1 stop bit, no parity, 8 bit data width
133
+ // This need Pico-PIO-USB at least 0.5.1
134
+ #define CFG_TUH_CDC_LINE_CODING_ON_ENUM \
135
+ { 115200, CDC_LINE_CONDING_STOP_BITS_1, CDC_LINE_CODING_PARITY_NONE, 8 }
136
+
86
137
#ifdef __cplusplus
87
138
}
88
139
#endif
0 commit comments