Compare commits

..

15 Commits

Author SHA1 Message Date
8473c178e6 Radio: Some minor corrections and tweaks 2025-09-21 21:44:58 +02:00
09ef4c39d4 SX126x: Per-modem validation of parameters 2025-09-21 21:29:36 +02:00
b437c66fa3 Radio: Make modulation property of RadioDevice 2025-09-21 21:01:20 +02:00
6a250edcdb Radio: Add parameter validation, add units 2025-09-21 20:35:16 +02:00
cbfc7305f3 Radio: Refactor parameters and ParameterSet 2025-09-20 19:14:21 +02:00
26b122889c Radio: Refactor RadioDevice thread into compat class 2025-09-20 05:13:34 +02:00
8ae18b208f Radio: Add Parameter Set 2025-09-17 19:12:11 +02:00
e90c3e9170 Radio: Refactor RX/TX packages 2025-09-17 18:50:11 +02:00
6ddeef85b2 ChirpChatter: Update to improved Radio API
+ Add hexdump decode
 + Make progress/status functional
 + Transmit supported
2025-09-17 18:28:33 +02:00
ec7b738f33 Radio: Iteration 2 with Sx1262 - TX Update
Not quite as reliable still, but sending works.
2025-09-17 18:26:57 +02:00
be6266def6 Sx1262: Fixed DIO1 ISR registration by bypassing RadioLib 2025-09-14 11:31:02 +02:00
4d9617bf09 Add RadioDevice and support for SX1262 2025-09-14 09:53:22 +02:00
a0090bd48e ChripChatter: Uncomment all old LoRa API 2025-09-14 09:45:41 +02:00
1b04a18c02 Fixed layout, somewhat.. on the device it shifts in half. 2025-09-05 18:27:40 +02:00
38662dd6a0 Prototype ChripChatter GUI 2025-09-04 17:00:35 +02:00
417 changed files with 2470 additions and 8320 deletions

View File

@ -27,15 +27,6 @@ jobs:
with: with:
board_id: cyd-2432s028r board_id: cyd-2432s028r
arch: esp32 arch: esp32
cyd-e32r28t:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Build"
uses: ./.github/actions/build-firmware
with:
board_id: cyd-e32r28t
arch: esp32
cyd-2432s032c: cyd-2432s032c:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -153,15 +144,6 @@ jobs:
with: with:
board_id: lilygo-tlora-pager board_id: lilygo-tlora-pager
arch: esp32s3 arch: esp32s3
m5stack-cardputer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Build"
uses: ./.github/actions/build-firmware
with:
board_id: m5stack-cardputer
arch: esp32s3
m5stack-core2: m5stack-core2:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -198,30 +180,3 @@ jobs:
with: with:
board_id: waveshare-s3-touch-43 board_id: waveshare-s3-touch-43
arch: esp32s3 arch: esp32s3
waveshare-s3-touch-lcd-147:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Build"
uses: ./.github/actions/build-firmware
with:
board_id: waveshare-s3-touch-lcd-147
arch: esp32s3
waveshare-s3-touch-lcd-128:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Build"
uses: ./.github/actions/build-firmware
with:
board_id: waveshare-s3-touch-lcd-128
arch: esp32s3
waveshare-s3-lcd-13:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Build"
uses: ./.github/actions/build-firmware
with:
board_id: waveshare-s3-lcd-13
arch: esp32s3

3
.gitignore vendored
View File

@ -7,7 +7,6 @@ build-sim/
cmake-build-*/ cmake-build-*/
CMakeCache.txt CMakeCache.txt
*.cbp *.cbp
CMakeFiles
release/ release/
@ -18,6 +17,4 @@ managed_components/
dependencies.lock dependencies.lock
.vscode/ .vscode/
.gitpod.yml
sdkconfig.board.*.dev

3
.gitmodules vendored
View File

@ -10,6 +10,3 @@
[submodule "Libraries/SDL"] [submodule "Libraries/SDL"]
path = Libraries/SDL path = Libraries/SDL
url = https://github.com/libsdl-org/SDL.git url = https://github.com/libsdl-org/SDL.git
[submodule "Libraries/minitar/minitar"]
path = Libraries/minitar/minitar
url = https://github.com/ByteWelder/minitar.git

View File

@ -15,8 +15,6 @@ menu "Tactility App"
bool "CYD 2432S024C" bool "CYD 2432S024C"
config TT_BOARD_CYD_2432S028R config TT_BOARD_CYD_2432S028R
bool "CYD 2432S028R" bool "CYD 2432S028R"
config TT_BOARD_CYD_E32R28T
bool "CYD E32R28T"
config TT_BOARD_CYD_2432S032C config TT_BOARD_CYD_2432S032C
bool "CYD 2432S032C" bool "CYD 2432S032C"
config TT_BOARD_CYD_8048S043C config TT_BOARD_CYD_8048S043C
@ -43,8 +41,6 @@ menu "Tactility App"
bool "LilyGo T-Deck" bool "LilyGo T-Deck"
config TT_BOARD_LILYGO_TLORA_PAGER config TT_BOARD_LILYGO_TLORA_PAGER
bool "LilyGo T-Lora Pager" bool "LilyGo T-Lora Pager"
config TT_BOARD_M5STACK_CARDPUTER
bool "M5Stack Cardputer"
config TT_BOARD_M5STACK_CORE2 config TT_BOARD_M5STACK_CORE2
bool "M5Stack Core2" bool "M5Stack Core2"
config TT_BOARD_M5STACK_CORES3 config TT_BOARD_M5STACK_CORES3
@ -53,12 +49,6 @@ menu "Tactility App"
bool "unPhone" bool "unPhone"
config TT_BOARD_WAVESHARE_S3_TOUCH_43 config TT_BOARD_WAVESHARE_S3_TOUCH_43
bool "Waveshare ESP32 S3 Touch LCD 4.3" bool "Waveshare ESP32 S3 Touch LCD 4.3"
config TT_BOARD_WAVESHARE_S3_TOUCH_LCD_147
bool "Waveshare ESP32 S3 Touch LCD 1.47"
config TT_BOARD_WAVESHARE_S3_TOUCH_LCD_128
bool "Waveshare ESP32 S3 Touch LCD 1.28"
config TT_BOARD_WAVESHARE_S3_LCD_13
bool "Waveshare ESP32 S3 LCD 1.3"
help help
Select a board/hardware configuration. Select a board/hardware configuration.
Use TT_BOARD_CUSTOM if you will manually configure the board in your project. Use TT_BOARD_CUSTOM if you will manually configure the board in your project.

View File

