Tactility.py 3.0.0 and SDK updates for 0.7.0-dev (#19)
- Remove `Libraries/Str` - Replaced usage of `TactilityC` FreeRtos features with `TactilityFreeRtos` library - Update `tactility.py` - Removed redundant code from `TactilityCpp`
This commit is contained in:
committed by
GitHub
parent
3bc1e7a373
commit
b6c27b64d4
@@ -1,16 +1,11 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES
|
||||
Source/*.c*
|
||||
# Library source files must be included directly,
|
||||
# because all regular dependencies get stripped by elf_loader's cmake script
|
||||
../../../Libraries/Str/Source/*.c**
|
||||
../../../Libraries/TactilityCpp/Source/*.c**
|
||||
)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
# Library headers must be included directly,
|
||||
# because all regular dependencies get stripped by elf_loader's cmake script
|
||||
INCLUDE_DIRS ../../../Libraries/Str/Include
|
||||
INCLUDE_DIRS ../../../Libraries/TactilityCpp/Include
|
||||
REQUIRES TactilitySDK
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Gpio.h"
|
||||
|
||||
#include <tt_app_alertdialog.h>
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
|
||||
#include <tt_hal.h>
|
||||
#include <tt_hal_gpio.h>
|
||||
#include <tt_lvgl.h>
|
||||
@@ -18,7 +19,7 @@ void Gpio::updatePinStates() {
|
||||
}
|
||||
|
||||
void Gpio::updatePinWidgets() {
|
||||
tt_lvgl_lock(TT_MAX_TICKS);
|
||||
tt_lvgl_lock(tt::kernel::MAX_TICKS);
|
||||
for (int j = 0; j < pinStates.size(); ++j) {
|
||||
int level = pinStates[j];
|
||||
lv_obj_t* label = pinWidgets[j];
|
||||
@@ -46,28 +47,21 @@ lv_obj_t* Gpio::createGpioRowWrapper(lv_obj_t* parent) {
|
||||
|
||||
// region Task
|
||||
|
||||
void Gpio::onTimer(void* context) {
|
||||
Gpio* app = static_cast<Gpio*>(context);
|
||||
|
||||
app->mutex.lock();
|
||||
app->updatePinStates();
|
||||
app->updatePinWidgets();
|
||||
app->mutex.unlock();
|
||||
void Gpio::onTimer() {
|
||||
mutex.lock();
|
||||
updatePinStates();
|
||||
updatePinWidgets();
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Gpio::startTask() {
|
||||
mutex.lock();
|
||||
assert(timer == nullptr);
|
||||
timer = tt_timer_alloc(TimerTypePeriodic, onTimer, this);
|
||||
tt_timer_start(timer, 100 / portTICK_PERIOD_MS);
|
||||
timer.start();
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Gpio::stopTask() {
|
||||
assert(timer);
|
||||
tt_timer_stop(timer);
|
||||
tt_timer_free(timer);
|
||||
timer = nullptr;
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
// endregion Task
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include <TactilityCpp/App.h>
|
||||
|
||||
#include <tt_app.h>
|
||||
#include <tt_timer.h>
|
||||
|
||||
#include <TactilityCpp/Mutex.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
#include <Tactility/Timer.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <vector>
|
||||
@@ -14,11 +14,13 @@ class Gpio final : public App {
|
||||
|
||||
std::vector<lv_obj_t*> pinWidgets;
|
||||
std::vector<bool> pinStates;
|
||||
TimerHandle timer;
|
||||
Mutex mutex = Mutex(MutexTypeRecursive);
|
||||
tt::Timer timer = tt::Timer(tt::Timer::Type::Periodic, pdMS_TO_TICKS(100), [this]{
|
||||
onTimer();
|
||||
});
|
||||
tt::RecursiveMutex mutex;
|
||||
|
||||
static lv_obj_t* createGpioRowWrapper(lv_obj_t* parent);
|
||||
static void onTimer(void* parameter);
|
||||
void onTimer();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user