use timestamp_t for Ticker::_delay

pull/467/merge
Rohit Grover 2014-08-27 09:25:24 +01:00
parent ab17cc71dc
commit fedb7f02c0
2 changed files with 8 additions and 6 deletions

View File

@ -83,7 +83,7 @@ public:
* @param fptr pointer to the function to be called
* @param t the time between calls in micro-seconds
*/
void attach_us(void (*fptr)(void), unsigned int t) {
void attach_us(void (*fptr)(void), timestamp_t t) {
_function.attach(fptr);
setup(t);
}
@ -95,7 +95,7 @@ public:
* @param t the time between calls in micro-seconds
*/
template<typename T>
void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
void attach_us(T* tptr, void (T::*mptr)(void), timestamp_t t) {
_function.attach(tptr, mptr);
setup(t);
}
@ -105,11 +105,13 @@ public:
void detach();
protected:
void setup(unsigned int t);
void setup(timestamp_t t);
virtual void handler();
unsigned int _delay;
FunctionPointer _function;
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. */
};
} // namespace mbed

View File

@ -25,7 +25,7 @@ void Ticker::detach() {
_function.attach(0);
}
void Ticker::setup(unsigned int t) {
void Ticker::setup(timestamp_t t) {
remove();
_delay = t;
insert(_delay + us_ticker_read());