Skip to content

Commit f95babb

Browse files
committed
STM32: Add LP_TICKER and US_TICKER optimisation define
1 parent 9738b27 commit f95babb

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

targets/TARGET_STM/device.h

+3
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@
3737

3838
#include "objects.h"
3939

40+
#include "us_ticker_defines.h"
41+
#include "lp_ticker_defines.h"
42+
4043
#endif
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* mbed Microcontroller Library
2+
* SPDX-License-Identifier: BSD-3-Clause
3+
******************************************************************************
4+
*
5+
* Copyright (c) 2015-2021 STMicroelectronics.
6+
* All rights reserved.
7+
*
8+
* This software component is licensed by ST under BSD 3-Clause license,
9+
* the "License"; You may not use this file except in compliance with the
10+
* License. You may obtain a copy of the License at:
11+
* opensource.org/licenses/BSD-3-Clause
12+
*
13+
******************************************************************************
14+
*/
15+
16+
#ifndef __LP_TICKER_DEFINES_H
17+
#define __LP_TICKER_DEFINES_H
18+
19+
#define LP_TICKER_PERIOD_NUM 1000000
20+
21+
#if MBED_CONF_TARGET_LPTICKER_LPTIM
22+
23+
#if MBED_CONF_TARGET_LSE_AVAILABLE
24+
#define LP_TICKER_PERIOD_DEN (LSE_VALUE / MBED_CONF_TARGET_LPTICKER_LPTIM_CLOCK)
25+
#else
26+
#define LP_TICKER_PERIOD_DEN (LSI_VALUE / MBED_CONF_TARGET_LPTICKER_LPTIM_CLOCK)
27+
#endif
28+
#define LP_TICKER_MASK 0xFFFF // 16 bits
29+
30+
#else // MBED_CONF_TARGET_LPTICKER_LPTIM == 0 => Use RTC WAKEUP timer
31+
32+
#if MBED_CONF_TARGET_LSE_AVAILABLE
33+
#define LP_TICKER_PERIOD_DEN (LSE_VALUE / 4) // RTC_CLOCK / RTC_WAKEUPCLOCK_RTCCLK_DIV4
34+
#else
35+
#define LP_TICKER_PERIOD_DEN (LSI_VALUE / 4) // RTC_CLOCK / RTC_WAKEUPCLOCK_RTCCLK_DIV4
36+
#endif
37+
#define LP_TICKER_MASK 0xFFFFFFFF // 32 bits
38+
39+
#endif // MBED_CONF_TARGET_LPTICKER_LPTIM
40+
41+
#endif // __LP_TICKER_DEFINES_H

0 commit comments

Comments
 (0)