Ayke van Laethem
321488dcfe
machine: avoid heap allocations in USB code
...
This commit replaces most heap allocations in USB related code with
stack allocations. This is important for several reasons:
- It avoids running the GC unnecessarily.
- It reduces code size by 400-464 bytes.
- USB code might be called from interrupt handlers. The heap may be in
an inconsistent state when that happens if main thread code also
performs heap allocations.
The last one is by far the most important one: not doing heap
allocations in interrupts is critical for correctness. But the code size
reduction alone should be worth it.
There are two heap allocations in USB related code left: in the function
receiveUSBControlPacket (SAMD21 and SAMD51). This heap allocation must
also be removed because it runs in an interrupt, but I've left that for
a future change.
2021-04-23 23:37:24 +02:00
Kenneth Bell
25f3adb47e
stm32: support SPI on L4 series
2021-04-21 21:09:41 +02:00
sago35
b9043b649d
atsamd51: fix PWM support in atsamd51p20
...
This change is related to the following commit
72acda22b0
2021-04-21 15:02:47 +02:00
Dan Kegel
f1a5743f77
Make fmt-check happy again
2021-04-17 00:01:37 +02:00
sago35
9f52fe4e4a
atsame51: add initial support for feather-m4-can
2021-04-16 17:49:46 +02:00
developer
cb886a35c9
PWM Support for atmega1280
...
Add arduino mega 1280 PWM test
2021-04-16 17:47:31 +02:00
sago35
bd212cc000
atsame54: add initial support for atsame54-xpro
2021-04-15 15:43:37 +02:00
Ayke van Laethem
0d66475e10
nrf52833: add PWM support
...
This chip wasn't included in the PR for PWM support. Adding this support
is very easy, luckily.
2021-04-14 23:42:02 +02:00
Ayke van Laethem
3fe13a72bd
microbit: remove LED constant
...
There doesn't appear to be a user-controllable LED outside of the LED
matrix. In fact, the pin assigned for this was P13, which was connected
to the SPI SCK pin.
2021-04-14 17:40:32 +02:00
Agurato
e6d5c26df5
Fix RGBA color interpretation for GameBoyAdvance
2021-04-13 18:51:14 +02:00
Kenneth Bell
ae59e7703e
stm32: make SPI CLK fast to fix data issue
...
See "STM32F40x and STM32F41x Errata sheet" - SPI CLK port must be 'fast' or 'very fast' to avoid data corruption on last bit (at the APB clocks we configure).
2021-04-13 07:38:30 +02:00
developer
aa8e12c464
Arduino Mega 1280 support
...
Fix ldflags
Update targets/arduino-mega1280.json
Co-authored-by: Ayke <aykevanlaethem@gmail.com>
Update atmega1280.json
Update Makefile
2021-04-12 11:03:13 +02:00
Kenneth Bell
a30671751f
stm32: add nucleo-l031k6 support
...
Adds i2c for all L0 series
UART, Blinky (LED) and i2c tested
2021-04-07 17:20:19 +02:00
Ayke van Laethem
72acda22b0
machine: refactor PWM support
...
This commit refactors PWM support in the machine package to be more
flexible. The new API can be used to produce tones at a specific
frequency and control servos in a portable way, by abstracting over
counter widths and prescalers.
2021-04-06 20:36:10 +02:00
sago35
8d93b9e545
atsamd21, atsamd51, nrf52840: unify usbcdc code
2021-03-29 10:31:58 +02:00
Ayke van Laethem
90b42799a2
machine: make machine.I2C0 and similar objects pointers
...
This makes it possible to assign I2C objects (machine.I2C0,
machine.I2C1, etc.) without needing to take a pointer.
This is important especially in the future when I2C may be driven using
DMA and the machine.I2C type needs to store some state.
2021-03-29 02:02:04 +02:00
Ayke van Laethem
71bbe93ab2
avr: remove I2C stubs from attiny support
...
These stubs don't really belong there: attiny currently doesn't directly
support I2C at all (although it has hardware to support a software
implementation).
2021-03-29 02:02:04 +02:00
Olaf Flebbe
f23ba3b023
initial support for pca10059
...
Using the official USB Vendor name even for other boards.
2021-03-28 21:38:05 +02:00
Kenneth Bell
46a7993fb8
stm32: i2c implementation for F7, L5 and L4 MCUs
2021-03-24 08:35:34 +01:00
Kenneth Bell
aa7c7b7bd9
lgt92: update to new UART structure
2021-03-23 08:33:59 +01:00
Kenneth Bell
c7bd5405c3
Add support for nucleol432 board
...
LED and UART are working
2021-03-23 08:33:59 +01:00
Kenneth Bell
dc981ce509
stm32: separate altfunc selection for UART Tx/Rx
...
This is needed for stm32l432 nucleo with different altfun for tx and rx
2021-03-23 08:33:59 +01:00
Kenneth Bell
b5205cc3ca
stm32: move f103 (bluepill) to common i2c code
2021-03-21 11:25:10 +01:00
Kenneth Bell
ef613a5db7
stm32: housekeeping - remove empty file
2021-03-21 00:45:29 +01:00
sago35
1571b8fd34
Add special handling when SPI Freq is 24Mhz
2021-03-19 17:34:49 +01:00
sago35
a41b72578b
atsamd21: improve SPI
2021-03-19 17:34:49 +01:00
Kenneth Bell
ce8ad3650a
stm32l0: use unified UART logic
2021-03-18 12:10:36 +01:00
ardnew
99b129d366
Add board support for Adafruit Grand Central M4 (SAMD51) ( #1714 )
...
machine/grandcentral-m4: implementation for Adafruit Grand Central M4 board.
2021-03-15 14:06:09 +01:00
ardnew
7d1ce24be5
fix data shift/mask in func newUSBSetup
2021-03-14 23:58:25 +01:00
sago35
0cabd4de69
atsamd5x: improve SPI
2021-03-14 15:40:53 +01:00
Thomas Tromp
56bbc5bf6d
Fix fe310 SPI read
2021-03-13 08:56:15 +01:00
ardnew
0b44d0bcc5
add UART0 as alias for UART1
2021-03-13 07:34:44 +01:00
ardnew
6275b3a8d1
teensy40: move txBuffer allocation to UART declaration
2021-03-13 07:34:44 +01:00
Ayke van Laethem
42088f938e
attiny: remove dummy UART
...
I think it's better not to provide a UART0 global at all than one that
does nothing.
2021-03-10 22:28:58 +01:00
Kenneth Bell
66f76833ad
stm32: fix i2c and add stm32f407 i2c
2021-02-27 20:35:16 +01:00
deadprogram
24976a6974
machine/nrf52840+nxpmk66f18: rename files to match naming format for all other boards/machines
...
Signed-off-by: deadprogram <ron@hybridgroup.com>
2021-02-26 00:32:33 +01:00
sago35
e76729c6f3
fix
2021-02-25 13:39:33 +01:00
sago35
35c8707867
nrf52840: improve USBCDC
2021-02-25 13:39:33 +01:00
Ramon
c299386906
Add nrf52840-mdk-usb-dongle target ( #1654 )
...
machine/nrf52840: add support for nrf52840-mdk-usb-dongle target
2021-02-24 10:25:38 +01:00
sago35
52a20cf3bb
atsamd2x: avoid infinite loop when USBCDC is disconnected
2021-02-19 17:21:05 +01:00
sago35
1aac8a0cb1
atsamd5x: avoid infinite loop when USBCDC is disconnected
2021-02-19 17:20:15 +01:00
sago35
ba634c4cc7
atsamd2x: improve USBCDC
2021-02-16 14:52:05 +01:00
ardnew
681be2d4e3
STM32 I2C: replace addressable interface with simpler type ( #1609 )
...
machine/stm32: replace STM32 I2C addressable interface with simpler type
2021-02-16 13:03:29 +01:00
sago35
01b917fb11
atsamd5x: improve USBCDC
2021-02-16 12:48:52 +01:00
Kenneth Bell
fcdaa83368
stm32-l5: corrected alt function and other review comments
2021-02-16 12:48:52 +01:00
Kenneth Bell
289e1aa197
stm32: Harmonization of UART logic
2021-02-16 12:48:52 +01:00
Kenneth Bell
af02c09b56
nucleol552ze: implementation with CLOCK, LED, and UART
2021-02-16 12:48:52 +01:00
Weston Schmidt
f4b4dd8d62
Add SPI support for Atmega based chips.
...
This is based on @Nerzal's #1398 PR, but is a bit of a refactor and
expansion to support all the Atmega based chips present in tinygo.
2021-02-10 12:56:48 +01:00
Ayke van Laethem
d6cdf8ca28
machine: make I2C.Configure signature consistent
...
It's better to always return an error value (even if it is nil) for
consistency.
2021-02-07 14:06:49 +01:00
deadprogram
f1210caba8
machine/clue: correct for lack of low frequency crystal
...
Signed-off-by: deadprogram <ron@hybridgroup.com>
2021-02-01 12:25:18 +01:00