Skip to content

Relax us ticker frequency requirement + test update #11157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion TESTS/mbed_hal/us_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ void us_ticker_info_test()
const ticker_info_t *p_ticker_info = us_ticker_get_info();

TEST_ASSERT(p_ticker_info->frequency >= 250000);
TEST_ASSERT(p_ticker_info->frequency <= 8000000);

switch (p_ticker_info->bits) {
case 32:
TEST_ASSERT(p_ticker_info->frequency <= 100000000);
break;

default:
TEST_ASSERT(p_ticker_info->frequency <= 8000000);
break;
}

TEST_ASSERT(p_ticker_info->bits >= 16);

#ifdef US_TICKER_PERIOD_NUM
Expand Down
5 changes: 4 additions & 1 deletion TESTS/mbed_hal/us_ticker/us_ticker_api_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ extern "C" {
*
* Given ticker is available.
* When ticker information data is obtained.
* Then ticker information indicate that frequency between 250KHz and 8MHz and the counter is at least 16 bits wide.
* Then ticker information indicate that:
* - counter frequency is between 250KHz and 8MHz for counters which are less than 32 bits wide
* - counter frequency is up to 100MHz for counters which are 32 bits wide
* - the counter is at least 16 bits wide.
*/
void us_ticker_info_test(void);

Expand Down
3 changes: 2 additions & 1 deletion hal/us_ticker_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ extern "C" {
* Low level interface to the microsecond ticker of a target
*
* # Defined behavior
* * Has a reported frequency between 250KHz and 8MHz - Verified by test ::us_ticker_info_test
* * Has a reported frequency between 250KHz and 8MHz for counters which are less than 32 bits wide - Verified by test ::us_ticker_info_test
* * Has a reported frequency up to 100MHz for counters which are 32 bits wide - Verified by test ::us_ticker_info_test
* * Has a counter that is at least 16 bits wide - Verified by test ::us_ticker_info_test
* * All behavior defined by the @ref hal_ticker_shared "ticker specification"
*
Expand Down