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

1934 Commits

Author SHA1 Message Date
benpicco
2bce94a7c7
Merge pull request #21012 from benpicco/netdev_new_api-relax
netdev_new_api: allow `.send()` to return > 0 to signal synchronos send
2024-11-20 22:28:26 +00:00
Benjamin Valentin
a86411b81e drivers/netdev: allow .send() to return > 0 to signal synchronos send 2024-11-20 16:40:36 +01:00
Marian Buschsieweke
04f1597792
drivers/periph_timer: fix timer_query_freqs() doc
The code examples in the doc contained an obvious bug that this commit
fixes.
2024-11-18 21:27:41 +01:00
Marian Buschsieweke
51f969d655
Merge pull request #20993 from benpicco/netdev_new_api-enhance
gnrc_netif: netdev_new_api implies TX end irq, no need to check it
2024-11-17 08:45:19 +00:00
Benjamin Valentin
dbd52079e1 drivers/netdev: revise return values of .confirm_send() 2024-11-15 14:18:58 +01:00
Benjamin Valentin
fbd1ffe2f1 drivers/netdev: hide legacy events behind netdev_legacy_api 2024-11-14 17:11:28 +01:00
Marian Buschsieweke
2b6f65a08a
build_system/xfa: change API to fix alignment
This changes the API of xfa from

    XFA(array_name, prio) type element_name = INITIALIZER;

to

    XFA(type, array_name, prio) element_name = INITIALIZER;

this allows forcing natural alignment of the type, fixing failing tests
on `native64`.
2024-11-07 16:30:01 +01:00
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
Virgile Robles
7c68f00cd1 drivers/dht: test and doc 2024-10-21 15:13:23 +02:00
Mikolai Gütschow
f0e6776d40
treewide: apply codespell corrections 2024-10-09 13:03:52 +02:00
chrysn
f116a78de8 doc: Clarify that our CPU ID is not ARM's CPUID 2024-09-27 10:42:17 +02:00
Jan Romann
947a5043c3 drivers/sx127x: fix link formatting in documentation 2024-08-20 14:19:27 +02:00
Marian Buschsieweke
a6b459eff3
drivers/periph/gpio_ll: change gpio_ll_switch_dir API
It turns out that the feature to switch the GPIO direction quickly
is not only a way to emulate open drain / open source mode for less
sophisticated GPIO peripherals that do not natively support it.
It also enables tri-state output (push-pull high, push-pull low,
high impedance), which is useful e.g. for driven charlieplexed LEDs
quickly.

This changes the API by introducing a `gpio_ll_prepare_switch_dir()`
function that prepares the value used to identify which pins should
be switched to input or to output mode. This is useful for GPIO
peripherals in which the GPIO mode register does not allocate one bit
per pin (so that only the direction is given there), such as the one
for STM32. This allows an STM32 implementation in which preparing the
bitmask needed to modify the direction of pins is not trivial.
2024-08-08 16:22:36 +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
Mikolai Gütschow
b0b3b071d3
drivers/led: add LED_NUMOF and convenience inline functions 2024-07-11 14:48:16 +02:00
Leandro Lanzieri
ebf64133d7
drivers: add max31855 2024-06-12 13:11:45 +02:00
Mihai Renea
5a7d553b8e drivers/at: expose some internal API 2024-05-28 12:20:54 +02:00
Stefan Schmidt
9d62ad4c5c driver/w5500: driver for the W5500 ethernet chip
- driver can be used with interrupt or in polling mode (default)
2024-05-02 22:07:17 +02:00
krzysztof-cabaj
a813e9728b drivers/led: add LEDX_IS_PRESENT defines 2024-04-29 16:25:32 +02:00
Marian Buschsieweke
8cff167a93
Merge pull request #20588 from crasbe/master
drivers/at24cxxx: Add M24C01 device and enhance documentation
2024-04-17 08:40:04 +00:00
crasbe
251b525e7e drivers/at24cxxx: add documentation about driver usage 2024-04-16 18:06:03 +02:00
Teufelchen
5bc8ca5318
Merge pull request #18093 from Ollrogge/remove_flashpage_free_funcs
periph/flashpage: remove deprecated flashpage_*_free functions
2024-04-16 08:47:11 +00:00
Marian Buschsieweke
cf6fa4edf0
tree wide: add IWYU pragma: export where needed
We occasionally have some public `foo.h` header that includes a private
`foo_arch.h` header. Users are expected to include the `foo.h` header
and not the `foo_arch.h`. However, clangd will claim that the `#include`
of `foo.h` is unused if only functions / macros/ types / ... from
`foor_arch.h` is used and nothing from `foo.h`.

