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

321 Commits

Author SHA1 Message Date
Marian Buschsieweke
c2c2cc8592
drivers/periph_gpio: let gpio_read() return bool
Since https://github.com/RIOT-OS/RIOT/pull/20935 gpio_write()
uses a `bool` instead of an `int`. This does the same treatment for
`gpio_read()`.

This does indeed add an instruction to `gpio_read()` implementations.
However, users caring about an instruction more are better served with
`gpio_ll_read()` anyway. And `gpio_read() == 1` is often seen in
newcomer's code, which would now work as expected.
2024-10-23 13:24:09 +02:00
Benjamin Valentin
4627f66caa drivers/periph/gpio: make gpio_write() take a bool 2024-10-22 16:39:48 +02:00
Marian Buschsieweke
422042bd00
drivers/periph_gpio_ll_irq: make support for both edges optional
The assumption that every MCU has this feature turned out wrong. Hence,
add a feature to allow testing for support of edge triggered IRQs on
both flanks.
2024-08-02 13:41:36 +02:00
Marian Buschsieweke
36e8526046
drivers/periph_gpio_ll: change API to access GPIO ports
The API was based on the assumption that GPIO ports are mapped in memory
sanely, so that a `GPIO_PORT(num)` macro would work allow for constant
folding when `num` is known and still be efficient when it is not.

Some MCUs, however, will need a look up tables to efficiently translate
GPIO port numbers to the port's base address. This will prevent the use
of such a `GPIO_PORT(num)` macro in constant initializers.

As a result, we rather provide `GPIO_PORT_0`, `GPIO_PORT_1`, etc. macros
for each GPIO port present (regardless of MCU naming scheme), as well as
`GPIO_PORT_A`, `GPIO_PORT_B`, etc. macros if (and only if) the MCU port
naming scheme uses letters rather than numbers.

These can be defined as macros to the peripheral base address even when
those are randomly mapped into the address space. In addition, a C
function `gpio_port()` replaces the role of the `GPIO_PORT()` and
`gpio_port_num()` the `GPIO_PORT_NUM()` macro. Those functions will
still be implemented as efficient as possible and will allow constant
folding where it was formerly possible. Hence, there is no downside for
MCUs with sane peripheral memory mapping, but it is highly beneficial
for the crazy ones.

There are also two benefits for the non-crazy MCUs:
1. We can now test for valid port numbers with `#ifdef GPIO_PORT_<NUM>`
    - This directly benefits the test in `tests/periph/gpio_ll`, which
      can now provide a valid GPIO port for each and every board
    - Writing to invalid memory mapped I/O addresses was treated as
      triggering undefined behavior by the compiler and used as a
      optimization opportunity
2. We can now detect at compile time if the naming scheme of the MCU
   uses letters or numbers, and produce more user friendly output.
    - This is directly applied in the test app
2024-08-02 09:55:24 +02:00
MrKevinWeiss
e0fdc3c16c
*Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
Marian Buschsieweke
c011764022
cpu/atmega_common: implement gpio_ll_switch_dir 2024-02-05 10:56:16 +01:00
Marian Buschsieweke
f3bd3476ee
cpu/atmega_common: Make GPIO_DISCONNECT alias for GPIO_INPUT
Since on ATmega GPIOs cannot be disconnected and the reset state is
them being an input, this may help making code more portable.
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
bd3f54ac8f
drivers/periph_gpio_ll: Add features for compile-time-checks
This adds the features

 - periph_gpio_ll_input_pull_down:
        To indicate support for input mode with internal pull down
 - periph_gpio_ll_input_pull_keep:
        To indicate support for input mode with internal resistor
        pulling towards current level
 - periph_gpio_ll_input_pull_up:
        To indicate support for input mode with internal pull up
 - periph_gpio_ll_disconnect:
        To indicate a GPIO can be disconnected
 - periph_gpio_ll_open_drain:
        To indicate support for open drain mode
 - periph_gpio_ll_open_drain_pull_up:
        To indicate support for open drain mode with internal pull up
 - periph_gpio_ll_open_source:
        To indicate support for open source mode
 - periph_gpio_ll_open_source_pull_down:
        To indicate support for open source mode with internal pull down
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
922276296e
drivers/periph/gpio_ll: pass gpio_conf_t by value
Now that `gpio_conf_t` is on all implemented platforms no larger than
a register, we can more efficiently pass it by value rather than via
pointer.
2024-01-21 09:19:08 +01:00
Marian Buschsieweke
2a00ec13e5
drivers/periph/gpio_ll: shrink gpio_conf_t
This commit optimizes the `gpio_conf_t` type in the following
regards:

