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

4270 Commits

Author SHA1 Message Date
Gunar Schorcht
a5a08f0d63 drivers/touch_dev: add a function to get the maximum number of touches 2023-08-14 18:26:08 +02:00
Gunar Schorcht
09f07262f4 drivers/touch_dev: define invalid touch position 2023-08-14 18:26:08 +02:00
Gunar Schorcht
b921bf460b drivers/stmpe811: init INT pin only if callback is defined
If the INT pin is initialized if the callback function parameter `cb` is `NULL`, the driver crashes the first time an interrupt is triggered. Therefore, the INT pin must be initialized only if also the callback function parameter `cb` is not `NULL`.

Even if the interrupt pin is not initialized here because the callback function parameter `cb` is NULL, the device interrupts are configured here so that they will work when the interrupt pin is initialized later, as is the case when the Touch Device API is used, for example. Since the interrupt state is cleared on each read, this is not a problem even if the interrupt pin is not used at all.
2023-08-13 17:11:54 +02:00
Gunar Schorcht
00275326a8 drivers/mtd: add SDMMC support 2023-08-08 09:09:12 +02:00
Gunar Schorcht
556ef5235c drivers: add periph_sdmmc support 2023-08-08 09:09:12 +02:00
Gunar Schorcht
12f441ff74 drivers/st7735: remove buggy initialization, use reset defaults
Instead of using a wrong intialization command sequence for power and frame control, default values after reset are used.
2023-08-08 06:44:59 +02:00
Gunar Schorcht
d5a8ec9ae0 drivers/lcd: fix command index 2023-08-08 06:44:59 +02:00
Gunar Schorcht
0df9480126 drivers/fx5x06: fix vendor ID for FT6xx6
The vendor ID of FT6xx6 touch panel driver ICs is `0x11` instead of `0xcd`.
2023-08-06 16:09:40 +02:00
Gunar Schorcht
37472d54c3 cpu/stm32/periph: add FMC support 2023-07-26 09:02:10 +02:00
LP-HAW
61857d11ca drivers/enc28j60: disable flow control 2023-07-22 21:44:02 +02:00
Marian Buschsieweke
0337d08bcc
drivers/vl6180x: fix compilation with clang
Some of the `static inline` functions are only used in some
configurations, depending on the preprocessor. Explicitly disable the
warning to allow compilation with clang.
2023-07-18 12:24:08 +02:00
Marian Buschsieweke
510c6fd84e
drivers/dht: fix compilation with LLVM 2023-07-18 12:24:08 +02:00
bors[bot]
ae2118cbf6
Merge #19816
19816: drivers/lcd: code deduplication for st7735 and ili9341 r=aabadie a=gschorcht

### Contribution description

In preparation for the parallel interface support the following changes were made:

1. The code for basic communication (acquire/release SPI device, SPI transfers), which were always duplicated by copy & paste in each display driver again and again, has been moved to the LCD driver as low-level functions that are now used by the display drivers. These low level function allow 
- code deduplication and
- to define a more abstract communication interface that can then be extended later by parallel communication interface
2. Identical GPIO initializations has also been moved from display drivers to the LCD driver.
3. Using a default implementation of `lcd_set_area` function allows further code deduplication.

Finally, the `ili9341` and `st7735` drivers only implement the inialization sequence for the LCD driver IC.

### Testing procedure

`tests/drivers/ili9341` should still work for a board with an ILI9341. Tested with `esp32-wrover-kit`.
`tests/drivers/st7735` should still work for a board with a ST77xx. Tested with `esp32s3-usb-otg`.

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-07-12 14:08:56 +00:00
Gunar Schorcht
5cb51b17a3 driver/lcd: use a default implementation of lcd_set_area used
Using a default implementation of `lcd_set_area` function allows further code deduplication.
2023-07-12 15:31:29 +02:00
Gunar Schorcht
878af4f9a1 drivers/st7735: move basic communication functions to drivers/lcd 2023-07-12 15:31:29 +02:00
Gunar Schorcht
c51496fe2e drivers/ili9341: move basic communication functions to drivers/lcd 2023-07-12 15:31:29 +02:00
Gunar Schorcht
3f8ba798cb drivers/lcd: move basic communication functions to drivers/lcd
In preparation for the parallel interface support the following changes were made:

1. The code for basic communication (acquire/release SPI device, SPI transfers), which were always implemented identically in the individual display drivers again and again, have been moved to the LCD driver as low-level functions and are now used by the display drivers. These low level function allow 
- code deduplication on one hand and 
- to define a more abstract communication interface on the other hand that can then be extended by parallel communication
2. Identical GPIO initialization has  also been moved from display drivers to the LCD driver.
2023-07-12 15:31:29 +02:00
Gunar Schorcht
b30401a1c2 drivers/st7735: fix Kconfig logic for ST7789
MODULE_ST7789 is enabled if MODULE_ST7735 is enabled and the board has selected HAVE_ST7789.
2023-07-12 15:31:29 +02:00
bors[bot]
1b8ad7cffc
Merge #19777
19777: cpu/avr8_common: Prepare for rework ISR r=benpicco a=nandojve

### Contribution description

This prepares for rework how ISR is handled for AVR-8 platform. It is not expected changes on the behavior but tests on other boards were welcome to avoid regressions.

#### Improvements
 * Split UART state from ISR states. Now it is necessary two variables and GPIORx registers are automatically selected when available.
 * UART states now supports up to 8 UARTs.
 * Added AVR8_ISR macro do clean-up and hide internals related to ISR processing. This allows changes on ISR without any other changes on drivers.

### Testing procedure

Tests were conducted using atmega328p-xplained-mini and atxmega-a1u-xpro and the zigduino board was only built. The example thread_duel was used to test regressions.

Co-authored-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-11 10:39:11 +00:00
bors[bot]
37c6233bcb
Merge #19764 #19781
19764: drivers/shield_w5100: add module for the W5100 Ethernet Shield r=benpicco a=maribu

### Contribution description

This module provides no more than the correct configuration parameters for the `w5100` driver using the Arduino I/O mapping features. But by doing so, it will work out of the box with every mechanically and electrically compatible board for which the Arduino I/O mapping features are implemented.


19781: cpu/nrf{53,9160}: add pwm support r=benpicco a=dylad

### Contribution description

This PR moves the nRF52 PWM driver to `cpu/nrf5x_common` to allow nRF9160 and nRF53 to use this driver.
IP is identical on these families.

I didn't test on nRF9160DK and I didn't test if there is any regression on nRF52-based board as I don't have any so tests are welcome !
However it works fine on nRF53-based board.


### Testing procedure

Flash the `tests/periph/pwm` test application on `nrf5340dk` or `nrf9160dk`.
You can then use the `osci` command to make the onboard LEDs "breath".
You can also attach an oscilloscope and/or logic analyzer to watch the signal.


### Issues/PRs references
~~Based on #19769~~

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Co-authored-by: dylad <dylan.laduranty@mesotic.com>
2023-07-10 10:51:20 +00:00
Marian Buschsieweke
ca07f77f48
drivers/st7735: fix inconsistency in dependency modeling
In KConfig `MODULE_ST7789` now is hidden module that automatically
gets selected when `HAVE_ST7789` is selected in `MODULE_ST7735` is used.

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-07-09 14:15:25 +02:00
dylad
ef9dca0108 drivers/servo: update build dependencies for Nordic families
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2023-07-08 17:19:57 +02:00
Marian Buschsieweke
f1ab3b1ea6
drivers/shield_w5100: add module for the W5100 Ethernet Shield
This module provides no more than the correct configuration parameters
for the `w5100` driver using the Arduino I/O mapping features. But
by doing so, it will work out of the box with every mechanically and
electrically compatible board for which the Arduino I/O mapping
features are implemented.
2023-07-08 08:36:41 +02:00
Gunar Schorcht
f57b6b70b8 drivers/st7735: support for ST7789
ST7735 driver can also be used for ST7789. st7789 is simply defined as pseudomodule that pulls in automatically module st7735.
2023-07-07 08:17:12 +02:00
Gerson Fernando Budke
1e237305ea drivers: at86rf2xx: at86rf2xx_netdev: 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
Gunar Schorcht
34ba3a22c8 drivers/usbdev_synopsys_dwc2: set V_DDUSB for U5 2023-07-05 09:39:13 +02:00
Gunar Schorcht
b69165cde8 drivers/usbdev_synopsys_dwc2: fix disabling of V_BUS sensing 2023-07-05 09:33:53 +02:00
Gunar Schorcht
db52e5fa62 drivers/usbdev_synopsys_dwc2: comments improved 2023-07-05 09:29:48 +02:00
Marian Buschsieweke
043e8cc88e
boards,sys/arduino: major clean up
- Rename all `arduino_pinmap.h` to `arduino_iomap.h`
    - An empty `arduino_pinmap.h` that just includes `arduino_iomap.h`
      is provided for backward compatibility
    - Move all info from `arduino_board.h` into the new file as trivial
      macros, so that they can also be used outside of sketches
    - The new name reflects the fact not just pin mappings, but also
      other I/O features such as PWMs are mapped
