1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

225 Commits

Author SHA1 Message Date
84745365fd cpu: atmega_common: make THREAD_STACKSIZE_IDLE configurable 2020-03-12 13:01:13 +01:00
Benjamin Valentin
93d2068a9e cpu/atmega_common: Implement RTC based on TIM2
This implements a basic Real Time Clock based on TIM2.

As the timer is too fast and wraps around after just 8 bits, it is
not used directly. Instead TIM2 is responsible for providing a 1 Hz
tick by generating an alarm every second.

The current time data is kept in the `.noinit` section, so it will survive
a reboot, but the clock will not be updated while the bootloader runs, so
expect inaccuracies.
2020-03-03 16:26:26 +01:00
Gunar Schorcht
da244ffcaa cpu/atmega_common: fix compile problem with NDEBUG 2020-02-25 09:41:24 +01:00
benpicco
de89f3a459
Merge pull request #13319 from maribu/avr-reboot
cpu/atmega_common: Fix reboot issues
2020-02-11 17:18:12 +01:00
Francisco
e2dc125fb3
Merge pull request #13308 from maribu/atmega_state_cleanup
cpu/atmega_common: Cleanup state flags
2020-02-10 17:37:24 +01:00
Marian Buschsieweke
60ee8cd513
cpu/atmega_common: Fix pm_reboot with LTO
The reboot process for ATmegas is to enable the watchdog timer and loop until
the wdt reboots this MCU. However, this reboot will keep the wdt configuration,
so that the wdt needs to be disabled during boot. This is done in get_mcusr,
but without the attribute "used" it will be optimized out in LTO builds. This
commits adds the attribute "used" to get_mcusr.

Also simplified the backward compatibility with older ATmegas (currently not
supported by RIOT) on outdated versions of avrlibc.
2020-02-10 17:08:09 +01:00
benpicco
24fb7a9aae
Merge pull request #12933 from maribu/atmega_pcint_cleanup
cpu/atmega_common/periph/gpio: Clean up PCINT support
2020-02-06 18:29:15 +01:00
Marian Buschsieweke
1879f58512
cpu/atmega_common: Cleanup state flags
- Use one byte of RAM to track both IRQ and UART TX state
- Fix incorrect use of volatile
2020-02-06 15:41:41 +01:00
Gunar Schorcht
668e05ed4f cpu/atmega: fix PWM compilation error with NDEBUG
When NDEBUG macro is defined during compilation, the assert macro produces empty code. The dev parameter is then unused.
2020-02-03 00:14:32 +01:00
Gunar Schorcht
2051167176 cpu/atmega: fix I2C compilation error with NDEBUG
When NDEBUG macro is defined during compilation, the assert macro produces empty code. The dev parameter is then unused.
2020-01-30 11:46:31 +01:00
Gunar Schorcht
ddd7cb0a7d
Merge pull request #12898 from aabadie/pr/cpu/dependencies_cleanup
cpu: move cpu level dependencies in dedicated Makefile.dep files
2020-01-28 17:57:02 +01:00
Sebastian Meiling
91cff05a15 doc: use @name for doxygen groups 2020-01-28 15:46:09 +01:00
Sebastian Meiling
2eae1952f7 doc: fix doxygen groups for atmega cpus 2020-01-28 15:44:29 +01:00
e969b2fcd5
cpu/atmega_common: move common dependencies 2020-01-28 13:20:53 +01:00
90e10d3009
cpu/atmega_common: move avr-libc-extra dependency to Makefile.dep 2020-01-28 13:20:52 +01:00
76b9cfb677
Merge pull request #12973 from fjmolinas/pr_atmega_tx_isr
cpu/atmega_common/periph/uart: use TX_ISR to check TX end
2020-01-15 11:51:22 +01:00
Francisco Molina
70c6df9330 cpu/atmega_common/periph/uart: use TX_ISR to check TX end
For atmega boards a TX has not actually completed until UDRn is empty
as well as the Transmit Shift Register.

To avoid resetting an UART before a TX has completed we use the TXCn
flash and ISR to set a variables that indicates TX is ongoing. This
allows not reseting the UART while there are ongoing TX pending.

This fixes an issue where part of the last byte is not shifted out
of the TX shift register causing rubish on the first TX following an
uart_init.
2020-01-15 10:02:40 +01:00
Marian Buschsieweke
3c7d95de02
cpu/atmega_common/periph: adc_sample() now returns int32_t 2020-01-10 14:13:13 +01:00
Marian Buschsieweke
3ecd303ed0
cpu/atmega_common/periph: Clean up PCINT support
- Using a enum instead of _COUNTER is easier to read
    - _COUNTER is also a reserved name; so better not use it to avoid issues
- Split out the pcint code into a static inline function for increased
  readability
2019-12-12 11:38:43 +01:00
Marian Buschsieweke
a45066551b
cpu/atmega_common/periph: Fixed bug in PCINT
The bank index and the pin number are not necessarily identical. For all
PCINT banks except for bank 3 bank_idx was used therefore. It was likely
just forgotten to update that for bank 3 as well.
2019-12-12 11:33:19 +01:00
chudov
efa9bb88a2 cpu/atmega256rfr2: symbol counter based RTT support 2019-12-05 22:53:05 +01:00
Matthew Blue
fb211c7c0c cpu/atmega_common: initial RTT support 2019-12-01 17:26:24 +01:00
Marian Buschsieweke
97f727349b
cpu/atmega_common: Fixed atmega_exit_isr
A context switch at the end of the ISR should only occur, if requested.
This fixes this.
2019-11-27 01:39:33 +01:00
41e29e3fda
Merge pull request #12790 from maribu/atmega_isr_thread
cpu/atmega_common
2019-11-24 11:10:10 +01:00
cc51f4ff7c cpu/atmega_common: fix typos 2019-11-23 22:39:35 +01:00
Francois Berder
4a31f94cfc many typo fixes
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-23 22:39:07 +01:00
Marian Buschsieweke
606d72f64b
cpu/atmega_common: Clean up & fix IRQ handling
At the end of an ISR, the ATmega code was doing an `thread_yield()` instead of
 a `thread_yield_higher()`. This resulted in tests/isr_yield_higher failing.
 Fixing this saves a few lines of code, some ROM, and solves the issue.
