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:
committed by
GitHub
parent
c4406b24ba
commit
50c0a14a93
@@ -1,8 +1,10 @@
|
||||
#include "Tactility/lvgl/Lvgl.h"
|
||||
#include "tactility/drivers/backlight.h"
|
||||
#include "tactility/drivers/display.h"
|
||||
|
||||
#include <Tactility/SystemEvents.h>
|
||||
#include <Tactility/CpuAffinity.h>
|
||||
#include <Tactility/Paths.h>
|
||||
#include <Tactility/SystemEvents.h>
|
||||
#include <Tactility/TactilityPrivate.h>
|
||||
#include <Tactility/app/AppContext.h>
|
||||
#include <Tactility/app/AppPaths.h>
|
||||
@@ -56,7 +58,7 @@ class BootApp : public App {
|
||||
getCpuAffinityConfiguration().system
|
||||
);
|
||||
|
||||
static void setupDisplay() {
|
||||
static void setupHalDisplay() {
|
||||
const auto hal_display = getHalDisplay();
|
||||
if (hal_display == nullptr) {
|
||||
return;
|
||||
@@ -80,6 +82,41 @@ class BootApp : public App {
|
||||
}
|
||||
}
|
||||
|
||||
static void setupKernelDisplay() {
|
||||
auto* display = device_find_first_by_type(&DISPLAY_TYPE);
|
||||
// Boards not yet migrated to the kernel display driver register a placeholder device (so
|
||||
// the devicetree node resolves) with a NULL api - nothing for this function to act on.
|
||||
if (display != nullptr && device_get_driver(display)->api == nullptr) {
|
||||
display = nullptr;
|
||||
}
|
||||
if (display != nullptr) {
|
||||
Device* backlight;
|
||||
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
|
||||
if (!device_is_ready(backlight)) {
|
||||
if (device_start(backlight) != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to start %s", backlight->name);
|
||||
}
|
||||
}
|
||||
|
||||
settings::display::DisplaySettings settings;
|
||||
if (settings::display::load(settings)) {
|
||||
} else {
|
||||
settings = settings::display::getDefault();
|
||||
}
|
||||
|
||||
if (backlight_set_brightness(backlight, settings.backlightDuty) == ERROR_NONE) {
|
||||
LOG_I(TAG, "Backlight for %s set to %d", display->name, settings.backlightDuty);
|
||||
} else {
|
||||
LOG_E(TAG, "Failed to set brightness of %s", backlight->name);
|
||||
}
|
||||
} else {
|
||||
LOG_I(TAG, "No backlight for %s", display->name);
|
||||
}
|
||||
} else {
|
||||
LOG_I(TAG, "No kernel display");
|
||||
}
|
||||
}
|
||||
|
||||
static bool setupUsbBootMode() {
|
||||
if (!hal::usb::isUsbBootMode()) {
|
||||
return false;
|
||||
@@ -124,7 +161,8 @@ class BootApp : public App {
|
||||
|
||||
// TODO: Support for multiple displays
|
||||
LOG_I(TAG, "Setup display");
|
||||
setupDisplay(); // Set backlight
|
||||
setupHalDisplay();
|
||||
setupKernelDisplay();
|
||||
prepareFileSystems();
|
||||
|
||||
#ifdef CONFIG_TT_USER_DATA_LOCATION_SD
|
||||
|
||||
Reference in New Issue
Block a user