- The "base" `gpio_conf_t` is stripped from members that only some
  platforms support, e.g. drive strength, slew rate, and disabling of
  the Schmitt Trigger are no longer universally available but
  platform-specific extensions
- The `gpio_conf_t` is now crammed into a bit-field that is 8 bit or
  16 bit wide. This allows for storing lots of them e.g. in
  `driver_foo_params_t` or `uart_conf_t` etc.
- A `union` of the `struct` with bit-field members and a `bits` is used
  to allow accessing all bits in a simple C statement and to ensure
  alignment for efficient handling of the type

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2024-01-21 08:38:40 +01:00
Marian Buschsieweke
e78630fc40
cpu/atmega_common: implement periph_timer_query_freqs 2023-12-07 16:15:22 +01:00
Gerson Fernando Budke
c64a64f549
cpu/atmega_common: Increase stack a little bit
This is necessary to allow run the thread_duel example.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
9dfdedcaf7
cpu/atmega_common: Add PM on peripherals
Add PM blocks to adc/i2c/spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +01:00
Benjamin Valentin
fd6486b19b cpu/atmega_common: hook up BAT LOW irq to power bus 2023-07-12 14:52:05 +02:00
Hugues Larrive
064c799e57 cpu/atmega_common: some additional periph drivers fixed for atmega8 cpu
- periph/eeprom.c
- periph/wdt.c
- periph/gpio_ll_irq.c

removed unsupported cpuid and dpgpin feature for atmega8 cpu familly

pkg/qdsa: bump the commit hash bump the commit hash after RIOT-OS/qDSA#4
was merged
2023-07-11 21:22:02 +02:00
Gerson Fernando Budke
f87cb3fc36 cpu: atmega_common: rtt: Fix vera warnings
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 20:00:19 +02:00
Gerson Fernando Budke
783afbc666 cpu/avr8_common: Add AVR8_ISR macro
The current ISR implementation for AVR8 requires use of
avr8_[enter/exit]_isr pair which add some boilerplate on code.
This add AVR8_ISR which clean-up the code and make it simpler
and hides any schedule detail from the user perspective.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 20:00:19 +02:00
Gerson Fernando Budke
b7873015aa cpu/avr8_common: Split avr8_state
The avr8_state store state information used to determine scheduling
and uart irq. This move all uart irq states to avr8_state_uart
variable. It introduce the use of General Purpose IO Register 0
(GPIOR0) when available and now all uarts from xmega can be used.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 19:01:13 +02:00
bors[bot]
9d596734a1
Merge #19752
19752: cpu/atmega_common: checking features instead of CPU models r=benpicco a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

