mirror of https://github.com/ARMmbed/mbed-os.git
use timestamp_t for Ticker::_delay
parent
ab17cc71dc
commit
fedb7f02c0
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue