New kernel drivers and more (#560)

- Added kernel base drivers for: display, pointer (touch, mouse, etc.), keyboard, adc, power supply and backlight
- Implement new kernel driver modules: `st7789-module` and `gt911-module`
- Implement ESP32 ADC "oneshot" kernel driver
- Implement ESP32  backlight kernel driver with ledc API
- Implemented `battery-sense` driver that allows for voltage measurement and creates a power supply child device
- Updated github actions
- Updated flash scripts
- Fix for esp32 legacy driver conflict with ADC
- Created separate `lilygo-tdeck` and `lilygo-tdeck-plus` devices
- Created `lilygo-module` with LilyGO kernel drivers
- Fix for intermittent errors in build related to code generation of `devicetree.c`
- `lvgl-module` can now map kernel drivers onto LVGL devices
- Created `KernelDisplayApp` as a mirror of `HalDisplayApp` (formerly `DisplayApp`)
- Removed `struct` and `enum` prefix in a lot of kernel driver cpp source files
- `lilygo-tdeck` and `lilygo-tdeck-plus` are now fully relying on kernel drivers and don't use any of the old HAL
This commit is contained in:
Ken Van Hoeylandt
2026-07-12 00:29:12 +02:00
committed by GitHub
parent c4406b24ba
commit 50c0a14a93
149 changed files with 5274 additions and 1266 deletions
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/bindings/bindings.h>
#include <lilygo/drivers/tdeck_keyboard.h>
DEFINE_DEVICETREE(tdeck_keyboard, struct TdeckKeyboardConfig)
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/bindings/bindings.h>
#include <lilygo/drivers/tdeck_keyboard_backlight.h>
DEFINE_DEVICETREE(tdeck_keyboard_backlight, struct TdeckKeyboardBacklightConfig)
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/bindings/bindings.h>
#include <lilygo/drivers/tdeck_trackball.h>
DEFINE_DEVICETREE(tdeck_trackball, struct TdeckTrackballConfig)
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
struct TdeckKeyboardConfig {
uint8_t address;
};
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
struct TdeckKeyboardBacklightConfig {
uint8_t address;
uint8_t brightness_default;
};
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
bool tdeck_power_on();
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <tactility/drivers/gpio.h>
#include <tactility/error.h>
#include <stdbool.h>
#include <stdint.h>
struct Device;
struct DeviceType;
struct TdeckTrackballConfig {
struct GpioPinSpec pin_right;
struct GpioPinSpec pin_up;
struct GpioPinSpec pin_left;
struct GpioPinSpec pin_down;
struct GpioPinSpec pin_click;
};
/**
* @brief API for the T-Deck 5-way trackball driver.
* Reports raw, unscaled movement: sensitivity and mode (encoder vs. pointer) are UI concerns
* layered on top by the consumer, not something this driver knows about.
*/
struct TdeckTrackballApi {
/**
* @brief Reads the accumulated movement since the last read, then resets it to zero.
* @param[in] device the trackball device
* @param[out] out_dx horizontal movement (right positive), in raw pulses
* @param[out] out_dy vertical movement (down positive), in raw pulses
* @retval ERROR_NONE when the operation was successful
*/
error_t (*read_delta)(struct Device* device, int32_t* out_dx, int32_t* out_dy);
/**
* @brief Gets whether the click button is currently pressed.
* @param[in] device the trackball device
* @param[out] out_pressed true when pressed
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_button_pressed)(struct Device* device, bool* out_pressed);
};
/**
* @brief Reads the accumulated movement using the specified trackball device.
*/
error_t tdeck_trackball_read_delta(struct Device* device, int32_t* out_dx, int32_t* out_dy);
/**
* @brief Gets whether the click button is currently pressed on the specified trackball device.
*/
error_t tdeck_trackball_get_button_pressed(struct Device* device, bool* out_pressed);
extern const struct DeviceType TDECK_TRACKBALL_TYPE;
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,56 @@
#pragma once
#include <lvgl.h>
namespace trackball {
/**
* @brief Trackball operating mode
*/
enum class Mode {
Encoder, // Navigation via enc_diff (scroll wheel behavior)
Pointer // Mouse cursor via point.x/y
};
/**
* @brief Initialize trackball as an LVGL input device, backed by the kernel tdeck_trackball driver.
* @return LVGL input device pointer, or nullptr if the kernel device isn't found/started
*/
lv_indev_t* init();
/**
* @brief Deinitialize trackball
*/
void deinit();
/**
* @brief Set encoder mode sensitivity
* @param sensitivity Steps per trackball tick (1-10, default: 1)
*/
void setEncoderSensitivity(uint8_t sensitivity);
/**
* @brief Set pointer mode sensitivity
* @param sensitivity Pixels per trackball tick (1-10, default: 10)
*/
void setPointerSensitivity(uint8_t sensitivity);
/**
* @brief Enable or disable trackball input processing
* @param enabled Boolean value to enable or disable
*/
void setEnabled(bool enabled);
/**
* @brief Set trackball operating mode
* @param mode Encoder or Pointer mode
*/
void setMode(Mode mode);
/**
* @brief Get current trackball operating mode
* @return Current mode
*/
Mode getMode();
}
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/module.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct Module lilygo_module;
#ifdef __cplusplus
}
#endif