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

348 Commits

Author SHA1 Message Date
Fabian Hüßler
66a7a0a065 drivers/periph: add VBAT interface 2022-02-20 13:43:19 +01:00
Francisco Molina
579ca6d941 drivers/periph_spi: spi_init_with_gpio_mode mode by reference 2022-01-18 16:22:18 +01:00
79df157727
sys: move rtc utility functions to their own module 2021-12-20 13:04:20 +01:00
benpicco
e8cbf1ea90
Merge pull request #16681 from benpicco/drivers/dose-collision
drivers/dose: make use of UART collision detection feature
2021-12-08 20:48:28 +01:00
b6cc07009f
Merge pull request #17284 from fjmolinas/pr_ztimer_no_periph_rtt
sys/ztimer: add 'ztimer_no_periph_rtt'
2021-12-02 11:02:24 +01:00
Francisco Molina
7c3360e4d6 sys/ztimer: add 'ztimer_no_periph_rtt'
This is a temporary fix for Issue #17060. It allows to disable
auto inclusion of `ztimer_periph_rtt` in cases where another
module or application requires direct access.

Limitations:
- as ifeq are involved order of inclusion matters, therefore
  these modules should be included early in the build at application
  level and not in modules `Makefile.dep`
- this does not disallow direct inclusions of `ztimer_periph_rtt`,
  since this only disables auto inclusion of these modules

This is a temporary solution since this is already possible with
Kconfig, but not in make.
2021-12-02 07:54:38 +01:00
Gunar Schorcht
3d93b2bcf0 drivers/periph/i2c: i2c_acquire() returns void
Since all implementations simply return 0 and most drivers do not check the return value, it is better to return void and use an assert to ensure that the given device identifier and given device parameters are correct.
2021-11-29 06:35:25 +01:00
Benjamin Valentin
1768e93710 drivers/periph: use uint_fast8_t as default type
The default driver type is just an index into a device array defined
by the board.

If a platform wants to encode additional information in the device type,
it can define a custom type.

This means we can just set the default type to whatever fits the target
CPU best.

On ARM this will still be a 32 bit word, but on AVR it will by a 8 bit byte.
2021-11-18 10:29:50 +01:00
597f1d19aa
usbdev: Refactor to xmit API
This API change refactors the usbdev API to supply buffers via the
usbdev_ep_xmit function. This changes from the usbdev_ep_ready call to allow
separate buffers per call. An usbdev_ep_buf_t pseudotype is available and must
be used when defining buffers used for endpoints to adhere to the DMA alignment
restrictions often required with usb peripherals.

Main advantage is that the usbdev peripherals no longer have to allocate
oversized buffers for the endpoint data, potentially saving multiple KiB
of unused buffer space. These allocations are now the responsibility of
the individual USB interfaces in the firmware
2021-11-16 11:21:07 +01:00
59e85cf921
usbdev: Refactor to xmit API
This API change refactors the usbdev API to supply buffers via the
usbdev_ep_xmit function. This changes from the usbdev_ep_ready call to allow
separate buffers per call. An usbdev_ep_buf_t pseudotype is available and must
be used when defining buffers used for endpoints to adhere to the DMA alignment
restrictions often required with usb peripherals.

