Skip to content

Commit 7b6f89a

Browse files
authored
Merge pull request #4215 from dhalbert/secondary-cdc
Second USB CDC (serial) channel
2 parents 220f86f + 985e020 commit 7b6f89a

File tree

53 files changed

+1797
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1797
-684
lines changed

main.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@
6969
#include "shared-bindings/alarm/__init__.h"
7070
#endif
7171

72+
#if CIRCUITPY_BLEIO
73+
#include "shared-bindings/_bleio/__init__.h"
74+
#include "supervisor/shared/bluetooth.h"
75+
#endif
76+
77+
#if CIRCUITPY_BOARD
78+
#include "shared-module/board/__init__.h"
79+
#endif
80+
81+
#if CIRCUITPY_CANIO
82+
#include "common-hal/canio/CAN.h"
83+
#endif
84+
7285
#if CIRCUITPY_DISPLAYIO
7386
#include "shared-module/displayio/__init__.h"
7487
#endif
@@ -81,17 +94,8 @@
8194
#include "shared-module/network/__init__.h"
8295
#endif
8396

84-
#if CIRCUITPY_BOARD
85-
#include "shared-module/board/__init__.h"
86-
#endif
87-
88-
#if CIRCUITPY_BLEIO
89-
#include "shared-bindings/_bleio/__init__.h"
90-
#include "supervisor/shared/bluetooth.h"
91-
#endif
92-
93-
#if CIRCUITPY_CANIO
94-
#include "common-hal/canio/CAN.h"
97+
#if CIRCUITPY_USB_CDC
98+
#include "shared-module/usb_cdc/__init__.h"
9599
#endif
96100

97101
#if CIRCUITPY_WIFI

ports/atmel-samd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ CFLAGS += -ftree-vrp
122122
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
123123
#Debugging/Optimization
124124
ifeq ($(DEBUG), 1)
125-
CFLAGS += -ggdb3 -Og
125+
CFLAGS += -ggdb3 -Og -Os
126126
# You may want to disable -flto if it interferes with debugging.
127127
CFLAGS += -flto -flto-partition=none
128128
# You may want to enable these flags to make setting breakpoints easier.

ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
1212

1313
SUPEROPT_GC = 0
14+
SUPEROPT_VM = 0

ports/atmel-samd/common-hal/supervisor/Runtime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
#include "shared-bindings/supervisor/Runtime.h"
2929
#include "supervisor/serial.h"
3030

31-
bool common_hal_get_serial_connected(void) {
31+
bool common_hal_supervisor_runtime_get_serial_connected(void) {
3232
return (bool) serial_connected();
3333
}
3434

35-
bool common_hal_get_serial_bytes_available(void) {
35+
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
3636
return (bool) serial_bytes_available();
3737
}

ports/atmel-samd/mpconfigport.mk

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ ifeq ($(LONGINT_IMPL),LONGLONG)
1818
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
1919
endif
2020

21+
INTERNAL_LIBM = 1
22+
23+
USB_SERIAL_NUMBER_LENGTH = 32
24+
25+
# Number of USB endpoint pairs.
26+
USB_NUM_EP = 8
27+
28+
######################################################################
2129
# Put samd21-only choices here.
30+
2231
ifeq ($(CHIP_FAMILY),samd21)
2332

2433
# The ?='s allow overriding in mpconfigboard.mk.
@@ -40,7 +49,9 @@ CIRCUITPY_SDCARDIO ?= 0
4049
CIRCUITPY_FRAMEBUFFERIO ?= 0
4150

4251
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
52+
# Because of that, there aren't enough endpoints for a secondary CDC serial connection.
4353
USB_MSC_EP_NUM_OUT = 1
54+
CIRCUITPY_USB_CDC = 0
4455

4556
CIRCUITPY_ULAB = 0
4657

@@ -55,9 +66,13 @@ CIRCUITPY_TERMINALIO = 0
5566
endif
5667

5768
endif # samd21
69+
######################################################################
5870

71+
######################################################################
5972
# Put samd51-only choices here.
73+
6074
ifeq ($(CHIP_FAMILY),samd51)
75+
6176
# No native touchio on SAMD51.
6277
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
6378

@@ -70,9 +85,4 @@ CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FULL_BUILD)
7085
CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD)
7186

7287
endif # samd51
73-
74-
INTERNAL_LIBM = 1
75-
76-
USB_SERIAL_NUMBER_LENGTH = 32
77-
78-
USB_NUM_EP = 8
88+
######################################################################

ports/cxd56/common-hal/supervisor/Runtime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
#include "shared-bindings/supervisor/Runtime.h"
2828
#include "supervisor/serial.h"
2929

30-
bool common_hal_get_serial_connected(void) {
30+
bool common_hal_supervisor_runtime_get_serial_connected(void) {
3131
return (bool) serial_connected();
3232
}
3333

34-
bool common_hal_get_serial_bytes_available(void) {
34+
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
3535
return (bool) serial_bytes_available();
3636
}

ports/cxd56/mpconfigport.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ USB_CDC_EP_NUM_DATA_IN = 1
77
USB_MSC_EP_NUM_OUT = 5
88
USB_MSC_EP_NUM_IN = 4
99

10+
# Number of USB endpoint pairs.
11+
USB_NUM_EP = 6
12+
1013
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
1114

1215
CIRCUITPY_AUDIOBUSIO = 0

ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ USB_VID = 0x303a
22
USB_PID = 0x8007
33
USB_PRODUCT = "TTGO T8 ESP32-S2"
44
USB_MANUFACTURER = "LILYGO"
5-
USB_DEVICES = "CDC,MSC,HID"
65

76
INTERNAL_FLASH_FILESYSTEM = 1
87
LONGINT_IMPL = MPZ

ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ USB_VID = 0x239A
22
USB_PID = 0x80C6
33
USB_PRODUCT = "microS2"
44
USB_MANUFACTURER = "microDev"
5-
USB_DEVICES = "CDC,MSC,HID"
65

76
INTERNAL_FLASH_FILESYSTEM = 1
87
LONGINT_IMPL = MPZ

ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ USB_VID = 0x239A
22
USB_PID = 0x80AC
33
USB_PRODUCT = "FeatherS2"
44
USB_MANUFACTURER = "UnexpectedMaker"
5-
USB_DEVICES = "CDC,MSC,HID"
65

76
INTERNAL_FLASH_FILESYSTEM = 1
87
LONGINT_IMPL = MPZ

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy