1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00

Merge pull request #13909 from fjmolinas/pr_stm32_rtt

cpu/stm32_common: make RTT_FREQUENCY configurable
This commit is contained in:
Alexandre Abadie 2020-05-05 16:45:39 +02:00 committed by GitHub
commit 343dc3f90f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View File

@ -31,8 +31,15 @@ extern "C" {
* On the STM32Lx platforms, we always utilize the LPTIM1.
* @{
*/
#define RTT_FREQUENCY (1024U) /* 32768 / 2^n */
#define RTT_MAX_VALUE (0x0000ffff) /* 16-bit timer */
#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */
#define RTT_MAX_VALUE (0x0000ffff) /* 16-bit timer */
#define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* 32768Hz at @32768Hz */
#define RTT_MIN_FREQUENCY (RTT_CLOCK_FREQUENCY / 128) /* 256Hz at @32768Hz */
#ifndef RTT_FREQUENCY
#define RTT_FREQUENCY (RTT_MAX_FREQUENCY) /* in Hz */
#endif
/** @} */
#ifdef __cplusplus

View File

@ -24,6 +24,7 @@
#include "periph_cpu.h"
#include "f4/cfg_clock_100_8_1.h"
#include "cfg_i2c1_pb8_pb9.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_tim5.h"
#include "cfg_usb_otg_fs.h"
@ -217,8 +218,9 @@ static const spi_conf_t spi_config[] = {
* @name RTT configuration
* @{
*/
#ifndef RTT_FREQUENCY
#define RTT_FREQUENCY (4096)
#define RTT_MAX_VALUE (0xffff)
#endif
/** @} */
#ifdef __cplusplus

View File

@ -6,3 +6,11 @@ FEATURES_REQUIRED = periph_rtt
DISABLE_MODULE += periph_init_rtt
include $(RIOTBASE)/Makefile.include
# Put board specific dependencies here
ifneq (,$(filter-out stm32f1,$(filter stm32%,$(CPU))))
# all stm32% but stm32f1 RTT are based on a 16 bit LPTIM, if using the default
# 32768KHz configuration TICKS_TO_WAIT will overflow
RTT_FREQUENCY ?= 1024
CFLAGS += -DRTT_FREQUENCY=$(RTT_FREQUENCY)
endif