Device migrations, drivers and fixes (#571)

Device migrations:

- cyd-4848S040c
- guition-jc1060p470ciwy
- guition-jc2432w328c
- guition-jc3248w535c (known issue with display and touch, Shadowtrance will look into it)
- guition-jc8048w550c
- heltec-wifi-lora-32-v3
- lilygo-tdeck-max (excluding graphics)
- lilygo-tdisplay
- lilygo-tdisplay-s3
- lilygo-tdongle-s3
- lilygo-tlora-pager

Driver migrations:

- Implemented haptic driver interface in kernel
- AXS15231b
- BQ25896
- BQ27220
- CST328
- CST6xx
- DRV2605
- JD9165
- Custom LilyGO driver for T-Lora Pager
- SSD1306
- ST7701
- ST7735
- SY6970
- TCA8418

Fixes/improvements:

- Boot app: support for multiple power devices, improved UI
- lvgl_devices and related code: fixes for mapping
- Support for arrays in dts parser
This commit is contained in:
Ken Van Hoeylandt
2026-07-18 15:01:42 +02:00
committed by GitHub
parent 3b5a401594
commit d896657bf9
290 changed files with 9113 additions and 6719 deletions
@@ -1,7 +1,6 @@
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
file(GLOB_RECURSE SOURCE_FILES source/*.c*)
idf_component_register(
SRCS ${SOURCE_FILES}
INCLUDE_DIRS "Source"
REQUIRES Tactility EspLcdCompat SSD1306 ButtonControl EstimatedPower driver
REQUIRES TactilityKernel
)
@@ -1,48 +0,0 @@
#include "devices/Display.h"
#include "devices/Power.h"
#include "devices/Constants.h"
#include <tactility/log.h>
#include <tactility/freertos/task.h>
#include <Tactility/hal/Configuration.h>
#include <ButtonControl.h>
#include <driver/gpio.h>
static void enableOledPower() {
gpio_config_t io_conf = {
.pin_bit_mask = (1ULL << DISPLAY_PIN_POWER),
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE, // The board has an external pull-up
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE,
};
gpio_config(&io_conf);
gpio_set_level(DISPLAY_PIN_POWER, 0); // Active low
vTaskDelay(pdMS_TO_TICKS(500)); // Add a small delay for power to stabilize
LOG_I("HeltecV3", "OLED power enabled");
}
static bool initBoot() {
// Enable power to the OLED before doing anything else
enableOledPower();
return true;
}
using namespace tt::hal;
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createPower(),
ButtonControl::createOneButtonControl(0),
createDisplay()
};
}
extern const Configuration hardwareConfiguration = {
.initBoot = initBoot,
.createDevices = createDevices
};
@@ -1,16 +0,0 @@
#pragma once
#include <driver/gpio.h>
#include <driver/i2c.h>
#include <driver/spi_common.h>
// Display
constexpr auto DISPLAY_I2C_ADDRESS = 0x3C;
constexpr auto DISPLAY_I2C_SPEED = 200000;
constexpr auto DISPLAY_I2C_PORT = I2C_NUM_0;
constexpr auto DISPLAY_PIN_SDA = GPIO_NUM_17;
constexpr auto DISPLAY_PIN_SCL = GPIO_NUM_18;
constexpr auto DISPLAY_PIN_RST = GPIO_NUM_21;
constexpr auto DISPLAY_HORIZONTAL_RESOLUTION = 128;
constexpr auto DISPLAY_VERTICAL_RESOLUTION = 64;
constexpr auto DISPLAY_PIN_POWER = GPIO_NUM_36;
@@ -1,19 +0,0 @@
#include "Display.h"
#include "Constants.h"
#include <Ssd1306Display.h>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto configuration = std::make_unique<Ssd1306Display::Configuration>(
DISPLAY_I2C_PORT,
DISPLAY_I2C_ADDRESS,
DISPLAY_PIN_RST,
DISPLAY_HORIZONTAL_RESOLUTION,
DISPLAY_VERTICAL_RESOLUTION,
nullptr, // no touch
false // invert
);
auto display = std::make_shared<Ssd1306Display>(std::move(configuration));
return std::static_pointer_cast<tt::hal::display::DisplayDevice>(display);
}
@@ -1,5 +0,0 @@
#pragma once
#include <Tactility/hal/display/DisplayDevice.h>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
@@ -1,20 +0,0 @@
#include "Power.h"
#include <ChargeFromAdcVoltage.h>
#include <EstimatedPower.h>
#include <Tactility/hal/gpio/Gpio.h>
#include <memory>
// ADC enable pin on GPIO37
constexpr auto ADC_CTRL = 37;
std::shared_ptr<tt::hal::power::PowerDevice> createPower() {
ChargeFromAdcVoltage::Configuration configuration;
// 2.0 ratio, but +0.11 added as display voltage sag compensation.
configuration.adcMultiplier = 2.11;
// Configure the ADC enable pin as an output
tt::hal::gpio::configure(ADC_CTRL, tt::hal::gpio::Mode::Output, false, false);
return std::make_shared<EstimatedPower>(configuration);
}
@@ -1,7 +0,0 @@
#pragma once
#include <memory>
#include <Tactility/hal/power/PowerDevice.h>
#include <driver/gpio.h>
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
@@ -12,6 +12,8 @@ hardware.tinyUsb=true
hardware.esptoolFlashFreq=120M
hardware.bluetooth=true
dependencies.useDeprecatedHal=false
storage.userDataLocation=Internal
display.size=0.96"
@@ -1,3 +1,5 @@
dependencies:
- Platforms/platform-esp32
- Drivers/ssd1306-module
- Drivers/button-control-module
dts: heltec,wifi-lora-32-v3.dts
@@ -5,6 +5,11 @@
#include <tactility/bindings/esp32_wifi_pinned.h>
#include <tactility/bindings/esp32_gpio.h>
#include <tactility/bindings/esp32_i2c.h>
#include <tactility/bindings/esp32_adc_oneshot.h>
#include <tactility/bindings/battery_sense.h>
#include <tactility/bindings/gpio_hog.h>
#include <bindings/button_control.h>
#include <bindings/ssd1306.h>
/ {
compatible = "root";
@@ -25,11 +30,87 @@
gpio-count = <49>;
};
// Board power-enable pins. Must be asserted before the dependent devices below start, since
// devicetree devices are constructed and started during kernel_init(), earlier than the
// deprecated HAL's initBoot() used to run. gpio-hog nodes run in declaration order, so they
// must stay before their dependents.
oled_power_en {
// Active low (external pull-up on the board).
compatible = "gpio-hog";
pin = <&gpio0 36 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_LOW>;
};
adc_ctrl_en {
compatible = "gpio-hog";
pin = <&gpio0 37 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_LOW>;
};
i2c_internal {
compatible = "espressif,esp32-i2c";
port = <I2C_NUM_0>;
clock-frequency = <200000>;
pin-sda = <&gpio0 17 GPIO_FLAG_NONE>;
pin-scl = <&gpio0 18 GPIO_FLAG_NONE>;
display0 {
compatible = "solomon,ssd1306";
reg = <0x3C>;
horizontal-resolution = <128>;
vertical-resolution = <64>;
pin-reset = <&gpio0 21 GPIO_FLAG_NONE>;
// oled_power_en above only just asserted the OLED's power rail moments earlier in
// the same kernel_init() pass - matches the deprecated HAL's old
// enableOledPower()'s explicit 500ms settle delay before touching the chip.
power-on-delay-ms = <500>;
// Vendor bring-up sequence, carried over unchanged from the deprecated HAL's old
// Ssd1306Display.cpp (its own comment: "esp_lcd_panel_init() ... doesn't configure
// correctly for Heltec V3!"). Each byte is its own SSD1306 command - see
// ssd1306-module's init-sequence binding property for the encoding.
init-sequence = [
0xAE // Display off while configuring
0xD5 0xF0 // Set oscillator frequency (~96 Hz) - must come early in the sequence
0xA8 0x3F // Set multiplex ratio (vertical-resolution - 1 = 64 - 1)
0xD3 0x00 // Set display offset
0x40 // Set display start line = 0
0x8D 0x14 // Enable charge pump - must be before memory mode
0x20 0x00 // Horizontal addressing mode
0xA1 // Segment remap (Heltec V3 orientation)
0xC8 // Scan direction reversed
0xDA 0x12 // COM pin config (alternate, for 64-row displays)
0x81 0xCF // Contrast
0xD9 0xF1 // Pre-charge period
0xDB 0x40 // VCOMH deselect level
0x21 0x00 0x7F // Column address range: 0 to (horizontal-resolution - 1)
0x22 0x00 0x07 // Page address range: 0 to 7 (for a 64-row display)
0xA7 // Display invert - required for this panel's wiring
0x2E // Stop scroll
0xAF // Display on
];
};
};
adc0 {
compatible = "espressif,esp32-adc-oneshot";
unit-id = <ADC_UNIT_1>;
channels = <ADC_CHANNEL_3 ADC_ATTEN_DB_12 ADC_BITWIDTH_DEFAULT>;
};
// Matches the deprecated HAL's old Power.cpp: ADC1 CH3 behind a 2:1 divider, with +0.11
// added as display voltage sag compensation (adcMultiplier = 2.11, so multiplier = 2110).
// reference-voltage-mv is the nominal full-scale value at ADC_ATTEN_DB_12 (battery-sense has
// no calibration path, unlike the old driver's raw-scaling formula).
battery-sense {
compatible = "battery-sense";
io-channel = <&adc0 0>;
reference-voltage-mv = <3300>;
multiplier = <2110>;
};
buttons {
compatible = "tactility,button-control";
pin-primary = <&gpio0 0 GPIO_FLAG_NONE>;
};
};
@@ -3,12 +3,10 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}