Implemented I2C scanner app (#97)

This commit is contained in:
Ken Van Hoeylandt
2024-11-28 21:42:18 +01:00
committed by GitHub
parent 6094b9c3f2
commit 3f62ec2efa
19 changed files with 451 additions and 44 deletions
@@ -0,0 +1,35 @@
#pragma once
#include <TactilityCore.h>
#include <Mutex.h>
#include <Thread.h>
#include "lvgl.h"
#include "hal/i2c/I2c.h"
namespace tt::app::i2cscanner {
#define TAG "i2cscanner"
enum ScanState {
ScanStateInitial,
ScanStateScanning,
ScanStateStopped
};
struct Data {
// Core
Mutex mutex = Mutex(MutexTypeRecursive);
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(Data* data);
}