Main advantage is that the usbdev peripherals no longer have to allocate
oversized buffers for the endpoint data, potentially saving multiple KiB
of unused buffer space. These allocations are now the responsibility of
the individual USB interfaces in the firmware
2021-11-16 11:21:00 +01:00
Benjamin Valentin
f89d0c7c25 drivers/periph/uart: add periph_uart_collision feature 2021-11-10 15:57:45 +01:00
benpicco
bfb8d1d3fd
Merge pull request #17014 from benpicco/periph/gpio-cb_not_NULL
drivers/periph/gpio: state that interrupt callback must not be NULL
2021-11-05 12:47:16 +01:00
Ollrogge
c6e94aa6be periph/flashpage.h: add comment about riotboot impact on flashpage layout 2021-10-26 14:35:33 +02:00
Francisco
7f3344870d
Merge pull request #16972 from Ollrogge/flashpage_pr
periph/flashpage: extend API
2021-10-26 12:51:05 +02:00
9f8aee4e95
usbdev: Deprecate USBDEV_EVENT_TR_FAIL 2021-10-24 19:33:29 +02:00
Ollrogge
72d47013dd periph/flashpage: extend API 2021-10-19 22:33:09 +02:00
Benjamin Valentin
f624eb473a drivers/periph/gpio: state that interrupt callback must not be NULL
This allows us to use `assert(cb != NULL)` inside `gpio_init_int()`
and save a few cycles of interrupt latency.
2021-10-19 21:26:50 +02:00
Benjamin Valentin
0ee0c5e40e drivers/periph: define periph_rtc_mem 2021-09-03 11:43:42 +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
Benjamin Valentin
f903ec90d4 drivers/flashpage: flashpage_page() takes a const argument
All addresses to flashpage_page() must be in flash. Flash memory is
`const`, therefore this function must also take `const` pointers.
2021-08-27 14:08:25 +02:00
benpicco
025770968b
Merge pull request #16036 from bergzand/pr/gd32vf103/initial
gd32v/seeedstudio-gd32: Initial support
2021-08-25 00:38:00 +02:00
Benjamin Valentin
75e2a65681 drivers/flashpage: add missing include 2021-08-24 14:30:23 +02:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
Marian Buschsieweke
9e5f7b6797
drivers/periph_spi: make spi_acquire() return void
There is no way to properly handle incorrect SPI parameters at run time, so
just having an assertion blow up is the better choice here.

As most instances of `spi_acquire()` don't check the return value anyway, this
will improve debugging experience quite a bit. Some implementation of
spi_acquire() don't even check parameters anyway.
2021-08-06 12:46:57 +02:00
benpicco
feac187d54
Merge pull request #16506 from benpicco/drivers/dose-rx_start
drivers/dose: make use of start condition received interrupt
2021-07-28 17:21:29 +02:00
Benjamin Valentin
9194440ead drivers/periph/uart: add periph_uart_rx_start feature 2021-07-27 16:29:30 +02:00
Marian Buschsieweke
e7cacf6f60
periph/uart: Fix doc, use errno for return values
Some terminology issues are fixed. (The speed of an UART interface is
the symbol rate. The unit it is measured in is baud, which is symbols
per second. There is no such thing as baudrate or even baud/s.)

The return codes are changed to use negative errno constants on error
to match the driver design rules. For backward compatibility, the
enum was updated to match the error codes. Unless an application
depends on the exact numerical value (which would be insane), this is
not breaking any code.
2021-07-09 17:06:01 +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
dcebc7d480 drivers/rtt_rtc: implement rtc_get_time_ms()
RTC on RTT usually runs at a frequency greater than 1 Hz, so sub-second
precision is available.
Add a function to get the current RTC timestamp together with it's sub-second
component.
2021-05-03 00:09:18 +02:00
Benjamin Valentin
917cf85225 drivers/periph: flashpage: add common helper functions 2021-04-27 16:52:36 +02:00
Marian Buschsieweke
40859b61f0
drivers/periph_spi: fix Doxygen commands
use @retval to document individual return values rather than @return
2021-03-17 10:34:20 +01:00
Marian Buschsieweke
b9cb75fedf
drivers/periph/rtt: add periph_rtt_set_counter feature
Some periph_rtt implementations do not provide `rtt_set_counter()`. This
adds `periph_rtt_set_counter` as feature to allow testing for its
availability. The feature is provided at CPU level if periph_rtt is
provided by the board for all CPUs implementing `rtt_set_counter()`.
2021-03-04 18:05:06 +01:00
Jean Pierre Dudey
a30184b5a9
Merge pull request #15896 from maribu/spi-api-cleanup
drivers/periph/spi: clean up error codes and doc
2021-02-27 01:09:49 +01:00
Marian Buschsieweke
acd9f4cc1a
drivers/periph_ptp: fix adjustment API
The clock adjustment API only used a 16 bit integer for speed correction. This
is to course grained to allow compensating clock drifts at high accuracy.
Using a 32 bit integer instead would allow to fix for a drift of up to
about 1 nanosecond drift per each 5 seconds.

