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,8 +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 esp_lvgl_port esp_lcd EspLcdCompat esp_lcd_jd9165 GT911 PwmBacklight driver vfs fatfs
PRIV_REQUIRES esp_adc EstimatedPower
REQUIRES TactilityKernel
)
@@ -1,17 +0,0 @@
#include "devices/Display.h"
#include "devices/Power.h"
#include <Tactility/hal/Configuration.h>
using namespace tt::hal;
static DeviceVector createDevices() {
return {
createDisplay(),
createPower()
};
}
extern const Configuration hardwareConfiguration = {
.createDevices = createDevices,
};
@@ -1,66 +0,0 @@
#include "Display.h"
#include "Jd9165Display.h"
#include <Gt911Touch.h>
#include <PwmBacklight.h>
#include <Tactility/Mutex.h>
#include <tactility/check.h>
#include <tactility/device.h>
#include <tactility/log.h>
constexpr auto LCD_PIN_RESET = GPIO_NUM_0; // Match P4 EV board reset line
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_23;
constexpr auto LCD_HORIZONTAL_RESOLUTION = 1024;
constexpr auto LCD_VERTICAL_RESOLUTION = 600;
constexpr auto TOUCH_PIN_RESET = GPIO_NUM_NC;
constexpr auto TOUCH_PIN_INTERRUPT = GPIO_NUM_NC;
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto* i2c = device_find_by_name("i2c_internal");
check(i2c);
auto configuration = std::make_unique<Gt911Touch::Configuration>(
i2c,
LCD_HORIZONTAL_RESOLUTION,
LCD_VERTICAL_RESOLUTION,
false, // swapXY
false, // mirrorX
false, // mirrorY
TOUCH_PIN_RESET,
TOUCH_PIN_INTERRUPT
);
return std::make_shared<Gt911Touch>(std::move(configuration));
}
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
// Initialize PWM backlight
if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT, 20000, LEDC_TIMER_1, LEDC_CHANNEL_0)) {
LOG_W("jc1060p470ciwy", "Failed to initialize backlight");
}
auto touch = createTouch();
auto configuration = std::make_shared<EspLcdConfiguration>(EspLcdConfiguration {
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
.verticalResolution = LCD_VERTICAL_RESOLUTION,
.gapX = 0,
.gapY = 0,
.monochrome = false,
.swapXY = false,
.mirrorX = false,
.mirrorY = false,
.invertColor = false,
.bufferSize = 0, // 0 = default (1/10 of screen)
.touch = touch,
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
.resetPin = LCD_PIN_RESET,
.lvglColorFormat = LV_COLOR_FORMAT_RGB565,
.lvglSwapBytes = false,
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB,
.bitsPerPixel = 16
});
const auto display = std::make_shared<Jd9165Display>(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,203 +0,0 @@
#include "Jd9165Display.h"
#include <tactility/log.h>
#include <esp_lcd_jd9165.h>
constexpr auto* TAG = "JD9165";
// MIPI DSI PHY power configuration
#define MIPI_DSI_PHY_PWR_LDO_CHAN 3 // LDO_VO3 connects to VDD_MIPI_DPHY
#define MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV 2500
// JD9165 initialization commands from ESP32-P4 Function EV Board
// Delays set to match the reference sequence exactly.
static const jd9165_lcd_init_cmd_t jd9165_init_cmds[] = {
{0x30, (uint8_t[]){0x00}, 1, 0},
{0xF7, (uint8_t[]){0x49,0x61,0x02,0x00}, 4, 0},
{0x30, (uint8_t[]){0x01}, 1, 0},
{0x04, (uint8_t[]){0x0C}, 1, 0},
{0x05, (uint8_t[]){0x00}, 1, 0},
{0x06, (uint8_t[]){0x00}, 1, 0},
{0x0B, (uint8_t[]){0x11}, 1, 0},
{0x17, (uint8_t[]){0x00}, 1, 0},
{0x20, (uint8_t[]){0x04}, 1, 0},
{0x1F, (uint8_t[]){0x05}, 1, 0},
{0x23, (uint8_t[]){0x00}, 1, 0},
{0x25, (uint8_t[]){0x19}, 1, 0},
{0x28, (uint8_t[]){0x18}, 1, 0},
{0x29, (uint8_t[]){0x04}, 1, 0},
{0x2A, (uint8_t[]){0x01}, 1, 0},
{0x2B, (uint8_t[]){0x04}, 1, 0},
{0x2C, (uint8_t[]){0x01}, 1, 0},
{0x30, (uint8_t[]){0x02}, 1, 0},
{0x01, (uint8_t[]){0x22}, 1, 0},
{0x03, (uint8_t[]){0x12}, 1, 0},
{0x04, (uint8_t[]){0x00}, 1, 0},
{0x05, (uint8_t[]){0x64}, 1, 0},
{0x0A, (uint8_t[]){0x08}, 1, 0},
{0x0B, (uint8_t[]){0x0A,0x1A,0x0B,0x0D,0x0D,0x11,0x10,0x06,0x08,0x1F,0x1D}, 11, 0},
{0x0C, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x0D, (uint8_t[]){0x16,0x1B,0x0B,0x0D,0x0D,0x11,0x10,0x07,0x09,0x1E,0x1C}, 11, 0},
{0x0E, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x0F, (uint8_t[]){0x16,0x1B,0x0D,0x0B,0x0D,0x11,0x10,0x1C,0x1E,0x09,0x07}, 11, 0},
{0x10, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x11, (uint8_t[]){0x0A,0x1A,0x0D,0x0B,0x0D,0x11,0x10,0x1D,0x1F,0x08,0x06}, 11, 0},
{0x12, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x14, (uint8_t[]){0x00,0x00,0x11,0x11}, 4, 0},
{0x18, (uint8_t[]){0x99}, 1, 0},
{0x30, (uint8_t[]){0x06}, 1, 0},
{0x12, (uint8_t[]){0x36,0x2C,0x2E,0x3C,0x38,0x35,0x35,0x32,0x2E,0x1D,0x2B,0x21,0x16,0x29}, 14, 0},
{0x13, (uint8_t[]){0x36,0x2C,0x2E,0x3C,0x38,0x35,0x35,0x32,0x2E,0x1D,0x2B,0x21,0x16,0x29}, 14, 0},
{0x30, (uint8_t[]){0x0A}, 1, 0},
{0x02, (uint8_t[]){0x4F}, 1, 0},
{0x0B, (uint8_t[]){0x40}, 1, 0},
{0x12, (uint8_t[]){0x3E}, 1, 0},
{0x13, (uint8_t[]){0x78}, 1, 0},
{0x30, (uint8_t[]){0x0D}, 1, 0},
{0x0D, (uint8_t[]){0x04}, 1, 0},
{0x10, (uint8_t[]){0x0C}, 1, 0},
{0x11, (uint8_t[]){0x0C}, 1, 0},
{0x12, (uint8_t[]){0x0C}, 1, 0},
{0x13, (uint8_t[]){0x0C}, 1, 0},
{0x30, (uint8_t[]){0x00}, 1, 0},
{0X3A, (uint8_t[]){0x55}, 1, 0},
{0x11, (uint8_t[]){0x00}, 1, 120},
{0x29, (uint8_t[]){0x00}, 1, 20},
};
Jd9165Display::~Jd9165Display() {
// TODO: This should happen during ::stop(), but this isn't currently exposed
if (mipiDsiBus != nullptr) {
esp_lcd_del_dsi_bus(mipiDsiBus);
mipiDsiBus = nullptr;
}
if (ldoChannel != nullptr) {
esp_ldo_release_channel(ldoChannel);
ldoChannel = nullptr;
}
}
bool Jd9165Display::createMipiDsiBus() {
// Enable MIPI DSI PHY power (transition from "no power" to "shutdown" state)
esp_ldo_channel_config_t ldo_mipi_phy_config = {
.chan_id = MIPI_DSI_PHY_PWR_LDO_CHAN,
.voltage_mv = MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV,
.flags = {}
};
if (esp_ldo_acquire_channel(&ldo_mipi_phy_config, &ldoChannel) != ESP_OK) {
LOG_E(TAG, "Failed to acquire LDO channel for MIPI DSI PHY");
return false;
}
LOG_I(TAG, "MIPI DSI PHY powered on");
// Create MIPI DSI bus
// TODO: use MIPI_DSI_PHY_CLK_SRC_DEFAULT() in future ESP-IDF 6.0.0 update with esp_lcd_jd9165 library version 2.x
const esp_lcd_dsi_bus_config_t bus_config = {
.bus_id = 0,
.num_data_lanes = 2,
.phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT,
.lane_bit_rate_mbps = 750
};
if (esp_lcd_new_dsi_bus(&bus_config, &mipiDsiBus) != ESP_OK) {
LOG_E(TAG, "Failed to create MIPI DSI bus");
return false;
}
LOG_I(TAG, "MIPI DSI bus created");
return true;
}
bool Jd9165Display::createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) {
// Initialize MIPI DSI bus if not already done
if (mipiDsiBus == nullptr) {
if (!createMipiDsiBus()) {
return false;
}
}
// Use DBI interface to send LCD commands and parameters
esp_lcd_dbi_io_config_t dbi_config = JD9165_PANEL_IO_DBI_CONFIG();
if (esp_lcd_new_panel_io_dbi(mipiDsiBus, &dbi_config, &ioHandle) != ESP_OK) {
LOG_E(TAG, "Failed to create panel IO");
return false;
}
return true;
}
esp_lcd_panel_dev_config_t Jd9165Display::createPanelConfig(std::shared_ptr<EspLcdConfiguration> espLcdConfiguration, gpio_num_t resetPin) {
return {
.reset_gpio_num = resetPin,
.rgb_ele_order = espLcdConfiguration->rgbElementOrder,
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
.bits_per_pixel = static_cast<uint8_t>(espLcdConfiguration->bitsPerPixel),
.flags = {
.reset_active_high = 0
},
.vendor_config = nullptr // Will be set in createPanelHandle
};
}
bool Jd9165Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_panel_dev_config_t& panelConfig, esp_lcd_panel_handle_t& panelHandle) {
// Create DPI panel configuration
// Override default timings
const esp_lcd_dpi_panel_config_t dpi_config = {
.virtual_channel = 0,
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT,
.dpi_clock_freq_mhz = 50,
.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565,
.in_color_format = LCD_COLOR_FMT_RGB565,
.out_color_format = LCD_COLOR_FMT_RGB565,
.num_fbs = 1,
.video_timing = {
.h_size = 1024,
.v_size = 600,
.hsync_pulse_width = 20,
.hsync_back_porch = 160,
.hsync_front_porch = 160,
.vsync_pulse_width = 2,
.vsync_back_porch = 21,
.vsync_front_porch = 12,
},
.flags = {
.use_dma2d = 1,
.disable_lp = 0
}
};
jd9165_vendor_config_t vendor_config = {
.init_cmds = jd9165_init_cmds,
.init_cmds_size = sizeof(jd9165_init_cmds) / sizeof(jd9165_lcd_init_cmd_t),
.mipi_config = {
.dsi_bus = mipiDsiBus,
.dpi_config = &dpi_config,
},
};
// Create a mutable copy of panelConfig to set vendor_config
esp_lcd_panel_dev_config_t mutable_panel_config = panelConfig;
mutable_panel_config.vendor_config = &vendor_config;
if (esp_lcd_new_panel_jd9165(ioHandle, &mutable_panel_config, &panelHandle) != ESP_OK) {
LOG_E(TAG, "Failed to create panel");
return false;
}
LOG_I(TAG, "JD9165 panel created successfully");
// Defer reset/init to base class applyConfiguration to avoid double initialization
return true;
}
lvgl_port_display_dsi_cfg_t Jd9165Display::getLvglPortDisplayDsiConfig(esp_lcd_panel_io_handle_t /*ioHandle*/, esp_lcd_panel_handle_t /*panelHandle*/) {
// Disable avoid_tearing to prevent stalls/blank flashes when other tasks (e.g. flash writes) block timing
return lvgl_port_display_dsi_cfg_t{
.flags = {
.avoid_tearing = 0,
},
};
}
@@ -1,39 +0,0 @@
#pragma once
#include <EspLcdDisplayV2.h>
#include <Tactility/RecursiveMutex.h>
#include <esp_lcd_mipi_dsi.h>
#include <esp_ldo_regulator.h>
class Jd9165Display final : public EspLcdDisplayV2 {
esp_lcd_dsi_bus_handle_t mipiDsiBus = nullptr;
esp_ldo_channel_handle_t ldoChannel = nullptr;
bool createMipiDsiBus();
protected:
bool createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) override;
esp_lcd_panel_dev_config_t createPanelConfig(std::shared_ptr<EspLcdConfiguration> espLcdConfiguration, gpio_num_t resetPin) override;
bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_panel_dev_config_t& panelConfig, esp_lcd_panel_handle_t& panelHandle) override;
bool useDsiPanel() const override { return true; }
lvgl_port_display_dsi_cfg_t getLvglPortDisplayDsiConfig(esp_lcd_panel_io_handle_t /*ioHandle*/, esp_lcd_panel_handle_t /*panelHandle*/) override;
public:
Jd9165Display(
const std::shared_ptr<EspLcdConfiguration>& configuration
) : EspLcdDisplayV2(configuration) {}
~Jd9165Display() override;
std::string getName() const override { return "JD9165"; }
std::string getDescription() const override { return "JD9165 MIPI-DSI 1024x600 display"; }
};
@@ -1,180 +0,0 @@
#include "Power.h"
#include <ChargeFromVoltage.h>
#include <tactility/log.h>
#include <esp_adc/adc_oneshot.h>
#include <esp_adc/adc_cali.h>
#include <esp_adc/adc_cali_scheme.h>
using tt::hal::power::PowerDevice;
constexpr auto* TAG = "JcPower";
namespace {
constexpr adc_unit_t ADC_UNIT = ADC_UNIT_2;
constexpr adc_channel_t ADC_CHANNEL = ADC_CHANNEL_4; // matches ADC2 CH4 used in brookesia config
constexpr adc_atten_t ADC_ATTEN = ADC_ATTEN_DB_12;
constexpr int32_t UPPER_RESISTOR_OHM = 85'000; // per brookesia settings
constexpr int32_t LOWER_RESISTOR_OHM = 100'000; // per brookesia settings
class JcPower final : public PowerDevice {
public:
JcPower() : chargeEstimator(3.3f, 4.2f) {}
~JcPower() override { deinit(); }
std::string getName() const override { return "JC Power"; }
std::string getDescription() const override { return "Battery voltage via ADC"; }
bool supportsMetric(MetricType type) const override {
switch (type) {
using enum MetricType;
case BatteryVoltage:
case ChargeLevel:
return true;
default:
return false;
}
}
bool getMetric(MetricType type, MetricData& data) override {
if (!ensureInit()) {
return false;
}
uint32_t batteryMv = 0;
if (!readBatteryMilliVolt(batteryMv)) {
return false;
}
switch (type) {
case MetricType::BatteryVoltage:
data.valueAsUint32 = batteryMv;
return true;
case MetricType::ChargeLevel:
data.valueAsUint8 = chargeEstimator.estimateCharge(batteryMv);
return true;
default:
return false;
}
}
private:
bool ensureInit() {
if (initialized) {
return true;
}
adc_oneshot_unit_init_cfg_t init_cfg = {
.unit_id = ADC_UNIT,
.clk_src = ADC_RTC_CLK_SRC_DEFAULT,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
if (adc_oneshot_new_unit(&init_cfg, &adcHandle) != ESP_OK) {
LOG_E(TAG, "ADC unit init failed");
return false;
}
adc_oneshot_chan_cfg_t chan_cfg = {
.atten = ADC_ATTEN,
.bitwidth = ADC_BITWIDTH_DEFAULT,
};
if (adc_oneshot_config_channel(adcHandle, ADC_CHANNEL, &chan_cfg) != ESP_OK) {
LOG_E(TAG, "ADC channel config failed");
adc_oneshot_del_unit(adcHandle);
adcHandle = nullptr;
return false;
}
calibrated = tryInitCalibration();
initialized = true;
return true;
}
bool tryInitCalibration() {
#if ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
adc_cali_line_fitting_config_t cali_config = {
.unit_id = ADC_UNIT,
.atten = ADC_ATTEN,
.bitwidth = ADC_BITWIDTH_DEFAULT,
};
if (adc_cali_create_scheme_line_fitting(&cali_config, &caliHandle) == ESP_OK) {
calScheme = CaliScheme::Line;
LOG_I(TAG, "ADC calibration (line fitting) enabled");
return true;
}
#endif
#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
adc_cali_curve_fitting_config_t curve_cfg = {
.unit_id = ADC_UNIT,
.chan = ADC_CHANNEL,
.atten = ADC_ATTEN,
.bitwidth = ADC_BITWIDTH_DEFAULT,
};
if (adc_cali_create_scheme_curve_fitting(&curve_cfg, &caliHandle) == ESP_OK) {
calScheme = CaliScheme::Curve;
LOG_I(TAG, "ADC calibration (curve fitting) enabled");
return true;
}
#endif
LOG_W(TAG, "ADC calibration not available, using raw scaling");
return false;
}
bool readBatteryMilliVolt(uint32_t& outMv) {
int raw = 0;
if (adc_oneshot_read(adcHandle, ADC_CHANNEL, &raw) != ESP_OK) {
LOG_E(TAG, "ADC read failed");
return false;
}
int mv = 0;
if (calibrated && adc_cali_raw_to_voltage(caliHandle, raw, &mv) == ESP_OK) {
// ok
} else {
// Fallback: approximate assuming 12-bit full scale 3.3V
mv = (raw * 3300) / 4095;
}
const int64_t numerator = static_cast<int64_t>(UPPER_RESISTOR_OHM + LOWER_RESISTOR_OHM) * mv;
const int64_t denominator = LOWER_RESISTOR_OHM;
outMv = static_cast<uint32_t>(numerator / denominator);
return true;
}
void deinit() {
if (adcHandle) {
adc_oneshot_del_unit(adcHandle);
adcHandle = nullptr;
}
if (caliHandle) {
if (calScheme == CaliScheme::Line) {
#if ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
adc_cali_delete_scheme_line_fitting(caliHandle);
#endif
#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
} else if (calScheme == CaliScheme::Curve) {
adc_cali_delete_scheme_curve_fitting(caliHandle);
#endif
}
caliHandle = nullptr;
calibrated = false;
}
}
enum class CaliScheme { None, Line, Curve };
bool initialized = false;
bool calibrated = false;
CaliScheme calScheme = CaliScheme::None;
adc_oneshot_unit_handle_t adcHandle = nullptr;
adc_cali_handle_t caliHandle = nullptr;
ChargeFromVoltage chargeEstimator;
};
} // namespace
std::shared_ptr<PowerDevice> createPower() {
return std::make_shared<JcPower>();
}
@@ -1,7 +0,0 @@
#pragma once
#include <memory>
#include <Tactility/hal/power/PowerDevice.h>
// Battery measurement via ADC2 channel 4 with 85k/100k divider
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
@@ -11,6 +11,8 @@ hardware.spiRamSpeed=200M
hardware.esptoolFlashFreq=80M
hardware.bluetooth=true
dependencies.useDeprecatedHal=false
storage.userDataLocation=SD
display.size=7"
@@ -1,3 +1,5 @@
dependencies:
- Platforms/platform-esp32
- Drivers/jd9165-module
- Drivers/gt911-module
dts: guition,jc1060p470ciwy.dts
@@ -7,13 +7,20 @@
#include <tactility/bindings/esp32_i2s.h>
#include <tactility/bindings/esp32_sdmmc.h>
#include <tactility/bindings/esp32_wifi.h>
#include <tactility/bindings/esp32_adc_oneshot.h>
#include <tactility/bindings/battery_sense.h>
#include <tactility/bindings/esp32_pwm_ledc.h>
#include <tactility/bindings/pwm_backlight.h>
#include <bindings/jd9165.h>
#include <bindings/gt911.h>
/**
* For future reference:
* - ES8311 on I2C with PA PIN at GPIO 11
* - Built-in led at GPIO 26
* - Boot button at GPIO 21
* - LCD reset: GPIO 27
* - LCD reset: GPIO 0 (matches P4 EV board reset line - deprecated HAL's old Display.cpp
* comment claimed GPIO 27 here, but its actual LCD_PIN_RESET constant was GPIO_NUM_0)
* - LCD backlight: GPIO 23
*/
/ {
@@ -41,6 +48,13 @@
clock-frequency = <400000>;
pin-sda = <&gpio0 7 GPIO_FLAG_NONE>;
pin-scl = <&gpio0 8 GPIO_FLAG_NONE>;
touch0 {
compatible = "goodix,gt911";
reg = <0x5D>;
x-max = <1024>;
y-max = <600>;
};
};
i2s0 {
@@ -65,4 +79,116 @@
bus-width = <4>;
on-chip-ldo-chan = <4>;
};
adc0 {
compatible = "espressif,esp32-adc-oneshot";
unit-id = <ADC_UNIT_2>;
channels = <ADC_CHANNEL_4 ADC_ATTEN_DB_12 ADC_BITWIDTH_DEFAULT>;
};
// Matches the deprecated HAL's old Power.cpp: ADC2 CH4 behind an 85k/100k divider
// (multiplier = (85000+100000)/100000 = 1.850), 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 adc_cali fallback).
battery-sense {
compatible = "battery-sense";
io-channel = <&adc0 0>;
reference-voltage-mv = <3300>;
multiplier = <1850>;
};
display_backlight_pwm {
compatible = "espressif,esp32-pwm-ledc";
pin = <&gpio0 23 GPIO_FLAG_NONE>;
period-ns = <50000>;
ledc-timer = <1>;
ledc-channel = <0>;
};
display_backlight {
compatible = "pwm-backlight";
pwm = <&display_backlight_pwm>;
};
display0 {
compatible = "jdi,jd9165";
horizontal-resolution = <1024>;
vertical-resolution = <600>;
pin-reset = <&gpio0 0 GPIO_FLAG_NONE>;
ldo-channel = <3>; // LDO_VO3 connects to VDD_MIPI_DPHY
ldo-voltage-mv = <2500>;
num-data-lanes = <2>;
lane-bit-rate-mbps = <750>;
dpi-clock-freq-mhz = <50>;
hsync-pulse-width = <20>;
hsync-back-porch = <160>;
hsync-front-porch = <160>;
vsync-pulse-width = <2>;
vsync-back-porch = <21>;
vsync-front-porch = <12>;
// Skips the wait-for-scanout in draw_bitmap(): prevents stalls/blank flashes when
// other tasks (e.g. flash writes) block timing, at the cost of tear-free rendering
// (matches the deprecated HAL's old Jd9165Display::getLvglPortDisplayDsiConfig(),
// which disabled esp_lvgl_port's avoid_tearing for the same reason).
allow-tearing;
backlight = <&display_backlight>;
// Vendor bring-up sequence from the ESP32-P4 Function EV Board reference, carried over
// unchanged from the deprecated HAL's old Jd9165Display.cpp. Framing is
// [cmd, data-len, delay-ms, data-len bytes of data...] - see jd9165-module's
// init-sequence binding property for the encoding.
init-sequence = [
0x30 1 0 0x00
0xF7 4 0 0x49 0x61 0x02 0x00
0x30 1 0 0x01
0x04 1 0 0x0C
0x05 1 0 0x00
0x06 1 0 0x00
0x0B 1 0 0x11
0x17 1 0 0x00
0x20 1 0 0x04
0x1F 1 0 0x05
0x23 1 0 0x00
0x25 1 0 0x19
0x28 1 0 0x18
0x29 1 0 0x04
0x2A 1 0 0x01
0x2B 1 0 0x04
0x2C 1 0 0x01
0x30 1 0 0x02
0x01 1 0 0x22
0x03 1 0 0x12
0x04 1 0 0x00
0x05 1 0 0x64
0x0A 1 0 0x08
0x0B 11 0 0x0A 0x1A 0x0B 0x0D 0x0D 0x11 0x10 0x06 0x08 0x1F 0x1D
0x0C 11 0 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D
0x0D 11 0 0x16 0x1B 0x0B 0x0D 0x0D 0x11 0x10 0x07 0x09 0x1E 0x1C
0x0E 11 0 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D
0x0F 11 0 0x16 0x1B 0x0D 0x0B 0x0D 0x11 0x10 0x1C 0x1E 0x09 0x07
0x10 11 0 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D
0x11 11 0 0x0A 0x1A 0x0D 0x0B 0x0D 0x11 0x10 0x1D 0x1F 0x08 0x06
0x12 11 0 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D 0x0D
0x14 4 0 0x00 0x00 0x11 0x11
0x18 1 0 0x99
0x30 1 0 0x06
0x12 14 0 0x36 0x2C 0x2E 0x3C 0x38 0x35 0x35 0x32 0x2E 0x1D 0x2B 0x21 0x16 0x29
0x13 14 0 0x36 0x2C 0x2E 0x3C 0x38 0x35 0x35 0x32 0x2E 0x1D 0x2B 0x21 0x16 0x29
0x30 1 0 0x0A
0x02 1 0 0x4F
0x0B 1 0 0x40
0x12 1 0 0x3E
0x13 1 0 0x78
0x30 1 0 0x0D
0x0D 1 0 0x04
0x10 1 0 0x0C
0x11 1 0 0x0C
0x12 1 0 0x0C
0x13 1 0 0x0C
0x30 1 0 0x00
0x3A 1 0 0x55
0x11 1 120 0x00
0x29 1 20 0x00
];
};
};
@@ -3,16 +3,14 @@
extern "C" {
static error_t start() {
// Empty for now
return ERROR_NONE;
}
static error_t stop() {
// Empty for now
return ERROR_NONE;
}
struct Module guition_jc1060p470ciwy_module = {
Module guition_jc1060p470ciwy_module = {
.name = "guition-jc1060p470ciwy",
.start = start,
.stop = stop,