Update GPIO driver usage (#23)
Recently the SDK removed GPIO functionality because pins are now exclusively claimed by a driver. That means the GPIO app can't claim pins that are already in use... except when it calls the ESP-IDF driver code directly, which is what the app now does.
This commit is contained in:
committed by
GitHub
parent
1955cda81b
commit
9ba1d460bd
@@ -7,6 +7,6 @@ idf_component_register(
|
||||
# Library headers must be included directly,
|
||||
# because all regular dependencies get stripped by elf_loader's cmake script
|
||||
INCLUDE_DIRS ../../../Libraries/TactilityCpp/Include
|
||||
REQUIRES TactilitySDK
|
||||
REQUIRES TactilitySDK driver
|
||||
)
|
||||
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
|
||||
#include <tt_hal.h>
|
||||
#include <tt_hal_gpio.h>
|
||||
#include <tt_lvgl.h>
|
||||
#include <tt_lvgl_toolbar.h>
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
constexpr char* TAG = "GPIO";
|
||||
|
||||
void Gpio::updatePinStates() {
|
||||
// Update pin states
|
||||
for (int i = 0; i < pinStates.size(); ++i) {
|
||||
pinStates[i] = tt_hal_gpio_get_level(i);
|
||||
pinStates[i] = gpio_get_level((gpio_num_t)i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,11 +113,10 @@ void Gpio::onShow(AppHandle app, lv_obj_t* parent) {
|
||||
|
||||
mutex.lock();
|
||||
|
||||
auto pin_count = tt_hal_gpio_get_pin_count();
|
||||
pinStates.resize(pin_count);
|
||||
pinWidgets.resize(pin_count);
|
||||
pinStates.resize(GPIO_PIN_COUNT);
|
||||
pinWidgets.resize(GPIO_PIN_COUNT);
|
||||
|
||||
for (int i = 0; i < pin_count; ++i) {
|
||||
for (int i = 0; i < GPIO_PIN_COUNT; ++i) {
|
||||
constexpr uint8_t offset_from_left_label = 4;
|
||||
|
||||
// Add the GPIO number before the first item on a row
|
||||
|
||||
@@ -5,6 +5,6 @@ sdk=0.7.0-dev
|
||||
platforms=esp32,esp32s3,esp32c6,esp32p4
|
||||
[app]
|
||||
id=one.tactility.gpio
|
||||
versionName=0.3.0
|
||||
versionCode=3
|
||||
versionName=0.4.0
|
||||
versionCode=4
|
||||
name=GPIO
|
||||
|
||||
Reference in New Issue
Block a user