-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/native: Add support for periph_timer_query_freqs #20306
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this. The CI has same nitpicks, feel free to amend directly rather than using --fixup=
commits.
Btw: This is excellent first PR (unless I overlooked other PRs of you)!
cpu/native/periph/timer.c
Outdated
assert(dev < TIMER_NUMOF); | ||
|
||
if (index > 0) { | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0; | |
return 0; |
cpu/native/include/periph_conf.h
Outdated
@@ -49,7 +49,8 @@ extern "C" { | |||
* @name Timer peripheral configuration | |||
* @{ | |||
*/ | |||
#define TIMER_NUMOF (1U) | |||
#define TIMER_NUMOF (1U) | |||
#define TIMER_CHANNEL_NUMOF (1U) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define TIMER_CHANNEL_NUMOF (1U) | |
#define TIMER_CHANNEL_NUMOF (1U) /**< number of timer channels */ |
I'm well aware that the name is pretty self-documenting, but the CI insists on having this documented. The alternative would be to add this to the list of exceptions, but that is IMHO more effort that just documenting the obvious.
Add support for querying the frequency supported by `periph_timer`. This allows applications which require this feature to run on the `native` board. Signed-off-by: Armin Wolf <W_Armin@gmx.de>
d1902ad
to
6070c57
Compare
Contribution description
This pull request adds support for the
periph_timer_query_freqs
feature to thenative
platform.The feature allows software to query the supported frequency of the timer, which in this case is
a fixed frequency used internally for time conversions.
This allows software which depends on this feature to run on the
native
board. Since theperiph/timer
test expects all timers supporting this feature to also define
TIMER_CHANNEL_NUMOF
, the necessary definewas added to the CPU configuration.
Testing procedure
Build:
make BOARD=native -C tests/periph/timer flash test