File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,12 @@ void lp_ticker_info_test()
110
110
TEST_ASSERT (p_ticker_info->frequency >= 4000 );
111
111
TEST_ASSERT (p_ticker_info->frequency <= 64000 );
112
112
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
+
113
119
}
114
120
115
121
#if DEVICE_SLEEP
Original file line number Diff line number Diff line change @@ -49,6 +49,22 @@ extern "C" {
49
49
*
50
50
* @see hal_lp_ticker_tests
51
51
*
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 32 bits or less. They do not need to be fully simplified,
60
+ * so 32.768kHz could also be NUM = 1000000, DEN = 32768, but more simplification may be a minor
61
+ * speed optimisation, as can matching numerator or denominator with US_TICKER.
62
+ *
63
+ * LP_TICKER_MASK: The value mask for the ticker - eg 0x07FFFFFF for a 27-bit ticker.
64
+ *
65
+ * If any are defined, all 3 must be defined, and the macros are checked for consistency with
66
+ * lp_ticker_get_info by test ::lp_ticker_info_test.
67
+
52
68
* @{
53
69
*/
54
70
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ extern "C" {
50
50
* US_TICKER_PERIOD_NUM, US_TICKER_PERIOD_DEN: These denote the ratio (numerator, denominator)
51
51
* of the ticker period to a microsecond. For example, an 8MHz ticker would have NUM = 1, DEN = 8;
52
52
* a 1MHz ticker would have NUM = 1, DEN = 1; a 250kHz ticker would have NUM = 4, DEN = 1.
53
- * Both numerator and denominator must be 16 bits or less.
53
+ * Both numerator and denominator must be 16 bits or less, but need not be fully simplified .
54
54
*
55
55
* US_TICKER_MASK: The value mask for the ticker - eg 0x07FFFFFF for a 27-bit ticker.
56
56
*
You can’t perform that action at this time.
0 commit comments