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

129 Commits

Author SHA1 Message Date
Marian Buschsieweke
e5d0f83696
cpu/atmega_common: store periph_timer prescalers in flash 2023-02-27 12:06:30 +01:00
Marian Buschsieweke
86fdbd7054
core/lib: Add macros/utils.h header
The macros CONCAT(), MIN(), and MAX() are defined over and over again in
RIOT's code base. This de-duplicates the code by moving the macros to a
common place.
2023-01-07 09:47:44 +01:00
Marian Buschsieweke
787884aa95
cpu/atmega_common/periph_timer: fix spurious IRQs 2022-11-25 14:46:16 +01:00
Benjamin Valentin
7abaae7bbd treewide: fix typos 2022-09-15 12:12:23 +02:00
Marian Buschsieweke
bae91c1660
Merge pull request #17723 from benpicco/periph_timer_periodic-set_stopped
drivers/periph/timer: add TIM_FLAG_SET_STOPPED flag
2022-05-03 12:06:37 +02:00
Marian Buschsieweke
04ab5a74f3
cpu/atmega_common: implement periph/gpio_ll{,_irq}
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2022-05-02 14:44:55 +02:00
Benjamin Valentin
4540e490e3 cpu/atmega_common: timer: implement TIM_FLAG_SET_STOPPED 2022-04-28 13:27:59 +02:00
Niels Gandraß
41e8a57960
cpu/atmega_common: Remember CTC mode with timer_periodic 2021-12-13 12:08:38 +01:00
Gunar Schorcht
007e29ebb5 cpu/periph/i2c: update implementations to new I2C API
Make all `spi_acquire` implementations return `void` and add assertions to check for valid device identifier where missing.
2021-11-29 06:35:25 +01:00
Leandro Lanzieri
b8e2e3ce66
cpu/atmega_common: model Kconfig 2021-11-22 12:25:29 +01:00
Marian Buschsieweke
d91c9cdc5a
cpu/atmega_common: make cppcheck happy 2021-11-16 16:20:26 +01:00
Francisco
a1cbcc9ede
Merge pull request #15902 from maribu/spi-api-change-1
drivers/periph_spi: let spi_acquire return void
2021-09-02 08:50:56 +02:00
Marian Buschsieweke
f04b522601
cpu/periph_spi: update implementations to new API
Make all spi_acquire() implementations return `void` and add assertions to
check for valid parameters, where missing.
2021-09-01 21:38:40 +02:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
benpicco
619a444741
Merge pull request #16347 from benpicco/drivers/rtt_rtc-rtc_get_time_ms
drivers/rtt_rtc: implement rtc_get_time_ms()
2021-05-05 19:13:21 +02:00
Benjamin Valentin
7c1b5630d2 cpu/atmega_common: RTC: implement rtc_get_time_ms() 2021-05-04 23:17:05 +02:00
Benjamin Valentin
5ea85ca433 cpu/atmega_common: RTC: get rid of isr_flag 2021-05-04 23:14:35 +02:00
Benjamin Valentin
2d706b3295 cpu/atmega_common: RTC: fix off-by-one normalisation 2021-05-04 17:56:13 +02:00
Gerson Fernando Budke
1426e15679 cpu/avr8_common: Normalize method prefix name
Refactor atmega_ prefix to avr8_ prefix and update copyrights.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-01-07 16:29:42 -03:00
Marian Buschsieweke
125c892c03
drivers/periph/timer: Use uint32_t for frequency
For all currently supported platforms `unsigned long` is 32 bit in width. But
better use `uint32_t` to be safe.
2020-10-30 22:02:12 +01:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Bas Stottelaar
fb61443bbd cpu/*: remove unused assert.h include 2020-10-22 11:13:09 +02:00
Bas Stottelaar
ab6188cea3 cpu/*: add missing include of assert.h 2020-10-22 11:13:08 +02:00
Benjamin Valentin
96273b4df0 cpu/atmega_common: use TIMER_CHANNEL_NUMOF 2020-06-24 00:45:35 +02:00
benpicco
49aef1b678
Merge pull request #13902 from benpicco/periph_timer_periodic
periph/timer: add timer_set_periodic()
2020-05-28 18:03:32 +02:00
Benjamin Valentin
c000a77658 cpu/atmega_common: implement timer_set_periodic() 2020-05-28 17:37:42 +02:00
benpicco
2183fb9273
Merge pull request #14155 from maribu/atmega_timer_cleanup
cpu/atmega*: Clean up timer configs
2020-05-28 17:33:31 +02:00
Marian Buschsieweke
fb722b1be7
cpu/atmega_common/periph_timer: Fix style 2020-05-28 16:27:08 +02:00
Marian Buschsieweke
99bd1c318c
cpu/atmega_common/periph_timer: Add timer_set
Added a low level implementation of timer_set() that allows setting relative
timeouts as short as 0. This results in tests/periph_timer_short_relative_set
no passing.
2020-05-28 11:46:02 +02:00
Marian Buschsieweke
067a9c38ae
cpu/atmega_common: Fix race in periph_timer
As AVR is an 8 bit platform, special care needs to be taken when accessing 16
bit registers in an atomic fashion. This commit as just this care.
2020-05-18 21:22:31 +02:00
benpicco
cc44992abe
Merge pull request #12827 from maribu/atmega_pwm
cpu/atmega_common/periph/pwm: Minor fix & cleanup
2020-05-16 22:26:58 +02:00
Marian Buschsieweke
506288791d
cpu/atmega_common/periph/pwm: Minor fix & cleanup
- On pwm_poweron, the PWM resolution was not restored. (A custom resolution was
  only usable if, PWM channel 0 is not used. That configuration is not common,
  so this bug was likely never triggered)
- Disabled a work around to prevent flickering:
    - Previously, PWM was disconnected on level 0% and 100%
    - This increases the run time of `pwm_set()`
    - It prevents using the PWM for wave form generation via DDS, as the wave
      noticeably jumps when reaching 0% or 100%
- Slightly reduces memory requirements: 2 Bytes of RAM, 112 Bytes of ROM
    - Tested with avr-gcc 9.2.0 and LTO enabled
2020-05-16 20:43:31 +02:00
Marian Buschsieweke
4d1a5b9256
cpu/atmega_common: Drop legacy include
Drop `#include "irq.h"` in `cpu.h`, which was there for a legacy work around.
A bunch of missing includes of `irq.h` materialized due to this and were
fixed.
2020-05-15 11:24:28 +02: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
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
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
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
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
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