@@ -113,6 +113,11 @@ extern "C" {
113
113
//--------------------------------------------------------------------
114
114
// DEVICE CONFIGURATION
115
115
//--------------------------------------------------------------------
116
+ #if defined(PKG_TINYUSB_DEVICE_ENABLE )
117
+ #define CFG_TUD_ENABLED (1)
118
+ #else
119
+ #define CFG_TUD_ENABLED (0)
120
+ #endif
116
121
117
122
#ifndef CFG_TUD_ENDPOINT0_SIZE
118
123
#define CFG_TUD_ENDPOINT0_SIZE PKG_TINYUSB_EDPT0_SIZE
@@ -138,6 +143,72 @@ extern "C" {
138
143
#define PKG_TINYUSB_DEVICE_HID_STRING ""
139
144
#endif
140
145
146
+ //--------------------------------------------------------------------
147
+ // HOST CONFIGURATION
148
+ //--------------------------------------------------------------------
149
+ #if defined(PKG_TINYUSB_HOST_ENABLE )
150
+ #define CFG_TUH_ENABLED (1)
151
+ #else
152
+ #define CFG_TUH_ENABLED (0)
153
+ #endif
154
+
155
+ #if (PKG_TINYUSB_HOST_PORT == 0 )
156
+ #undef CFG_TUSB_RHPORT0_MODE
157
+ #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | PKG_TINYUSB_HOST_PORT_SPEED)
158
+ #endif
159
+
160
+ #if (PKG_TINYUSB_HOST_PORT == 1 )
161
+ #undef CFG_TUSB_RHPORT1_MODE
162
+ #define CFG_TUSB_RHPORT1_MODE (OPT_MODE_HOST | PKG_TINYUSB_HOST_PORT_SPEED)
163
+ #endif
164
+
165
+ #define BOARD_TUH_RHPORT PKG_TINYUSB_HOST_PORT // FULL SPEED
166
+ #define BOARD_TUH_MAX_SPEED PKG_TINYUSB_HOST_PORT_SPEED
167
+ // Default is max speed that hardware controller could support with on-chip PHY
168
+ #define CFG_TUH_MAX_SPEED BOARD_TUH_MAX_SPEED
169
+
170
+ //------------------------- Board Specific --------------------------
171
+
172
+ // RHPort number used for host can be defined by board.mk, default to port 0
173
+ #ifndef BOARD_TUH_RHPORT
174
+ #define BOARD_TUH_RHPORT 0
175
+ #endif
176
+
177
+ // RHPort max operational speed can defined by board.mk
178
+ #ifndef BOARD_TUH_MAX_SPEED
179
+ #define BOARD_TUH_MAX_SPEED OPT_MODE_DEFAULT_SPEED
180
+ #endif
181
+
182
+ // Size of buffer to hold descriptors and other data used for enumeration
183
+ #define CFG_TUH_ENUMERATION_BUFSIZE 256
184
+
185
+ #define CFG_TUH_HUB 2 // number of supported hubs
186
+ #define CFG_TUH_CDC 0 // CDC ACM
187
+ #define CFG_TUH_CDC_FTDI 0 // FTDI Serial. FTDI is not part of CDC class, only to re-use CDC driver API
188
+ #define CFG_TUH_CDC_CP210X 0 // CP210x Serial. CP210X is not part of CDC class, only to re-use CDC driver API
189
+ #define CFG_TUH_CDC_CH34X 0 // CH340 or CH341 Serial. CH34X is not part of CDC class, only to re-use CDC driver API
190
+ #define CFG_TUH_HID 0 // typical keyboard + mouse device can have 3-4 HID interfaces
191
+ #define CFG_TUH_MSC 0
192
+ //#define CFG_TUH_VENDOR 3
193
+
194
+ // max device support (excluding hub device): 1 hub typically has 4 ports
195
+ #define CFG_TUH_DEVICE_MAX (3*CFG_TUH_HUB + 1)
196
+
197
+ //------------- HID -------------//
198
+ #define CFG_TUH_HID_EPIN_BUFSIZE 64
199
+ #define CFG_TUH_HID_EPOUT_BUFSIZE 64
200
+
201
+ //------------- CDC -------------//
202
+
203
+ // Set Line Control state on enumeration/mounted:
204
+ // DTR ( bit 0), RTS (bit 1)
205
+ #define CFG_TUH_CDC_LINE_CONTROL_ON_ENUM 0x03
206
+
207
+ // Set Line Coding on enumeration/mounted, value for cdc_line_coding_t
208
+ // bit rate = 115200, 1 stop bit, no parity, 8 bit data width
209
+ #define CFG_TUH_CDC_LINE_CODING_ON_ENUM { 115200, CDC_LINE_CODING_STOP_BITS_1, CDC_LINE_CODING_PARITY_NONE, 8 }
210
+
211
+
141
212
142
213
#ifdef __cplusplus
143
214
}
0 commit comments