40
40
41
41
#if CIRCUITPY_USB_DEVICE
42
42
#include "shared-bindings/supervisor/__init__.h"
43
- #endif
44
43
45
44
#if CIRCUITPY_USB_CDC
46
45
#include "shared-module/usb_cdc/__init__.h"
58
57
#include "shared-module/usb_video/__init__.h"
59
58
#endif
60
59
60
+ #endif
61
+
61
62
#include "tusb.h"
62
63
63
64
bool usb_enabled (void ) {
@@ -100,7 +101,7 @@ void usb_init(void) {
100
101
101
102
post_usb_init ();
102
103
103
- #if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC
104
+ #if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_DEVICE && CIRCUITPY_USB_CDC
104
105
// Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received
105
106
// This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here
106
107
@@ -114,6 +115,7 @@ void usb_init(void) {
114
115
115
116
// Set up USB defaults before any USB changes are made in boot.py
116
117
void usb_set_defaults (void ) {
118
+ #if CIRCUITPY_USB_DEVICE
117
119
#if CIRCUITPY_STORAGE && CIRCUITPY_USB_MSC
118
120
storage_usb_set_defaults ();
119
121
#endif
@@ -129,17 +131,20 @@ void usb_set_defaults(void) {
129
131
#if CIRCUITPY_USB_MIDI
130
132
usb_midi_set_defaults ();
131
133
#endif
134
+ #endif
132
135
};
133
136
134
137
// Call this when ready to run code.py or a REPL, and a VM has been started.
135
138
void usb_setup_with_vm (void ) {
139
+ #if CIRCUITPY_USB_DEVICE
136
140
#if CIRCUITPY_USB_HID
137
141
usb_hid_setup_devices ();
138
142
#endif
139
143
140
144
#if CIRCUITPY_USB_MIDI
141
145
usb_midi_setup_ports ();
142
146
#endif
147
+ #endif
143
148
}
144
149
145
150
void usb_background (void ) {
@@ -155,13 +160,13 @@ void usb_background(void) {
155
160
vTaskDelay (0 );
156
161
#endif
157
162
// No need to flush if there's no REPL.
158
- #if CIRCUITPY_USB_CDC
163
+ #if CIRCUITPY_USB_DEVICE && CIRCUITPY_USB_CDC
159
164
if (usb_cdc_console_enabled ()) {
160
165
// Console will always be itf 0.
161
166
tud_cdc_write_flush ();
162
167
}
163
168
#endif
164
- #if CIRCUITPY_USB_VIDEO
169
+ #if CIRCUITPY_USB_DEVICE && CIRCUITPY_USB_VIDEO
165
170
usb_video_task ();
166
171
#endif
167
172
}
0 commit comments