This one probably need to be tested on others cpu.
### Tests on 1284p:
#### tests/periph/adc
```
tests/periph/adc$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  10712	    304	   1021	  12037	   2f05	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/bin/atmega1284p/tests_adc.elf
avrdude: 11016 bytes of flash written
avrdude: 11016 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:44:54,846 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:44:55,848 # 

2023-06-22 18:44:55,848 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:44:55,848 # 
2023-06-22 18:44:55,849 # RIOT ADC peripheral driver test
2023-06-22 18:44:55,849 # 
2023-06-22 18:44:55,850 # This test will sample all available ADC lines once every 100ms with
2023-06-22 18:44:55,850 # a 10-bit resolution and print the sampled results to STDIO
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(0)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(1)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(2)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(3)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(4)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(5)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(6)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(7)
2023-06-22 18:44:55,853 # ADC_LINE(0): 796
2023-06-22 18:44:55,854 # ADC_LINE(1): 599
2023-06-22 18:44:55,854 # ADC_LINE(2): 522
2023-06-22 18:44:55,854 # ADC_LINE(3): 485
2023-06-22 18:44:55,854 # ADC_LINE(4): 466
2023-06-22 18:44:55,854 # ADC_LINE(5): 466
2023-06-22 18:44:55,854 # ADC_LINE(6): 478
2023-06-22 18:44:55,855 # ADC_LINE(7): 501
2023-06-22 18:44:55,855 #  Exiting Pyterm
make: *** [/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/../../../Makefile.include:879: term] Interrompre
```
#### tests/periph/gpio
```
tests/periph/gpio$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  17828	   2112	   1095	  21035	   522b	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/gpio/bin/atmega1284p/tests_gpio.elf
avrdude: 19940 bytes of flash written
avrdude: 19940 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:46:50,726 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:46:51,734 # This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:46:51,734 # GPIO peripheral driver test
2023-06-22 18:46:51,734 # 
2023-06-22 18:46:51,735 # In this test, pins are specified by integer port and pin numbers.
2023-06-22 18:46:51,735 # So if your platform has a pin PA01, it will be port=0 and pin=1,
2023-06-22 18:46:51,736 # PC14 would be port=2 and pin=14 etc.
2023-06-22 18:46:51,736 # 
2023-06-22 18:46:51,736 # NOTE: make sure the values you use exist on your platform! The
2023-06-22 18:46:51,738 #       behavior for not existing ports/pins is not defined!
init_out 1 5
2023-06-22 18:47:50,380 # init_out 1 5
toggle 1 5
2023-06-22 18:48:09,425 # toggle 1 5
> toggle 1 5
2023-06-22 18:48:12,477 # toggle 1 5
> 2023-06-22 18:48:15,013 # Exiting Pyterm
```
#### tests/periph/i2c
```
tests/periph/i2c$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  18634	   1288	   1215	  21137	   5291	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/i2c/bin/atmega1284p/tests_i2c.elf
avrdude: 19922 bytes of flash written
avrdude: 19922 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:50:37,434 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:50:38,437 # 
2023-06-22 18:50:38,438 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:50:38,438 # Start: Test for the low-level I2C driver
> i2c_scan 0
2023-06-22 18:51:37,661 # i2c_scan 0
2023-06-22 18:51:37,687 # Scanning I2C device 0...
2023-06-22 18:51:37,765 # addr not ack'ed = "-", addr ack'ed = "X", addr reserved = "R", error = "E"
2023-06-22 18:51:37,804 #      0 1 2 3 4 5 6 7 8 9 a b c d e f
2023-06-22 18:51:37,842 # 0x00 R R R R R R R R R R R R R R - -
2023-06-22 18:51:37,881 # 0x10 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,919 # 0x20 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,958 # 0x30 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,996 # 0x40 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,035 # 0x50 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,073 # 0x60 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,112 # 0x70 - - - - - - - - R R R R R R R R
> 2023-06-22 18:52:54,462 # Exiting Pyterm
```
#### tests/periph/pwm
```
tests/periph/pwm$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15382	    896	   1093	  17371	   43db	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/pwm/bin/atmega1284p/tests_pwm.elf
avrdude: 16278 bytes of flash written
avrdude: 16278 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:54:32,308 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:54:33,310 # 
2023-06-22 18:54:33,312 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:54:33,312 # PWM peripheral driver test
2023-06-22 18:54:33,313 # 
> osci
2023-06-22 18:54:39,105 # osci
2023-06-22 18:54:39,106 # 
2023-06-22 18:54:39,121 # RIOT PWM test
2023-06-22 18:54:39,177 # Connect an LED or scope to PWM pins to see something.
2023-06-22 18:54:39,178 # 
2023-06-22 18:54:39,216 # Available PWM device between 0 and 1
2023-06-22 18:54:39,244 # Initialized PWM_0 @ 488Hz.
2023-06-22 18:54:39,273 # Initialized PWM_1 @ 976Hz.
2023-06-22 18:54:39,274 # 
2023-06-22 18:54:39,313 # Letting the PWM pins oscillate now...
2023-06-22 18:54:45,655 # Exiting Pyterm
```
#### tests/periph/spi
```
tests/periph/spi$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  19240	   1402	   2317	  22959	   59af	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/spi/bin/atmega1284p/tests_spi.elf
avrdude: 20642 bytes of flash written
avrdude: 20642 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:58:12,394 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:58:13,396 # 
2023-06-22 18:58:13,398 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:58:13,398 # Manual SPI peripheral driver test (see README.md)
2023-06-22 18:58:13,399 # There are 1 SPI devices configured for your platform.
init 0 0 4
2023-06-22 18:58:32,086 # init 0 0 4
2023-06-22 18:58:32,161 # Trying to initialize SPI_DEV(0): mode: 0, clk: 4, cs_port: 0, cs_pin: 0
2023-06-22 18:58:32,270 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-06-22 18:58:32,280 # Success.
bench
2023-06-22 18:58:41,590 # bench
2023-06-22 18:58:41,644 # ### Running some benchmarks, all values in [us] ###
2023-06-22 18:58:41,682 # ### Test				Transfer time	user time
2023-06-22 18:58:41,683 # 
2023-06-22 18:58:41,755 #  1 - write 1000 times 1 byte:			28456	28640
2023-06-22 18:58:41,827 #  2 - write 1000 times 2 byte:			28184	28352
2023-06-22 18:58:42,454 #  3 - write 1000 times 100 byte:		579528	579704
2023-06-22 18:58:42,563 #  4 - write 1000 times 1 byte to register:	54080	54256
2023-06-22 18:58:42,674 #  5 - write 1000 times 2 byte to register:	56720	56888
2023-06-22 18:58:43,340 #  6 - write 1000 times 100 byte to register:	608152	608320
2023-06-22 18:58:43,412 #  7 - read 1000 times 2 byte:			28304	28480
2023-06-22 18:58:44,025 #  8 - read 1000 times 100 byte:		567408	567576
2023-06-22 18:58:44,138 #  9 - read 1000 times 2 byte from register:	56840	57016
2023-06-22 18:58:44,793 # 10 - read 1000 times 100 byte from register:	596024	596200
2023-06-22 18:58:44,868 # 11 - transfer 1000 times 2 byte:		28336	28512
2023-06-22 18:58:45,510 # 12 - transfer 1000 times 100 byte:		592128	592304
2023-06-22 18:58:45,625 # 13 - transfer 1000 times 2 byte to register:	56960	57136
2023-06-22 18:58:46,306 # 14 - transfer 1000 times 100 byte to register:620744	620920
2023-06-22 18:58:46,373 # 15 - acquire/release 1000 times:		20960	21136
2023-06-22 18:58:46,879 # -- - SUM:					3922824	3925440
2023-06-22 18:58:46,880 # 
2023-06-22 18:58:46,907 # ### All runs complete ###
> 2023-06-22 18:58:54,706 # Exiting Pyterm
```
I always wonder how fast it really goes:
- #16727
- #18374
#### tests/periph/timer
```
tests/periph/timer$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
   8968	    274	   1032	  10274	   2822	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/timer/bin/atmega1284p/tests_timer.elf
avrdude: 9242 bytes of flash written
avrdude: 9242 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:00:15,136 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:00:16,138 # 
2023-06-22 19:00:16,139 # Help: Press s to start test, r to print it is ready
s
2023-06-22 19:00:31,118 # START
2023-06-22 19:00:31,200 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:00:31,201 # 
2023-06-22 19:00:31,230 # Test for peripheral TIMERs
2023-06-22 19:00:31,231 # 
2023-06-22 19:00:31,251 # Available timers: 2
2023-06-22 19:00:31,252 # 
2023-06-22 19:00:31,270 # Testing TIMER_0:
2023-06-22 19:00:31,306 # TIMER_0: initialization successful
2023-06-22 19:00:31,324 # TIMER_0: stopped
2023-06-22 19:00:31,356 # TIMER_0: set channel 0 to 5000
2023-06-22 19:00:31,390 # TIMER_0: set channel 1 to 10000
2023-06-22 19:00:31,408 # TIMER_0: starting
2023-06-22 19:00:31,482 # TIMER_0: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,547 # TIMER_0: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,551 # 
2023-06-22 19:00:31,568 # Testing TIMER_1:
2023-06-22 19:00:31,605 # TIMER_1: initialization successful
2023-06-22 19:00:31,622 # TIMER_1: stopped
2023-06-22 19:00:31,655 # TIMER_1: set channel 0 to 5000
2023-06-22 19:00:31,688 # TIMER_1: set channel 1 to 10000
2023-06-22 19:00:31,707 # TIMER_1: starting
2023-06-22 19:00:31,780 # TIMER_1: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,846 # TIMER_1: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,849 # 
2023-06-22 19:00:31,864 # TEST SUCCEEDED
2023-06-22 19:00:31,939 # { "threads": [{ "name": "idle", "stack_size": 128, "stack_used": 86 }]}
2023-06-22 19:00:32,015 # { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 120 }]}
2023-06-22 19:00:34,259 # Exiting Pyterm
```
#### tests/periph/uart
```
tests/periph/uart$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15918	   1044	   2000	  18962	   4a12	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/uart/bin/atmega1284p/tests_uart.elf
avrdude: 16962 bytes of flash written
avrdude: 16962 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:01:25,894 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:01:26,896 # 
2023-06-22 19:01:26,898 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:01:26,898 # 
2023-06-22 19:01:26,899 # Manual UART driver test application
2023-06-22 19:01:26,899 # ===================================
2023-06-22 19:01:26,900 # This application is intended for testing additional UART
2023-06-22 19:01:26,900 # interfaces, that might be defined for a board. The 'primary' UART
2023-06-22 19:01:26,901 # interface is tested implicitly, as it is running the shell...
2023-06-22 19:01:26,901 # 
2023-06-22 19:01:26,902 # When receiving data on one of the additional UART interfaces, this
2023-06-22 19:01:26,902 # data will be outputted via STDIO. So the easiest way to test an 
2023-06-22 19:01:26,903 # UART interface, is to simply connect the RX with the TX pin. Then 
2023-06-22 19:01:26,904 # you can send data on that interface and you should see the data 
2023-06-22 19:01:26,904 # being printed to STDOUT
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,904 # NOTE: all strings need to be '\n' terminated!
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,909 # UARD_DEV(0): test uart_poweron() and uart_poweroff()  ->  [OK]
2023-06-22 19:01:26,910 # 
2023-06-22 19:01:26,921 # UART INFO:
2023-06-22 19:01:26,958 # Available devices:               2
2023-06-22 19:01:27,004 # UART used for STDIO (the shell): UART_DEV(0)
2023-06-22 19:01:27,006 # 
init 1 9600
2023-06-22 19:01:50,464 # init 1 9600
send 1 ping
2023-06-22 19:04:12,912 # send 1 ping
2023-06-22 19:04:12,934 # UART_DEV(1) TX: ping
> 2023-06-22 19:04:12,973 # Success: UART_DEV(1) RX: [ping]\n
2023-06-22 19:04:23,894 # Exiting Pyterm
````

### Issues/PRs references

Depends on PR:
- #19751


Co-authored-by: Hugues Larrive <hlarrive@pm.me>
2023-07-04 22:12:54 +00:00
Hugues Larrive
6336672c08 cpu/atmega_common: checking features instead of CPU models 2023-07-04 23:17:21 +02:00
Marian Buschsieweke
87e3a611fe
cpu/atmega_common: make vera++ happy
Vera++ doesn't like `#error` preprocessor directives without a quoted
string afterwards (and also my syntax highlighter doesn't like this as
well). So let's add the quotes to have the tools not spooked out.
2023-06-29 22:27:59 +02:00
chudov
c52f6e71c2 drivers/at86rf2xx: rx timestamp generation for ATmegaRFR2
Signed-off-by: chudov <chudov@gmail.com>
2023-05-19 15:33:15 +02:00
Marian Buschsieweke
4e3c0777fc
sys/flash_utils: add helpers for placing variables in flash
This adds a layer of convenience abstraction over classical Harvard
architectures (like most AVRs) that do not map the flash memory into
the data address space and modern Harvard architectures or von-Neumann
architectures that do so. The motivation is to safe a lot of RAM for
AVR by storing constant strings into flash.
2023-02-27 12:31:03 +01:00
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
benpicco
a1ee44e114
Merge pull request #18263 from maribu/cpu/avr8/idle_stack
cpu/{atmega_common,atxmega}: increase idle thread stack size
2022-06-29 00:57:57 +02:00
Marian Buschsieweke
b72cafb169
cpu/atmega_common: Fix atmega_port_addr()
In 04ab5a74f3 a bug was introduced in
the calculation of the GPIO port address by refactoring code. This
fixes the issue by extracting the GPIO port first from the pin.
2022-06-27 22:15:52 +02:00
Marian Buschsieweke
8cc0199437
cpu/{atmega_common,atxmega}: increase idle thread stack size
Our AVR port doesn't make use of an ISR stack and just victimizes the
stack of whatever thread happens to be running, which in most cases is
the idle thread. Hence, the idle stack has to be large enough to
support the ztimer ISR.
2022-06-27 14:39:57 +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
b7e9d4fad2 cpu/atmega_common: also enlarge idle stack for ztimer64 2021-12-08 13:49:25 +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
845681448d
cpu/atmega_common: move PCINT documentation from boards 2021-11-22 12:25:57 +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
Marian Buschsieweke
35a1b60068
cpu/{atxmega,atmega_common}: fix invalid use of PSTR()
core_panic() doesn't expect the message to be in program memory, but
in data memory. Bad things will happen on AVR when the address is
interpreted as being in data address space, but the allocation is
done in program address space.
2021-09-30 17:15:39 +02: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
Benjamin Valentin
87f7e5a963 cpu/atmega_common: move clock init to common code
This code should not be in the realm of the board config, but in
common arch code.
2021-08-27 17:06:50 +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
Benjamin Valentin
d47a880915 cpu: add periph_rtt_overflow feature
The RTT overflow callback is not available on all RTT implementations.
This means it is either a no-op or `rtt_set_overflow_cb()` is a no-op
or it will overwrite the alarm set with `rtt_set_alarm()`.

This adds a feature to indicate that proper overflow reporting is available.
2021-04-30 11:58:00 +02:00