New kernel drivers and device implementation updates (#561)
- Added modular device support and devicetree bindings for ILI9341, ILI9488, CST816S, XPT2046, and GPIO button input, updating several board configurations for display/touch/backlight/keyboard/battery. - Added a setting to control deprecated HAL usage (device property + Kconfig).
This commit is contained in:
committed by
GitHub
parent
50c0a14a93
commit
fa4a6e255c
@@ -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 esp_lvgl_port ILI9488 XPT2046 PwmBacklight driver
|
||||
REQUIRES TactilityKernel driver
|
||||
)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "devices/Display.h"
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static bool initBoot() {
|
||||
driver::pwmbacklight::init(GPIO_NUM_27);
|
||||
// Delay is required, or GUI will lock up.
|
||||
// It's possibly related to the increased power draw when turning on the backlight.
|
||||
vTaskDelay(100);
|
||||
return true;
|
||||
}
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
};
|
||||
}
|
||||
|
||||
extern const Configuration hardwareConfiguration = {
|
||||
.initBoot = initBoot,
|
||||
.createDevices = createDevices
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include <Ili9488Display.h>
|
||||
#include <PwmBacklight.h>
|
||||
#include <Xpt2046Touch.h>
|
||||
|
||||
std::shared_ptr<Xpt2046Touch> createTouch() {
|
||||
auto configuration = std::make_unique<Xpt2046Touch::Configuration>(
|
||||
CROWPANEL_LCD_SPI_HOST,
|
||||
CROWPANEL_TOUCH_PIN_CS,
|
||||
320,
|
||||
480,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
return std::make_shared<Xpt2046Touch>(std::move(configuration));
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
auto touch = createTouch();
|
||||
|
||||
auto configuration = std::make_unique<Ili9488Display::Configuration>(
|
||||
CROWPANEL_LCD_SPI_HOST,
|
||||
CROWPANEL_LCD_PIN_CS,
|
||||
CROWPANEL_LCD_PIN_DC,
|
||||
320,
|
||||
480,
|
||||
touch,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||
|
||||
auto display = std::make_shared<Ili9488Display>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
|
||||
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST
|
||||
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_15
|
||||
#define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_12
|
||||
#define CROWPANEL_LCD_PIN_DC GPIO_NUM_2 // RS
|
||||
#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320
|
||||
#define CROWPANEL_LCD_VERTICAL_RESOLUTION 240
|
||||
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10)
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
@@ -7,6 +7,8 @@ hardware.target=ESP32
|
||||
hardware.flashSize=4MB
|
||||
hardware.spiRam=false
|
||||
|
||||
dependencies.useDeprecatedHal=false
|
||||
|
||||
storage.userDataLocation=SD
|
||||
|
||||
display.size=3.5"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
- Drivers/ili9488-module
|
||||
- Drivers/xpt2046-module
|
||||
dts: elecrow,crowpanel-basic-35.dts
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/pointer_placeholder.h>
|
||||
#include <tactility/bindings/esp32_ledc_backlight.h>
|
||||
#include <bindings/ili9488.h>
|
||||
#include <bindings/xpt2046.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -32,6 +33,15 @@
|
||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
compatible = "espressif,esp32-ledc-backlight";
|
||||
// Off by default so display power-on won't show the screen from before the last power loss.
|
||||
// The display backlight is turned on during the boot process.
|
||||
status = "disabled";
|
||||
pin-backlight = <&gpio0 27 GPIO_FLAG_NONE>;
|
||||
frequency-hz = <512>;
|
||||
};
|
||||
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
@@ -41,13 +51,22 @@
|
||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
max-transfer-size = <65536>;
|
||||
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
compatible = "ilitek,ili9488";
|
||||
horizontal-resolution = <320>;
|
||||
vertical-resolution = <480>;
|
||||
color-conversion-buffer-size = <15360>;
|
||||
pixel-clock-hz = <40000000>;
|
||||
pin-dc = <&gpio0 2 GPIO_FLAG_NONE>;
|
||||
backlight = <&display_backlight>;
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "pointer-placeholder";
|
||||
compatible = "xptek,xpt2046";
|
||||
x-max = <320>;
|
||||
y-max = <480>;
|
||||
mirror-y;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+1
-3
@@ -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 elecrow_crowpanel_basic_35_module = {
|
||||
Module elecrow_crowpanel_basic_35_module = {
|
||||
.name = "elecrow-crowpanel-basic-35",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
Reference in New Issue
Block a user