diff options
| author | ailurux <me@dbyron.id.au> | 2023-03-13 15:14:32 +1100 |
|---|---|---|
| committer | ailurux <me@dbyron.id.au> | 2023-03-13 15:14:32 +1100 |
| commit | 78ec09c494faadf9e7d06dc7d3e04531c3a34ff7 (patch) | |
| tree | 7f328e7236492f6bbcc66aea044b5e78fda620cc /src/main | |
| parent | b9a75cd55a11fd404a1977539acb64a6705f3809 (diff) | |
| download | tangara-fw-78ec09c494faadf9e7d06dc7d3e04531c3a34ff7.tar.gz | |
Touchwheel test
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp index 91e17451..bd0a06af 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -35,6 +35,7 @@ #include "i2c.hpp" #include "spi.hpp" #include "storage.hpp" +#include "touchwheel.hpp" static const char* TAG = "MAIN"; @@ -102,6 +103,7 @@ extern "C" void app_main(void) { ESP_LOGI(TAG, "Enable power rails for development"); expander->with([&](auto& gpio) { gpio.set_pin(drivers::GpioExpander::AUDIO_POWER_ENABLE, 1); + gpio.set_pin(drivers::GpioExpander::DISPLAY_LED, 0); gpio.set_pin(drivers::GpioExpander::USB_INTERFACE_POWER_ENABLE, 0); gpio.set_pin(drivers::GpioExpander::SD_CARD_POWER_ENABLE, 1); gpio.set_pin(drivers::GpioExpander::SD_MUX_SWITCH, @@ -121,6 +123,15 @@ extern "C" void app_main(void) { storage = std::move(storage_res.value()); } + ESP_LOGI(TAG, "Init touch wheel"); + auto touchwheel_res = drivers::TouchWheel::create(expander); + std::shared_ptr<drivers::TouchWheel> touchwheel; + if (touchwheel_res.has_error()) { + ESP_LOGE(TAG, "Failed!"); + } else { + touchwheel = std::move(touchwheel_res.value()); + } + LvglArgs* lvglArgs = (LvglArgs*)calloc(1, sizeof(LvglArgs)); lvglArgs->gpio_expander = expander; xTaskCreateStaticPinnedToCore(&lvgl_main, "LVGL", kLvglStackSize, @@ -146,6 +157,8 @@ extern "C" void app_main(void) { console.Launch(); while (1) { + touchwheel->Update(); + ESP_LOGI(TAG, "Touch wheel pos: %d", touchwheel->GetTouchWheelData().wheel_position); vTaskDelay(pdMS_TO_TICKS(100)); } } |
