Convert code to use Timer instead of Thread (#120)
This commit is contained in:
committed by
GitHub
parent
51c6aaa428
commit
34f99205ca
@@ -5,6 +5,7 @@
|
||||
#include <Thread.h>
|
||||
#include "lvgl.h"
|
||||
#include "hal/i2c/I2c.h"
|
||||
#include "Timer.h"
|
||||
#include <memory>
|
||||
|
||||
namespace tt::app::i2cscanner {
|
||||
@@ -20,7 +21,7 @@ enum ScanState {
|
||||
struct Data {
|
||||
// Core
|
||||
Mutex mutex = Mutex(Mutex::TypeRecursive);
|
||||
Thread* _Nullable scanThread = nullptr;
|
||||
std::unique_ptr<Timer> scanTimer = nullptr;
|
||||
// State
|
||||
ScanState scanState;
|
||||
i2c_port_t port = I2C_NUM_0;
|
||||
@@ -31,6 +32,6 @@ struct Data {
|
||||
lv_obj_t* scanListWidget = nullptr;
|
||||
};
|
||||
|
||||
void onThreadFinished(std::shared_ptr<Data> data);
|
||||
void onScanTimerFinished(std::shared_ptr<Data> data);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user