diff options
author | Ayke van Laethem <[email protected]> | 2021-05-11 13:39:14 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-05-13 16:43:37 +0200 |
commit | 7c949ad386ef36eb0be100eb54a4190740f6f24d (patch) | |
tree | cb2c910468b67f96ee81583fded96d242abd3bd7 /src/machine/board_particle_boron.go | |
parent | 164632616496e21f5f11098316c650ab5ad9356c (diff) | |
download | tinygo-7c949ad386ef36eb0be100eb54a4190740f6f24d.tar.gz tinygo-7c949ad386ef36eb0be100eb54a4190740f6f24d.zip |
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.
Diffstat (limited to 'src/machine/board_particle_boron.go')
-rw-r--r-- | src/machine/board_particle_boron.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/machine/board_particle_boron.go b/src/machine/board_particle_boron.go index a50d87eb9..cb05e7253 100644 --- a/src/machine/board_particle_boron.go +++ b/src/machine/board_particle_boron.go @@ -41,7 +41,7 @@ const ( // UART var ( - Serial = &USB + Serial = USB UART0 = NRF_UART0 ) |