2019-11-23 11:57:11 +01:00
Marian Buschsieweke
2b1bee750a
cpu/atmega_common: Stop using reserved names
Names with two leading underscores are reserved in any context of the c
 standard, and thus must not be used. This ATmega platform used it however for
 defining internal stuff. This commit fixes this.
2019-11-23 11:56:11 +01:00
benpicco
09f647eee2
Merge pull request #12693 from maribu/neopixel-atmega
drivers: Added WS281x RGB LED driver for ATmega platform
2019-11-22 22:36:36 +01:00
Marian Buschsieweke
8d0a9ead7b
cpu/atmega_common/periph: Fixed typo in gpio.c 2019-11-18 22:45:40 +01:00
Yegor Yefremov
cf65070b06 doxygen/GPIO: don't include overridden typedefs
Add missing #ifndefs to overridden GPIO typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:33 +01:00
Yegor Yefremov
fa3b0ff04b doxygen/SPI: don't include overridden typedefs
Add missing #ifndefs to overridden SPI typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:32 +01:00
Marian Buschsieweke
ba26aed107
cpu/atmega_common: Restructured code
Moved macros and static inline helper functions needed to access ATmega GPIOs
to cpu/atmega_common/include/atmega_gpio.h in order to reuse them for the
platform specific low level part of the Neopixel driver.
2019-11-12 20:15:59 +01:00
Benjamin Valentin
3ce6ddcdb2 cpu/atmega_common: cpuid: add a word of warning
The CPU ID only differs in byte 4 (RC calibration) between devices.

Add a word of warning to the documentation that this may not be very unique.
2019-11-11 18:07:09 +01:00
Benjamin Valentin
5b6d56efd5 atmega_common: provide CPU ID for every device
ATmega128RFA1/ATmega256RFR2 do not have a unique CPU ID.

Use the RC oscillator callibration byte as an impromptu CPU ID and rely
on bootlader constants present on all ATmega families for the remaining
bytes.

This way we can provide a faux CPU ID on all ATmega MCUs and typical hobbyists
with no access to JTAG adapters or high voltage programmer capable of writing
the user signature have a good chance that the CPU IDs of their device do not collide.
2019-11-08 16:58:03 +01:00
d22404b8b7
cpu/atmega_common: add implementation for watchdog 2019-11-07 11:35:29 +01:00
Marian Buschsieweke
314184adb5
cpu: Platform specific C11 atomics compat headers
Added headers to define platform specific sizes and types for the C11 atomics
compatibility module for C++.
2019-10-24 23:08:36 +02:00
629003d042
cpu/atmega: cleanup dependencies handling 2019-10-18 12:40:34 +02:00
9c442a3547
cpu/atmega_common: provide gpio feature at cpu level 2019-10-17 21:42:07 +02:00
Benjamin Valentin
b1ef68abf7 cpu/atmega_common: move periph/cpuid.c to common code
Both atmega128rfa1 and atmega256rfr2 implement it.
2019-10-17 19:20:31 +02:00
Benjamin Valentin
7d78e32b15 cpu/atmega128rfa1: ATmega128rfa1 MCU support 2019-10-17 19:20:31 +02:00
ebf43616b7 cpu: add arch_* features 2019-10-13 21:03:41 +02:00
Kevin "Tristate Tom" Weiss
4b7c5915ec
Merge pull request #10953 from gschorcht/sys/shell/heap_cmd/pr
sys/shell: add heap command
2019-10-04 13:49:57 +02:00
Gunar Schorcht
02d81b717e
Merge pull request #12063 from maribu/i2c_release
drivers/periph/i2c: Updated i2c_release() to return void
2019-10-01 19:50:38 +02:00
Sebastian Meiling
1d24709674 cpu/atmega_common: adapt timer to return 0 on success
Adapt periph/timer implementation of atmega based MCUs
to return 0 on success for all functions.
2019-09-11 13:41:44 +02:00
Juan I Carrano
abc25f0715
Merge pull request #11452 from maribu/atmega_irq
cpu/atmega_common: Bugfixes in irq_arch.c
2019-09-10 13:39:53 +02:00
Francisco
6d800ed85a
Merge pull request #11366 from maribu/early_stdio_atmega
cpu/atmega_common: Moved atmega_stdio_init() to cpu_init()
2019-09-09 10:22:53 +03:00
Gunar Schorcht
4b009649c6 cpu/atmega_common: changes for common heap command 2019-09-05 09:20:55 +02:00
Gaëtan Harter
1be5b7b10b
cpu: do not locally export compilation variables
These are already exported by `makefiles/vars.inc.mk`.
It is a prerequisite to allow handling compilation without global exports.
2019-08-29 10:35:53 +02:00
Marian Buschsieweke
454d25ae68
cpu/atmega_common: Updated i2c_release() 2019-08-22 12:03:07 +02:00