changes proposed from Martin's review

pull/467/merge
Rohit Grover 2014-08-28 08:16:55 +01:00
parent 6daf3ac52a
commit 958aa2488b
3 changed files with 10 additions and 8 deletions

View File

@ -113,9 +113,8 @@ protected:
virtual void handler();
protected:
timestamp_t _delay; /* Time delay (in microseconds) for re-setting the multi-shot callback.
* Initialized at the point where callback is attached. */
FunctionPointer _function; /* Callback. */
timestamp_t _delay; /**< Time delay (in microseconds) for re-setting the multi-shot callback. */
FunctionPointer _function; /**< Callback. */
};
} // namespace mbed

View File

@ -18,7 +18,6 @@
#include "cmsis.h"
#include "PeripheralNames.h"
#include "app_timer.h"
#include "projectconfig.h"
static bool us_ticker_inited = false;
static volatile bool us_ticker_appTimerRunning = false;
@ -30,7 +29,7 @@ void us_ticker_init(void)
return;
}
APP_TIMER_INIT(CFG_TIMER_PRESCALER , CFG_TIMER_MAX_INSTANCE, CFG_TIMER_OPERATION_QUEUE_SIZE, CFG_SCHEDULER_ENABLE);
APP_TIMER_INIT(0 /*CFG_TIMER_PRESCALER*/ , 1 /*CFG_TIMER_MAX_INSTANCE*/, 1 /*CFG_TIMER_OPERATION_QUEUE_SIZE*/, false /*CFG_SCHEDULER_ENABLE*/);
us_ticker_inited = true;
}
@ -92,10 +91,14 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
void us_ticker_disable_interrupt(void)
{
app_timer_stop(us_ticker_appTimerID);
if (us_ticker_appTimerRunning) {
app_timer_stop(us_ticker_appTimerID);
}
}
void us_ticker_clear_interrupt(void)
{
/* empty */
if (us_ticker_appTimerRunning) {
app_timer_stop(us_ticker_appTimerID);
}
}

View File

@ -50,7 +50,7 @@ uint32_t us_ticker_read() {
void us_ticker_set_interrupt(timestamp_t timestamp) {
// set match value
US_TICKER_TIMER->MR[3] = (uint32_t)timestamp;
US_TICKER_TIMER->MR[0] = (uint32_t)timestamp;
// enable match interrupt
US_TICKER_TIMER->MCR |= 1;
}