Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions libraries/Ticker/Ticker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t
}
else
{
_timer = new ETSTimer;
_timer = new(_etsTimerMemory) ETSTimer;
}

os_timer_setfn(_timer, reinterpret_cast<ETSTimerFunc*>(callback), reinterpret_cast<void*>(arg));
Expand All @@ -63,7 +63,7 @@ void Ticker::detach()
return;

os_timer_disarm(_timer);
delete _timer;
_timer->~ETSTimer();
_timer = nullptr;
_callback_function = nullptr;
}
Expand Down
1 change: 1 addition & 0 deletions libraries/Ticker/Ticker.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class Ticker

protected:
ETSTimer* _timer;
char _etsTimerMemory[sizeof(ETSTimer)];
callback_function_t _callback_function = nullptr;
};

Expand Down