Add drivers to module and make start/stop optional (#580)

This commit is contained in:
Ken Van Hoeylandt
2026-07-23 23:28:09 +02:00
committed by GitHub
parent 08eac48e64
commit 429125734a
131 changed files with 488 additions and 2381 deletions
+2 -7
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
struct Module btt_panda_touch_module = {
.name = "btt-panda-touch",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
Module btt_panda_touch_module = {
.name = "btt-panda-touch"
};
}
-5
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_2432s024c_module = {
.name = "cyd-2432s024c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
};
}
+2 -7
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
struct Module cyd_2432s024r_module = {
.name = "cyd-2432s024r",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
Module cyd_2432s024r_module = {
.name = "cyd-2432s024r"
};
}
+2 -7
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
struct Module cyd_2432s028r_module = {
.name = "cyd-2432s028r",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
Module cyd_2432s028r_module = {
.name = "cyd-2432s028r"
};
}
+2 -7
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
struct Module cyd_2432s028rv3_module = {
.name = "cyd-2432s028rv3",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
Module cyd_2432s028rv3_module = {
.name = "cyd-2432s028rv3"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_2432s032c_module = {
.name = "cyd-2432s032c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "cyd-2432s032c"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_3248s035c_module = {
.name = "cyd-3248s035c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "cyd-3248s035c"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_4848s040c_module = {
.name = "cyd-4848s040c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "cyd-4848s040c"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_8048s043c_module = {
.name = "cyd-8048s043c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "cyd-8048s043c"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_e32r28t_module = {
.name = "cyd-e32r28t",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "cyd-e32r28t"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module cyd_e32r32p_module = {
.name = "cyd-e32r32p",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "cyd-e32r32p"
};
}
@@ -1,13 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module elecrow_crowpanel_advance_28_module = {
.name = "elecrow-crowpanel-advance-28",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr
.name = "elecrow-crowpanel-advance-28"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module elecrow_crowpanel_advance_35_module = {
.name = "elecrow-crowpanel-advance-35",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "elecrow-crowpanel-advance-35"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module elecrow_crowpanel_advance_50_module = {
.name = "elecrow-crowpanel-advance-50",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "elecrow-crowpanel-advance-50"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module elecrow_crowpanel_basic_28_module = {
.name = "elecrow-crowpanel-basic-28",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "elecrow-crowpanel-basic-28"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module elecrow_crowpanel_basic_35_module = {
.name = "elecrow-crowpanel-basic-35",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "elecrow-crowpanel-basic-35"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module elecrow_crowpanel_basic_50_module = {
.name = "elecrow-crowpanel-basic-50",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "elecrow-crowpanel-basic-50"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module es3c28p_module = {
.name = "es3c28p",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "es3c28p"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module generic_esp32_module = {
.name = "generic-esp32",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "generic-esp32"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module generic_esp32c6_module = {
.name = "generic-esp32c6",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "generic-esp32c6"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module generic_esp32p4_module = {
.name = "generic-esp32p4",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "generic-esp32p4"
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module generic_esp32s3_module = {
.name = "generic-esp32s3",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "generic-esp32s3"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module guition_jc1060p470ciwy_module = {
.name = "guition-jc1060p470ciwy",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "guition-jc1060p470ciwy"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module guition_jc2432w328c_module = {
.name = "guition-jc2432w328c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "guition-jc2432w328c"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module guition_jc8048w550c_module = {
.name = "guition-jc8048w550c",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "guition-jc8048w550c"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module heltec_wifi_lora_32_v3_module = {
.name = "heltec-wifi-lora-32-v3",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "heltec-wifi-lora-32-v3"
};
}
+2 -16
View File
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module lilygo_tdeck_max_module = {
.name = "lilygo-tdeck-max",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
Module lilygo_tdeck_max_module = {
.name = "lilygo-tdeck-max"
};
}
@@ -12,6 +12,8 @@ hardware.tinyUsb=true
hardware.esptoolFlashFreq=120M
hardware.bluetooth=true
dependencies.useDeprecatedHal=false
storage.userDataLocation=SD
display.size=2.8"
@@ -19,9 +19,6 @@
constexpr auto* TAG = "tdeck-plus";
// Legacy placeholder (required until legacy HAL is cleaned up everywhere)
extern const tt::hal::Configuration hardwareConfiguration = {};
extern "C" {
void subscribe_events() {
+2
View File
@@ -12,6 +12,8 @@ hardware.tinyUsb=true
hardware.esptoolFlashFreq=120M
hardware.bluetooth=true
dependencies.useDeprecatedHal=false
storage.userDataLocation=SD
display.size=2.8"
+1 -6
View File
@@ -18,9 +18,6 @@
constexpr auto* TAG = "tdeck";
// Legacy placeholder (required until legacy HAL is cleaned up everywhere)
extern const tt::hal::Configuration hardwareConfiguration = {};
extern "C" {
void subscribe_events() {
@@ -63,9 +60,7 @@ static error_t stop() {
Module lilygo_tdeck_module = {
.name = "lilygo-tdeck",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.stop = stop
};
}
+6 -5
View File
@@ -30,16 +30,17 @@ static error_t start() {
}
static error_t stop() {
// Empty for now
if (gpio_set_level(POWER_ON_PIN, 0) != ESP_OK) {
return ERROR_RESOURCE;
}
return ERROR_NONE;
}
struct Module lilygo_tdisplay_s3_module = {
Module lilygo_tdisplay_s3_module = {
.name = "lilygo-tdisplay-s3",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.stop = stop
};
}
+2 -16
View File
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module lilygo_tdisplay_module = {
.name = "lilygo-tdisplay",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
Module lilygo_tdisplay_module = {
.name = "lilygo-tdisplay"
};
}
+2 -16
View File
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module lilygo_tdongle_s3_module = {
.name = "lilygo-tdongle-s3",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
Module lilygo_tdongle_s3_module = {
.name = "lilygo-tdongle-s3"
};
}
+2 -16
View File
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module lilygo_thmi_module = {
.name = "lilygo-thmi",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
Module lilygo_thmi_module = {
.name = "lilygo-thmi"
};
}
@@ -13,6 +13,8 @@ hardware.tinyUsb=true
hardware.esptoolFlashFreq=40M
hardware.bluetooth=true
dependencies.useDeprecatedHal=false
storage.userDataLocation=SD
display.size=2.33"
+8 -16
View File
@@ -15,18 +15,15 @@
constexpr auto* TAG = "T-Lora Pager";
// Legacy placeholder (required until legacy HAL is cleaned up everywhere). All board
// peripherals are kernel drivers now (see the .dts): display (st7796), battery (bq27220),
// charger power-off (bq25896), haptics (drv2605), keyboard (tca8418) and the encoder wheel
// (lilygo,tpager-encoder, bound to LVGL below).
extern const tt::hal::Configuration hardwareConfiguration = {};
extern "C" {
static void subscribe_events() {
tt::kernel::SystemEventSubscription event_subscription;
static error_t start() {
LOG_I(TAG, LOG_MESSAGE_POWER_ON_START);
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent) {
event_subscription = tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent) {
// The kernel tpager_encoder device is already started by kernel_init(); this just
// registers it as an LVGL input device, which requires LVGL to be up first.
lvgl_lock();
@@ -50,23 +47,18 @@ static void subscribe_events() {
}
}
});
}
static error_t start() {
subscribe_events();
return ERROR_NONE;
}
static error_t stop() {
tt::kernel::unsubscribeSystemEvent(event_subscription);
return ERROR_NONE;
}
struct Module lilygo_tlora_pager_module = {
Module lilygo_tlora_pager_module = {
.name = "lilygo-tlora-pager",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.stop = stop
};
}
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module m5stack_cardputer_adv_module = {
.name = "m5stack-cardputer-adv",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
Module m5stack_cardputer_adv_module = {
.name = "m5stack-cardputer-adv"
};
}
+1 -15
View File
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
Module m5stack_cardputer_module = {
.name = "m5stack-cardputer",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.name = "m5stack-cardputer"
};
}
+1 -6
View File
@@ -1,4 +1,3 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
@@ -7,11 +6,7 @@ extern "C" {
// and axp192-module's start()), replacing what used to be done by hand here via a
// DEVICE_EVENT_STARTED device_listener.
Module m5stack_core2_module = {
.name = "m5stack-core2",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "m5stack-core2"
};
}
+2 -9
View File
@@ -1,16 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
#include <cstring>
extern "C" {
struct Module m5stack_cores3_module = {
.name = "m5stack-cores3",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
Module m5stack_cores3_module = {
.name = "m5stack-cores3"
};
}
+7 -19
View File
@@ -1,6 +1,4 @@
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
@@ -9,26 +7,16 @@ extern Driver papers3_power_driver;
extern Driver papers3_power_supply_driver;
extern Driver papers3_display_driver;
static error_t start() {
check(driver_construct_add(&papers3_power_supply_driver) == ERROR_NONE);
check(driver_construct_add(&papers3_power_driver) == ERROR_NONE);
check(driver_construct_add(&papers3_display_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&papers3_display_driver) == ERROR_NONE);
check(driver_remove_destruct(&papers3_power_driver) == ERROR_NONE);
check(driver_remove_destruct(&papers3_power_supply_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const papers3_drivers[] = {
&papers3_display_driver,
&papers3_power_driver,
&papers3_power_supply_driver,
nullptr
};
Module m5stack_papers3_module = {
.name = "m5stack-papers3",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = papers3_drivers
};
}
+1 -3
View File
@@ -56,9 +56,7 @@ static error_t stop() {
Module m5stack_stackchan_module = {
.name = "m5stack-stackchan",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.stop = stop
};
}
+2 -15
View File
@@ -7,7 +7,7 @@ constexpr auto* TAG = "StickCPlus2";
extern "C" {
static bool init_power() {
static error_t init_power() {
// CH552 applies 4 V to GPIO 0, which reduces Wi-Fi sensitivity.
// Setting output to high adds a bias of 3.3 V and suppresses over-voltage:
gpio_set_direction(GPIO_NUM_0, GPIO_MODE_OUTPUT);
@@ -17,25 +17,12 @@ static bool init_power() {
gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_NUM_4, 1);
return true;
}
static error_t start() {
init_power();
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
Module m5stack_stickc_plus2_module = {
.name = "m5stack-stickc-plus2",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.start = init_power
};
}
+1 -6
View File
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module m5stack_sticks3_module = {
.name = "m5stack-sticks3",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "m5stack-sticks3"
};
}
+8 -21
View File
@@ -16,7 +16,7 @@
#include "devices/tab5_power_control.h"
#include "devices/tab_5_camera.h"
#define TAG "Tab5"
constexpr auto* TAG = "Tab5";
// PI4IOE5V6408-0 (0x43) bit 1
constexpr auto GPIO_EXP0_PIN_SPEAKER_ENABLE = 1;
@@ -65,44 +65,31 @@ static void on_io_expander0_started(Device* device, DeviceEvent event, void* con
extern "C" {
static error_t start() {
/* Crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&tab5_keyboard_driver) == ERROR_NONE);
check(driver_construct_add(&tab5_power_control_driver) == ERROR_NONE);
tab5_detect_start();
tab5_camera_init();
device_listener_add(on_io_expander0_started, nullptr);
tab5_headphone_detect_start();
return ERROR_NONE;
}
static error_t stop() {
tab5_headphone_detect_stop();
device_listener_remove(on_io_expander0_started);
tab5_detect_stop();
/* Crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&tab5_keyboard_driver) == ERROR_NONE);
check(driver_remove_destruct(&tab5_power_control_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const tab5_drivers[] = {
&tab5_keyboard_driver,
&tab5_power_control_driver,
nullptr
};
Module m5stack_tab5_module = {
.name = "m5stack-tab5",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = tab5_drivers
};
}
+8 -11
View File
@@ -38,29 +38,26 @@ static void on_device_event(Device* device, DeviceEvent event, void* context) {
}
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&unphone_power_switch_driver) == ERROR_NONE);
check(driver_construct_add(&unphone_nav_buttons_driver) == ERROR_NONE);
device_listener_add(on_device_event, nullptr);
return ERROR_NONE;
}
static error_t stop() {
device_listener_remove(&on_device_event);
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&unphone_nav_buttons_driver) == ERROR_NONE);
check(driver_remove_destruct(&unphone_power_switch_driver) == ERROR_NONE);
return ERROR_NONE;
}
struct Module unphone_module = {
static Driver* const unphone_drivers[] = {
&unphone_nav_buttons_driver,
&unphone_power_switch_driver,
nullptr
};
Module unphone_module = {
.name = "unphone",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = unphone_drivers
};
}
@@ -2,22 +2,8 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module waveshare_esp32_s3_geek_module = {
.name = "waveshare-esp32-s3-geek",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
Module waveshare_esp32_s3_geek_module = {
.name = "waveshare-esp32-s3-geek"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module waveshare_s3_lcd_13_module = {
.name = "waveshare-s3-lcd-13",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "waveshare-s3-lcd-13"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module waveshare_s3_touch_lcd_128_module = {
.name = "waveshare-s3-touch-lcd-128",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "waveshare-s3-touch-lcd-128"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module waveshare_s3_touch_lcd_147_module = {
.name = "waveshare-s3-touch-lcd-147",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "waveshare-s3-touch-lcd-147"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module waveshare_s3_touch_lcd_43_module = {
.name = "waveshare-s3-touch-lcd-43",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "waveshare-s3-touch-lcd-43"
};
}
@@ -1,14 +1,9 @@
#include <tactility/error.h>
#include <tactility/module.h>
extern "C" {
Module wireless_tag_wt32_sc01_plus_module = {
.name = "wireless-tag-wt32-sc01-plus",
.start = [] -> error_t { return ERROR_NONE; },
.stop = [] -> error_t { return ERROR_NONE; },
.symbols = nullptr,
.internal = nullptr
.name = "wireless-tag-wt32-sc01-plus"
};
}
+1
View File
@@ -13,6 +13,7 @@
## Higher Priority
- Drivers/audio-codec-module is not a module. Move it somewhere else. Or make it an actual module.
- LilyGO T-Dongle S3: 1 button control, stop auto-launching web server
- Core2: support power off via software
- Create `#define` for empty module (for modules that fully rely on device.properties and don't define drivers or have start/stop logic)
-5
View File
@@ -1,5 +0,0 @@
idf_component_register(
SRC_DIRS "Source"
INCLUDE_DIRS "Source"
REQUIRES Tactility esp_lcd esp_lcd_touch esp_lvgl_port
)
-3
View File
@@ -1,3 +0,0 @@
# EspLcdCompat
A set of helper classes to implement `esp_lcd` drivers in Tactility.
@@ -1,130 +0,0 @@
#include "EspLcdDisplay.h"
#include "EspLcdDisplayDriver.h"
#include <tactility/log.h>
#include <tactility/check.h>
#include <Tactility/hal/touch/TouchDevice.h>
#include <cassert>
#include <esp_lvgl_port_disp.h>
constexpr auto* TAG = "EspLcdDisplay";
EspLcdDisplay::~EspLcdDisplay() {
check(
displayDriver == nullptr || displayDriver.use_count() < 2, // 1 reference is held by this class
"DisplayDriver is still in use. This will cause memory access violations."
);
}
bool EspLcdDisplay::start() {
if (!createIoHandle(ioHandle)) {
LOG_E(TAG, "Failed to create IO handle");
return false;
}
if (!createPanelHandle(ioHandle, panelHandle)) {
LOG_E(TAG, "Failed to create panel handle");
esp_lcd_panel_io_del(ioHandle);
return false;
}
return true;
}
bool EspLcdDisplay::stop() {
if (lvglDisplay != nullptr) {
stopLvgl();
lvglDisplay = nullptr;
}
if (panelHandle != nullptr && esp_lcd_panel_del(panelHandle) != ESP_OK) {
return false;
}
if (ioHandle != nullptr && esp_lcd_panel_io_del(ioHandle) != ESP_OK) {
return false;
}
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
LOG_W(TAG, "DisplayDriver is still in use.");
}
return true;
}
bool EspLcdDisplay::startLvgl() {
assert(lvglDisplay == nullptr);
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
LOG_W(TAG, "DisplayDriver is still in use.");
}
auto lvgl_port_config = getLvglPortDisplayConfig(ioHandle, panelHandle);
if (isRgbPanel()) {
auto rgb_config = getLvglPortDisplayRgbConfig(ioHandle, panelHandle);
lvglDisplay = lvgl_port_add_disp_rgb(&lvgl_port_config , &rgb_config);
} else {
lvglDisplay = lvgl_port_add_disp(&lvgl_port_config );
}
auto touch_device = getTouchDevice();
if (touch_device != nullptr && touch_device->supportsLvgl()) {
touch_device->startLvgl(lvglDisplay);
}
return lvglDisplay != nullptr;
}
bool EspLcdDisplay::stopLvgl() {
if (lvglDisplay == nullptr) {
return false;
}
auto touch_device = getTouchDevice();
if (touch_device != nullptr) {
touch_device->stopLvgl();
}
lvgl_port_remove_disp(lvglDisplay);
lvglDisplay = nullptr;
return true;
}
std::shared_ptr<tt::hal::display::DisplayDriver> EspLcdDisplay::getDisplayDriver() {
assert(lvglDisplay == nullptr); // Still attached to LVGL context. Call stopLvgl() first.
if (displayDriver == nullptr) {
auto lvgl_port_config = getLvglPortDisplayConfig(ioHandle, panelHandle);
tt::hal::display::ColorFormat color_format;
if (lvgl_port_config.color_format == LV_COLOR_FORMAT_I1) {
color_format = tt::hal::display::ColorFormat::Monochrome;
} else if (lvgl_port_config.color_format == LV_COLOR_FORMAT_RGB565) {
if (rgbElementOrder == LCD_RGB_ELEMENT_ORDER_RGB) {
if (lvgl_port_config.flags.swap_bytes) {
color_format = tt::hal::display::ColorFormat::RGB565Swapped;
} else {
color_format = tt::hal::display::ColorFormat::RGB565;
}
} else {
if (lvgl_port_config.flags.swap_bytes) {
color_format = tt::hal::display::ColorFormat::BGR565Swapped;
} else {
color_format = tt::hal::display::ColorFormat::BGR565;
}
}
} else if (lvgl_port_config.color_format == LV_COLOR_FORMAT_RGB888) {
color_format = tt::hal::display::ColorFormat::RGB888;
} else {
check(false, "unsupported driver");
}
displayDriver = std::make_shared<EspLcdDisplayDriver>(
panelHandle,
lvgl_port_config.hres,
lvgl_port_config.vres,
color_format
);
}
return displayDriver;
}
@@ -1,64 +0,0 @@
#pragma once
#include <tactility/check.h>
#include <Tactility/hal/display/DisplayDevice.h>
#include <esp_lcd_types.h>
#include <esp_lvgl_port_disp.h>
/** @deprecated use EspLcdDisplayV2 */
class EspLcdDisplay : public tt::hal::display::DisplayDevice {
esp_lcd_panel_io_handle_t ioHandle = nullptr;
esp_lcd_panel_handle_t panelHandle = nullptr;
lv_display_t* lvglDisplay = nullptr;
std::shared_ptr<tt::hal::display::DisplayDriver> displayDriver;
/** @warning This is never changed, so a driver that needs BGR is not supported */
lcd_rgb_element_order_t rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB;
protected:
// Used for sending commands such as setting curves
esp_lcd_panel_io_handle_t getIoHandle() const { return ioHandle; }
virtual bool createIoHandle(esp_lcd_panel_io_handle_t& outHandle) = 0;
virtual bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) = 0;
virtual lvgl_port_display_cfg_t getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) = 0;
virtual bool isRgbPanel() const { return false; }
virtual lvgl_port_display_rgb_cfg_t getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { check(false, "Not supported"); }
public:
EspLcdDisplay() = default;
~EspLcdDisplay() override;
bool start() final;
bool stop() final;
// region LVGL
bool supportsLvgl() const final { return true; }
bool startLvgl() final;
bool stopLvgl() final;
lv_display_t* getLvglDisplay() const final { return lvglDisplay; }
// endregion
// region DisplayDriver
bool supportsDisplayDriver() const override { return true; }
/** @return a NativeDisplay instance if this device supports it */
std::shared_ptr<tt::hal::display::DisplayDriver> getDisplayDriver() final;
// endregion
};
@@ -1,47 +0,0 @@
#pragma once
#include <Tactility/hal/display/DisplayDriver.h>
#include <esp_lcd_panel_ops.h>
#if CONFIG_SOC_MIPI_DSI_SUPPORTED
#include <esp_lcd_mipi_dsi.h>
#endif
class EspLcdDisplayDriver : public tt::hal::display::DisplayDriver {
esp_lcd_panel_handle_t panelHandle;
uint16_t hRes;
uint16_t vRes;
tt::hal::display::ColorFormat colorFormat;
public:
EspLcdDisplayDriver(
esp_lcd_panel_handle_t panelHandle,
uint16_t hRes,
uint16_t vRes,
tt::hal::display::ColorFormat colorFormat
) : panelHandle(panelHandle), hRes(hRes), vRes(vRes), colorFormat(colorFormat) {}
tt::hal::display::ColorFormat getColorFormat() const override {
return colorFormat;
}
bool drawBitmap(int xStart, int yStart, int xEnd, int yEnd, const void* pixelData) override {
bool result = esp_lcd_panel_draw_bitmap(panelHandle, xStart, yStart, xEnd, yEnd, pixelData) == ESP_OK;
return result;
}
uint16_t getPixelWidth() const override { return hRes; }
uint16_t getPixelHeight() const override { return vRes; }
#if CONFIG_SOC_MIPI_DSI_SUPPORTED
uint8_t getFrameBuffers(void* outBuffers[2]) const override {
if (outBuffers == nullptr) {
return 0;
}
return (esp_lcd_dpi_panel_get_frame_buffer(panelHandle, 2, &outBuffers[0], &outBuffers[1]) == ESP_OK) ? 2 : 0;
}
#endif
};
@@ -1,231 +0,0 @@
#include "EspLcdDisplayV2.h"
#include "EspLcdDisplayDriver.h"
#include <tactility/log.h>
#include <tactility/check.h>
#include <Tactility/hal/touch/TouchDevice.h>
#include <cassert>
#include <esp_lvgl_port_disp.h>
constexpr auto* TAG = "EspLcdDispV2";
inline unsigned int getBufferSize(const std::shared_ptr<EspLcdConfiguration>& configuration) {
if (configuration->bufferSize != DEFAULT_BUFFER_SIZE) {
return configuration->bufferSize;
} else {
return configuration->horizontalResolution * (configuration->verticalResolution / 10);
}
}
EspLcdDisplayV2::~EspLcdDisplayV2() {
check(
displayDriver == nullptr || displayDriver.use_count() < 2, // 1 reference is held by this class
"DisplayDriver is still in use. This will cause memory access violations."
);
}
bool EspLcdDisplayV2::applyConfiguration() const {
if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
LOG_E(TAG, "Failed to reset panel");
return false;
}
if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
LOG_E(TAG, "Failed to init panel");
return false;
}
if (configuration->invertColor && esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) {
LOG_E(TAG, "Failed to set panel to invert");
return false;
}
// Warning: it looks like LVGL rotation is broken when "gap" is set and the screen is moved to a non-default orientation
int gap_x = configuration->swapXY ? configuration->gapY : configuration->gapX;
int gap_y = configuration->swapXY ? configuration->gapX : configuration->gapY;
bool should_set_gap = gap_x != 0 || gap_y != 0;
if (should_set_gap && esp_lcd_panel_set_gap(panelHandle, gap_x, gap_y) != ESP_OK) {
LOG_E(TAG, "Failed to set panel gap");
return false;
}
if (configuration->swapXY && esp_lcd_panel_swap_xy(panelHandle, configuration->swapXY) != ESP_OK) {
LOG_E(TAG, "Failed to swap XY ");
return false;
}
bool should_set_mirror = configuration->mirrorX || configuration->mirrorY;
if (should_set_mirror && esp_lcd_panel_mirror(panelHandle, configuration->mirrorX, configuration->mirrorY) != ESP_OK) {
LOG_E(TAG, "Failed to set panel to mirror");
return false;
}
if (configuration->invertColor && esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) {
LOG_E(TAG, "Failed to set panel to invert");
return false;
}
if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
LOG_E(TAG, "Failed to turn display on");
return false;
}
return true;
}
bool EspLcdDisplayV2::start() {
if (!createIoHandle(ioHandle)) {
LOG_E(TAG, "Failed to create IO handle");
return false;
}
esp_lcd_panel_dev_config_t panel_config = createPanelConfig(configuration, configuration->resetPin);
if (!createPanelHandle(ioHandle, panel_config, panelHandle)) {
LOG_E(TAG, "Failed to create panel handle");
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
return false;
}
if (!applyConfiguration()) {
esp_lcd_panel_del(panelHandle);
panelHandle = nullptr;
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
return false;
}
return true;
}
bool EspLcdDisplayV2::stop() {
if (lvglDisplay != nullptr) {
stopLvgl();
lvglDisplay = nullptr;
}
if (panelHandle != nullptr && esp_lcd_panel_del(panelHandle) != ESP_OK) {
return false;
}
if (ioHandle != nullptr && esp_lcd_panel_io_del(ioHandle) != ESP_OK) {
return false;
}
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
LOG_W(TAG, "DisplayDriver is still in use.");
}
return true;
}
bool EspLcdDisplayV2::startLvgl() {
assert(lvglDisplay == nullptr);
if (displayDriver != nullptr && displayDriver.use_count() > 1) {
LOG_W(TAG, "DisplayDriver is still in use.");
}
auto lvgl_port_config = getLvglPortDisplayConfig(configuration, ioHandle, panelHandle);
if (useDsiPanel()) {
auto dsi_config = getLvglPortDisplayDsiConfig(ioHandle, panelHandle);
lvglDisplay = lvgl_port_add_disp_dsi(&lvgl_port_config, &dsi_config);
} else if (isRgbPanel()) {
auto rgb_config = getLvglPortDisplayRgbConfig(ioHandle, panelHandle);
lvglDisplay = lvgl_port_add_disp_rgb(&lvgl_port_config, &rgb_config);
} else {
lvglDisplay = lvgl_port_add_disp(&lvgl_port_config);
}
auto touch_device = getTouchDevice();
if (touch_device != nullptr && touch_device->supportsLvgl()) {
touch_device->startLvgl(lvglDisplay);
}
return lvglDisplay != nullptr;
}
bool EspLcdDisplayV2::stopLvgl() {
if (lvglDisplay == nullptr) {
return false;
}
auto touch_device = getTouchDevice();
if (touch_device != nullptr) {
touch_device->stopLvgl();
}
lvgl_port_remove_disp(lvglDisplay);
lvglDisplay = nullptr;
return true;
}
lvgl_port_display_cfg_t EspLcdDisplayV2::getLvglPortDisplayConfig(std::shared_ptr<EspLcdConfiguration> configuration, esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) {
return lvgl_port_display_cfg_t {
.io_handle = ioHandle,
.panel_handle = panelHandle,
.control_handle = nullptr,
.buffer_size = getBufferSize(configuration),
.double_buffer = false,
.trans_size = 0,
.hres = configuration->horizontalResolution,
.vres = configuration->verticalResolution,
.monochrome = configuration->monochrome,
.rotation = {
.swap_xy = configuration->swapXY,
.mirror_x = configuration->mirrorX,
.mirror_y = configuration->mirrorY,
},
.color_format = configuration->lvglColorFormat,
.flags = {
.buff_dma = configuration->buffSpiram ? 0u : 1u,
.buff_spiram = configuration->buffSpiram ? 1u : 0u,
.sw_rotate = configuration->swRotate ? 1u : 0u,
.swap_bytes = configuration->lvglSwapBytes,
.full_refresh = 0,
.direct_mode = 0
}
};
}
std::shared_ptr<tt::hal::display::DisplayDriver> EspLcdDisplayV2::getDisplayDriver() {
assert(lvglDisplay == nullptr); // Still attached to LVGL context. Call stopLvgl() first.
if (displayDriver == nullptr) {
auto lvgl_port_config = getLvglPortDisplayConfig(configuration, ioHandle, panelHandle);
auto panel_config = createPanelConfig(configuration, GPIO_NUM_NC);
tt::hal::display::ColorFormat color_format;
if (lvgl_port_config.color_format == LV_COLOR_FORMAT_I1) {
color_format = tt::hal::display::ColorFormat::Monochrome;
} else if (lvgl_port_config.color_format == LV_COLOR_FORMAT_RGB565) {
if (panel_config.rgb_ele_order == LCD_RGB_ELEMENT_ORDER_RGB) {
if (lvgl_port_config.flags.swap_bytes) {
color_format = tt::hal::display::ColorFormat::RGB565Swapped;
} else {
color_format = tt::hal::display::ColorFormat::RGB565;
}
} else {
if (lvgl_port_config.flags.swap_bytes) {
color_format = tt::hal::display::ColorFormat::BGR565Swapped;
} else {
color_format = tt::hal::display::ColorFormat::BGR565;
}
}
} else if (lvgl_port_config.color_format == LV_COLOR_FORMAT_RGB888) {
color_format = tt::hal::display::ColorFormat::RGB888;
} else {
check(false, "unsupported driver");
}
displayDriver = std::make_shared<EspLcdDisplayDriver>(
panelHandle,
lvgl_port_config.hres,
lvgl_port_config.vres,
color_format
);
}
return displayDriver;
}
@@ -1,114 +0,0 @@
#pragma once
#include <tactility/check.h>
#include <Tactility/hal/display/DisplayDevice.h>
#include <esp_lcd_panel_dev.h>
#include <esp_lcd_types.h>
#include <esp_lvgl_port_disp.h>
constexpr auto DEFAULT_BUFFER_SIZE = 0;
struct EspLcdConfiguration {
unsigned int horizontalResolution;
unsigned int verticalResolution;
int gapX;
int gapY;
bool monochrome;
bool swapXY;
bool mirrorX;
bool mirrorY;
bool invertColor;
uint32_t bufferSize; // Size in pixel count. 0 means default, which is 1/10 of the screen size
bool swRotate = false; // Use LVGL software rotation instead of hardware swap_xy (required for MIPI-DSI panels that don't support swap_xy)
bool buffSpiram = false; // Allocate LVGL draw buffers from PSRAM instead of DMA-capable internal SRAM (required when sw_rotate needs a 3rd buffer that won't fit in internal SRAM)
std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction;
gpio_num_t resetPin;
lv_color_format_t lvglColorFormat;
bool lvglSwapBytes;
lcd_rgb_element_order_t rgbElementOrder;
uint32_t bitsPerPixel;
};
class EspLcdDisplayV2 : public tt::hal::display::DisplayDevice {
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_panel_handle_t _Nullable panelHandle = nullptr;
lv_display_t* _Nullable lvglDisplay = nullptr;
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable displayDriver;
std::shared_ptr<EspLcdConfiguration> configuration;
bool applyConfiguration() const;
lvgl_port_display_cfg_t getLvglPortDisplayConfig(std::shared_ptr<EspLcdConfiguration> configuration, esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle);
protected:
virtual bool createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) = 0;
virtual esp_lcd_panel_dev_config_t createPanelConfig(std::shared_ptr<EspLcdConfiguration> espLcdConfiguration, gpio_num_t resetPin) = 0;
virtual bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_panel_dev_config_t& panelConfig, esp_lcd_panel_handle_t& panelHandle) = 0;
virtual bool isRgbPanel() const { return false; }
virtual lvgl_port_display_rgb_cfg_t getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { check(false, "Not supported"); }
// Hook for MIPI-DSI DPI panels to let LVGL port use DSI-specific path
virtual bool useDsiPanel() const { return false; }
virtual lvgl_port_display_dsi_cfg_t getLvglPortDisplayDsiConfig(esp_lcd_panel_io_handle_t /*ioHandle*/, esp_lcd_panel_handle_t /*panelHandle*/) {
return lvgl_port_display_dsi_cfg_t{ .flags = { .avoid_tearing = 0 } };
}
// Used for sending commands such as setting curves
esp_lcd_panel_io_handle_t getIoHandle() const { return ioHandle; }
public:
explicit EspLcdDisplayV2(const std::shared_ptr<EspLcdConfiguration>& configuration) :
configuration(configuration)
{}
~EspLcdDisplayV2() override;
bool start() final;
bool stop() final;
// region LVGL
bool supportsLvgl() const final { return true; }
bool startLvgl() final;
bool stopLvgl() final;
lv_display_t* _Nullable getLvglDisplay() const final { return lvglDisplay; }
// endregion
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override { return configuration->touch; }
// region Backlight
void setBacklightDuty(uint8_t backlightDuty) override {
if (configuration->backlightDutyFunction != nullptr) {
configuration->backlightDutyFunction(backlightDuty);
}
}
bool supportsBacklightDuty() const override { return configuration->backlightDutyFunction != nullptr; }
// endregion
// region DisplayDriver
bool supportsDisplayDriver() const override { return true; }
/** @return a NativeDisplay instance if this device supports it */
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable getDisplayDriver() final;
// endregion
};
@@ -1,70 +0,0 @@
#include "EspLcdSpiDisplay.h"
#include <esp_lcd_panel_commands.h>
#include <tactility/log.h>
constexpr auto* TAG = "EspLcdSpiDisplay";
bool EspLcdSpiDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
LOG_I(TAG, "createIoHandle");
const esp_lcd_panel_io_spi_config_t panel_io_config = {
.cs_gpio_num = spiConfiguration->csPin,
.dc_gpio_num = spiConfiguration->dcPin,
.spi_mode = 0,
.pclk_hz = spiConfiguration->pixelClockFrequency,
.trans_queue_depth = spiConfiguration->transactionQueueDepth,
.on_color_trans_done = nullptr,
.user_ctx = nullptr,
.lcd_cmd_bits = 8,
.lcd_param_bits = 8,
.cs_ena_pretrans = 0,
.cs_ena_posttrans = 0,
.flags = {
.dc_high_on_cmd = 0,
.dc_low_on_data = 0,
.dc_low_on_param = 0,
.octal_mode = 0,
.quad_mode = 0,
.sio_mode = 1,
.lsb_first = 0,
.cs_high_active = 0
}
};
if (esp_lcd_new_panel_io_spi(spiConfiguration->spiHostDevice, &panel_io_config, &outHandle) != ESP_OK) {
LOG_E(TAG, "Failed to create panel");
return false;
}
return true;
}
void EspLcdSpiDisplay::setGammaCurve(uint8_t index) {
uint8_t gamma_curve;
switch (index) {
case 0:
gamma_curve = 0x01;
break;
case 1:
gamma_curve = 0x04;
break;
case 2:
gamma_curve = 0x02;
break;
case 3:
gamma_curve = 0x08;
break;
default:
return;
}
const uint8_t param[] = {
gamma_curve
};
auto io_handle = getIoHandle();
assert(io_handle != nullptr);
if (esp_lcd_panel_io_tx_param(io_handle, LCD_CMD_GAMSET, param, 1) != ESP_OK) {
LOG_E(TAG, "Failed to set gamma");
}
}
@@ -1,49 +0,0 @@
#pragma once
#include "EspLcdDisplayV2.h"
#include <driver/spi_common.h>
#include <esp_lcd_io_spi.h>
#include <esp_lcd_types.h>
/**
* Adds IO implementations on top of EspLcdDisplayV2
* @warning This is an abstract class. You need to extend it to use it.
*/
class EspLcdSpiDisplay : public EspLcdDisplayV2 {
public:
struct SpiConfiguration {
spi_host_device_t spiHostDevice;
gpio_num_t csPin;
gpio_num_t dcPin;
unsigned int pixelClockFrequency = 80'000'000; // Hertz
size_t transactionQueueDepth = 10;
};
explicit EspLcdSpiDisplay(const std::shared_ptr<EspLcdConfiguration>& configuration, const std::shared_ptr<SpiConfiguration> spiConfiguration, int gammaCurveCount) :
EspLcdDisplayV2(configuration),
spiConfiguration(spiConfiguration),
gammaCurveCount(gammaCurveCount)
{}
private:
std::shared_ptr<SpiConfiguration> spiConfiguration;
int gammaCurveCount;
protected:
bool createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) override;
// region Gamma
void setGammaCurve(uint8_t index) override;
uint8_t getGammaCurveCount() const override { return gammaCurveCount; }
// endregion
};
@@ -1,93 +0,0 @@
#include "EspLcdTouch.h"
#include <EspLcdTouchDriver.h>
#include <tactility/log.h>
#include <esp_lvgl_port_touch.h>
constexpr auto* TAG = "EspLcdTouch";
bool EspLcdTouch::start() {
if (!createIoHandle(ioHandle) != ESP_OK) {
LOG_E(TAG, "Touch IO failed");
return false;
}
config = createEspLcdTouchConfig();
if (!createTouchHandle(ioHandle, config, touchHandle)) {
LOG_E(TAG, "Driver init failed");
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
return false;
}
return true;
}
bool EspLcdTouch::stop() {
if (lvglDevice != nullptr) {
stopLvgl();
}
if (ioHandle != nullptr) {
esp_lcd_panel_io_del(ioHandle);
ioHandle = nullptr;
}
if (touchHandle != nullptr) {
esp_lcd_touch_del(touchHandle);
touchHandle = nullptr;
}
return true;
}
bool EspLcdTouch::startLvgl(lv_disp_t* display) {
if (lvglDevice != nullptr) {
return false;
}
if (touchDriver != nullptr && touchDriver.use_count() > 1) {
LOG_W(TAG, "TouchDriver is still in use.");
}
const lvgl_port_touch_cfg_t touch_cfg = {
.disp = display,
.handle = touchHandle,
};
LOG_I(TAG, "Adding touch to LVGL");
lvglDevice = lvgl_port_add_touch(&touch_cfg);
if (lvglDevice == nullptr) {
LOG_E(TAG, "Adding touch failed");
return false;
}
return true;
}
bool EspLcdTouch::stopLvgl() {
if (lvglDevice == nullptr) {
return false;
}
lvgl_port_remove_touch(lvglDevice);
lvglDevice = nullptr;
return true;
}
std::shared_ptr<tt::hal::touch::TouchDriver> _Nullable EspLcdTouch::getTouchDriver() {
assert(lvglDevice == nullptr); // Still attached to LVGL context. Call stopLvgl() first.
if (touchHandle == nullptr) {
return nullptr;
}
if (touchDriver == nullptr) {
touchDriver = std::make_shared<EspLcdTouchDriver>(touchHandle);
}
return touchDriver;
}
-44
View File
@@ -1,44 +0,0 @@
#pragma once
#include <esp_lcd_touch.h>
#include <esp_lcd_types.h>
#include <lvgl.h>
#include <Tactility/hal/touch/TouchDevice.h>
#include <Tactility/hal/touch/TouchDriver.h>
class EspLcdTouch : public tt::hal::touch::TouchDevice {
esp_lcd_touch_config_t config;
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_touch_handle_t _Nullable touchHandle = nullptr;
lv_indev_t* lvglDevice = nullptr;
std::shared_ptr<tt::hal::touch::TouchDriver> touchDriver;
protected:
esp_lcd_touch_handle_t _Nullable getTouchHandle() const { return touchHandle; }
virtual bool createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) = 0;
virtual bool createTouchHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_touch_config_t& configuration, esp_lcd_touch_handle_t& touchHandle) = 0;
virtual esp_lcd_touch_config_t createEspLcdTouchConfig() = 0;
public:
bool start() final;
bool stop() final;
bool supportsLvgl() const final { return true; }
bool startLvgl(lv_display_t* display) final;
bool stopLvgl() final;
lv_indev_t* getLvglIndev() final { return lvglDevice; }
bool supportsTouchDriver() override { return true; }
std::shared_ptr<tt::hal::touch::TouchDriver> _Nullable getTouchDriver() final;
};
@@ -1,13 +0,0 @@
#include "EspLcdTouchDriver.h"
#include <tactility/log.h>
constexpr auto* TAG = "EspLcdTouchDriver";
bool EspLcdTouchDriver::getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) {
if (esp_lcd_touch_read_data(handle) != ESP_OK) {
LOG_E(TAG, "Read data failed");
return false;
}
return esp_lcd_touch_get_coordinates(handle, x, y, strength, pointCount, maxPointCount);
}
@@ -1,15 +0,0 @@
#pragma once
#include <esp_lcd_touch.h>
#include <Tactility/hal/touch/TouchDriver.h>
class EspLcdTouchDriver final : public tt::hal::touch::TouchDriver {
esp_lcd_touch_handle_t handle;
public:
EspLcdTouchDriver(esp_lcd_touch_handle_t handle) : handle(handle) {}
bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) override;
};
+9 -14
View File
@@ -1,19 +1,14 @@
# Audio codec module
Defines `AUDIO_CODEC_TYPE` and the codec-agnostic `AudioCodecApi` (open/close/
read/write/volume/mute/native-rate/native-channels/capabilities) that every
audio codec driver in this repo implements (ES8311, ES8388, ES7210, AW88298,
the dummy I2S amps, the PDM mic). This is intentionally low-level: no
resampling or mixing, one codec device per chip. Most app code should go
through `audio_stream` (see `Drivers/audio-stream-module`) instead of talking
to a codec device directly.
Defines codec-agnostic `AudioCodecApi` (open/close/read/write/volume/mute/native-rate/native-channels/capabilities)
that every audio codec driver in this repo implements (ES8311, ES8388, ES7210, AW88298, the dummy I2S amps, the PDM mic).
This is intentionally low-level: no resampling or mixing, one codec device per chip. Most app code should go through
`audio_stream` (see `Drivers/audio-stream-module`) instead of talking to a codec device directly.
Also provides `audio_codec_adapters.h`: glue that lets a codec driver build an
`esp_codec_dev` control/data/GPIO interface (`audio_codec_ctrl_if_t` /
`audio_codec_data_if_t` / `audio_codec_gpio_if_t`) directly from Tactility's
own I2C controller, I2S controller, and GPIO pin devices, so a codec driver
only ever needs `device_get_parent()`/`device_find_by_name()` plus a handful
of devicetree properties -- it never touches the platform I2C/I2S/GPIO APIs
directly.
Also provides `audio_codec_adapters.h`: glue that lets a codec driver build an `esp_codec_dev` control/data/GPIO
interface (`audio_codec_ctrl_if_t` / `audio_codec_data_if_t` / `audio_codec_gpio_if_t`) directly from Tactility's
own I2C controller, I2S controller, and GPIO pin devices, so a codec driver only ever needs
`device_get_parent()`/`device_find_by_name()` plus a handful of devicetree properties -- it never touches the platform
I2C/I2S/GPIO APIs directly.
License: [Apache v2.0](LICENSE-Apache-2.0.md)
@@ -44,8 +44,7 @@ Module audio_stream_module = {
.name = "audio-stream",
.start = start,
.stop = stop,
.symbols = audio_stream_module_symbols,
.internal = nullptr
.symbols = audio_stream_module_symbols
};
}
+7 -15
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,24 +6,17 @@ extern "C" {
extern Driver aw88298_driver;
static error_t start() {
check(driver_construct_add(&aw88298_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&aw88298_driver) == ERROR_NONE);
return ERROR_NONE;
}
extern const ModuleSymbol aw88298_module_symbols[];
static Driver* const aw88298_drivers[] = {
&aw88298_driver,
nullptr
};
Module aw88298_module = {
.name = "aw88298",
.start = start,
.stop = stop,
.symbols = aw88298_module_symbols,
.internal = nullptr
.drivers = aw88298_drivers,
.symbols = aw88298_module_symbols
};
}
+5 -14
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,22 +6,14 @@ extern "C" {
extern Driver aw9523b_driver;
static error_t start() {
check(driver_construct_add(&aw9523b_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&aw9523b_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const aw9523b_drivers[] = {
&aw9523b_driver,
nullptr
};
Module aw9523b_module = {
.name = "aw9523b",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = aw9523b_drivers
};
}
+8 -21
View File
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
#include <drivers/axp192.h>
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -10,6 +9,13 @@ extern Driver axp192_driver;
extern Driver axp192_power_supply_driver;
extern Driver axp192_backlight_driver;
static Driver* const axp192_drivers[] = {
&axp192_driver,
&axp192_power_supply_driver,
&axp192_backlight_driver,
nullptr
};
const struct ModuleSymbol axp192_module_symbols[] = {
DEFINE_MODULE_SYMBOL(axp192_is_rail_enabled),
DEFINE_MODULE_SYMBOL(axp192_set_rail_enabled),
@@ -27,28 +33,9 @@ const struct ModuleSymbol axp192_module_symbols[] = {
MODULE_SYMBOL_TERMINATOR
};
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&axp192_driver) == ERROR_NONE);
check(driver_construct_add(&axp192_power_supply_driver) == ERROR_NONE);
check(driver_construct_add(&axp192_backlight_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&axp192_backlight_driver) == ERROR_NONE);
check(driver_remove_destruct(&axp192_power_supply_driver) == ERROR_NONE);
check(driver_remove_destruct(&axp192_driver) == ERROR_NONE);
return ERROR_NONE;
}
Module axp192_module = {
.name = "axp192",
.start = start,
.stop = stop,
.drivers = axp192_drivers,
.symbols = axp192_module_symbols,
.internal = nullptr
};
+9 -23
View File
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
#include <drivers/axp2101.h>
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -10,6 +9,13 @@ extern Driver axp2101_driver;
extern Driver axp2101_power_supply_driver;
extern Driver axp2101_backlight_driver;
static Driver* const axp2101_drivers[] = {
&axp2101_driver,
&axp2101_power_supply_driver,
&axp2101_backlight_driver,
nullptr
};
const struct ModuleSymbol axp2101_module_symbols[] = {
DEFINE_MODULE_SYMBOL(axp2101_is_dcdc_enabled),
DEFINE_MODULE_SYMBOL(axp2101_set_dcdc_enabled),
@@ -28,30 +34,10 @@ const struct ModuleSymbol axp2101_module_symbols[] = {
MODULE_SYMBOL_TERMINATOR
};
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&axp2101_driver) == ERROR_NONE);
check(driver_construct_add(&axp2101_power_supply_driver) == ERROR_NONE);
check(driver_construct_add(&axp2101_backlight_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&axp2101_backlight_driver) == ERROR_NONE);
check(driver_remove_destruct(&axp2101_power_supply_driver) == ERROR_NONE);
check(driver_remove_destruct(&axp2101_driver) == ERROR_NONE);
return ERROR_NONE;
}
Module axp2101_module = {
.name = "axp2101",
.start = start,
.stop = stop,
.symbols = axp2101_module_symbols,
.internal = nullptr
.drivers = axp2101_drivers,
.symbols = axp2101_module_symbols
};
}
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver axs5106_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&axs5106_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&axs5106_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const axs5106_drivers[] = {
&axs5106_driver,
nullptr
};
Module axs5106_module = {
.name = "axs5106",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = axs5106_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver bm8563_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&bm8563_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&bm8563_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const bm8563_drivers[] = {
&bm8563_driver,
nullptr
};
Module bm8563_module = {
.name = "bm8563",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = bm8563_drivers
};
}
+6 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,28 +6,17 @@ extern "C" {
extern Driver bmi270_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&bmi270_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&bmi270_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const bmi270_drivers[] = {
&bmi270_driver,
nullptr
};
extern const ModuleSymbol bmi270_module_symbols[];
Module bmi270_module = {
.name = "bmi270",
.start = start,
.stop = stop,
.symbols = bmi270_module_symbols,
.internal = nullptr
.drivers = bmi270_drivers,
.symbols = bmi270_module_symbols
};
}
+6 -20
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -8,28 +7,15 @@ extern "C" {
extern Driver bq24295_driver;
extern Driver bq24295_power_supply_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&bq24295_driver) == ERROR_NONE);
check(driver_construct_add(&bq24295_power_supply_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&bq24295_power_supply_driver) == ERROR_NONE);
check(driver_remove_destruct(&bq24295_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const bq24295_drivers[] = {
&bq24295_driver,
&bq24295_power_supply_driver,
nullptr
};
Module bq24295_module = {
.name = "bq24295",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = bq24295_drivers
};
}
+6 -20
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -8,28 +7,15 @@ extern "C" {
extern Driver bq25896_driver;
extern Driver bq25896_power_supply_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&bq25896_power_supply_driver) == ERROR_NONE);
check(driver_construct_add(&bq25896_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&bq25896_driver) == ERROR_NONE);
check(driver_remove_destruct(&bq25896_power_supply_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const bq25896_drivers[] = {
&bq25896_driver,
&bq25896_power_supply_driver,
nullptr
};
Module bq25896_module = {
.name = "bq25896",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = bq25896_drivers
};
} // extern "C"
+6 -20
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -8,28 +7,15 @@ extern "C" {
extern Driver bq27220_driver;
extern Driver bq27220_power_supply_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&bq27220_power_supply_driver) == ERROR_NONE);
check(driver_construct_add(&bq27220_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&bq27220_driver) == ERROR_NONE);
check(driver_remove_destruct(&bq27220_power_supply_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const bq27220_drivers[] = {
&bq27220_driver,
&bq27220_power_supply_driver,
nullptr
};
Module bq27220_module = {
.name = "bq27220",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = bq27220_drivers
};
} // extern "C"
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver button_control_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&button_control_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&button_control_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const button_control_drivers[] = {
&button_control_driver,
nullptr
};
Module button_control_module = {
.name = "button-control",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = button_control_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver ch422g_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ch422g_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ch422g_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ch422g_drivers[] = {
&ch422g_driver,
nullptr
};
Module ch422g_module = {
.name = "ch422g",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = ch422g_drivers
};
}
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver cst328_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&cst328_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&cst328_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const cst328_drivers[] = {
&cst328_driver,
nullptr
};
Module cst328_module = {
.name = "cst328",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = cst328_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver cst66xx_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&cst66xx_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&cst66xx_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const cst66xx_drivers[] = {
&cst66xx_driver,
nullptr
};
Module cst66xx_module = {
.name = "cst66xx",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = cst66xx_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver cst816s_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&cst816s_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&cst816s_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const cst816s_drivers[] = {
&cst816s_driver,
nullptr
};
Module cst816s_module = {
.name = "cst816s",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = cst816s_drivers
};
} // extern "C"
+5 -12
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,20 +6,14 @@ extern "C" {
extern Driver cst816t_driver;
static error_t start() {
return driver_construct_add(&cst816t_driver);
}
static error_t stop() {
return driver_remove_destruct(&cst816t_driver);
}
static Driver* const cst816t_drivers[] = {
&cst816t_driver,
nullptr
};
Module cst816t_module = {
.name = "cst816t",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = cst816t_drivers
};
} // extern "C"
+5 -14
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,22 +6,14 @@ extern "C" {
extern Driver drv2605_driver;
static error_t start() {
check(driver_construct_add(&drv2605_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&drv2605_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const drv2605_drivers[] = {
&drv2605_driver,
nullptr
};
Module drv2605_module = {
.name = "drv2605",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = drv2605_drivers
};
} // extern "C"
+6 -14
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,24 +6,17 @@ extern "C" {
extern Driver dummy_i2s_amp_driver;
static error_t start() {
check(driver_construct_add(&dummy_i2s_amp_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&dummy_i2s_amp_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const dummy_drivers[] = {
&dummy_i2s_amp_driver,
nullptr
};
extern const ModuleSymbol dummy_i2s_amp_module_symbols[];
Module dummy_i2s_amp_module = {
.name = "dummy_i2s_amp",
.start = start,
.stop = stop,
.symbols = dummy_i2s_amp_module_symbols,
.internal = nullptr
.drivers = dummy_drivers,
.symbols = dummy_i2s_amp_module_symbols
};
}
+5 -13
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,24 +6,17 @@ extern "C" {
extern Driver es7210_driver;
static error_t start() {
check(driver_construct_add(&es7210_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&es7210_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const es7210_drivers[] = {
&es7210_driver,
nullptr
};
extern const ModuleSymbol es7210_module_symbols[];
Module es7210_module = {
.name = "es7210",
.start = start,
.stop = stop,
.drivers = es7210_drivers,
.symbols = es7210_module_symbols,
.internal = nullptr
};
}
+6 -14
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,24 +6,17 @@ extern "C" {
extern Driver es8311_driver;
static error_t start() {
check(driver_construct_add(&es8311_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&es8311_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const es8311_drivers[] = {
&es8311_driver,
nullptr
};
extern const ModuleSymbol es8311_module_symbols[];
Module es8311_module = {
.name = "es8311",
.start = start,
.stop = stop,
.symbols = es8311_module_symbols,
.internal = nullptr
.drivers = es8311_drivers,
.symbols = es8311_module_symbols
};
}
+6 -14
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,24 +6,17 @@ extern "C" {
extern Driver es8388_driver;
static error_t start() {
check(driver_construct_add(&es8388_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&es8388_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const es8388_drivers[] = {
&es8388_driver,
nullptr
};
extern const ModuleSymbol es8388_module_symbols[];
Module es8388_module = {
.name = "es8388",
.start = start,
.stop = stop,
.symbols = es8388_module_symbols,
.internal = nullptr
.drivers = es8388_drivers,
.symbols = es8388_module_symbols
};
}
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver ft5x06_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ft5x06_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ft5x06_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ft5x06_drivers[] = {
&ft5x06_driver,
nullptr
};
Module ft5x06_module = {
.name = "ft5x06",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = ft5x06_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver ft6x36_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ft6x36_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ft6x36_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ft6x36_drivers[] = {
&ft6x36_driver,
nullptr
};
Module ft6x36_module = {
.name = "ft6x36",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = ft6x36_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver gc9a01_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&gc9a01_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&gc9a01_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const gc9a01_drivers[] = {
&gc9a01_driver,
nullptr
};
Module gc9a01_module = {
.name = "gc9a01",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = gc9a01_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver gt911_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&gt911_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&gt911_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const gt911_drivers[] = {
&gt911_driver,
nullptr
};
Module gt911_module = {
.name = "gt911",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = gt911_drivers
};
} // extern "C"
+6 -19
View File
@@ -1,32 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
extern Driver hx8357_driver;
static Driver* const hx8357_drivers[] = {
&hx8357_driver,
nullptr
};
extern "C" {
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&hx8357_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&hx8357_driver) == ERROR_NONE);
return ERROR_NONE;
}
Module hx8357_module = {
.name = "hx8357",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = hx8357_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver ili9341_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ili9341_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ili9341_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ili9341_drivers[] = {
&ili9341_driver,
nullptr
};
Module ili9341_module = {
.name = "ili9341",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = ili9341_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver ili9488_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ili9488_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ili9488_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ili9488_drivers[] = {
&ili9488_driver,
nullptr
};
Module ili9488_module = {
.name = "ili9488",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = ili9488_drivers
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver ili9881c_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ili9881c_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ili9881c_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ili9881c_drivers[] = {
&ili9881c_driver,
nullptr
};
Module ili9881c_module = {
.name = "ili9881c",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = ili9881c_drivers
};
} // extern "C"
+6 -19
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -8,30 +7,18 @@ extern "C" {
extern Driver ina226_driver;
extern Driver ina226_power_supply_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&ina226_driver) == ERROR_NONE);
check(driver_construct_add(&ina226_power_supply_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&ina226_power_supply_driver) == ERROR_NONE);
check(driver_remove_destruct(&ina226_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const ina226_drivers[] = {
&ina226_driver,
&ina226_power_supply_driver,
nullptr
};
extern const ModuleSymbol ina226_module_symbols[];
Module ina226_module = {
.name = "ina226",
.start = start,
.stop = stop,
.drivers = ina226_drivers,
.symbols = ina226_module_symbols,
.internal = nullptr
};
} // extern "C"
+5 -18
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
@@ -7,26 +6,14 @@ extern "C" {
extern Driver jd9165_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct_add(&jd9165_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_remove_destruct(&jd9165_driver) == ERROR_NONE);
return ERROR_NONE;
}
static Driver* const jd9165_drivers[] = {
&jd9165_driver,
nullptr
};
Module jd9165_module = {
.name = "jd9165",
.start = start,
.stop = stop,
.symbols = nullptr,
.internal = nullptr
.drivers = jd9165_drivers
};
} // extern "C"

Some files were not shown because too many files have changed in this diff Show More