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

Merge pull request #18783 from jue89/fix/ztimer_lptimer_kconfig

sys/ztimer: model ztimer_periph_lptimer for Kconfig
This commit is contained in:
Juergen Fitschen 2022-11-02 13:56:05 +01:00 committed by GitHub
commit 84c89f9dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 0 deletions

View File

@ -20,3 +20,4 @@ config BOARD_XG23_PK6068A
# Put other features for this board (in alphabetical order)
select HAVE_SAUL_GPIO
select HAVE_ZTIMER_PERIPH_LPTIMER

View File

@ -1,3 +1,7 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
ifneq (,$(filter ztimer_msec ztimer_sec,$(USEMODULE)))
USEMODULE += ztimer_periph_lptimer
endif

View File

@ -35,6 +35,16 @@ extern "C" {
*/
#define PM_BLOCKER_INITIAL { 0, 0, 0 }
/**
* @name ztimer configuration
* @{
*/
#define CONFIG_ZTIMER_LPTIMER_DEV TIMER_DEV(1)
#define CONFIG_ZTIMER_LPTIMER_FREQ LFXO_FREQ
#define CONFIG_ZTIMER_LPTIMER_WIDTH 24
#define CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE EFM32_PM_MODE_EM3
/** @} */
/**
* @brief Power mode required for GPIO IRQs
*

View File

@ -61,6 +61,13 @@ extern "C" {
#define CONFIG_ZTIMER_USEC_DEV (TIMER_DEV(0))
#endif
/**
* @brief Default width of ZTIMER_LPTIMER
*/
#ifndef CONFIG_ZTIMER_LPTIMER_WIDTH
#define CONFIG_ZTIMER_LPTIMER_WIDTH (32)
#endif
/**
* @brief ZTIMER_USEC optimal minimum value for ztimer_set()
*
@ -114,6 +121,13 @@ extern "C" {
# endif
#endif
/**
* @brief The minimum pm mode required for ZTIMER_LPTIMER to run
*/
#ifndef CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE
# define CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
#endif
/**
* @brief The minimum pm mode required for ZTIMER_RTT to run
*/

View File

@ -5,6 +5,11 @@
# directory for more details.
#
config HAVE_ZTIMER_PERIPH_LPTIMER
bool
help
Indicates that ZTIMER_PERIPH_LPTIMER configuration is available.
menu "ztimer - High level timer abstraction layer"
config ZTIMER_CUSTOM_BACKEND_CONFIGURATION
@ -39,6 +44,10 @@ config MODULE_ZTIMER_PERIPH_TIMER
depends on HAS_PERIPH_TIMER
select MODULE_PERIPH_TIMER
config MODULE_ZTIMER_PERIPH_LPTIMER
bool "Low-power Timer peripheral"
select MODULE_ZTIMER_PERIPH_TIMER
endmenu # Backends
menu "Clocks"
@ -62,7 +71,9 @@ config MODULE_ZTIMER_MSEC
choice ZTIMER_MSEC_BACKEND
bool "Backend"
depends on MODULE_ZTIMER_MSEC
default ZTIMER_MSEC_BACKEND_LPTIMER if HAVE_ZTIMER_PERIPH_LPTIMER
default ZTIMER_MSEC_BACKEND_RTT if !MODULE_ZTIMER_NO_PERIPH_RTT
default ZTIMER_MSEC_BACKEND_TIMER
config ZTIMER_MSEC_BACKEND_TIMER
bool "Timer"
@ -73,6 +84,11 @@ config ZTIMER_MSEC_BACKEND_RTT
depends on HAS_PERIPH_RTT
select MODULE_ZTIMER_PERIPH_RTT
config ZTIMER_MSEC_BACKEND_LPTIMER
bool "Low Power Timer"
depends on HAVE_ZTIMER_PERIPH_LPTIMER
select MODULE_ZTIMER_PERIPH_LPTIMER
endchoice
config MODULE_ZTIMER_SEC
@ -82,7 +98,9 @@ config MODULE_ZTIMER_SEC
choice
bool "Backend"
depends on MODULE_ZTIMER_SEC
default ZTIMER_SEC_BACKEND_LPTIMER if HAVE_ZTIMER_PERIPH_LPTIMER
default ZTIMER_SEC_BACKEND_RTT if !MODULE_ZTIMER_NO_PERIPH_RTT
default ZTIMER_SEC_BACKEND_TIMER
config ZTIMER_SEC_BACKEND_TIMER
bool "Timer"
@ -98,6 +116,11 @@ config ZTIMER_SEC_BACKEND_RTC
depends on HAS_PERIPH_RTC
select MODULE_ZTIMER_PERIPH_RTC
config ZTIMER_SEC_BACKEND_LPTIMER
bool "Low Power Timer"
depends on HAVE_ZTIMER_PERIPH_LPTIMER
select MODULE_ZTIMER_PERIPH_LPTIMER
endchoice
endmenu # Clocks

View File

@ -41,6 +41,10 @@ ifneq (,$(filter ztimer_convert_%,$(USEMODULE)))
USEMODULE += ztimer_convert
endif
ifneq (,$(filter ztimer_periph_lptimer,$(USEMODULE)))
USEMODULE += ztimer_periph_timer
endif
ifneq (,$(filter ztimer_periph_timer,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer
endif