@ -17,9 +17,6 @@
#elif defined(CONFIG_TT_BOARD_CYD_2432S028R) #elif defined(CONFIG_TT_BOARD_CYD_2432S028R)
#include "CYD2432S028R.h" #include "CYD2432S028R.h"
#define TT_BOARD_HARDWARE &cyd_2432s028r_config #define TT_BOARD_HARDWARE &cyd_2432s028r_config
#elif defined(CONFIG_TT_BOARD_CYD_E32R28T)
#include "E32R28T.h"
#define TT_BOARD_HARDWARE &cyd_e32r28t_config
#elif defined(CONFIG_TT_BOARD_CYD_2432S032C) #elif defined(CONFIG_TT_BOARD_CYD_2432S032C)
#include "CYD2432S032C.h" #include "CYD2432S032C.h"
#define TT_BOARD_HARDWARE &cyd_2432S032c_config #define TT_BOARD_HARDWARE &cyd_2432S032c_config
@ -41,9 +38,6 @@
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_50)) #elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_50))
#define TT_BOARD_HARDWARE &crowpanel_basic_50 #define TT_BOARD_HARDWARE &crowpanel_basic_50
#include "CrowPanelBasic50.h" #include "CrowPanelBasic50.h"
#elif defined(CONFIG_TT_BOARD_M5STACK_CARDPUTER)
#include "M5stackCardputer.h"
#define TT_BOARD_HARDWARE &m5stack_cardputer
#elif defined(CONFIG_TT_BOARD_M5STACK_CORE2) #elif defined(CONFIG_TT_BOARD_M5STACK_CORE2)
#include "M5stackCore2.h" #include "M5stackCore2.h"
#define TT_BOARD_HARDWARE &m5stack_core2 #define TT_BOARD_HARDWARE &m5stack_core2
@ -68,15 +62,6 @@
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43) #elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43)
#include "WaveshareS3Touch43.h" #include "WaveshareS3Touch43.h"
#define TT_BOARD_HARDWARE &waveshare_s3_touch_43 #define TT_BOARD_HARDWARE &waveshare_s3_touch_43
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_LCD_147)
#include "WaveshareS3TouchLcd147.h"
#define TT_BOARD_HARDWARE &waveshare_s3_touch_lcd_147
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_LCD_128)
#include "WaveshareS3TouchLcd128.h"
#define TT_BOARD_HARDWARE &waveshare_s3_touch_lcd_128
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_LCD_13)
#include "WaveshareS3Lcd13.h"
#define TT_BOARD_HARDWARE &waveshare_s3_lcd_13
#else #else
#define TT_BOARD_HARDWARE NULL #define TT_BOARD_HARDWARE NULL
#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig. #error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.

View File

@ -1,5 +1,5 @@
dependencies: dependencies:
espressif/esp_lcd_ili9341: "2.0.1" espressif/esp_lcd_ili9341: "2.0.0"
atanisoft/esp_lcd_ili9488: "1.0.10" atanisoft/esp_lcd_ili9488: "1.0.10"
espressif/esp_lcd_touch: "1.1.2" espressif/esp_lcd_touch: "1.1.2"
atanisoft/esp_lcd_touch_xpt2046: "1.0.5" atanisoft/esp_lcd_touch_xpt2046: "1.0.5"
@ -14,7 +14,6 @@ dependencies:
- if: "target in [esp32s3, esp32p4]" - if: "target in [esp32s3, esp32p4]"
espressif/esp_lcd_st7796: espressif/esp_lcd_st7796:
version: "1.3.4" version: "1.3.4"
espressif/esp_lcd_gc9a01: "2.0.3"
espressif/esp_lcd_panel_io_additions: "1.0.1" espressif/esp_lcd_panel_io_additions: "1.0.1"
espressif/esp_tinyusb: espressif/esp_tinyusb:
version: "1.7.6~1" version: "1.7.6~1"

View File

