* Remove version from artifact name * Target C++ 20 and higher * Use cpp string * Better crash implementation * String utils in cpp style * Replace parameter methods with start() method * MutexType to Mutex::Type * Kernel c to cpp style * Cleanup event flag * More cpp conversions * Test fixes * Updated ideas docs
37 lines
723 B
C++
37 lines
723 B
C++
#pragma once
|
|
|
|
#include <TactilityCore.h>
|
|
#include <Mutex.h>
|
|
#include <Thread.h>
|
|
#include "lvgl.h"
|
|
#include "hal/i2c/I2c.h"
|
|
#include <memory>
|
|
|
|
namespace tt::app::i2cscanner {
|
|
|
|
#define TAG "i2cscanner"
|
|
|
|
enum ScanState {
|
|
ScanStateInitial,
|
|
ScanStateScanning,
|
|
ScanStateStopped
|
|
};
|
|
|
|
struct Data {
|
|
// Core
|
|
Mutex mutex = Mutex(Mutex::TypeRecursive);
|
|
Thread* _Nullable scanThread = nullptr;
|
|
// State
|
|
ScanState scanState;
|
|
i2c_port_t port = I2C_NUM_0;
|
|
std::vector<uint8_t> scannedAddresses;
|
|
// Widgets
|
|
lv_obj_t* scanButtonLabelWidget = nullptr;
|
|
lv_obj_t* portDropdownWidget = nullptr;
|
|
lv_obj_t* scanListWidget = nullptr;
|
|
};
|
|
|
|
void onThreadFinished(std::shared_ptr<Data> data);
|
|
|
|
}
|