Skip to content

Make event queue use RTOS tick count #6693

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 1 commit into from
Apr 27, 2018
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
11 changes: 10 additions & 1 deletion events/equeue/equeue_mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
#include <stdbool.h>
#include "mbed.h"

// Ticker operations
#if MBED_CONF_RTOS_PRESENT

unsigned equeue_tick() {
return osKernelGetTickCount();
}

#else

#if MBED_CONF_EVENTS_USE_LOWPOWER_TIMER_TICKER
#define ALIAS_TIMER LowPowerTimer
#define ALIAS_TICKER LowPowerTicker
Expand All @@ -33,7 +42,6 @@
#define ALIAS_TIMEOUT Timeout
#endif

// Ticker operations
static bool equeue_tick_inited = false;
static volatile unsigned equeue_minutes = 0;
static unsigned equeue_timer[
Expand Down Expand Up @@ -77,6 +85,7 @@ unsigned equeue_tick() {
return minutes + ms;
}

#endif

// Mutex operations
int equeue_mutex_create(equeue_mutex_t *m) { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion events/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"value": 256
},
"use-lowpower-timer-ticker": {
"help": "Enable use of low power timer and ticker classes. May reduce the accuracy of the event queue.",
"help": "Enable use of low power timer and ticker classes in non-RTOS builds. May reduce the accuracy of the event queue. In RTOS builds, the RTOS tick count is used, and this configuration option has no effect.",
Copy link
Contributor

@geky geky Apr 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is there a "lowpower timer" option for the RTOS? (@bulislaw?)

If so we should probably note that here

"value": 0
}
}
Expand Down