Skip to content

Commit 0fef823

Browse files
committed
Add documentation for LP_TICKER defines
They're now potentially useful, so document them as per the US_TICKER defines.
1 parent 70c3b1a commit 0fef823

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

TESTS/mbed_hal/lp_ticker/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ void lp_ticker_info_test()
110110
TEST_ASSERT(p_ticker_info->frequency >= 4000);
111111
TEST_ASSERT(p_ticker_info->frequency <= 64000);
112112
TEST_ASSERT(p_ticker_info->bits >= 12);
113+
114+
#ifdef LP_TICKER_PERIOD_NUM
115+
TEST_ASSERT_UINT32_WITHIN(1, 1000000 * LP_TICKER_PERIOD_DEN / LP_TICKER_PERIOD_NUM, p_ticker_info->frequency);
116+
TEST_ASSERT_EQUAL_UINT32(LP_TICKER_MASK, ((uint64_t)1 << p_ticker_info->bits) - 1);
117+
#endif
118+
113119
}
114120

115121
#if DEVICE_SLEEP

hal/lp_ticker_api.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ extern "C" {
4949
*
5050
* @see hal_lp_ticker_tests
5151
*
52+
* # Compile-time optimization macros
53+
*
54+
* To permit compile-time optimization, the following macros can be defined by a target's device.h:
55+
*
56+
* LP_TICKER_PERIOD_NUM, LP_TICKER_PERIOD_DEN: These denote the ratio (numerator, denominator)
57+
* of the ticker period to a microsecond. For example, a 64kHz ticker would have NUM = 125, DEN = 8;
58+
* a 4kHz ticker would have NUM = 250, DEN = 1; a 32.768kHz ticker would have NUM = 15625, DEN = 512.
59+
* Both numerator and denominator must be 16 bits or less.
60+
*
61+
* LP_TICKER_MASK: The value mask for the ticker - eg 0x07FFFFFF for a 27-bit ticker.
62+
*
63+
* If any are defined, all 3 must be defined, and the macros are checked for consistency with
64+
* lp_ticker_get_info by test ::lp_ticker_info_test.
65+
5266
* @{
5367
*/
5468

0 commit comments

Comments
 (0)