This adds the `IWYU pragma: export` comment to the include of
`foo_arch.h` in `foo.h`, so that clangd treats functions / macros /
types provided by `foo_arch.h` as if they were instead provided by
`foo.h`, which fixes the false positives.
2024-04-14 14:26:05 +02:00
Ollrogge
10c987eb66 Revert "periph/flashpage: extend API"
This reverts commit 72d47013dd.
2024-04-04 17:57:40 +02:00
MrKevinWeiss
2ace90a8fc
drivers/lsm6dsxx: Allow non-specific variant 2024-03-26 18:13:19 +01:00
Mihai Renea
63e057cb50 drivers/at: Fix sync URC handling. at_send_cmd_get_lines() keeps EOL. 2024-03-20 14:32:09 +01:00
benpicco
17ec57ee6d
Merge pull request #20488 from dylad/pr/usbus/remove_deprecated_event
periph_usbdev: remove deprecated event flag
2024-03-19 19:49:04 +00:00
Dylan Laduranty
6fdc00a1b5 drivers/periph/usbdev: remove deprecated event flag
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-03-19 16:41:27 +01:00
Teufelchen
de176a8ef3
Merge pull request #20407 from chrysn-pull-requests/drop-rgbled
drivers/rgbled: Remove driver
2024-03-19 11:12:37 +00:00
Kasper Hjort Berthelsen
9ba76c38be drivers/mtd: update docs to match implementation
some parts reported retvals of number of bytes written, when it should be 0 on success.
2024-03-13 14:35:19 +01:00
benpicco
5c9240970e
Merge pull request #18608 from benpicco/mtd_flashpage-aux
drivers/mtd_flashpage: allow to define AUX slot on flash
2024-02-28 12:58:18 +00:00
Benjamin Valentin
e3819ca960 drivers/mtd_flashpage: define mtd_flash_aux_slot device 2024-02-28 11:49:05 +01:00
Benjamin Valentin
e8a4defafd drivers/pcf857x: stop (ab)using gpio_t
The driver only supports addressing GPIOs by their index, (ab)using
`gpio_t` for that will break on platforms that encode GPIO values
differently.
2024-02-27 16:31:59 +01:00
Gilles DOFFE
04c8d442da drivers/pcf857x: fix missing include kernel_defines.h
If not included before, IS_USED macro from modules.h is undefined,
leading to such errors:
  error: missing binary operator before token "("

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-02-24 16:55:05 +01:00
Mihai Renea
c58b71b899 drivers/at: parse +CME/+CMS responses and save error value 2024-02-22 12:21:25 +01:00
chrysn
fb2002d84a drivers/rgbled: Remove driver
The driver is largely unused, and redundant with the saul_pwm_rgb_params
functionality of SAUL.
2024-02-21 15:44:05 +01:00
chrysn
756a384442 makefiles, treewide: Remove MCU variable 2024-02-18 20:46:09 +01:00
Marian Buschsieweke
f68f977274
Merge pull request #20312 from maribu/drivers/periph_common/spi/transfer_u16
drivers/periph_spi: Add `spi_transfer_u16_be()`
2024-02-12 16:24:10 +00:00
Marian Buschsieweke
6fb369d4fc
drivers/periph/gpio_ll: Add API to switch direction
This adds two functions:

    void gpio_ll_switch_dir_output(gpio_port_t port, uword_t outputs);
    void gpio_ll_switch_dir_input(gpio_port_t port, uword_t inputs);

The first configures GPIO pins specified by a bitmask as output, the
second configures the specified pins as input.

The main use case is to allow bit-banging bidirectional protocols using
more basic GPIO peripherals that do not implement open drain mode, such
as found e.g. on MSP430, ATmega, or SAM0.

It is not intended to implement this feature on modern MCUs with
sophisticated GPIO peripherals.
2024-02-05 10:56:16 +01:00
Marian Buschsieweke
8bf61336a2
Merge pull request #20290 from maribu/drivers/periph/gpio_ll/features
drivers/periph_gpio_ll: Fix GPIO_DISCONNECT handling and add compile time feature checks
2024-02-05 07:30:54 +00:00
Marian Buschsieweke
87abafb13f
drivers/periph_spi: Add spi_transfer_u16_be()
This adds a helper function to exchange a 16 bit number that is to
be transferred in big endian order on the wire.
2024-02-02 13:05:02 +01:00
Martine Lenders
34fcffe37b
Merge pull request #20170 from miquel-b/lsm6dsxx
drivers/lsm6dsxx: refactoring Lsm6dsl into common driver Lsm6dsxx
2024-01-30 19:07:04 +00: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
00cb9668ae
drivers/periph_gpio_ll: Improve documentation
The documentation on the state `GPIO_DISCONNECT` was a bit vague. The
API doc said it should disconnect the GPIO from all peripherals, the
test also tested them for being electrically disconnected.

The documentation in both the test and the API is extended to point out
that a GPIO indeed SHOULD be in high impedance state, but that user
MUST NOT expect that this requested is honored by every implementation
and for every GPIO pin.

In the test it is also pointed out that failing the test for a GPIO
in the `GPIO_DISCONNECT` state being electrically disconnected is for
some pins expected, and that the test should be just run again with
different GPIOs. The test intentionally tests for a feature not provided
by every GPIO pin rather than warning on a failure: The effort to just
flash and run the test again with different GPIOs is relatively low, but
it does confirm correct behavior of the API.
2024-01-22 10:28:35 +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
Miquel-HAW
c79631c6a5 drivers/lsm6dsxx: Replace all lsm6dsl with lsm6dsxx in the files 2024-01-18 14:20:56 +01:00
Miquel-HAW
ce987ccddd drivers/lsm6dsxx: dir and file renaming 2024-01-18 14:20:56 +01:00