Skip to content

Commit 6d802fe

Browse files
committed
Fix ESP builds
1 parent 6cbdb64 commit 6d802fe

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
#include "shared-module/usb_hid/__init__.h"
119119
#endif
120120

121-
#if CIRCUITPY_USB_DEVICE
121+
#if CIRCUITPY_TINYUSB
122122
#include "supervisor/usb.h"
123123
#endif
124124

ports/espressif/supervisor/internal_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "supervisor/filesystem.h"
4545
#include "supervisor/flash.h"
4646

47-
#if CIRCUITPY_USB
47+
#if CIRCUITPY_USB_DEVICE
4848
#include "supervisor/usb.h"
4949
#endif
5050

shared-module/busdisplay/BusDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include "supervisor/shared/display.h"
4444
#include "supervisor/shared/tick.h"
4545

46-
#if CIRCUITPY_USB_DEVICE
46+
#if CIRCUITPY_TINYUSB
4747
#include "supervisor/usb.h"
4848
#endif
4949

shared-module/epaperdisplay/EPaperDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "supervisor/shared/display.h"
3737
#include "supervisor/shared/tick.h"
3838

39-
#if CIRCUITPY_USB_DEVICE
39+
#if CIRCUITPY_TINYUSB
4040
#include "supervisor/usb.h"
4141
#endif
4242

shared-module/framebufferio/FramebufferDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "supervisor/shared/display.h"
3737
#include "supervisor/shared/tick.h"
3838

39-
#if CIRCUITPY_USB_DEVICE
39+
#if CIRCUITPY_TINYUSB
4040
#include "supervisor/usb.h"
4141
#endif
4242

supervisor/shared/serial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
#endif
4242

4343
#if CIRCUITPY_USB_DEVICE
44-
#include "supervisor/usb.h"
4544
#include "shared-module/usb_cdc/__init__.h"
4645
#endif
4746

4847
#if CIRCUITPY_TINYUSB
48+
#include "supervisor/usb.h"
4949
#include "tusb.h"
5050
#endif
5151

supervisor/shared/usb/usb.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
#if CIRCUITPY_USB_DEVICE
4242
#include "shared-bindings/supervisor/__init__.h"
43-
#endif
4443

4544
#if CIRCUITPY_USB_CDC
4645
#include "shared-module/usb_cdc/__init__.h"
@@ -58,6 +57,8 @@
5857
#include "shared-module/usb_video/__init__.h"
5958
#endif
6059

60+
#endif
61+
6162
#include "tusb.h"
6263

6364
bool usb_enabled(void) {
@@ -100,7 +101,7 @@ void usb_init(void) {
100101

101102
post_usb_init();
102103

103-
#if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC
104+
#if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_DEVICE && CIRCUITPY_USB_CDC
104105
// Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received
105106
// This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here
106107

@@ -114,6 +115,7 @@ void usb_init(void) {
114115

115116
// Set up USB defaults before any USB changes are made in boot.py
116117
void usb_set_defaults(void) {
118+
#if CIRCUITPY_USB_DEVICE
117119
#if CIRCUITPY_STORAGE && CIRCUITPY_USB_MSC
118120
storage_usb_set_defaults();
119121
#endif
@@ -129,17 +131,20 @@ void usb_set_defaults(void) {
129131
#if CIRCUITPY_USB_MIDI
130132
usb_midi_set_defaults();
131133
#endif
134+
#endif
132135
};
133136

134137
// Call this when ready to run code.py or a REPL, and a VM has been started.
135138
void usb_setup_with_vm(void) {
139+
#if CIRCUITPY_USB_DEVICE
136140
#if CIRCUITPY_USB_HID
137141
usb_hid_setup_devices();
138142
#endif
139143

140144
#if CIRCUITPY_USB_MIDI
141145
usb_midi_setup_ports();
142146
#endif
147+
#endif
143148
}
144149

145150
void usb_background(void) {
@@ -155,13 +160,13 @@ void usb_background(void) {
155160
vTaskDelay(0);
156161
#endif
157162
// No need to flush if there's no REPL.
158-
#if CIRCUITPY_USB_CDC
163+
#if CIRCUITPY_USB_DEVICE && CIRCUITPY_USB_CDC
159164
if (usb_cdc_console_enabled()) {
160165
// Console will always be itf 0.
161166
tud_cdc_write_flush();
162167
}
163168
#endif
164-
#if CIRCUITPY_USB_VIDEO
169+
#if CIRCUITPY_USB_DEVICE && CIRCUITPY_USB_VIDEO
165170
usb_video_task();
166171
#endif
167172
}

0 commit comments

Comments
 (0)