This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I re-use timers?

Timers are defined by a macro: APP_TIMER_DEF. This unfortunately expands to: #define APP_TIMER_DEF(timer_id)
static app_timer_t timer_id##_data = { {0} };
static const app_timer_id_t timer_id = &timer_id##_data

Suppose I have several modules that are used depending on the configuration of some GPIO bits. Each module is implemented in a separate file. However, each module uses several timers, many of which ought to be shared, since the Nordic timer implementation is somewhat RAM-hungry.

Is my best option merely to define new macros such as #APP_TIMER_DEF_PUBLIC and #APP_TIMER_DEF_EXTERN, or is there a better approach?

Parents Reply Children
No Data
Related