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()`.
This commit is contained in:
Marian Buschsieweke 2021-03-03 17:05:35 +01:00
parent 720b350f6f
commit b9cb75fedf
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
11 changed files with 13 additions and 1 deletions

View File

@ -8,6 +8,7 @@ FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_eeprom
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_timer_periodic
FEATURES_PROVIDED += periph_wdt
FEATURES_PROVIDED += puf_sram

View File

@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_flashpage_pagewise
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_uart_modecfg
FEATURES_PROVIDED += periph_uart_nonblocking
FEATURES_PROVIDED += periph_wdt

View File

@ -13,6 +13,7 @@ FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_flashpage_pagewise
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_wdt
FEATURES_CONFLICT += periph_rtc:periph_rtt

View File

@ -9,3 +9,4 @@ FEATURES_PROVIDED += esp_wifi_enterprise
FEATURES_PROVIDED += periph_adc_ctrl
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_rtt_set_counter

View File

@ -7,3 +7,4 @@ include $(RIOTCPU)/esp_common/Makefile.features
FEATURES_PROVIDED += arch_esp8266
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt_set_counter

View File

@ -1,6 +1,7 @@
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_wdt
include $(RIOTCPU)/riscv_common/Makefile.features

View File

@ -14,6 +14,7 @@ endif
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_gpio_irq
FEATURES_PROVIDED += periph_rtt_set_counter
# Parse parameters from CPU_MODEL using the kinetis-info.mk script in the same
# directory as this Makefile.

View File

@ -4,6 +4,7 @@ FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_flashpage_pagewise
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_temperature
FEATURES_PROVIDED += periph_timer_periodic
FEATURES_PROVIDED += periph_uart_modecfg

View File

@ -12,6 +12,7 @@ FEATURES_PROVIDED += periph_flashpage_pagewise
FEATURES_PROVIDED += periph_flashpage_rwee
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_i2c_reconfigure
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_spi_reconfigure
FEATURES_PROVIDED += periph_timer_periodic # implements timer_set_periodic()
FEATURES_PROVIDED += periph_uart_modecfg

View File

@ -28,6 +28,7 @@ endif
ifeq (f1,$(CPU_FAM))
FEATURES_CONFLICT += periph_rtc:periph_rtt
FEATURES_CONFLICT_MSG += "On the STM32F1, the RTC and RTT map to the same hardware peripheral."
FEATURES_PROVIDED += periph_rtt_set_counter
endif
# Not all F4 and L0 parts implement a RNG.

View File

@ -191,9 +191,11 @@ void rtt_clear_overflow_cb(void);
uint32_t rtt_get_counter(void);
/**
* @brief Set the RTT counter to a specified value.
* @brief Set the RTT counter to a specified value.
*
* @param[in] counter The value to set the RTT to.
*
* @note This function is only provided when the feature `periph_rtt_set_counter` is provided
*/
void rtt_set_counter(uint32_t counter);