That ought to be enough for anyone! (*cough* *cough*)
2021-02-10 09:55:52 +01:00
Francisco Molina
85caf7cbc7
drivers/flashpage: add FLASHPAGE_ERASE_STATE definition 2021-02-09 11:11:46 +01:00
c93c3e46d6
flashpage: Support non uniform flashpage sizes 2021-02-01 14:27:22 +01:00
Marian Buschsieweke
ae79f5fc59
drivers/periph/spi: clean up error codes and doc
- Use negative errno as error codes, rather than home-grown enums
    - Update the home-grown enum with negative errno codes for backward
      compatibility and mark it deprecated
- Update API doc to use negative errno codes
- Fix various style issues in Doxygen doc
    - Use `@retval` to document specific return values instead of abusing
      `@return` for this
    - Align parameters to proper indent level
2021-02-01 11:02:14 +01:00
Marian Buschsieweke
7d1edd51f4
drivers/periph: Added PTP clock API 2020-12-02 17:53:00 +01:00
Hauke Petersen
c4a8c45a3e periph/rtt: fix tick conversion macros 2020-11-16 10:00:24 +01:00
41bbaa7442
flashpage: Make pagewise API optional
flashpage currently requires pagewise implementation with an optional
extension for per block writes (flashpage_raw). Most implementations
with flashpage_raw implement the pagewise access via the flashpage_raw
functions. This commit makes the flashpage raw the main access method
and adds an extension feature for the pagewise access.

