mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
machine: make USBCDC global a pointer
Make the USBCDC use a pointer receiver everywhere. This makes it easier
to pass around the object in the future.
This commit sometimes changes code size, but not significantly (a few
bytes) and usually in a positive way.
My eventual goal is the following:
- Declare `machine.USB` (or similar, name TBD) as a pointer receiver
for the USB-CDC interface.
- Let `machine.UART0` always point to an UART, never actually to a
USBCDC object.
- Define `machine.Serial`, which is either a real UART or an USB-CDC,
depending on the board.
This way, if you want a real UART you can use machine.UARTx and if you
just want to print to the default serial port, you can use
machine.Serial.
This change does have an effect on code size and memory consumption.
There is often a small reduction (-8 bytes) in RAM consumption and an
increase in flash consumption.
This commit is contained in:
committed by
Ron Evans
parent
1646326164
commit
7c949ad386
@@ -105,7 +105,7 @@ const (
|
||||
|
||||
// UART0 is the USB device
|
||||
var (
|
||||
UART0 = &USB
|
||||
UART0 = USB
|
||||
)
|
||||
|
||||
// I2C pins
|
||||
|
||||
Reference in New Issue
Block a user