@ -1,26 +1,22 @@
#include "CYD2432S024C.h" #include "CYD2432S024C.h"
#include "devices/Display.h" #include "hal/YellowDisplay.h"
#include "devices/SdCard.h" #include "hal/YellowDisplayConstants.h"
#include "hal/YellowSdCard.h"
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#define CYD_SPI_TRANSFER_SIZE_LIMIT (TWODOTFOUR_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) #define CYD_SPI_TRANSFER_SIZE_LIMIT (TWODOTFOUR_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(TWODOTFOUR_LCD_PIN_BACKLIGHT); return driver::pwmbacklight::init(TWODOTFOUR_LCD_PIN_BACKLIGHT);
} }
static tt::hal::DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const tt::hal::Configuration cyd_2432s024c_config = { const tt::hal::Configuration cyd_2432s024c_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createYellowSdCard(),
.power = nullptr,
.i2c = { .i2c = {
tt::hal::i2c::Configuration { tt::hal::i2c::Configuration {
.name = "First", .name = "First",

View File

@ -1,5 +1,6 @@
#include "Display.h" #include "YellowDisplay.h"
#include "Cst816Touch.h" #include "Cst816Touch.h"
#include "YellowDisplayConstants.h"
#include <Ili934xDisplay.h> #include <Ili934xDisplay.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>

View File

@ -0,0 +1,6 @@
#pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,8 +1,5 @@
#pragma once #pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
#define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27 #define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27
// Display // Display
@ -14,4 +11,3 @@
#define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15 #define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15
#define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2 #define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,4 +1,4 @@
#include "SdCard.h" #include "YellowSdCard.h"
#define TAG "twodotfour_sdcard" #define TAG "twodotfour_sdcard"
@ -9,14 +9,14 @@ constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() { std::shared_ptr<SdCardDevice> createYellowSdCard() {
auto configuration = std::make_unique<SpiSdCardDevice::Config>( auto configuration = std::make_unique<SpiSdCardDevice::Config>(
SDCARD_PIN_CS, SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot, SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive), std::make_shared<tt::Mutex>(),
std::vector<gpio_num_t>(), std::vector<gpio_num_t>(),
SDCARD_SPI_HOST SDCARD_SPI_HOST
); );

View File

@ -4,5 +4,5 @@
using tt::hal::sdcard::SdCardDevice; using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard(); std::shared_ptr<SdCardDevice> createYellowSdCard();

View File

@ -0,0 +1,5 @@
#pragma once
// Touch
#define TWODOTFOUR_TOUCH_I2C_PORT I2C_NUM_0

View File

@ -1,18 +1,14 @@
#include "CYD2432S028R.h" #include "CYD2432S028R.h"
#include "devices/Display.h" #include "hal/YellowDisplay.h"
#include "devices/SdCard.h" #include "hal/YellowConstants.h"
#include "hal/YellowSdCard.h"
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
// SPI Transfer
#define CYD_SPI_TRANSFER_SIZE_LIMIT (CYD2432S028R_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
// Display backlight (PWM)
#define CYD2432S028R_LCD_PIN_BACKLIGHT GPIO_NUM_21
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
//Set the RGB Led Pins to output and turn them off //Set the RGB Led Pins to output and turn them off
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green
@ -26,39 +22,16 @@ static bool initBoot() {
return driver::pwmbacklight::init(CYD2432S028R_LCD_PIN_BACKLIGHT); return driver::pwmbacklight::init(CYD2432S028R_LCD_PIN_BACKLIGHT);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const Configuration cyd_2432s028r_config = { const Configuration cyd_2432s028r_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.i2c = { .sdcard = createYellowSdCard(),
i2c::Configuration { .power = nullptr,
.name = "CN1", .i2c = {},
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_27,
.scl_io_num = GPIO_NUM_22,
.sda_pullup_en = false,
.scl_pullup_en = false,
.master = {
.clk_speed = 400000
},
.clk_flags = 0
}
}
},
.spi { .spi {
//Display //Display
spi::Configuration { spi::Configuration {
.device = SPI2_HOST, .device = CYD2432S028R_LCD_SPI_HOST,
.dma = SPI_DMA_CH_AUTO, .dma = SPI_DMA_CH_AUTO,
.config = { .config = {
.mosi_io_num = GPIO_NUM_13, .mosi_io_num = GPIO_NUM_13,
@ -80,9 +53,10 @@ const Configuration cyd_2432s028r_config = {
.isMutable = false, .isMutable = false,
.lock = tt::lvgl::getSyncLock() .lock = tt::lvgl::getSyncLock()
}, },
// SDCard // SDCard
spi::Configuration { spi::Configuration {
.device = SPI3_HOST, .device = CYD2432S028R_SDCARD_SPI_HOST,
.dma = SPI_DMA_CH_AUTO, .dma = SPI_DMA_CH_AUTO,
.config = { .config = {
.mosi_io_num = GPIO_NUM_23, .mosi_io_num = GPIO_NUM_23,
@ -100,35 +74,9 @@ const Configuration cyd_2432s028r_config = {
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0 .intr_flags = 0
}, },
.initMode = spi::InitMode::ByTactility, .initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false, .isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display .lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
}, },
},
.uart {
uart::Configuration {
.name = "P1",
.port = UART_NUM_1,
.rxPin = GPIO_NUM_1,
.txPin = GPIO_NUM_3,
.rtsPin = GPIO_NUM_NC,
.ctsPin = GPIO_NUM_NC,
.rxBufferSize = 1024,
.txBufferSize = 1024,
.config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 0,
.source_clk = UART_SCLK_DEFAULT,
.flags = {
.allow_pd = 0,
.backup_before_sleep = 0,
}
}
}
} }
}; };

View File

@ -2,5 +2,5 @@
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
// Resistive touch version of the 2.8" yellow board // Resitive touch version of the 2.8" yellow board
extern const tt::hal::Configuration cyd_2432s028r_config; extern const tt::hal::Configuration cyd_2432s028r_config;

View File

@ -1,21 +0,0 @@
#include "SdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() {
auto config = std::make_unique<SpiSdCardDevice::Config>(
GPIO_NUM_5,
GPIO_NUM_NC,
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
std::vector<gpio_num_t>(),
SPI3_HOST
);
return std::make_shared<SpiSdCardDevice>(std::move(config));
}

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "Tactility/hal/display/DisplayDevice.h" // Display backlight (PWM)
#include <memory> #define CYD2432S028R_LCD_PIN_BACKLIGHT GPIO_NUM_21
// Display // Display
#define CYD2432S028R_LCD_SPI_HOST SPI2_HOST #define CYD2432S028R_LCD_SPI_HOST SPI2_HOST
@ -12,6 +12,10 @@
#define CYD2432S028R_LCD_PIN_CS GPIO_NUM_15 #define CYD2432S028R_LCD_PIN_CS GPIO_NUM_15
#define CYD2432S028R_LCD_PIN_DC GPIO_NUM_2 #define CYD2432S028R_LCD_PIN_DC GPIO_NUM_2
// Touch
#define CYD2432S028R_TOUCH_SPI_HOST SPI3_HOST
#define CYD2432S028R_TOUCH_PIN_CS GPIO_NUM_33
// Touch (Software SPI) // Touch (Software SPI)
#define CYD_TOUCH_MISO_PIN GPIO_NUM_39 #define CYD_TOUCH_MISO_PIN GPIO_NUM_39
#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32 #define CYD_TOUCH_MOSI_PIN GPIO_NUM_32
@ -19,4 +23,9 @@
#define CYD_TOUCH_CS_PIN GPIO_NUM_33 #define CYD_TOUCH_CS_PIN GPIO_NUM_33
#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36 #define CYD_TOUCH_IRQ_PIN GPIO_NUM_36
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(); // SDCard
#define CYD2432S028R_SDCARD_SPI_HOST SPI3_HOST
#define CYD2432S028R_SDCARD_PIN_CS GPIO_NUM_5
// SPI Transfer
#define CYD_SPI_TRANSFER_SIZE_LIMIT (CYD2432S028R_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)

View File

@ -1,9 +1,13 @@
#include "Display.h" #include "YellowDisplay.h"
#include "Xpt2046SoftSpi.h" #include "Xpt2046SoftSpi.h"
#include "YellowConstants.h"
#include <Ili934xDisplay.h> #include <Ili934xDisplay.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
constexpr auto* TAG = "CYD"; static const char* TAG = "YellowDisplay";
// Global to hold reference (only needed if calling stop() later)
static std::unique_ptr<Xpt2046SoftSpi> touch;
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() { static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>( auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
@ -19,7 +23,7 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
); );
// Allocate the driver // Allocate the driver
auto touch = std::make_shared<Xpt2046SoftSpi>(std::move(configuration)); touch = std::make_unique<Xpt2046SoftSpi>(std::move(configuration));
// Start the driver // Start the driver
if (!touch->start()) { if (!touch->start()) {
@ -27,7 +31,9 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
return nullptr; return nullptr;
} }
return touch; return std::shared_ptr<tt::hal::touch::TouchDevice>(touch.get(), [](tt::hal::touch::TouchDevice*) {
// No delete needed; `touch` is managed above
});
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {

View File

@ -0,0 +1,6 @@
#pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -0,0 +1,26 @@
#include "YellowSdCard.h"
#include "YellowConstants.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createYellowSdCard() {
auto* configuration = new SpiSdCardDevice::Config(
CYD2432S028R_SDCARD_PIN_CS,
GPIO_NUM_NC,
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(),
std::vector<gpio_num_t>(),
CYD2432S028R_SDCARD_SPI_HOST
);
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
);
return std::shared_ptr<SdCardDevice>(sdcard);
}

View File

@ -4,5 +4,5 @@
using tt::hal::sdcard::SdCardDevice; using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard(); std::shared_ptr<SdCardDevice> createYellowSdCard();

View File

@ -1,7 +1,7 @@
#include "CYD2432S032C.h" #include "CYD2432S032C.h"
#include "Tactility/lvgl/LvglSync.h" #include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "hal/CydDisplay.h"
#include "devices/SdCard.h" #include "hal/CydSdCard.h"
#include <Tactility/kernel/SystemEvents.h> #include <Tactility/kernel/SystemEvents.h>
@ -25,16 +25,11 @@ bool initBoot() {
return true; return true;
} }
static tt::hal::DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const tt::hal::Configuration cyd_2432S032c_config = { const tt::hal::Configuration cyd_2432S032c_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.power = nullptr,
.i2c = { .i2c = {
tt::hal::i2c::Configuration { tt::hal::i2c::Configuration {
.name = "Internal", .name = "Internal",

View File

@ -1,8 +0,0 @@
#pragma once
#include <Tactility/hal/sdcard/SdCardDevice.h>
using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard();

View File

@ -1,4 +1,4 @@
#include "Display.h" #include "CydDisplay.h"
#include <Gt911Touch.h> #include <Gt911Touch.h>
#include <Ili934xDisplay.h> #include <Ili934xDisplay.h>

View File

@ -0,0 +1,6 @@
#pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,10 +1,10 @@
#include "SdCard.h" #include "CydSdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
constexpr auto SDCARD_SPI_HOST = SPI3_HOST; #define SDCARD_SPI_HOST SPI3_HOST
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5; #define SDCARD_PIN_CS GPIO_NUM_5
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
@ -15,7 +15,7 @@ std::shared_ptr<SdCardDevice> createSdCard() {
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot, SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive), std::make_shared<tt::Mutex>(),
std::vector<gpio_num_t>(), std::vector<gpio_num_t>(),
SDCARD_SPI_HOST SDCARD_SPI_HOST
); );

View File

@ -1,25 +1,20 @@
#include "CYD4848S040C.h" #include "CYD4848S040C.h"
#include "devices/St7701Display.h" #include "hal/CydDisplay.h"
#include "devices/SdCard.h" #include "hal/CydSdCard.h"
#include <PwmBacklight.h> #include <PwmBacklight.h>
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_38, 1000); return driver::pwmbacklight::init(GPIO_NUM_38, 1000);
} }
static DeviceVector createDevices() {
return {
std::reinterpret_pointer_cast<Device>(std::make_shared<St7701Display>()),
createSdCard()
};
}
const Configuration cyd_4848s040c_config = { const Configuration cyd_4848s040c_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.power = nullptr,
.i2c = { .i2c = {
//Touch //Touch
i2c::Configuration { i2c::Configuration {

View File

@ -1,4 +1,4 @@
#include "St7701Display.h" #include "CydDisplay.h"
#include <Gt911Touch.h> #include <Gt911Touch.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
@ -11,7 +11,7 @@
#include <esp_lcd_panel_io_additions.h> #include <esp_lcd_panel_io_additions.h>
#include <esp_lcd_st7701.h> #include <esp_lcd_st7701.h>
constexpr auto TAG = "St7701Display"; constexpr auto TAG = "ST7701";
static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = { static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = {
// {cmd, { data }, data_size, delay_ms} // {cmd, { data }, data_size, delay_ms}
@ -56,7 +56,7 @@ static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = {
{0x29, (uint8_t[]) {0x00}, 0, 0}, //Display On {0x29, (uint8_t[]) {0x00}, 0, 0}, //Display On
}; };
bool St7701Display::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) { bool CydDisplay::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
spi_line_config_t line_config = { spi_line_config_t line_config = {
.cs_io_type = IO_TYPE_GPIO, .cs_io_type = IO_TYPE_GPIO,
.cs_gpio_num = GPIO_NUM_39, .cs_gpio_num = GPIO_NUM_39,
@ -70,7 +70,7 @@ bool St7701Display::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
return esp_lcd_new_panel_io_3wire_spi(&panel_io_config, &outHandle) == ESP_OK; return esp_lcd_new_panel_io_3wire_spi(&panel_io_config, &outHandle) == ESP_OK;
} }
bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) { bool CydDisplay::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) {
const esp_lcd_rgb_panel_config_t rgb_config = { const esp_lcd_rgb_panel_config_t rgb_config = {
.clk_src = LCD_CLK_SRC_DEFAULT, .clk_src = LCD_CLK_SRC_DEFAULT,
.timings = { .timings = {
@ -180,7 +180,7 @@ bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc
return true; return true;
} }
lvgl_port_display_cfg_t St7701Display::getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { lvgl_port_display_cfg_t CydDisplay::getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) {
return { return {
.io_handle = ioHandle, .io_handle = ioHandle,
.panel_handle = panelHandle, .panel_handle = panelHandle,
@ -208,7 +208,7 @@ lvgl_port_display_cfg_t St7701Display::getLvglPortDisplayConfig(esp_lcd_panel_io
}; };
} }
lvgl_port_display_rgb_cfg_t St7701Display::getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) { lvgl_port_display_rgb_cfg_t CydDisplay::getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) {
return { return {
.flags = { .flags = {
.bb_mode = true, .bb_mode = true,
@ -217,7 +217,7 @@ lvgl_port_display_rgb_cfg_t St7701Display::getLvglPortDisplayRgbConfig(esp_lcd_p
}; };
} }
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable St7701Display::getTouchDevice() { std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable CydDisplay::getTouchDevice() {
if (touchDevice == nullptr) { if (touchDevice == nullptr) {
auto configuration = std::make_unique<Gt911Touch::Configuration>( auto configuration = std::make_unique<Gt911Touch::Configuration>(
I2C_NUM_0, I2C_NUM_0,
@ -231,6 +231,11 @@ std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable St7701Display::getTouchDe
return touchDevice; return touchDevice;
} }
void St7701Display::setBacklightDuty(uint8_t backlightDuty) { void CydDisplay::setBacklightDuty(uint8_t backlightDuty) {
driver::pwmbacklight::setBacklightDuty(backlightDuty); driver::pwmbacklight::setBacklightDuty(backlightDuty);
} }
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto display = std::make_shared<CydDisplay>();
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
}

View File

@ -5,7 +5,7 @@
#include <EspLcdDisplay.h> #include <EspLcdDisplay.h>
#include <lvgl.h> #include <lvgl.h>
class St7701Display final : public EspLcdDisplay { class CydDisplay final : public EspLcdDisplay {
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable touchDevice; std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable touchDevice;
@ -21,7 +21,7 @@ class St7701Display final : public EspLcdDisplay {
public: public:
St7701Display() : EspLcdDisplay(std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive)) {} CydDisplay() : EspLcdDisplay(std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive)) {}
std::string getName() const override { return "ST7701S"; } std::string getName() const override { return "ST7701S"; }
@ -32,7 +32,6 @@ public:
void setBacklightDuty(uint8_t backlightDuty) override; void setBacklightDuty(uint8_t backlightDuty) override;
bool supportsBacklightDuty() const override { return true; } bool supportsBacklightDuty() const override { return true; }
// TODO: Find out why it crashes
bool supportsDisplayDriver() const override { return false; }
}; };
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,4 +1,4 @@
#include "SdCard.h" #include "CydSdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>

View File

@ -1,25 +1,19 @@
#include "CYD8048S043C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_8048s043c_config'" - GCC bug?) #include "CYD8048S043C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_8048s043c_config'" - GCC bug?)
#include "PwmBacklight.h" #include "PwmBacklight.h"
#include "devices/Display.h" #include "hal/CydDisplay.h"
#include "devices/SdCard.h" #include "hal/CydSdCard.h"
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
// Display backlight
return driver::pwmbacklight::init(GPIO_NUM_2, 200); return driver::pwmbacklight::init(GPIO_NUM_2, 200);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const Configuration cyd_8048s043c_config = { const Configuration cyd_8048s043c_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.power = nullptr,
.i2c = { .i2c = {
//Touch //Touch
i2c::Configuration { i2c::Configuration {

View File

@ -1,4 +1,4 @@
#include "Display.h" #include "CydDisplay.h"
#include <Gt911Touch.h> #include <Gt911Touch.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>

View File

@ -1,4 +1,4 @@
#include "SdCard.h" #include "CydSdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>

View File

@ -1,7 +0,0 @@
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
idf_component_register(
SRCS ${SOURCE_FILES}
INCLUDE_DIRS "Source"
REQUIRES Tactility esp_lvgl_port ILI934x XPT2046SoftSPI PwmBacklight driver vfs fatfs
)

View File

@ -1,73 +0,0 @@
#include "E32R28T.h"
#include "devices/SdCard.h"
#include "devices/Display.h"
#include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h>
#define CYD_SPI_TRANSFER_SIZE_LIMIT (240 * 320 / 4 * 2)
static bool initBoot() {
return driver::pwmbacklight::init(CYD_BACKLIGHT_PIN);
}
static tt::hal::DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const tt::hal::Configuration cyd_e32r28t_config = {
.initBoot = initBoot,
.createDevices = createDevices,
.i2c = {},
.spi = {
tt::hal::spi::Configuration {
.device = SPI2_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_13,
.miso_io_num = GPIO_NUM_12,
.sclk_io_num = GPIO_NUM_14,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock()
},
tt::hal::spi::Configuration {
.device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = GPIO_NUM_19,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock()
},
}
};

View File

@ -1,6 +0,0 @@
#pragma once
#include <Tactility/hal/Configuration.h>
// Resistive touch version of the waveshare 2.8" yellow board
extern const tt::hal::Configuration cyd_e32r28t_config;

View File

@ -1,41 +0,0 @@
#include "Display.h"
#include <Xpt2046SoftSpi.h>
#include <Ili934xDisplay.h>
#include <PwmBacklight.h>
#include <Tactility/hal/touch/TouchDevice.h>
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto config = std::make_unique<Xpt2046SoftSpi::Configuration>(
CYD_TOUCH_MOSI_PIN,
CYD_TOUCH_MISO_PIN,
CYD_TOUCH_SCK_PIN,
CYD_TOUCH_CS_PIN,
CYD_DISPLAY_HORIZONTAL_RESOLUTION,
CYD_DISPLAY_VERTICAL_RESOLUTION,
false,
true,
false
);
return std::make_shared<Xpt2046SoftSpi>(std::move(config));
}
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
CYD_DISPLAY_SPI_HOST,
CYD_DISPLAY_PIN_CS,
CYD_DISPLAY_PIN_DC,
CYD_DISPLAY_HORIZONTAL_RESOLUTION,
CYD_DISPLAY_VERTICAL_RESOLUTION,
createTouch(),
false,
true,
false,
false,
0,
LCD_RGB_ELEMENT_ORDER_BGR
);
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
return std::make_shared<Ili934xDisplay>(std::move(configuration));
}

View File

@ -1,25 +0,0 @@
#pragma once
#include <Tactility/hal/display/DisplayDevice.h>
#include <memory>
// Display
#define CYD_DISPLAY_SPI_HOST SPI2_HOST
#define CYD_DISPLAY_PIN_CS GPIO_NUM_15
#define CYD_DISPLAY_PIN_DC GPIO_NUM_2
#define CYD_DISPLAY_HORIZONTAL_RESOLUTION 240
#define CYD_DISPLAY_VERTICAL_RESOLUTION 320
#define CYD_DISPLAY_DRAW_BUFFER_HEIGHT (CYD_DISPLAY_VERTICAL_RESOLUTION / 10)
#define CYD_DISPLAY_DRAW_BUFFER_SIZE (CYD_DISPLAY_HORIZONTAL_RESOLUTION * CYD_DISPLAY_DRAW_BUFFER_HEIGHT)
// Touch (Software SPI)
#define CYD_TOUCH_MISO_PIN GPIO_NUM_39
#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32
#define CYD_TOUCH_SCK_PIN GPIO_NUM_25
#define CYD_TOUCH_CS_PIN GPIO_NUM_33
#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36
// Backlight
#define CYD_BACKLIGHT_PIN GPIO_NUM_21
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,21 +0,0 @@
#include "SdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() {
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
GPIO_NUM_5,
GPIO_NUM_NC,
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
std::vector<gpio_num_t>(),
SPI3_HOST
);
return std::make_shared<SpiSdCardDevice>(
std::move(configuration)
);
}

View File

@ -1,7 +0,0 @@
#pragma once
#include <Tactility/hal/sdcard/SdCardDevice.h>
using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard();

View File

@ -1,16 +1,18 @@
#include "JC2432W328C.h" #include "JC2432W328C.h"
#include "devices/Display.h" #include "hal/YellowDisplay.h"
#include "devices/SdCard.h" #include "hal/YellowDisplayConstants.h"
#include "hal/YellowSdCard.h"
#include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h>
using namespace tt::hal; using namespace tt::hal;
#define CYD_SPI_TRANSFER_SIZE_LIMIT (JC2432W328C_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) #define CYD_SPI_TRANSFER_SIZE_LIMIT (JC2432W328C_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
static bool initBoot() { bool initBoot() {
//Set the RGB Led Pins to output and turn them off //Set the RGB Led Pins to output and turn them off
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green
@ -24,16 +26,11 @@ static bool initBoot() {
return driver::pwmbacklight::init(JC2432W328C_LCD_PIN_BACKLIGHT); return driver::pwmbacklight::init(JC2432W328C_LCD_PIN_BACKLIGHT);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const Configuration cyd_jc2432w328c_config = { const Configuration cyd_jc2432w328c_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createYellowSdCard(),
.power = nullptr,
.i2c = { .i2c = {
//Touch //Touch
i2c::Configuration { i2c::Configuration {

View File

@ -1,8 +1,9 @@
#include "Display.h" #include "YellowDisplay.h"
#include "Cst816Touch.h"
#include "YellowDisplayConstants.h"
#include <Cst816Touch.h>
#include <PwmBacklight.h>
#include <St7789Display.h> #include <St7789Display.h>
#include <PwmBacklight.h>
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() { static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto configuration = std::make_unique<Cst816sTouch::Configuration>( auto configuration = std::make_unique<Cst816sTouch::Configuration>(

View File

@ -0,0 +1,6 @@
#pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,8 +1,5 @@
#pragma once #pragma once
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
// Display backlight (PWM) // Display backlight (PWM)
#define JC2432W328C_LCD_PIN_BACKLIGHT GPIO_NUM_27 #define JC2432W328C_LCD_PIN_BACKLIGHT GPIO_NUM_27
@ -15,4 +12,3 @@
#define JC2432W328C_LCD_PIN_CS GPIO_NUM_15 #define JC2432W328C_LCD_PIN_CS GPIO_NUM_15
#define JC2432W328C_LCD_PIN_DC GPIO_NUM_2 #define JC2432W328C_LCD_PIN_DC GPIO_NUM_2
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,4 +1,6 @@
#include "SdCard.h" #include "YellowSdCard.h"
#define TAG "jc2432w328c_sdcard"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
@ -8,14 +10,14 @@ constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() { std::shared_ptr<SdCardDevice> createYellowSdCard() {
auto configuration = std::make_unique<SpiSdCardDevice::Config>( auto configuration = std::make_unique<SpiSdCardDevice::Config>(
SDCARD_PIN_CS, SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot, SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive), std::make_shared<tt::Mutex>(),
std::vector<gpio_num_t>(), std::vector<gpio_num_t>(),
SDCARD_SPI_HOST SDCARD_SPI_HOST
); );

View File

@ -4,4 +4,5 @@
using tt::hal::sdcard::SdCardDevice; using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard(); std::shared_ptr<SdCardDevice> createYellowSdCard();

View File

@ -1,24 +1,19 @@
#include "JC8048W550C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_jc8048w550c_config'" - GCC bug?) #include "JC8048W550C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_jc8048w550c_config'" - GCC bug?)
#include "PwmBacklight.h" #include "PwmBacklight.h"
#include "devices/Display.h" #include "hal/CydDisplay.h"
#include "devices/SdCard.h" #include "hal/CydSdCard.h"
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_2); return driver::pwmbacklight::init(GPIO_NUM_2);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
const Configuration cyd_jc8048w550c_config = { const Configuration cyd_jc8048w550c_config = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.power = nullptr,
.i2c = { .i2c = {
//Touch //Touch
i2c::Configuration { i2c::Configuration {

View File

@ -1,7 +0,0 @@
#pragma once
#include <Tactility/hal/sdcard/SdCardDevice.h>
using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard();

View File

@ -1,8 +1,9 @@
#include "Display.h" #include "RgbDisplay.h"
#include "CydDisplay.h"
#include <Gt911Touch.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <RgbDisplay.h> #include <Gt911Touch.h>
#include <Tactility/Log.h> #include <Tactility/Log.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() { std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {

View File

@ -1,4 +1,4 @@
#include "SdCard.h" #include "CydSdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
@ -12,7 +12,7 @@ std::shared_ptr<SdCardDevice> createSdCard() {
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot, SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive), std::make_shared<tt::Mutex>(),
std::vector<gpio_num_t>(), std::vector<gpio_num_t>(),
SPI2_HOST SPI2_HOST
); );

View File

@ -1,7 +1,8 @@
#include "PwmBacklight.h" #include "PwmBacklight.h"
#include "Tactility/lvgl/LvglSync.h" #include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "hal/CrowPanelDisplay.h"
#include "devices/SdCard.h" #include "hal/CrowPanelDisplayConstants.h"
#include "hal/CrowPanelSdCard.h"
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
@ -9,20 +10,14 @@
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_38); return driver::pwmbacklight::init(GPIO_NUM_38);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
extern const Configuration crowpanel_advance_28 = { extern const Configuration crowpanel_advance_28 = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.i2c = { .i2c = {
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port) // There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces // Note: You could repurpose 1 or more UART interfaces as I2C interfaces

View File

@ -1,4 +1,5 @@
#include "Display.h" #include "CrowPanelDisplay.h"
#include "CrowPanelDisplayConstants.h"
#include <Ft5x06Touch.h> #include <Ft5x06Touch.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
@ -10,8 +11,8 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
I2C_NUM_0, I2C_NUM_0,
240, 240,
320, 320,
false, true,
false, true,
false false
); );
@ -25,11 +26,11 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
CROWPANEL_LCD_SPI_HOST, CROWPANEL_LCD_SPI_HOST,
CROWPANEL_LCD_PIN_CS, CROWPANEL_LCD_PIN_CS,
CROWPANEL_LCD_PIN_DC, CROWPANEL_LCD_PIN_DC,
240,
320, 320,
240,
touch, touch,
false, true,
false, true,
false, false,
true true
); );

View File

@ -1,12 +1,8 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h>
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST #define CROWPANEL_LCD_SPI_HOST SPI2_HOST
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_40 #define CROWPANEL_LCD_PIN_CS GPIO_NUM_40
#define CROWPANEL_LCD_PIN_DC GPIO_NUM_41 // RS #define CROWPANEL_LCD_PIN_DC GPIO_NUM_41 // RS
#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320 #define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320
#define CROWPANEL_LCD_VERTICAL_RESOLUTION 240 #define CROWPANEL_LCD_VERTICAL_RESOLUTION 240
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10) #define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10)
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,8 +1,10 @@
#include "SdCard.h" #include "CrowPanelSdCard.h"
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <esp_vfs_fat.h>
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7; constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;

View File

@ -1,7 +1,8 @@
#include "PwmBacklight.h" #include "PwmBacklight.h"
#include "Tactility/lvgl/LvglSync.h" #include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "hal/CrowPanelDisplay.h"
#include "devices/SdCard.h" #include "hal/CrowPanelDisplayConstants.h"
#include "hal/CrowPanelSdCard.h"
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
@ -9,20 +10,14 @@
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_38); return driver::pwmbacklight::init(GPIO_NUM_38);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
extern const Configuration crowpanel_advance_35 = { extern const Configuration crowpanel_advance_35 = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.i2c = { .i2c = {
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port) // There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces // Note: You could repurpose 1 or more UART interfaces as I2C interfaces

View File

@ -1,9 +1,12 @@
#include "Display.h" #include "CrowPanelDisplay.h"
#include "CrowPanelDisplayConstants.h"
#include <Gt911Touch.h> #include <Gt911Touch.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <Ili9488Display.h> #include <Ili9488Display.h>
#define TAG "crowpanel_display"
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() { static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 48 and interrupt pin is 47 // Note for future changes: Reset pin is 48 and interrupt pin is 47
auto configuration = std::make_unique<Gt911Touch::Configuration>( auto configuration = std::make_unique<Gt911Touch::Configuration>(

View File

@ -1,12 +1,8 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h>
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST #define CROWPANEL_LCD_SPI_HOST SPI2_HOST
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_40 #define CROWPANEL_LCD_PIN_CS GPIO_NUM_40
#define CROWPANEL_LCD_PIN_DC GPIO_NUM_41 // RS #define CROWPANEL_LCD_PIN_DC GPIO_NUM_41 // RS
#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320 #define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320
#define CROWPANEL_LCD_VERTICAL_RESOLUTION 480 #define CROWPANEL_LCD_VERTICAL_RESOLUTION 480
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10) #define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10)
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,8 +1,10 @@
#include "SdCard.h" #include "CrowPanelSdCard.h"
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <esp_vfs_fat.h>
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7; constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;

View File

@ -1,12 +1,12 @@
#include "devices/Display.h" #include "hal/CrowPanelDisplay.h"
#include "devices/SdCard.h" #include "hal/CrowPanelSdCard.h"
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <TCA9534.h> #include <TCA9534.h>
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
TCA9534_IO_EXP io_expander = { TCA9534_IO_EXP io_expander = {
.I2C_ADDR = 0x18, .I2C_ADDR = 0x18,
.i2c_master_port = I2C_NUM_0, .i2c_master_port = I2C_NUM_0,
@ -21,16 +21,10 @@ static bool initBoot() {
return true; return true;
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard()
};
}
extern const Configuration crowpanel_advance_50 = { extern const Configuration crowpanel_advance_50 = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.i2c = { .i2c = {
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port) // There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces // Note: You could repurpose 1 or more UART interfaces as I2C interfaces

View File

@ -1,7 +0,0 @@
#pragma once
#include <Tactility/hal/sdcard/SdCardDevice.h>
using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard();

View File

@ -1,4 +1,4 @@
#include "Display.h" #include "CrowPanelDisplay.h"
#include <Gt911Touch.h> #include <Gt911Touch.h>
#include <RgbDisplay.h> #include <RgbDisplay.h>

View File

@ -1,8 +1,10 @@
#include "SdCard.h" #include "CrowPanelSdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <esp_vfs_fat.h>
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() { std::shared_ptr<SdCardDevice> createSdCard() {

View File

@ -1,30 +1,25 @@
#include "PwmBacklight.h" #include "PwmBacklight.h"
#include "devices/Display.h" #include "Tactility/lvgl/LvglSync.h"
#include "devices/SdCard.h" #include "hal/CrowPanelDisplay.h"
#include "hal/CrowPanelDisplayConstants.h"
#include "hal/CrowPanelSdCard.h"
#include <Xpt2046Power.h> #include <Xpt2046Power.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)) #define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_27); return driver::pwmbacklight::init(GPIO_NUM_27);
} }
static DeviceVector createDevices() {
return {
std::make_shared<Xpt2046Power>(),
createDisplay(),
createSdCard(),
};
}
extern const Configuration crowpanel_basic_28 = { extern const Configuration crowpanel_basic_28 = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.power = getOrCreatePower,
.i2c = { .i2c = {
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port) // There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces // Note: You could repurpose 1 or more UART interfaces as I2C interfaces

View File

@ -1,4 +1,5 @@
#include "Display.h" #include "CrowPanelDisplay.h"
#include "CrowPanelDisplayConstants.h"
#include <Ili934xDisplay.h> #include <Ili934xDisplay.h>
#include <Xpt2046Touch.h> #include <Xpt2046Touch.h>

View File

@ -1,7 +1,5 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h>
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST #define CROWPANEL_LCD_SPI_HOST SPI2_HOST
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_15 #define CROWPANEL_LCD_PIN_CS GPIO_NUM_15
#define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_33 #define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_33
@ -9,5 +7,3 @@
#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320 #define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320
#define CROWPANEL_LCD_VERTICAL_RESOLUTION 240 #define CROWPANEL_LCD_VERTICAL_RESOLUTION 240
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10) #define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10)
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,8 +1,10 @@
#include "SdCard.h" #include "CrowPanelSdCard.h"
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <esp_vfs_fat.h>
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() { std::shared_ptr<SdCardDevice> createSdCard() {

View File

@ -1,30 +1,25 @@
#include "PwmBacklight.h" #include "PwmBacklight.h"
#include "Tactility/lvgl/LvglSync.h" #include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "hal/CrowPanelDisplay.h"
#include "devices/SdCard.h" #include "hal/CrowPanelDisplayConstants.h"
#include "hal/CrowPanelSdCard.h"
#include <Xpt2046Power.h> #include <Xpt2046Power.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
constexpr auto CROWPANEL_SPI_TRANSFER_SIZE_LIMIT = (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)); #define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
return driver::pwmbacklight::init(GPIO_NUM_27); return driver::pwmbacklight::init(GPIO_NUM_27);
} }
static DeviceVector createDevices() {
return {
std::make_shared<Xpt2046Power>(),
createDisplay(),
createSdCard(),
};
}
extern const Configuration crowpanel_basic_35 = { extern const Configuration crowpanel_basic_35 = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.power = getOrCreatePower,
.i2c = { .i2c = {
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port) // There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces // Note: You could repurpose 1 or more UART interfaces as I2C interfaces

View File

@ -1,17 +1,19 @@
#include "Display.h" #include "CrowPanelDisplay.h"
#include "CrowPanelDisplayConstants.h"
#include <Ili9488Display.h> #include <Ili9488Display.h>
#include <PwmBacklight.h>
#include <Xpt2046Touch.h> #include <Xpt2046Touch.h>
#include <PwmBacklight.h>
std::shared_ptr<Xpt2046Touch> createTouch() { std::shared_ptr<Xpt2046Touch> createTouch() {
auto configuration = std::make_unique<Xpt2046Touch::Configuration>( auto configuration = std::make_unique<Xpt2046Touch::Configuration>(
CROWPANEL_LCD_SPI_HOST, CROWPANEL_LCD_SPI_HOST,
CROWPANEL_TOUCH_PIN_CS, CROWPANEL_TOUCH_PIN_CS,
320, 320,
480, 480,
false, true,
false, true,
true true
); );
@ -21,18 +23,23 @@ std::shared_ptr<Xpt2046Touch> createTouch() {
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto touch = createTouch(); auto touch = createTouch();
/**
* This display is mirrored on X, but that doesn't seem to work with the driver.
* Instead, we swap XY, which does work. That results in a landscape image.
*/
auto configuration = std::make_unique<Ili9488Display::Configuration>( auto configuration = std::make_unique<Ili9488Display::Configuration>(
CROWPANEL_LCD_SPI_HOST, CROWPANEL_LCD_SPI_HOST,
CROWPANEL_LCD_PIN_CS, CROWPANEL_LCD_PIN_CS,
CROWPANEL_LCD_PIN_DC, CROWPANEL_LCD_PIN_DC,
320,
480, 480,
320,
touch, touch,
false, true,
false, false,
false false
); );
configuration->mirrorX = true;
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
auto display = std::make_shared<Ili9488Display>(std::move(configuration)); auto display = std::make_shared<Ili9488Display>(std::move(configuration));

View File

@ -1,7 +1,5 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h>
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST #define CROWPANEL_LCD_SPI_HOST SPI2_HOST
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_15 #define CROWPANEL_LCD_PIN_CS GPIO_NUM_15
#define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_12 #define CROWPANEL_TOUCH_PIN_CS GPIO_NUM_12
@ -9,5 +7,3 @@
#define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320 #define CROWPANEL_LCD_HORIZONTAL_RESOLUTION 320
#define CROWPANEL_LCD_VERTICAL_RESOLUTION 240 #define CROWPANEL_LCD_VERTICAL_RESOLUTION 240
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10) #define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10)
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -1,4 +1,4 @@
#include "SdCard.h" #include "CrowPanelSdCard.h"
#include <Tactility/lvgl/LvglSync.h> #include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>

View File

@ -1,26 +1,19 @@
#include "devices/Display.h" #include "hal/CrowPanelDisplay.h"
#include "devices/SdCard.h" #include "hal/CrowPanelSdCard.h"
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
using namespace tt::hal; using namespace tt::hal;
static bool initBoot() { bool initBoot() {
// Note: I tried 100 Hz to 100 kHz and couldn't get the flickering to stop
return driver::pwmbacklight::init(GPIO_NUM_2); return driver::pwmbacklight::init(GPIO_NUM_2);
} }
static DeviceVector createDevices() {
return {
createDisplay(),
createSdCard(),
};
}
extern const Configuration crowpanel_basic_50 = { extern const Configuration crowpanel_basic_50 = {
.initBoot = initBoot, .initBoot = initBoot,
.createDevices = createDevices, .createDisplay = createDisplay,
.sdcard = createSdCard(),
.i2c = { .i2c = {
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port) // There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces // Note: You could repurpose 1 or more UART interfaces as I2C interfaces

View File

@ -1,7 +0,0 @@
#pragma once
#include <Tactility/hal/sdcard/SdCardDevice.h>
using tt::hal::sdcard::SdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard();

View File

@ -1,4 +1,4 @@
#include "Display.h" #include "CrowPanelDisplay.h"
#include <Gt911Touch.h> #include <Gt911Touch.h>
#include <PwmBacklight.h> #include <PwmBacklight.h>

View File

@ -1,6 +1,9 @@
#include "SdCard.h" #include "CrowPanelSdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h> #include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
#include <esp_vfs_fat.h>
using tt::hal::sdcard::SpiSdCardDevice; using tt::hal::sdcard::SpiSdCardDevice;

View File

@ -1,22 +1,23 @@
#include "Tactility/lvgl/LvglSync.h" #include "Tactility/lvgl/LvglSync.h"
#include "devices/Display.h" #include "hal/TpagerDisplay.h"
#include "devices/SdCard.h" #include "hal/TpagerEncoder.h"
#include "devices/TpagerEncoder.h" #include "hal/TpagerDisplayConstants.h"
#include "devices/TpagerKeyboard.h" #include "hal/TpagerKeyboard.h"
#include "devices/TpagerPower.h" #include "hal/TpagerPower.h"
#include "hal/TpagerSdCard.h"
#include <Bq25896.h> #include <Bq25896.h>
#include <Drv2605.h> #include <Drv2605.h>
#include <Sx1262.h> #include <Sx1262.h>
#include <Tactility/hal/Configuration.h> #include <Tactility/hal/Configuration.h>
#define TPAGER_SPI_TRANSFER_SIZE_LIMIT (480 * 222 * (LV_COLOR_DEPTH / 8)) #define TPAGER_SPI_TRANSFER_SIZE_LIMIT (TPAGER_LCD_HORIZONTAL_RESOLUTION * TPAGER_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
bool tpagerInit(); bool tpagerInit();
using namespace tt::hal; using namespace tt::hal;
static DeviceVector createDevices() { DeviceVector createDevices() {
auto bq27220 = std::make_shared<Bq27220>(I2C_NUM_0); auto bq27220 = std::make_shared<Bq27220>(I2C_NUM_0);
auto power = std::make_shared<TpagerPower>(bq27220); auto power = std::make_shared<TpagerPower>(bq27220);

View File

@ -1,14 +1,10 @@
#include "Display.h" #include "TpagerDisplay.h"
#include "TpagerDisplayConstants.h"
#include <PwmBacklight.h> #include <PwmBacklight.h>
#include <St7796Display.h> #include <St7796Display.h>
#define TPAGER_LCD_SPI_HOST SPI2_HOST #include <driver/spi_master.h>
#define TPAGER_LCD_PIN_CS GPIO_NUM_38
#define TPAGER_LCD_PIN_DC GPIO_NUM_37 // RS
#define TPAGER_LCD_HORIZONTAL_RESOLUTION 222
#define TPAGER_LCD_VERTICAL_RESOLUTION 480
#define TPAGER_LCD_SPI_TRANSFER_HEIGHT (TPAGER_LCD_VERTICAL_RESOLUTION / 10)
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto configuration = std::make_unique<St7796Display::Configuration>( auto configuration = std::make_unique<St7796Display::Configuration>(

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <Tactility/hal/display/DisplayDevice.h> #include <Tactility/hal/display/DisplayDevice.h>
#include <memory>
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(); std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();

View File

@ -0,0 +1,8 @@
#pragma once
#define TPAGER_LCD_SPI_HOST SPI2_HOST
#define TPAGER_LCD_PIN_CS GPIO_NUM_38
#define TPAGER_LCD_PIN_DC GPIO_NUM_37 // RS
#define TPAGER_LCD_HORIZONTAL_RESOLUTION 222
#define TPAGER_LCD_VERTICAL_RESOLUTION 480
#define TPAGER_LCD_SPI_TRANSFER_HEIGHT (TPAGER_LCD_VERTICAL_RESOLUTION / 10)

View File

@ -111,7 +111,7 @@ void TpagerEncoder::initEncoder() {
} }
} }
int TpagerEncoder::getEncoderPulses() const { int TpagerEncoder::getEncoderPulses() {
int pulses = 0; int pulses = 0;
pcnt_unit_get_count(encPcntUnit, &pulses); pcnt_unit_get_count(encPcntUnit, &pulses);
return pulses; return pulses;

View File

@ -15,7 +15,7 @@ class TpagerEncoder final : public tt::hal::encoder::EncoderDevice {
public: public:
TpagerEncoder() {} TpagerEncoder() {}
~TpagerEncoder() override {} ~TpagerEncoder() {}
std::string getName() const override { return "T-Lora Pager Encoder"; } std::string getName() const override { return "T-Lora Pager Encoder"; }
std::string getDescription() const override { return "The encoder wheel next to the display"; } std::string getDescription() const override { return "The encoder wheel next to the display"; }
@ -23,7 +23,7 @@ public:
bool startLvgl(lv_display_t* display) override; bool startLvgl(lv_display_t* display) override;
bool stopLvgl() override; bool stopLvgl() override;
int getEncoderPulses() const; int getEncoderPulses();
lv_indev_t* _Nullable getLvglIndev() override { return encHandle; } lv_indev_t* _Nullable getLvglIndev() override { return encHandle; }
}; };

Some files were not shown because too many files have changed in this diff Show More