The functions and defines are renamed to reflect this. The API is also
extended with a dedicated function for erasing a sector.
2020-11-11 22:26:33 +01:00
Marian Buschsieweke
125c892c03
drivers/periph/timer: Use uint32_t for frequency
For all currently supported platforms `unsigned long` is 32 bit in width. But
better use `uint32_t` to be safe.
2020-10-30 22:02:12 +01:00
Bas Stottelaar
26835a949f drivers/*: remove unused assert.h include 2020-10-22 11:29:27 +02:00
dc8d32d30e
drivers/periph/gpio: fix typo 'occured' -> 'occurred' 2020-10-02 08:05:55 +02:00
MrKevinWeiss
7893158b5a drivers/dev_enums: Remove unused dev_enums.h 2020-09-24 09:27:39 +02:00
chrysn
9295f69da4
Merge pull request #15062 from kaspar030/fix_efm32_16b_timer_set_absolute
cpu/efm32/periph/timer: fix timer_set_absolute() in 16bit case
2020-09-23 11:28:00 +02:00
chrysn
d8d56e5e3a periph/timer: Document that set_absolute is expected to wrap
Most timers are implemented this way already, and keeping (documenting)
it that way allows the generic timer_set implementation to stay as
simple as it is.
2020-09-23 10:59:18 +02:00
MrKevinWeiss
cc1c2ab811 drivers/periph: Remove unused timer enum from dev_enums 2020-09-22 16:26:01 +02:00
Benjamin Valentin
696ddf3dbb drivers/periph/timer: amend documentation for timer_set_periodic()
The function needs the `periph_timer_periodic` feature.
Add a `@note` about that to the documentation.
2020-09-13 19:06:28 +02:00
MrKevinWeiss
bdeb39576e drivers/periph: Remove UART from dev_enums.h 2020-09-09 10:25:38 +02:00
benpicco
6f271b7d3e
Merge pull request #14903 from benpicco/drivers/include/periph/rtc-fix
drivers/periph_common: RTC: fix doxygen
2020-09-01 15:15:55 +02:00
Benjamin Valentin
bd57640d5b drivers/periph_common: RTC: fix doxygen 2020-08-31 14:16:42 +02:00
Gunar Schorcht
147b79169c drivers/periph/gpio: add comparison functions
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, drivers and other modules must first be changed so that they use the inline comparison functions.
2020-08-31 13:10:28 +02:00
Francisco
ad3568be87
Merge pull request #14712 from benpicco/gpio_init_int-clarify
periph/gpio: clarify behavior of gpio_irq_enable()
2020-08-11 11:30:05 +02:00
Benjamin Valentin
7543e714c1 drivers/periph_common: RTC: move RIOT_EPOCH to header, document it. 2020-08-07 13:22:19 +02:00
Benjamin Valentin
8c95198cbb periph/gpio: clarify behavior of gpio_irq_enable()
What happens with events that occured after `gpio_irq_disable()` is
currently not defined.
If they are not cleared, they will generate an interrupt on `gpio_irq_enable()`.

This does not seem like the intended behavior, so make the documentation more
explicit.
2020-08-05 17:41:27 +02:00
benpicco
ecab75b529
Merge pull request #13632 from benpicco/cpu/sam0_common/uart-deinit
drivers/periph/uart: add periph_uart_reconfigure feature & implementation for sam0
2020-07-28 11:12:19 +02:00
Benjamin Valentin
3eb54179ae drivers/periph/uart: add periph_uart_reconfigure feature 2020-07-28 10:10:15 +02:00
Benjamin Valentin
7af8a3e2d3 drivers/periph/timer: add note about TIM_FLAG_RESET_ON_MATCH 2020-07-27 17:17:08 +02:00
Francisco Molina
9dde6ec53d
drivers/rtt: overrite RTT_MAX_VALUE and RTT_FREQUENCY for mock
mock_rtt relies on setting mock values for RTT_MAX_VALUE and
RTT_FREQUENCY. Platforms with a rtt will already define these
values which leads to mock_rtt working with different values than
rtt_rtc.

This commit changes the ifdef logic so that when using mock_rtt
RTT_MAX_VALUE and RTT_FREQUENCY are redefined.
2020-07-22 08:52:54 +02:00
Benjamin Valentin
896fcd43b0 drivers/periph/spi: add periph_spi_reconfigure feature 2020-06-21 21:19:17 +02:00
Francisco Molina
8d329942df
drivers/periph/rtt: introduce RTT_MIN_OFFSET 2020-06-11 09:30:25 +02:00
Leandro Lanzieri
48759eccdc
drivers/wdt: Add feature to indicate a configurable warning period
This adds the feature `periph_wdt_warning_period` that indicates that a
platform WDT driver implementation supports a configurable
CONFIG_WDT_WARNING_PERIOD.
2020-06-02 12:54:25 +02:00
Benjamin Valentin
cd107be976 drivers/periph/timer: add timer_set_periodic() 2020-05-28 17:37:41 +02:00
Marian Buschsieweke
568404134a
drivers/periph/cpuid: Fix typo in doc 2020-05-14 16:53:05 +02:00
Francisco
cea0d1c532
Merge pull request #13421 from benpicco/cpu/sam0_common/i2c-deinit
drivers/periph/i2c: add periph_i2c_reconfigure feature & implementation for sam0
2020-05-05 19:09:47 +02:00
Benjamin Valentin
21958ff531 drivers/periph/i2c: add periph_i2c_reconfigure feature
It is often desireable to re-configure the pins of a bus back to GPIO mode,
either to save power when an external peripheral is turned off and current
would leak, or because a device may need a non-standard in-band signal to
be generated on the bus lines.

To serve those use cases, this patch introduces four new functions to the
I2C API:

 - `i2c_init_pins()`    equivalent to spi_init_pins(), restores I2C pin configuration

 - `i2c_deinit_pins()`  to switch the configuration of the I2C pins back to GPIO
                        mode and block access to the bus.

 - `i2c_pin_sda()`      to get the data pin for a given bus

 - `i2c_pin_scl()`      to get the clock pin for a given bus

Since it's unreasonable to expect having implementations for all platforms
already, those functions are only availiable when the periph_i2c_reconfigure
feature is availiable.

Applications should use FEATURES_REQUIRED += periph_i2c_reconfigure or
FEATURES_OPTIONAL if they want to make use of those functions.
2020-05-05 16:12:19 +02:00
Francisco Molina
0c0f8ec98f
drivers/periph/rtt.h: add RTT_FREQUENCY & RTT_MAX_VALUE doc 2020-04-23 22:11:16 +02:00
Francisco Molina
2604971753
drivers/periph/rtt.h: ensure RTT_MAX_VALUE is set 2020-04-23 19:07:18 +02:00
Leandro Lanzieri
00b71a2708
drivers/wdt: Move WDT_WARNING_PERIOD to 'CONFIG_' namespace 2020-03-31 13:39:37 +02:00
Benjamin Valentin
60cc3b8757 periph/rtt: Allow using MOCK_RTT defines from Unit Test 2020-03-19 15:25:14 +01:00
Benjamin Valentin
725311a054 periph_common/rtc: add rtc_tm_valid()
Add a function to verify all members of a struct tm are within
the valid range.
2020-03-03 16:26:14 +01:00
Benjamin Valentin
5b64ae4ef5 periph_common/rtc: add rtc_localtime()
Add function to convert a RTC timestamp (non-UNIX) to a time struct.
2020-03-03 11:01:02 +01:00
Benjamin Valentin
becff61e20 periph_common/rtc: add rtc_mktime()
Add a function to convert a time struct to an unsigned timestamp (non-UNIX).
2020-02-29 17:42:50 +01:00
Francisco
3e0043021b
Merge pull request #13110 from kaspar030/periph_rtt_docimp
periph/rtt: clarify rtt_set_alarm() documentation
2020-01-13 17:12:08 +01:00
4df2827fe1 periph/rtt: clarify rtt_set_alarm() documentation 2020-01-13 15:18:16 +01:00
Marian Buschsieweke
6e39b4d191
drivers/periph: adc_sample() now returns int32_t
Reasoning: This allow support for ADCs with resolution of more than 16 bits on
8 bit and 16 bit platforms.
2020-01-10 14:13:06 +01:00
c87748f563 periph: fix periph/gpio_util.h header guards 2019-11-23 22:39:40 +01:00
Francois Berder
4a31f94cfc many typo fixes
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-23 22:39:07 +01:00
abfa73193f
drivers/periph_pwm: define mapping struct for arduino pins 2019-11-15 17:51:45 +01:00
Benjamin Valentin
513a3a7d59 periph_common/rtc: add rtc_tm_compare()
Add an easy way to compare two points in time.
2019-11-05 12:52:45 +01:00
9eee6bc0a1
usbdev: Fix spelling mistakes 2019-10-23 10:36:49 +02:00
Hauke Petersen
7f419f4381 periph/uart: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
0cd8bb47c8 periph/timer: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
4914e6484a periph/spi: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
44c54c2ae0 periph/rtt: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
bf5ad17b9d periph/rtc: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
711af7cc27 periph/hwrng.h: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
3e9ee01103 periph/gpio: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
e71f0bb0c6 periph/flashpage: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
8ef4f0d134 periph/dac.h: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
348b337023 periph/cpuid: add doc on low power implications 2019-10-01 23:09:23 +02:00
Hauke Petersen
f361ebc0bd periph/adc: add doc on low power implications 2019-10-01 23:09:23 +02:00
Gunar Schorcht
02d81b717e
Merge pull request #12063 from maribu/i2c_release
drivers/periph/i2c: Updated i2c_release() to return void
2019-10-01 19:50:38 +02:00
benpicco
d5c272ed86
Merge pull request #12199 from smlng/fix_timer_returns
periph/timer: Fix return codes of timer API
2019-09-17 23:04:46 +02:00
aed12b4853
Merge pull request #11252 from fjmolinas/pr_wdg_stm32
cpu/stm32_common: add watchdog for stm32
2019-09-13 09:16:18 +02:00
Dylan Laduranty
513b767694
Merge pull request #11944 from benpicco/spi_doc-fix
drivers/include/periph/spi: fix documentation
2019-09-12 21:28:21 +02:00
Francisco Molina
cb876297a8 drivers/periph: include periph_cpu.h in wdt.h 2019-09-12 17:45:31 +02:00
Benjamin Valentin
fa9e9064cf periph_common/rtc: add rtc_tm_normalize() 2019-09-12 11:32:08 +02:00
Sebastian Meiling
ed5f085b30 periph/timer: always return 0 for success
Change documentation on return codes in periph/timer API to
return 0 on success and (-1) on error by default.
For timer_init this was already the case, but for timer_set,
timer_set_absolute, and timer_clear this is now changed
from 1 to 0 for success, while error remains (-1).
2019-09-11 13:31:13 +02:00
Marian Buschsieweke
5bba339a7c
drivers/periph/i2c: Fixed i2c_release() signature
i2c_release() should not have a return value, as:

- There is no reasonable error handling possible by the caller, so there is no
  value in indicating success/failure via the return value to the caller
- There is no legitimate reason to fail *unless* an invalid I2C bus was released
  or an I2C bus that was not previously acquired was released
    --> This would indicate a bug in the code and should be tackled by an
        assert()
2019-08-22 12:02:01 +02:00