- Drop all `arduino_board.h`
    - `arduino_board.h` and `arduino_iomap.h` now provide the exact
      same information, just in a different format
    - a generic `arduino_board.h` is provided instead that just
      uses the info in `arduinio_iomap.h` and provides them in the
      format the code in `sys/arduino` expects it
- Add fine grained features to indicate for mappings
    - availability of mappings for analog pins, DAC pins, PWM pins,
      UART devices, SPI/I2C buses to the corresponding RIOT
      identification can now be expressed:
        - `arduino_pins`: `ARDUINO_PIN_0` etc. are available
        - `arduino_analog`: `ARDUINO_A0` etc. are available
        - `arduino_pwm`: `ARDUINO_PIN_13_PWM_DEV` etc. are available
        - `arduino_dac`: `ARDUINO_DAC0` etc. are available
        - `arduino_uart`: `ARDUINO_UART_D0D1` or similar are available
        - `arduino_spi`: `ARDUINO_SPI_ISP` or similar are available
        - `arduino_i2c`: `ARDUINO_I2C_UNO` or similar are available
    - mechanical/electrical compatibility with specific form factors
      can now be expressed as features:
        - `aruino_shield_nano`: Arduino NANO compatible headers
        - `aruino_shield_uno`: Arduino UNO compatible headers
        - `aruino_shield_mega`: Arduino MEGA compatible headers
        - `aruino_shield_isp`: ISP header is available

This provides the groundwork to implement shield support as modules
that can rely on the I/O mappings, rather than having to provide a
configuration per board.
2023-06-26 17:24:07 +02:00
bors[bot]
561e19303d
Merge #19718 #19737 #19746
19718: drivers/dht: busy wait reimplementation r=benpicco a=hugueslarrive

### Contribution description

In PR #19674, I also provided quick and dirty fixes to restore functionality on esp8266 and enable operation on AVR. While reviewing PR #18591, it became apparent to me that this driver needed a refresh, particularly its migration to ztimer.

The cause of the malfunction on esp8266 was that since the default switch to ztimer as the backend for xtimer, XTIMER_BACKOFF was no longer taken into account. Therefore, the correction I provided in PR #19674 simply made explicit what was previously done implicitly with xtimer and now needs to be done explicitly with ztimer (spinning instead of sleeping).

Moreover, it was unnecessarily complex to measure the pulse duration in a busy-wait implementation, which required 2 calls to ztimer_now() and  32-bit operations expensive on 8-bit architecture. Instead, it is sufficient to read the state of the bus at the threshold moment.

Finally, in practice, it is possible to reduce the read interval (down to less than 0.5s for DHT22) by "harassing" the DHT with start signals until it responds.

