Various improvements (#264)
- Replace C function pointers with C++ `std::function` in `Thread`, `Timer` and `DispatcherThread` - Rename `SystemEvent`-related functions - WiFi: fix auto-connect when WiFi disconnects from bad signal - WiFi: fix auto-connect when WiFi fails to auto-connect - WiFi: implement disconnect() when tapping connected WiFi ap in WiFi management app
This commit is contained in:
committed by
GitHub
parent
d72852a6e2
commit
3f1bfee3f5
@@ -4,15 +4,12 @@
|
||||
#include "Tactility/RtosCompat.h"
|
||||
#include "Tactility/kernel/Kernel.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace tt {
|
||||
|
||||
void Timer::onCallback(TimerHandle_t hTimer) {
|
||||
auto* timer = static_cast<Timer*>(pvTimerGetTimerID(hTimer));
|
||||
|
||||
if (timer != nullptr) {
|
||||
timer->callback(timer->callbackContext);
|
||||
timer->callback();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +27,8 @@ static inline TimerHandle_t createTimer(Timer::Type type, void* timerId, TimerCa
|
||||
return xTimerCreate(nullptr, portMAX_DELAY, (BaseType_t)reload, timerId, callback);
|
||||
}
|
||||
|
||||
Timer::Timer(Type type, Callback callback, std::shared_ptr<void> callbackContext) :
|
||||
Timer::Timer(Type type, Callback callback) :
|
||||
callback(callback),
|
||||
callbackContext(std::move(callbackContext)),
|
||||
handle(createTimer(type, this, onCallback))
|
||||
{
|
||||
assert(!kernel::isIsr());
|
||||
|
||||
Reference in New Issue
Block a user