Skip to content

Commit 69bfc34

Browse files
authored
Merge pull request #11157 from mprse/us_ticker_freq_fix
Relax us ticker frequency requirement + test update
2 parents be23d3c + 6faf480 commit 69bfc34

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

TESTS/mbed_hal/us_ticker/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ void us_ticker_info_test()
3232
const ticker_info_t *p_ticker_info = us_ticker_get_info();
3333

3434
TEST_ASSERT(p_ticker_info->frequency >= 250000);
35-
TEST_ASSERT(p_ticker_info->frequency <= 8000000);
35+
36+
switch (p_ticker_info->bits) {
37+
case 32:
38+
TEST_ASSERT(p_ticker_info->frequency <= 100000000);
39+
break;
40+
41+
default:
42+
TEST_ASSERT(p_ticker_info->frequency <= 8000000);
43+
break;
44+
}
45+
3646
TEST_ASSERT(p_ticker_info->bits >= 16);
3747

3848
#ifdef US_TICKER_PERIOD_NUM

TESTS/mbed_hal/us_ticker/us_ticker_api_tests.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ extern "C" {
3131
*
3232
* Given ticker is available.
3333
* When ticker information data is obtained.
34-
* Then ticker information indicate that frequency between 250KHz and 8MHz and the counter is at least 16 bits wide.
34+
* Then ticker information indicate that:
35+
* - counter frequency is between 250KHz and 8MHz for counters which are less than 32 bits wide
36+
* - counter frequency is up to 100MHz for counters which are 32 bits wide
37+
* - the counter is at least 16 bits wide.
3538
*/
3639
void us_ticker_info_test(void);
3740

hal/us_ticker_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ extern "C" {
3232
* Low level interface to the microsecond ticker of a target
3333
*
3434
* # Defined behavior
35-
* * Has a reported frequency between 250KHz and 8MHz - Verified by test ::us_ticker_info_test
35+
* * Has a reported frequency between 250KHz and 8MHz for counters which are less than 32 bits wide - Verified by test ::us_ticker_info_test
36+
* * Has a reported frequency up to 100MHz for counters which are 32 bits wide - Verified by test ::us_ticker_info_test
3637
* * Has a counter that is at least 16 bits wide - Verified by test ::us_ticker_info_test
3738
* * All behavior defined by the @ref hal_ticker_shared "ticker specification"
3839
*

0 commit comments

Comments
 (0)