This re-implementation brings the following improvements:
- Many backports from `@maribu's` IRQ based implementation (#18591):
  - Use of ztimer
  - Use of errno.h
  - Use of a dht_data structure to pass arguments, to facilitate integration
  - Adaptation of the bit parsing technique to parse bits into the data array
- Reintroduction of DHT11/DHT22 differentiation.
- Separation of `dht_read()` steps into functions for better readability and the ability to share certain functions among different implementations
- Sensor presence check in `dht_init()`
- ~~Automatic adjustment to a minimum data hold time~~
- Default input mode changed to open drain (a pull-up resistor should be placed close to the output if necessary but not close to the input)
- AVR support without platform-specific handling by avoiding  ztimer_spin() and using the overflow of an 8-bit variable as a pre-timeout to minimize time-consuming ztimer_now() calls

Regarding the changes in the start signal sequence and the removal of the `_reset()` function:
![nano_dht_read_2](https://github.com/RIOT-OS/RIOT/assets/67432403/95966813-2b5f-4a0f-a388-8ac630526ab2)

~~In the previous implementation, there was an unnecessary spike at the beginning of the signal sequence, corresponding to START_HIGH_TIME. This spike has been removed in the re-implementation, as it is unnecessary. Instead, the MCU now simply pulls the signal low for START_LOW_TIME and then releases the bus, which is sufficient for initiating communication with the DHT sensor.~~ Actually, it is necessary to raise the bus level; otherwise, the _wait_for_level() called immediately after to check the response of the DHT may read the port before the signal level is raised, resulting in a false positive.

Additionally, the previous implementation had an issue where the MCU switched back to output mode and went high immediately after reading the 40 bits of data. However, the DHT sensor was still transmitting 2 or 3 additional bytes of '0' at that point, causing a conflict. This issue has been resolved in the re-implementation:
![nano_dht_read_optimized](https://github.com/RIOT-OS/RIOT/assets/67432403/ff124839-5ec5-4df3-bab7-5348d8160a25)

~~Regarding the optimization for AVR, I have performed measurements of `_wait_for_level()` until timeout (85 loops):~~
~~- on esp8266-esp-12x: 264 µs, which is 3.11 µs per loop~~
~~- on nucleo-f303k8: 319 µs, which is 3.75 µs per loop~~
~~- on arduino-nano: 3608 µs, which is 42.45 µs per loop~~
~~Duration measurements on the Arduino Nano:~~


19737: dist/tools/openocd: start debug-server in background and wait r=benpicco a=fabian18



19746: buildsystem: Always expose CPU_RAM_BASE & SIZE flags r=benpicco a=Teufelchen1

### Contribution description

Hello 🐧 

This moves the definition of `CPU_RAM_BASE/SIZE` from being only available in certain situation to be always available.
Reason for change is to simplify common code in the cpu folder.

In cooperation with `@benpicco` 

### Testing procedure

Passing CI


### Issues/PRs references

First usage will be in the PMP driver. Although there is more code in RIOT that could be refactored to use these defines instead of hacks / hardcoded values.

Co-authored-by: Hugues Larrive <hlarrive@pm.me>
Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
Co-authored-by: Teufelchen1 <bennet.blischke@outlook.com>
2023-06-20 10:40:01 +00:00
Hugues Larrive
a582da1f31 drivers/dht: busy wait reimplementation
- many backports from @maribu's IRQ based implementation (#18591)
- use of ztimer and errno.h
- separation of dht_read() steps into functions for better readability
- reintroduction of DHT11/DHT22 differentiation
- sensor presence checking in dht_init()
- default input mode changed to open drain
- AVR support without platform-specific handling by avoiding
  ztimer_spin() and using the overflow of an 8-bit variable as a
  pre-timeout to minimize time-consuming ztimer_now() calls
- add a new DHT11_2022 type for 0.01 °C resolution devices
- data caching removed
2023-06-20 12:07:48 +02:00
bors[bot]
829af7c105
Merge #19703 #19724 #19735
19703: cpu/sam0_eth: interrupt based link detection/auto-negotiation r=benpicco a=benpicco



19724: dist/tools/openocd: add OPENOCD_SERVER_ADDRESS variable r=benpicco a=fabian18



19735: nrf5x_common: Clear I2C periph shorts r=benpicco a=bergzand

### Contribution description

The I2C peripheral's shortcuts are used with the read and write register to automatically stop the I2C transaction or to continue with the next stage.

With simple I2C read and write bytes these shorts are not used, but are also not cleared by the function in all cases, causing it to use the shortcut configuration set by a previous function call. This patch ensures that the shorts are always set by the read and write functions

### Testing procedure

Should be possible to spot with a logic analyzer and the I2C periph test. Maybe the HIL test can also detect it :)

### Issues/PRs references

None

Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
2023-06-14 12:34:33 +00:00
bors[bot]
61d7c4028e
Merge #19734
19734: drivers/pcf857x: allow to define PCF857x_BASE_ADDR at compile time r=maribu a=hugueslarrive



Co-authored-by: Hugues Larrive <hlarrive@pm.me>
2023-06-14 07:38:17 +00:00
Hugues Larrive
85e41a1f18 drivers/pcf857x: allow to define PCF857x_BASE_ADDR at compile time 2023-06-14 05:38:20 +02:00
Marian Buschsieweke
826095d56e
drivers/sx127x: reduce use of floats 2023-06-12 13:54:06 +02:00
bors[bot]
d7e4f939c2
Merge #19695
19695: drivers/hih6130: avoid using floats r=maribu a=maribu

### Contribution description

- avoid using floating point arithmetic
- use ztimer instead of xtimer
- use fmt to print fixed point numbers in the test app


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-06-08 13:02:12 +00:00
Marian Buschsieweke
bb366c476a
drivers/hih6130: avoid using floats 2023-06-08 14:33:38 +02:00
Marian Buschsieweke
5dd548860c
drivers/mrf24j40: add note about missing wake pin handling
Fixes https://github.com/RIOT-OS/RIOT/issues/19711
2023-06-07 15:10:33 +02:00
Benjamin Valentin
9627b0d264 drivers/mii: add Interrupt Control/Status register 2023-06-05 12:46:08 +02:00
Benjamin Valentin
e469ecb593 drivers/mii: add missing MII_EXPANSION bit 2023-06-05 11:42:55 +02:00
bors[bot]
d16f8f1032
Merge #19696 #19698
19696: drivers/mq3: avoid use of floats r=maribu a=maribu



19698: tests/pkg/lvgl: avoid using floats r=maribu a=maribu



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-06-02 05:48:07 +00:00
Marian Buschsieweke
e29499cf3a
drivers/mq3: avoid use of floats 2023-06-01 16:52:26 +02:00
77a11be676
drivers/kw41zrf: boards/openlabs-kw41z-mini: cleanup Kconfig 2023-06-01 12:19:44 +02:00
bors[bot]
e71054def9
Merge #19691 #19694
19691: drivers/bmx055: fix crazy use of FPU r=maribu a=maribu

### Contribution description

As the title says...


19694: tests/drivers/epd_bw_spi_disp_dev: fix accidental use of FPU r=maribu a=maribu



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-06-01 02:53:25 +00:00
Marian Buschsieweke
6ddf76103a
drivers/bmx055: fix crazy use of FPU 2023-05-31 16:32:14 +02:00
Benjamin Valentin
7457c4545a drivers/shtcx: fix assertion and shtcx_saul_info idx 2023-05-31 14:42:44 +02:00
bors[bot]
00b5bc12a2
Merge #19610 #19670 #19678 #19679 #19680 #19681
19610: drivers/periph/rtc: improve doc on rtc_set_alarm r=maribu a=maribu

### Contribution description

- point out behavior on denormalized time stamps
- use errno codes to indicate errors (and adapt the few instances of actual error handling to use them)


19670: cpu/stm32: stm32f4 BRR from BSRR r=maribu a=kfessel

### Contribution description

sometimes one wants to save one instruction :) 
just write the bits we need to write.

### Testing procedure

tests/periph/gpio_ll tests this 

### Issues/PRs references

`@maribu` might know some reference

maybe #19407

19678: gnrc_sixlowpan_iphc: fix NULL pointer dereference r=maribu a=miri64



19679: gnrc_sixlowpan_frag_sfr: fix ARQ scheduler race-condition r=maribu a=miri64



19680: gnrc_sixlowpan_frag_rb: fix OOB write in _rbuf_add r=maribu a=miri64



19681: sys/xtimer: improve documentation r=maribu a=maribu

### Contribution description

- Add a warning that xtimer is deprecated, so that new code hopefully starts using ztimer
- Add a hint that `ztimer_xtimer_compat` can be used even after `xtimer` is gone


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
2023-05-30 17:11:06 +00:00
Marian Buschsieweke
51127f674a
drivers/periph/rtc: improve doc on rtc_set_alarm
- point out behavior on denormalized time stamps
- use errno codes to indicate errors (and adapt the few instances of
  actual error handling to use them)
2023-05-30 17:41:36 +02:00
bors[bot]
993c10a2a2
Merge #19556 #19662
19556: tools/mspdebug: fix `make debug` and `make debugserver` r=aabadie a=maribu

### Contribution description

The semantics of `make debug` and `make debugserver` have changed in the years since the MSP430 integration. This brings the implementation back into line with the current semantics

- `make debug` now starts both mspdebug and GDB, no need to run `make debugserver` prior to `make debug` anymore
- `make debug` no longer flashes the target to not waste flash erase cycles
- GDB mutliarch support is added
- support for selecting a debug adapter by its serial is added


19662: driver/lc709203f: remove unnecessary use of float r=aabadie a=kfessel

### Contribution description

removes a unnecessary use of float

### Testing procedure

read and test if you got that hardware (I don't)

### Issues/PRs references

#19614 

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
2023-05-24 15:54:23 +00:00
bors[bot]
7b324d7a4f
Merge #19650 #19660
19650: drivers/nrf24l01p: model in kconfig r=aabadie a=aabadie



19660: cpu/rpx0xx: Fix kconfig model r=aabadie a=MrKevinWeiss



### Contribution description

Broken master due to incorrect model of the periph_pio in kconfig.

### Testing procedure

Green murdock (now that the board is added to the list)

### Issues/PRs references

Look at the master CI...

Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
Co-authored-by: MrKevinWeiss <weiss.kevin604@gmail.com>
2023-05-24 13:09:20 +00:00
Karl Fessel
2c3920ab62 driver/lc709203f: remove unnecessary use of float 2023-05-24 14:22:24 +02:00
1dc6e0e32b
drivers/nrf24l01p: model in Kconfig 2023-05-24 10:18:53 +02:00
MrKevinWeiss
adbf951481
cpu/rpx0xx: Fix kconfig model 2023-05-24 09:53:23 +02:00
bors[bot]
40d0f64a04
Merge #19549 #19608 #19657
19549: pkg/littlefs2: bump version to 2.6 r=benpicco a=benpicco




19608: build system: fix `make compile-commands BUILD_IN_DOCKER=1` r=benpicco a=maribu

### Contribution description

Just run `make compile-commands` outside of docker, as the compile commands generated in the docker container won't be helpful for tools outside of the container anyway.


19657: drivers/mpu9x50: clean up code r=benpicco a=maribu

### Contribution description

Avoid using floating point arithmetic and some minor cleanups.


Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-23 23:35:57 +00:00
Marian Buschsieweke
533af18119
drivers/mpu9x50: clean up code
Avoid using floating point arithmetic and some minor cleanups.
2023-05-23 21:40:40 +02:00
bors[bot]
f3150120f7
Merge #17425
17425: cpu/rpx0xx: initial PIO support r=maribu a=fabian18



Co-authored-by: Fabian Hüßler <fabian.huessler@st.ovgu.de>
2023-05-23 07:02:45 +00:00
Fabian Hüßler
116c579cb5 cpu/rpx0xx: Add PIO I2C implementation 2023-05-23 08:49:37 +02:00
Fabian Hüßler
18315d3ddc cpu/rpx0xx: Add PIO implementation 2023-05-23 08:49:37 +02:00
bors[bot]
e4490f1793
Merge #19647
19647: drivers/mtd_spi_nor: fix hang and debug msgs r=aabadie a=Enoch247

### Contribution description

This patch adds a missing release of the SPI bus on error

### Testing procedure

This was discovered while attempting to bring up a board where I had the pin definitions wrong for a SPI flash part. Once the driver was fixed I was able to get the debug messages and not hang other drivers using the same bus.

### Issues/PRs references

None known

Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
2023-05-22 20:02:16 +00:00
Joshua DeWeese
ff450cd7f4 drivers/mtd_spi_nor: fix hang
This patch releases the SPI bus when the memory devices is not found.
This frees the bus for other devices to use the bus. It also allows
future attempts to init the device.
2023-05-22 12:22:01 -04:00
Joshua DeWeese
33cb2f489b drivers/mtd_spi_nor: fix debug msg
This patch adds some missing newline chars to debug output ensuring the
lines get flushed and don't run together.
2023-05-22 12:21:59 -04:00
Marian Buschsieweke
b9484852f1
drivers/sx126x: fix argument validation in spreading factor
The lowest possible value is `LORA_SF5` and not `LORA_SF6`. This fixes
the argument validation to allow setting `LORA_SF5` as spreading factor.

Fixes https://github.com/RIOT-OS/RIOT/issues/17861
2023-05-22 15:06:07 +02:00
bors[bot]
8fc1187278
Merge #17830 #19635
17830: periph/timer: fix Kconfig menu title r=aabadie a=gschorcht

### Contribution description

This PR is a very small fix of inconsistent peripheral driver entry in `Kconfig` for `periph/timer`.

In Kconfig menu `(Top) → Drivers → Peripherals drivers` all entries start with the peripheral name in alphabetical order with only one exception, the timer entry. This entry is called `Configure timer peripheral driver`:
```
[ ] CPU unique ID
[ ] EEPROM peripheral driver
[ ] Flashpage peripheral driver  ----
[*] GPIO peripheral driver  --->
[ ] HWRNG peripheral driver
[ ] PWM peripheral driver
[*] Power Management (PM) peripheral driver
[*]     Auto initialize Power Management (PM) peripheral
[ ] Quadrature Decoder (QDEC) peripheral driver
[ ] RTC peripheral driver  ----
[ ] SPI peripheral driver  ----
[*] UART peripheral driver  --->
[*] Configure timer peripheral driver  --->
```
This is confusing and doesn't help to find the right entry. This PR
1. changes the entry to `Timer peripheral driver` and
2. corrects the alphabetical order.

### Testing procedure

Use command
```
TEST_KCONFIG=1 make -C tests/periph_timer menuconfig
```
and check the output. in menu `(Top) → Drivers → Peripherals drivers`. It should be with this PR:
```
[ ] CPU unique ID
[ ] EEPROM peripheral driver
[ ] Flashpage peripheral driver  ----
[*] GPIO peripheral driver  --->
[ ] HWRNG peripheral driver
[ ] PWM peripheral driver
[*] Power Management (PM) peripheral driver
[*]     Auto initialize Power Management (PM) peripheral
[ ] Quadrature Decoder (QDEC) peripheral driver
[ ] RTC peripheral driver  ----
[ ] SPI peripheral driver  ----
[*] Timer peripheral driver  --->
[*] UART peripheral driver  --->
```
### Issues/PRs references


19635: drivers/mrf24j40: cleanup function r=aabadie a=maribu

### Contribution description

`_set_csma_params()` spends some time to prepare a value in `uint8_t tmp`, which then is never used. Likely this is a leftover of moving code to `mrf24j40_set_csma_max_retries()`. This drops the leftover code.


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-20 18:43:44 +00:00
Marian Buschsieweke
c10b8838f1
drivers/mrf24j40: cleanup function
`_set_csma_params()` spends some time to prepare a value in
`uint8_t tmp`, which then is never used. Likely this is a leftover
of moving code to `mrf24j40_set_csma_max_retries()`. This drops the
leftover code.
2023-05-20 16:59:25 +02:00
bors[bot]
a08b90c648
Merge #19633
19633: drivers/slipdev: fix logic bug r=fabian18 a=maribu

### Contribution description

A typo resulted in a boolean expression to always be true and the `_poweron()` function to always exit early. This fixes the issue.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-20 00:35:17 +00:00
bors[bot]
24593ce18c
Merge #19631 #19632
19631: drivers/dfplayer: fix bug in utility function r=maribu a=maribu

### Contribution description

Apparently, those functions have never been used. Otherwise this obvious bug wouldn't have sailed unnoticed for so long.



19632: drivers/pcf857x: fix error handling r=maribu a=maribu

### Contribution description

This fixes a typo/copy paste error in the error handling.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-19 21:54:05 +00:00
Marian Buschsieweke
adfe9ac306
drivers/slipdev: fix logic bug
A typo resulted in a boolean expression to always be true and the
`_poweron()` function to always exit early. This fixes the issue.
2023-05-19 23:01:30 +02:00
Marian Buschsieweke
bc1c831d39
drivers/pcf857x: fix error handling
This fixes a typo/copy paste error in the error handling.
2023-05-19 21:59:40 +02:00
Marian Buschsieweke
5683281b5d
drivers/dfplayer: fix bug in utility function
Apparently, those functions have never been used. Otherwise this
obvious bug wouldn't have sailed unnoticed for so long.
2023-05-19 21:51:44 +02:00
bors[bot]
a46b49a24c
Merge #19605 #19624 #19625
19605: drivers/at86rf2xx: setting rx timestamp based on symbol counter for ATmega*RFR2 r=maribu a=chudov



19624: pkg/tensorflow-lite: remove deprecated package r=maribu a=aabadie

Use tflite-micro instead



19625: sys/hashes: remove deprecated aes cmac hashing r=maribu a=aabadie



Co-authored-by: chudov <chudov@gmail.com>
Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-05-19 17:05:02 +00: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
dcb49cb46d
drivers/lpsxxx: avoid float arithmetics
Fixes https://github.com/RIOT-OS/RIOT/issues/17486
2023-05-19 09:23:30 +02:00
2dbf57fa46
drivers/pcf857x: fix path to saul test application 2023-05-13 19:08:40 +02:00
Fabian Hüßler
500d257a52 drivers/periph_common: Add PIO to periph init 2023-05-12 23:03:05 +02:00
Fabian Hüßler
d8cf31b094 drivers/include/periph: Add PIO driver interface 2023-05-12 23:03:05 +02:00
f9d247791d
treewide: replace occurrences of tests/driver_ with new path 2023-05-06 15:38:21 +02:00
Gunar Schorcht
714b3e3384 drivers/mtd_default: add external declarations for mtd*
The `mtd_default` module defines `MTD_NUMOF` if not existing based on the `MTD_*` defines which are usually set to the corresponding MTD device pointer variables `mtd*`. However, these MTD device pointer variables are not always made known by external variable declarations. An example are SD Card Interfaces which are defined via the `mtd_sdcard_default` module. As a consequence, an application that uses `mtd_default` has still to be modified. Therefore, `mtd_default` also declares up to 6 `mtd*` MTD device pointer variables.
2023-05-02 23:07:29 +02:00
bors[bot]
c4b27d8241
Merge #19523 #19527 #19530 #19532 #19533 #19535
19523: boards/iotlab-m3: enable l3g4200d_ng r=benpicco a=benpicco



19527: drivers/sdcard_spi: small cleanup r=benpicco a=gschorcht

### Contribution description

This PR provides a small cleanup:
- the copy of `sdcard_spi_params_t` is removed (commit bfc2a51f70)
- the documentation was changed to fit the 100 characters per line. (commit 36f0162b34)

It is not necessary to hold a complete copy `sdcard_spi_params_t` in the device descriptor. Constant parameters can be used directly from ROM instead. This saves 24 bytes of RAM.

### Testing procedure

Use any board with SD Card SPI interface. The driver test should still work, for example:
```
BOARD=esp32-wrover-kit make -j8 -C tests/driver_sdcard_spi flash term
```
```
main(): This is RIOT! (Version: 2023.07-devel-176-g7213c-drivers/sdcard_spi_cleanup)
SD-card spi driver test application
insert SD-card and use 'init' command to set card to spi mode
WARNING: using 'write' or 'copy' commands WILL overwrite data on your sd-card and
almost for sure corrupt existing filesystems, partitions and contained data!
> init
Initializing SD-card at SPI_0...
[OK]
> 
```

### Issues/PRs references


19530: sys/xtimer: add missing "modules.h" include to `xtimer.h` r=benpicco a=kaspar030



19532: tests/unittests: tests-core-mbox: add missing `container.h` include r=benpicco a=kaspar030



19533: core: move macros/math.h to core/lib/include/macros r=benpicco a=kaspar030



19535: nanocoap_sock: defuse nanocoap_sock_get() API footgun r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
2023-05-02 13:37:57 +00:00
Marian Buschsieweke
c3500eb6e0
tree wide: fix typos in comments found by codespell
This will not change generated binaries, only the Doxygen output and
source code will have less typos.
2023-05-02 09:52:06 +02:00
Gunar Schorcht
36f0162b34 drivers/sdcard_spi: doc cleanup to fit in 100 characters per line 2023-05-01 14:36:25 +02:00
Gunar Schorcht
bfc2a51f70 drivers/sdcard_spi: remove copy of sdcard_spi_params_t from device
It is not necessary to hold a complete copy `sdcard_spi_params_t` in the device descriptor. Constant parameters can be used directly from ROM instead. This saves 24 bytes of RAM.
2023-05-01 14:36:25 +02:00
Benjamin Valentin
fcece44394 drivers/l3gxxxx: fix check for l3g4200d_ng 2023-04-28 17:24:15 +02:00
Marian Buschsieweke
c0a614d896
drivers/servo: Fix missing dep
The servo test app uses `USEMODULE += servo` and lets the build system
pick automatically the best suitable backend. If one explicitly chooses
a backend e.g. via `USEMODULE += servo_timer`, this currently requires
adding `USEMODULE += servo` in addition. This commit fixes the issue.

Fixes https://github.com/RIOT-OS/RIOT/issues/19474
2023-04-26 15:15:53 +02:00
chrysn
8e2d26923a drivers/lsm303agr: Rename deprecated unit G to GForce 2023-04-25 09:23:21 +02:00
Gunar Schorcht
26d435a101 drivers/usbdev_synopsys_dwc2: add GD32V support 2023-04-16 23:24:23 +02:00
Gunar Schorcht
ee83893496 drivers/periph_usbdev: TXFE not used any longer
After changing IN EPs also to use XFRC (Transfer Complete) interrupts in non-DMA mode, the TXFE (TX FIFO Empty) interrupt is no longer needed to signal the completion of an IN transfer.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
ea776c92b6 drivers/usbdev_synopsys_dwc2: handle RXFLVL interruprs in ISR
Since RXFLVL (RX FIFO Level) interrupt doen't complete transfers anymore, they are handled now directly in the ISR.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
d15f0f3a7b drivers/usbdev_synopsys_dwc2: use XFRC for OUT EPs in non-DMA mode
XFRC (Transfer Complete) interrupts are now also used for OUT EPs in non-DMA mode. RXFLVL (RX FIFO Level) interrupts are no longer used to signal completed transfers, but only to copy data from FIFO to memory and to set a flag indicating that a SETUP stage is in progress. STUP (SETUP phase done) interrupts are then used to signal a completed SETUP stage and to reset the flags that indicates the SETUP stage. The flag that indicates the SETUP stage in progress is used to ignore additional XFRC interrupts for EP0 during the SETUP stage.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
1ccafe1621 drivers/usbdev_synopsys_dwc2: use XFRC for IN EPs in non-DMA mode
XFRC (Transfer Complete) interrupts are now also used for IN EPs in non-DMA mode. TXFE (TX FIFO Empty) interrupts are not necessarily needed but are still enabled.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
1a37d3b9e0 drivers/usbdev_synopsys_dwc2: several cleanups 2023-04-16 22:59:11 +02:00
Gunar Schorcht
e3fb4e7cfb drivers/usbdev_synopsys_dwc2: add OTG interrupt handling 2023-04-16 22:59:11 +02:00
Gunar Schorcht
1d7224602d drivers/usbdev_synopsys_dwc2: print CID/HW debug info 2023-04-16 22:59:11 +02:00
Gunar Schorcht
ff9e9e3a7c drivers/usbdev_synopsys_dwc2: fix power modes for STM32 2023-04-16 22:59:11 +02:00
Gunar Schorcht
d35fa914c8 drivers/usbdev_synopsys_dwc2: fix a typo 2023-04-16 22:59:11 +02:00
Gunar Schorcht
98b6d75c14 drivers/usbdev_synopsys_dwc2: improve FIFO allocation doc 2023-04-16 22:59:11 +02:00
Gunar Schorcht
9e8ef51283 drivers/usbdev_synopsys_dwc2: add thread context switch at ISR exit
The USB device driver ISR sets a thread flag of the waiting USBUS thread to indicate that it has to handle a USB device driver event. However, setting a thread flag only sets `sched_context_switch_request` to indicate that a thread context switch would be required, but it is not executed. Therefore, for STM32 MCUs, `cortexm_isr_end` was called to execute the context switch. Since the driver is also used by other platforms, this call is replaced by a direct call of `thread_yield_higher` if required. NOTE: For ESP32x SoC, such a thread context switch is implicitly executed at the end of each ISR if necessary.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
8999a5083f drivers/usbdev_synopsys_dwc2: remove USB OTG HS definition dependencies
If the MCU/board has only an USB OTG FS peripheral or only an USB OTG HS peripheral, it should only need to specify the USB OTG FS definitions such as the number of EPs or the FIFO sizes or only the USB OTG HS definitions. This commit cleans up the code so that it is translatable without the respective definitions.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
88cabbae64 drivers/usbdev_synopsys_dwc2: set USBDEV_SET_ADDR_AFTER_STATUS
DWC2 core requires that the device address has to be set directly after SETUP stage and not after the associated STATUS stage.
2023-04-16 17:14:08 +02:00
Gunar Schorcht
d675cd7290 drivers/periph_usbdev: define USBDEV_SET_ADDR_AFTER_STATUS
The address in the USB device can be set either directly after the SETUP stage on receipt of the `SET ADDRESS Request` or after the associated status stage. When the USB device address has to be set depends on the hardware. If `USBDEV_SET_ADDR_AFTER_STATUS` has the value 1 (default), the address is only set in the USB device after the status stage. Overwrite it with 0 in `periph_cpu.h` to set the address already directly after the SETUP stage.
2023-04-16 17:14:08 +02:00
bors[bot]
5a523ee894
Merge #19467
19467: drivers/at86rf2xx: fix default page being ignored r=maribu a=jia200x



Co-authored-by: Jose Alamos <jose@alamos.cc>
2023-04-13 16:26:35 +00:00
Jose Alamos
268487097b
drivers/at86rf2xx: fix default page 2023-04-13 11:10:54 +02:00
4ccbe0dbac
drivers/sx126x: add missing lora module dependency 2023-04-13 10:55:23 +02:00
bors[bot]
99b13cbb1b
Merge #19432 #19461
19432: boards/esp32: deduplication in common ESP32x board definitions r=benpicco a=gschorcht

### Contribution description

The PR reduced code duplication in `boards/common/esp32*`.

The PR moves the header files from `boards/common/esp32s3/include` that can be used for all types of ESP32x SoCs to a new common ESP32x board definition which is then included by all common ESP32x board definitions.

### Testing procedure

Green CI.

### Issues/PRs references


19461: drivers/enc28j60: fix ISR routine and bth r=benpicco a=peteut



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Alain Péteut <alain.peteut@yahoo.com>
2023-04-12 14:06:06 +00:00
bors[bot]
b342cdc4d4
Merge #19443
19443: drivers: add support for MTDs emulated in RAM r=dylad a=gschorcht

### Contribution description

This PR adds a driver to provide MTDs that are emulated in RAM. It allows to test MTD-based applications on boards that do not provide MTDs by hardware.

It includes also some small documentation fixes for `mtd.h` that were found while writing the driver.

### Testing procedure

The following tests should work on any board:

`tests/pkg_littlefs`
`tests/pkg_littlefs2`
`tests/pkg_spiffs`

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-04-12 09:57:18 +00:00
Gunar Schorcht
1d4d3e47b8 drivers/mtd_default: expose one SD Card and one MTD emulated 2023-04-12 06:27:12 +02:00
Gunar Schorcht
609c090ceb drivers/mtd_emulatd: MTD emulated in RAM for testing
This driver provides support for MTDs emulated in RAM to test MTD-based applications on boards that do not provide MTDs in hardware.
2023-04-11 17:42:10 +02:00
Gunar Schorcht
756197316d drivers/mtd: small fixes in doc 2023-04-11 17:42:10 +02:00
Alain Péteut
226b8cff52 drivers/enc28j60: fix PKTIF issue.
The PKTIF does not reliably report the status of pending packags.
Apply the proposed workaround [1].

[1] https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/Errata/80349c.pdf
2023-04-11 12:23:18 +02:00
Alain Péteut
200c49dead drivers/enc28j60: do not block in ISR ctx. 2023-04-10 14:41:21 +02:00
Gunar Schorcht
eff6c93cec drivers/usbus_synopsys_dwc2: fix interrupt handling in DMA mode 2023-04-07 12:43:02 +02:00
aa67c98a4a
synopsys_dwc2: implement USBOPT_ENUMERATED_SPEED 2023-03-31 16:43:44 +02:00
Gunar Schorcht
6d78cef999 drivers/ws281x: add ESP32x hardware support 2023-03-29 00:47:35 +02:00
Marian Buschsieweke
a44d248539
drivers/servo: Fix typo in comment 2023-03-26 20:54:14 +02:00
Gunar Schorcht
c40e015804 drivers/ws281x: improve timing for ESP32x
If overhead like the loop control or the calculation of the waiting times for the next bit are performed while waiting for the end of the LOW phase, the time required for such operations is included in the LOW phase. This makes both the LOW phase and the period more precise.
2023-03-25 17:58:37 +01:00
bors[bot]
50cd32fbbf
Merge #19397 #19416 #19418 #19419
19397: drivers/usbdev_synopsys_dwc2: fix and reenable DMA mode r=benpicco a=gschorcht

### Contribution description

This PR fixes the DMA mode for all STM32 USB OTG HS cores (including that for STM32F4xx CID 1.xxx) and reenables it. It fixes remaining problems in issue #19359.

This PR includes also includes some changes that are needed to use the DMA mode:
- EP number is used as defined in CMSIS (if defined) for STM32
- `periph_usbdev_hs` feature is added in Kconfig
- `periph_usbdev_hs` feature is added in board definition of `stm32f429i-disc1`
- largest number of available EPs is used for STM32 instead of the smallest number (to be able to use all EPs of HS peripheral)
- `stm32f429i-disco` is removed from blacklist in `tests/usbus_cdc_ecm` since it uses the HS peripheral

### Testing procedure

The following tests should work
```python
USEMODULE=stdio_cdc_acm BOARD=stm32f429i-disc1 make -j8 -C tests/usbus_cdc_ecm flash
```
<details>
<summary>Test results</summary>

```python
[526755.875691] usb 1-2.2: new full-speed USB device number 106 using xhci_hcd
[526755.977853] usb 1-2.2: config 1 interface 3 altsetting 1 endpoint 0x84 has invalid maxpacket 512, setting to 64
[526755.977856] usb 1-2.2: config 1 interface 3 altsetting 1 endpoint 0x2 has invalid maxpacket 512, setting to 64
[526755.978762] usb 1-2.2: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
[526755.978764] usb 1-2.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[526755.978766] usb 1-2.2: Product: stm32f429i-disc1
[526755.978768] usb 1-2.2: Manufacturer: RIOT-os.org
[526755.978769] usb 1-2.2: SerialNumber: 7C156425A950A8EB
[526755.991190] cdc_acm 1-2.2:1.0: ttyACM1: USB ACM device
[526755.998131] cdc_ether 1-2.2:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-2.2, CDC Ethernet Device, a6:f6:4a:85:1d:c9
[526756.044150] cdc_ether 1-2.2:1.2 enp0s20f0u2u2i2: renamed from usb0
```

</details>

```python
USEMODULE='stdio_cdc_acm periph_usbdev_hs_utmi' BOARD=stm32f723e-disco make -j8 -C tests/usbus_cdc_ecm flash
```
<details>
<summary>Test results</summary>

```python
[528733.480207] usb 1-4.3.4: reset high-speed USB device number 32 using xhci_hcd
[528733.707800] usb 1-4.4: new high-speed USB device number 111 using xhci_hcd
[528733.808257] usb 1-4.4: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11
[528733.808260] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
[528733.808263] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64
[528733.808642] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
[528733.808645] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[528733.808647] usb 1-4.4: Product: stm32f723e-disco
[528733.808649] usb 1-4.4: Manufacturer: RIOT-os.org
[528733.808651] usb 1-4.4: SerialNumber: A6BAC4E1B1E0806B
[528733.811988] cdc_acm 1-4.4:1.0: ttyACM1: USB ACM device
[528733.814456] cdc_ether 1-4.4:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.4, CDC Ethernet Device, e6:75:97:3a:74:ba
[528733.854371] cdc_ether 1-4.4:1.2 enp0s20f0u4u4i2: renamed from usb0
```

</details>

```python
USEMODULE='stdio_cdc_acm periph_usbdev_hs_ulpi' BOARD=stm32f746g-disco make -j8 -C tests/usbus_cdc_ecm flash
```
<details>
<summary>Test results</summary>

```python
[529000.944482] usb 1-4.3.4: reset high-speed USB device number 32 using xhci_hcd
[529003.728260] usb 1-4.4: new high-speed USB device number 114 using xhci_hcd
[529003.833107] usb 1-4.4: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11
[529003.833111] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
[529003.833113] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64
[529003.833743] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d00, bcdDevice= 1.00
[529003.833747] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[529003.833749] usb 1-4.4: Product: stm32f746g-disco
[529003.833751] usb 1-4.4: Manufacturer: RIOT-os.org
[529003.833753] usb 1-4.4: SerialNumber: 66FE8934D1A363E0
[529003.837143] cdc_acm 1-4.4:1.0: ttyACM1: USB ACM device
[529003.839755] cdc_ether 1-4.4:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.4, CDC Ethernet Device, 6a:88:1f:1f:b1:f0
[529003.879025] cdc_ether 1-4.4:1.2 enp0s20f0u4u4i2: renamed from usb0```
```
</details>

### Issues/PRs references

Fixes #19359


19416: cpu/rpx0xx/cmsis: Update vendor header files r=benpicco a=maribu

### Contribution description

Generated new vendor header files from upstream SVD files using:

    ./SVDConv "$PICO_SDK_DIR"/src/rp2040/hardware_regs/rp2040.svd \
        --generate=header --fields=macro --fields=enum

Note: The missing `--fields=struct` flag resulted in the header no longer containing bit-fields to represent different fields within registers. While this would generally ease writing code, the RP2040 has the unpleasant feature of corrupting the remaining bits of the register when a write access that is not word-sized occurs in the memory mapped I/O area. This could happen e.g. when a bit field is byte-sized and byte-aligned.
### Testing procedure

No binary changes (hopefully).

### Issues/PRs references

This adds a few additional vendor defines, notably for USB. If anyone were to implement USB, this would be a requirement.

19418: cpu/gd32v: fix gpio_read in periph_gpio r=benpicco a=gschorcht

### Contribution description

This PR fixes a bug in `gpio_read` which made `gpio_read` completely unusable!

A small bug with big consequences. In `gpio_read` the combined port | pin_num parameter `pin` was used instead of the pin number `pin_num` for the call of `_pin_is_input`. This caused the problem that for example instead of accessing GPIOA->CTL0 with address 0x40010800, address 0x60018c00 was accessed. As a result, a pin was randomly detected as input or output and thus a result was arbitrarily returned. Approx. 50% of all inputs always returned LOW.

I found this error by coincidence when I tried to find out why the BOOT0 button on a Sipeed Longan Nano is not usable as a button in RIOT.

### Testing procedure

Flash `tests/periph_gpio`
```
BOARD=sipeed-longan-nano make -j8 -C tests/periph_gpio flash
```
and use commands
```
init_in 0 8
read 0 8
```
Without this PR, the pin is always LOW. With the PR, the pin should be HIGH when the BOOT button is pressed.

### Issues/PRs references

19419: boards/sipeed-longan-nano: add BOOT as user button r=benpicco a=gschorcht

### Contribution description

This PR makes the BOOT button usable as a user button.

### Testing procedure

The test requires PR #19418 to work.

Flash and test:
```
BOARD=sipeed-longan-nano make -j8 -C tests/saul flash term
```
The output
```
Dev: BOOT	Type: SENSE_BTN
Data:	              0 
```
should change to
```
Dev: BOOT	Type: SENSE_BTN
Data:	              1 
```
when the BOOT button is pressed.

### Issues/PRs references

Depends on PR #19418 


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-03-24 08:38:06 +00:00
Vitor Batista
607cbc606c drivers/at: rename urc_isr_low pseudomodule to lowest 2023-03-21 15:46:35 +01:00
Vitor Batista
32781f3c51 drivers/at: fixed faulty event prio name 2023-03-21 14:55:50 +01:00
Gunar Schorcht
d388055850 drivers/usbdev_synopsys_dwc2: add ESP32x power management 2023-03-16 12:27:56 +01:00
Gunar Schorcht
97e1cdc15e drivers/usbdev_synopsys_dwc2: fix DMA mode 2023-03-16 08:44:48 +01:00
Gunar Schorcht
9c306815c2 drivers/periph_common: add periph_usbdev_hs feature in Kconfig 2023-03-16 07:47:18 +01:00
Gunar Schorcht
93c547aaa8 drivers/usbdev_synopsys_dwc2: disable DMA mode
DMA mode is disabled for now due to several problems:
 - The STALL bit of the OUT control endpoint does not seem to be cleared automatically on the next SETUP received. At least the USB OTG HS core does not generate an interrupt on the next SETUP received. This happens, for example, when CDC ACM is used and the host sends the SET_LINE_CODING request. In this case the enumeration of further interfaces, for example CDC ECM is stopped.
- The Enumeration fails for CDC ECM interface which uses URB support.
2023-03-14 14:04:20 +01:00
Gunar Schorcht
4d19f21703 driver/usbdev_synopsys_dwc2: use correct number of EPs
This commit fixes the problem that the driver uses the wrong number of EPs when using the USB OTG HS core. The reason is that the constant `DWC2_USB_OTG_FS_NUM_EP` is used in several places even though there is a function `_max_endpoints` which takes into account the configuration used. For most MCUs this is not a problem, because they have only a USB OTG FS core anyway. But for MCUs like the STM32, which has both a USB OTG FS core and a USB OTG HS core, it matters.
2023-03-11 16:57:23 +01:00
bors[bot]
513676f6e0
Merge #17086
17086: usbdev: Add dedicated stall functions r=benpicco a=bergzand

### Contribution description

This PR adds dedicated stall functions for usbdev peripherals. Two
functions are added. The first function (usbdev_ep_stall) to enable and
disable the stall condition on generic endpoints. The second function is
a dedicated function to set the stall condition on endpoint zero in both
directions. This status can only be set and should automatically be
cleared by the usbdev implementation (or hardware) after a new setup
request is received from the host.

### Testing procedure

- examples/usbus_minimal should still enumerate correctly on the host side.
- #17085 can be used to demonstrate the ep0_stall function with the `tests/usbus_cdc_acm_stdio/` test

### Issues/PRs references

None

Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-03-10 00:12:40 +00:00
bors[bot]
bdecf57516
Merge #19356
19356: usbus/msc: add CONFIG_USBUS_MSC_AUTO_MTD option to create LUNs on init r=dylad a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-03-09 19:49:51 +00:00
bors[bot]
6c1de71606
Merge #19358
19358: sys/usbus/cdc/ecm: fix High-Speed mode r=dylad a=gschorcht

### Contribution description

This PR provides some changes to fix the USBUS CDC ECM interface in High-Speed mode.

In High-Speed mode, the EP data size has to be at least 512 bytes instead of 64 Byte in Full-Speed mode. To be able to define configurations like EP data sizes depending on whether Full-Speed or High-Speed USB device peripherals are used, the feature `periph_usbdev_hs`/`HAD_PERIPH_USBDEV_HS` is introduced.

### Testing procedure

Use `tests/usbus_cdc_ecm`  and any board with USB HS connector, for example:
```
USEMODULE=periph_usbdev_hs_utmi BOARD=stm32f723e-disco make -j8 -C tests/usbus_cdc_ecm flash
```
`ping` command works with this PR but doesn't work without this PR.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-03-07 20:17:01 +00:00
Gunar Schorcht
744f59a2f0 drivers: introduce feture periph_usbdev_hs
To be able to define configurations like EP data sizes depending on whether full-speed or high-speed USB device peripherals are used, the feature `periph_usbdev_hs` is introduced.
2023-03-07 11:25:08 +01:00
Benjamin Valentin
092009e5ae drivers/mtd_default: add helper function for default MTD devices 2023-03-07 00:53:05 +01:00
33ba2adc68
drivers/usbdev_synopsys_dwc2: add stall functions to usbdev 2023-02-28 11:00:06 +01:00
608322a4ce
usbdev: Add dedicated stall functions
This commit adds dedicated stall functions for usbdev peripherals. Two
functions are added. The first function (usbdev_ep_stall) to enable and
disable the stall condition on generic endpoints. The second function is
a dedicated function to set the stall condition on endpoint zero in both
directions. This status can only be set and should automatically be
cleared by the usbdev implementation (or hardware) after a new setup
request is received from the host.
2023-02-28 11:00:05 +01:00
Marian Buschsieweke
cdcec5b3f9
drivers/saul: use flash_utils 2023-02-27 12:31:04 +01:00
bors[bot]
4809b687b6
Merge #19292 #19307
19292: sys/phydat: Fix unit confusion r=miri64 a=maribu

### Contribution description

Previously, `UNIT_G` was used for g-force with the correct symbol `g`, `UNIT_GR` for gram (as in kilogram) with the incorrect symbol `G` (which would be correct for Gauss), and `UNIT_GS` for Gauss with symbol `Gs` (which is an alternative correct symbol).

To avoid confusion between G-Force, Gauss, and Gram the units have been renamed to `UNIT_G_FORCE`, `UNIT_GRAM`, and `UNIT_GAUSS`. In addition, gram now uses the correct symbol `g`; which sadly is the same as for g-force. But usually there is enough context to tell them apart.

### Testing procedure

Green CI

### Issues/PRs references

None

19307: nanocoap_link_format: fix off-by-one error r=miri64 a=benpicco



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-23 21:25:12 +00:00
Marian Buschsieweke
3c287c058d
sys/phydat: Fix unit confusion
Previously, `UNIT_G` was used for g-force with the correct symbol `g`,
`UNIT_GR` for gram (as in kilogram) with the incorrect symbol `G` (which
would be correct for Gauss), and `UNIT_GS` for Gauss with symbol `Gs`
(which is an uncommon but correct symbol).

To avoid confusion between G-Force, Gauss, and Gram the units have been
renamed to `UNIT_G_FORCE`, `UNIT_GRAM`, and `UNIT_GAUSS`. In addition,
gram now uses the correct symbol `g` and Gauss uses `G`.
2023-02-23 16:44:24 +01:00
f4d4784034
matrix_keypad: Move documentation to doxygen group 2023-02-23 11:39:11 +01:00
bors[bot]
41b54d8594
Merge #18392
18392: drivers/servo: reimplement with high level interface r=benpicco a=maribu

### Contribution description

The previous servo driver didn't provide any benefit over using PWM directly, as users controlled the servo in terms of PWM duty cycles. This changes the interface to provide a high level interface that abstracts the gory PWM details.

In addition, a SAUL layer and auto-initialization is provided.

### Testing procedure

The test application provides access to the servo driver via the `saul` shell command.

```
> saul
2022-08-02 22:12:31,826 # saul
2022-08-02 22:12:31,827 # ID	Class		Name
2022-08-02 22:12:31,830 # #0	ACT_SWITCH	LD1(green)
2022-08-02 22:12:31,832 # #1	ACT_SWITCH	LD2(blue)
2022-08-02 22:12:31,834 # #2	ACT_SWITCH	LD3(red)
2022-08-02 22:12:31,837 # #3	SENSE_BTN	B1(User button)
2022-08-02 22:12:31,838 # #4	ACT_SERVO	servo
> saul write 4 0
2022-08-02 22:12:41,443 # saul write 4 0
2022-08-02 22:12:41,445 # Writing to device #4 - servo
2022-08-02 22:12:41,447 # Data:	             0 
2022-08-02 22:12:41,450 # [servo] setting 0 to 2949 (0 / 255)
2022-08-02 22:12:41,453 # data successfully written to device #4
> saul write 4 256
2022-08-02 22:12:45,343 # saul write 4 256
2022-08-02 22:12:45,346 # Writing to device #4 - servo
2022-08-02 22:12:45,347 # Data:	           256 
2022-08-02 22:12:45,351 # [servo] setting 0 to 6865 (255 / 255)
2022-08-02 22:12:45,354 # data successfully written to device #4
```

Each write resulted in the MG90S servo that I connected to move to the corresponding position.

### Issues/PRs references

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-02-22 09:15:59 +00:00
Marian Buschsieweke
6dc2a60597
drivers/servo: reimplement with high level interface
The previous servo driver didn't provide any benefit over using PWM
directly, as users controlled the servo in terms of PWM duty cycles.
This changes the interface to provide a high level interface that
abstracts the gory PWM details.

In addition, a SAUL layer and auto-initialization is provided.

Co-authored-by: benpicco <benpicco@googlemail.com>
2023-02-22 10:00:04 +01:00
bors[bot]
37b64912d4
Merge #19256
19256: pkg/tinyusb: add GD32VF103 support r=gschorcht a=gschorcht

### Contribution description

This PR provides the tinyUSB support for GD32VF103 and enables the `tinyusb_device` feature as well as `stdio_tinyusb_cdc_acm` for GD32VF103 boards.

### Testing procedure

```
BOARD=sipeeed-longan-nano make -C tests/shell flash term
```
should work

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-21 16:53:06 +00:00
Gunar Schorcht
31141a2350 drivers/periph_common: fix periph_usbdev_clk dependency in Kconfig
`periph_usbdev_clk` is just a pseudomodule that controls the clock selection which does not depend on full featured `periph_usbdev`.
2023-02-21 15:04:13 +01:00
Benjamin Valentin
7884d6e7fe drivers/at24cxxx: merge mtd driver with at24cxxx.c 2023-02-17 10:55:21 +01:00
bors[bot]
2221cbfa9b
Merge #19258
19258: drivers/mtd_flashpage: implement pagewise API, don't use raw addresses r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-16 15:02:19 +00:00
Benjamin Valentin
43fffcd74f drivers/mtd: add bounds checking 2023-02-16 15:50:52 +01:00
Benjamin Valentin
d8ab11b51f drivers/mtd_flashpage: drop legacy API 2023-02-16 15:50:52 +01:00
Benjamin Valentin
5d5d88b271 drivers/mtd_flashpage: implement pagewise API 2023-02-16 15:50:52 +01:00
bors[bot]
5667814d2c
Merge #19270 #19271
19270: drivers/at24cxxx: implement _mtd_at24cxxx_read_page r=benpicco a=HendrikVE

### Contribution description

The function `read_page` was missing which lead to (from a user perspective) undefined behavior on the MTD layer.

### Testing procedure

Any application using MTD in conjunction with a board with an at24cxxx.


19271: core/xfa: disable asan on llvm r=benpicco a=Teufelchen1

### Contribution description
Hi! 🦎

When using llvm and address sanitation, the XFA trip the sanitizer.
This PR attempts to fix this by adding the `no_sanitize` attribute to the XFA macros. Sadly, this attribute is not known by gnu, a guard is hence needed. I'm open for alternatives as I dislike this solution but it is the best I could come up with.

### Testing procedure

Before this patch:

Go to `examples/gnrc_minimal` and run `TOOLCHAIN=llvm make all-asan` and then `make term`.
You should see an error similar to this:
```
==3374719==ERROR: AddressSanitizer: global-buffer-overflow on address 0x080774e0 at pc 0x0804af5e bp 0x0808eb88 sp 0x0808eb78
READ of size 4 at 0x080774e0 thread T0
    #0 0x804af5d in _auto_init_module /RIOT/sys/auto_init/auto_init.c:40
    #1 0x804af5d in auto_init /RIOT/sys/auto_init/auto_init.c:339
    #2 0x804b375 in main_trampoline /RIOT/core/lib/init.c:56
    #3 0xf76bc7b8 in makecontext (/lib32/libc.so.6+0x4a7b8)
...
``` 
After applying this PR, the example can be build and run with llvm or gcc, with or without asan.



Co-authored-by: Hendrik van Essen <hendrik.vanessen@ml-pa.com>
Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
2023-02-15 17:03:30 +00:00
Hendrik van Essen
3837536a73 drivers/at24cxxx: implement read_page for mtd 2023-02-15 11:56:21 +01:00
bors[bot]
1c55118bd8
Merge #18257
18257: drivers/wdt: add periph_wdt_auto_start for early watchdog r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-13 21:09:07 +00:00
Benjamin Valentin
80fe4e5f26 sys/auto_init: add auto_init_wdt_{event, thread} modules 2023-02-13 15:06:24 +01:00
bors[bot]
f22ce155bb
Merge #19252
19252: mtd: add fast path to mtd_write_page() r=benpicco a=benpicco




Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-08 00:52:25 +00:00
bors[bot]
f341ad6c9c
Merge #17045 #19243
17045: sys/coding: add XOR based coding module r=benpicco a=benpicco



19243: cpu/gd32v: add periph_gpio_ll and periph_gpio_ll_irq support r=benpicco a=gschorcht

### Contribution description

This PR provides the `periph_gpio_ll` and `periph_gpio_ll_irq` support for GD32VF103. Level triggered interrupts are emulated.

`periph_gpio_ll_irq` could be split off from this PR as a separate PR if necessary.

### Testing procedure

Use any GD32V board and connect PA0 -> PB0 and PA1 -> PB1 where PA is the output port and PB the input port. With these connections `tests/periph_gpio_ll` should work.
```
BOARD=sipeed-longan-nano make -j8 -C tests/periph_gpio_ll flash term
```

If necessary, change the input and output pins by setting the environment variables and connect the corresponding pins, for example for `seeedstudio-gd32` PA1 -> PB8 and PA8 -> PB9:
```
PIN_OUT_0=1 PIN_OUT_1=8  PIN_IN_0=8 PIN_IN_1=9 BOARD=seedstudio-gd32 make -j8 -C tests/periph_gpio_ll flash term
```

### Issues/PRs references


Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-07 17:39:20 +00:00
Gunar Schorcht
7e0d1df9c3 drivers/usbdev_synopsys_dwc2: add config type for GD32V 2023-02-07 00:49:42 +01:00