Skip to content

Commit

Permalink
Merge pull request #6693 from kjbracey-arm/equeue-ticks
Browse files Browse the repository at this point in the history
Make event queue use RTOS tick count
  • Loading branch information
Cruz Monrreal committed Apr 27, 2018
2 parents d06ad9b + d979c59 commit c8d72c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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.",
"value": 0
}
}
Expand Down

0 comments on commit c8d72c5

Please sign in to comment.