Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a343e58cc | |||
| 61277e74b8 | |||
| efd3c6041c | |||
| 647678ff82 | |||
| 8115ca4fd9 | |||
| db6d3b4acb | |||
| 37420db000 | |||
| b067978c16 | |||
| 09f8031bff | |||
| 1450ca319d | |||
| c139300a58 | |||
| d0d05c67ca | |||
| f660550f86 | |||
| e9384e0c11 | |||
| 9c5a427a34 | |||
| d8346998ce | |||
| 3a59540365 | |||
| d25603166a | |||
| 17b4fc6a47 | |||
| 45a8379426 | |||
| 1e4234d895 | |||
| 2cb413c3d1 | |||
| 5777a1381b | |||
| 15de4e20b8 | |||
| 3802679de4 | |||
| a05a6afaaf | |||
| efd9662cfc | |||
| 00347cbd29 | |||
| b214a3358e | |||
| c7621b5e4c | |||
| 6dc4f698c9 | |||
| f97ca26b01 | |||
| 98bbea3e9c | |||
| f6cdabf3c0 | |||
| dcf28d0868 | |||
| 9cc58099b4 | |||
| 1216862aec | |||
| 7ad0a3cb04 | |||
| bab3eb19bc | |||
| a4d15b2a1e | |||
| 41ad569154 | |||
| faab6d825f | |||
| a2af95b92d | |||
| 53b711584f | |||
| ce8ac61d42 | |||
| d5c94c7a8a | |||
| 7027da00b8 | |||
| 095c8146c3 | |||
| 62c613477a | |||
| d83b98e99b | |||
| ade86c99b4 | |||
| 980b115f1d | |||
| 84049658db | |||
| 068600f98c |
@@ -36,14 +36,16 @@ runs:
|
|||||||
WLR_LIBINPUT_NO_DEVICES: 1
|
WLR_LIBINPUT_NO_DEVICES: 1
|
||||||
WAYLAND_DISPLAY: wayland-1
|
WAYLAND_DISPLAY: wayland-1
|
||||||
GTK_USE_PORTAL: 0
|
GTK_USE_PORTAL: 0
|
||||||
- name: "Configure Project"
|
- name: Setup cmake
|
||||||
uses: threeal/cmake-action@v1.3.0
|
uses: jwlawson/actions-setup-cmake@v2
|
||||||
|
with:
|
||||||
|
cmake-version: '3.31.x'
|
||||||
- name: "Prepare Project"
|
- name: "Prepare Project"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake -S ./ -B buildsim
|
run: cmake -S ./ -B buildsim
|
||||||
- name: "Build Tests"
|
- name: "Build Tests"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build buildsim --target AppSim
|
run: cmake --build buildsim --target FirmwareSim
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: Buildscripts/release-simulator.sh buildsim release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}
|
run: Buildscripts/release-simulator.sh buildsim release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}
|
||||||
|
|||||||
@@ -4,188 +4,51 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [ opened, synchronize, reopened ]
|
||||||
|
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cyd-2432s024c:
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
board: [
|
||||||
|
{ id: cyd-2432s024c, arch: esp32 },
|
||||||
|
{ id: cyd-2432s028r, arch: esp32 },
|
||||||
|
{ id: cyd-2432s028rv3, arch: esp32 },
|
||||||
|
{ id: cyd-e32r28t, arch: esp32 },
|
||||||
|
{ id: cyd-e32r32p, arch: esp32 },
|
||||||
|
{ id: cyd-2432s032c, arch: esp32 },
|
||||||
|
{ id: cyd-jc2432w328c, arch: esp32 },
|
||||||
|
{ id: cyd-8048s043c, arch: esp32s3 },
|
||||||
|
{ id: cyd-jc8048w550c, arch: esp32s3 },
|
||||||
|
{ id: cyd-4848s040c, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-advance-28, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-advance-35, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-advance-50, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-basic-28, arch: esp32 },
|
||||||
|
{ id: elecrow-crowpanel-basic-35, arch: esp32 },
|
||||||
|
{ id: elecrow-crowpanel-basic-50, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tdeck, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tdongle-s3, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tlora-pager, arch: esp32s3 },
|
||||||
|
{ id: m5stack-cardputer, arch: esp32s3 },
|
||||||
|
{ id: m5stack-cardputer-adv, arch: esp32s3 },
|
||||||
|
{ id: m5stack-core2, arch: esp32 },
|
||||||
|
{ id: m5stack-cores3, arch: esp32s3 },
|
||||||
|
{ id: m5stack-stickc-plus, arch: esp32 },
|
||||||
|
{ id: m5stack-stickc-plus2, arch: esp32 },
|
||||||
|
{ id: unphone, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-touch-lcd-43, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-touch-lcd-147, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-touch-lcd-128, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-lcd-13, arch: esp32s3 }
|
||||||
|
]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
uses: ./.github/actions/build-firmware
|
uses: ./.github/actions/build-firmware
|
||||||
with:
|
with:
|
||||||
board_id: cyd-2432s024c
|
board_id: ${{ matrix.board.id }}
|
||||||
arch: esp32
|
arch: ${{ matrix.board.arch }}
|
||||||
cyd-2432s028r:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-2432s028r
|
|
||||||
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:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-2432s032c
|
|
||||||
arch: esp32
|
|
||||||
cyd-jc2432w328c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-jc2432w328c
|
|
||||||
arch: esp32
|
|
||||||
cyd-8048s043c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-8048s043c
|
|
||||||
arch: esp32s3
|
|
||||||
cyd-jc8048w550c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-jc8048w550c
|
|
||||||
arch: esp32s3
|
|
||||||
cyd-4848s040c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-4848s040c
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-advance-28:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-advance-28
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-advance-35:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-advance-35
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-advance-50:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-advance-50
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-basic-28:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-basic-28
|
|
||||||
arch: esp32
|
|
||||||
elecrow-crowpanel-basic-35:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-basic-35
|
|
||||||
arch: esp32
|
|
||||||
elecrow-crowpanel-basic-50:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-basic-50
|
|
||||||
arch: esp32s3
|
|
||||||
lilygo-tdeck:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: lilygo-tdeck
|
|
||||||
arch: esp32s3
|
|
||||||
lilygo-tlora-pager:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: lilygo-tlora-pager
|
|
||||||
arch: esp32s3
|
|
||||||
m5stack-core2:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: m5stack-core2
|
|
||||||
arch: esp32
|
|
||||||
m5stack-cores3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: m5stack-cores3
|
|
||||||
arch: esp32s3
|
|
||||||
unphone:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: unphone
|
|
||||||
arch: esp32s3
|
|
||||||
waveshare-s3-touch-43:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: waveshare-s3-touch-43
|
|
||||||
arch: esp32s3
|
|
||||||
|
|||||||
@@ -4,26 +4,23 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [ opened, synchronize, reopened ]
|
||||||
|
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
esp32:
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
board: [
|
||||||
|
{ id: cyd-2432s028r, arch: esp32 },
|
||||||
|
{ id: lilygo-tdeck, arch: esp32s3 },
|
||||||
|
]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
uses: ./.github/actions/build-sdk
|
uses: ./.github/actions/build-sdk
|
||||||
with:
|
with:
|
||||||
board_id: cyd-2432s024c
|
board_id: ${{ matrix.board.id }}
|
||||||
arch: esp32
|
arch: ${{ matrix.board.arch }}
|
||||||
esp32s3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-sdk
|
|
||||||
with:
|
|
||||||
board_id: lilygo-tdeck
|
|
||||||
arch: esp32s3
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [ opened, synchronize, reopened ]
|
||||||
jobs:
|
jobs:
|
||||||
Build-Simulator-Linux:
|
Linux:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
os_name: linux
|
os_name: linux
|
||||||
platform_name: amd64
|
platform_name: amd64
|
||||||
publish: true
|
publish: true
|
||||||
Build-Simulator-macOS:
|
macOS:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
jobs:
|
jobs:
|
||||||
Run:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repo"
|
- name: "Checkout repo"
|
||||||
|
|||||||
@@ -10,3 +10,9 @@
|
|||||||
[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
|
||||||
|
[submodule "Libraries/cJSON/cJSON"]
|
||||||
|
path = Libraries/cJSON/cJSON
|
||||||
|
url = https://github.com/DaveGamble/cJSON.git
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
|
||||||
#include <sdkconfig.h>
|
|
||||||
|
|
||||||
// Supported hardware:
|
|
||||||
#if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
|
|
||||||
#include "LilygoTdeck.h"
|
|
||||||
#define TT_BOARD_HARDWARE &lilygo_tdeck
|
|
||||||
#elif defined(CONFIG_TT_BOARD_LILYGO_TLORA_PAGER)
|
|
||||||
#include "LilygoTloraPager.h"
|
|
||||||
#define TT_BOARD_HARDWARE &lilygo_tlora_pager
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_2432S024C)
|
|
||||||
#include "CYD2432S024C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_2432s024c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_2432S028R)
|
|
||||||
#include "CYD2432S028R.h"
|
|
||||||
#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)
|
|
||||||
#include "CYD2432S032C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_2432S032c_config
|
|
||||||
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_ADVANCE_28))
|
|
||||||
#define TT_BOARD_HARDWARE &crowpanel_advance_28
|
|
||||||
#include "CrowPanelAdvance28.h"
|
|
||||||
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_ADVANCE_35))
|
|
||||||
#define TT_BOARD_HARDWARE &crowpanel_advance_35
|
|
||||||
#include "CrowPanelAdvance35.h"
|
|
||||||
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_ADVANCE_50))
|
|
||||||
#define TT_BOARD_HARDWARE &crowpanel_advance_50
|
|
||||||
#include "CrowPanelAdvance50.h"
|
|
||||||
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_28))
|
|
||||||
#define TT_BOARD_HARDWARE &crowpanel_basic_28
|
|
||||||
#include "CrowPanelBasic28.h"
|
|
||||||
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_35))
|
|
||||||
#define TT_BOARD_HARDWARE &crowpanel_basic_35
|
|
||||||
#include "CrowPanelBasic35.h"
|
|
||||||
#elif (defined(CONFIG_TT_BOARD_ELECROW_CROWPANEL_BASIC_50))
|
|
||||||
#define TT_BOARD_HARDWARE &crowpanel_basic_50
|
|
||||||
#include "CrowPanelBasic50.h"
|
|
||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_CORE2)
|
|
||||||
#include "M5stackCore2.h"
|
|
||||||
#define TT_BOARD_HARDWARE &m5stack_core2
|
|
||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
|
|
||||||
#include "M5stackCoreS3.h"
|
|
||||||
#define TT_BOARD_HARDWARE &m5stack_cores3
|
|
||||||
#elif defined(CONFIG_TT_BOARD_UNPHONE)
|
|
||||||
#include "UnPhone.h"
|
|
||||||
#define TT_BOARD_HARDWARE &unPhone
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_JC2432W328C)
|
|
||||||
#include "JC2432W328C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_jc2432w328c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_8048S043C)
|
|
||||||
#include "CYD8048S043C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_8048s043c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_JC8048W550C)
|
|
||||||
#include "JC8048W550C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_jc8048w550c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_4848S040C)
|
|
||||||
#include "CYD4848S040C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_4848s040c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43)
|
|
||||||
#include "WaveshareS3Touch43.h"
|
|
||||||
#define TT_BOARD_HARDWARE &waveshare_s3_touch_43
|
|
||||||
#else
|
|
||||||
#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.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // else simulator
|
|
||||||
|
|
||||||
#include "Simulator.h"
|
|
||||||
|
|
||||||
extern tt::hal::Configuration hardware;
|
|
||||||
#define TT_BOARD_HARDWARE &hardware
|
|
||||||
|
|
||||||
#endif // ESP_PLATFORM
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#include <Tactility/app/AppManifest.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
using namespace tt::app;
|
|
||||||
|
|
||||||
class HelloWorldApp : public App {
|
|
||||||
|
|
||||||
void onShow(AppContext& context, lv_obj_t* parent) override {
|
|
||||||
lv_obj_t* toolbar = tt::lvgl::toolbar_create(parent, context);
|
|
||||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
|
||||||
|
|
||||||
lv_obj_t* label = lv_label_create(parent);
|
|
||||||
lv_label_set_text(label, "Hello, world!");
|
|
||||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const AppManifest hello_world_app = {
|
|
||||||
.id = "HelloWorld",
|
|
||||||
.name = "Hello World",
|
|
||||||
.createApp = create<HelloWorldApp>
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 2.4" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_2432s024c_config;
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
#include "Cst816Touch.h"
|
|
||||||
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
// Note: GPIO 25 for reset and GPIO 21 for interrupt?
|
|
||||||
auto configuration = std::make_unique<Cst816sTouch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
240,
|
|
||||||
320
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Cst816sTouch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
TWODOTFOUR_LCD_SPI_HOST,
|
|
||||||
TWODOTFOUR_LCD_PIN_CS,
|
|
||||||
TWODOTFOUR_LCD_PIN_DC,
|
|
||||||
TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
TWODOTFOUR_LCD_VERTICAL_RESOLUTION,
|
|
||||||
touch
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->mirrorX = true;
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27
|
|
||||||
|
|
||||||
// Display
|
|
||||||
#define TWODOTFOUR_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION 240
|
|
||||||
#define TWODOTFOUR_LCD_VERTICAL_RESOLUTION 320
|
|
||||||
#define TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT (TWODOTFOUR_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define TWODOTFOUR_LCD_DRAW_BUFFER_SIZE (TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION * TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
#define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15
|
|
||||||
#define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Resistive touch version of the 2.8" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_2432s028r_config;
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
#include "Xpt2046SoftSpi.h"
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
constexpr auto* TAG = "CYD";
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
|
||||||
CYD_TOUCH_MOSI_PIN,
|
|
||||||
CYD_TOUCH_MISO_PIN,
|
|
||||||
CYD_TOUCH_SCK_PIN,
|
|
||||||
CYD_TOUCH_CS_PIN,
|
|
||||||
CYD2432S028R_LCD_HORIZONTAL_RESOLUTION, // 240
|
|
||||||
CYD2432S028R_LCD_VERTICAL_RESOLUTION, // 320
|
|
||||||
false, // swapXY
|
|
||||||
true, // mirrorX
|
|
||||||
false // mirrorY
|
|
||||||
);
|
|
||||||
|
|
||||||
// Allocate the driver
|
|
||||||
auto touch = std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
|
|
||||||
|
|
||||||
// Start the driver
|
|
||||||
if (!touch->start()) {
|
|
||||||
ESP_LOGE(TAG, "Touch driver start failed");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return touch;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
CYD2432S028R_LCD_SPI_HOST,
|
|
||||||
CYD2432S028R_LCD_PIN_CS,
|
|
||||||
CYD2432S028R_LCD_PIN_DC,
|
|
||||||
CYD2432S028R_LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
CYD2432S028R_LCD_VERTICAL_RESOLUTION,
|
|
||||||
touch,
|
|
||||||
false, // swapXY
|
|
||||||
true, // mirrorX
|
|
||||||
false, // mirrorY
|
|
||||||
false,
|
|
||||||
CYD2432S028R_LCD_DRAW_BUFFER_SIZE
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
#define CYD2432S028R_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define CYD2432S028R_LCD_HORIZONTAL_RESOLUTION 240
|
|
||||||
#define CYD2432S028R_LCD_VERTICAL_RESOLUTION 320
|
|
||||||
#define CYD2432S028R_LCD_DRAW_BUFFER_HEIGHT (CYD2432S028R_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define CYD2432S028R_LCD_DRAW_BUFFER_SIZE (CYD2432S028R_LCD_HORIZONTAL_RESOLUTION * CYD2432S028R_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
#define CYD2432S028R_LCD_PIN_CS GPIO_NUM_15
|
|
||||||
#define CYD2432S028R_LCD_PIN_DC GPIO_NUM_2
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 2.4" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_2432S032c_config;
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
240,
|
|
||||||
320
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
SPI2_HOST,
|
|
||||||
GPIO_NUM_15,
|
|
||||||
GPIO_NUM_2,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
touch,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
0,
|
|
||||||
LCD_RGB_ELEMENT_ORDER_RGB
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 4" square yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_4848s040c_config;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 4.3" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_8048s043c_config;
|
|
||||||
@@ -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;
|
|
||||||
@@ -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));
|
|
||||||
}
|
|
||||||
@@ -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();
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 2.8" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_jc2432w328c_config;
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display backlight (PWM)
|
|
||||||
#define JC2432W328C_LCD_PIN_BACKLIGHT GPIO_NUM_27
|
|
||||||
|
|
||||||
// Display
|
|
||||||
#define JC2432W328C_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define JC2432W328C_LCD_HORIZONTAL_RESOLUTION 240
|
|
||||||
#define JC2432W328C_LCD_VERTICAL_RESOLUTION 320
|
|
||||||
#define JC2432W328C_LCD_DRAW_BUFFER_HEIGHT (JC2432W328C_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define JC2432W328C_LCD_DRAW_BUFFER_SIZE (JC2432W328C_LCD_HORIZONTAL_RESOLUTION * JC2432W328C_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
#define JC2432W328C_LCD_PIN_CS GPIO_NUM_15
|
|
||||||
#define JC2432W328C_LCD_PIN_DC GPIO_NUM_2
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 5" black board
|
|
||||||
extern const tt::hal::Configuration cyd_jc8048w550c_config;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_advance_28;
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Ft5x06Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <St7789Display.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
// Note for future changes: Reset pin is 48 and interrupt pin is 47
|
|
||||||
auto configuration = std::make_unique<Ft5x06Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Ft5x06Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<St7789Display::Configuration>(
|
|
||||||
CROWPANEL_LCD_SPI_HOST,
|
|
||||||
CROWPANEL_LCD_PIN_CS,
|
|
||||||
CROWPANEL_LCD_PIN_DC,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
touch,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
auto display = std::make_shared<St7789Display>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
|
|
||||||
#define CROWPANEL_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define CROWPANEL_LCD_PIN_CS GPIO_NUM_40
|
|
||||||
#define CROWPANEL_LCD_PIN_DC GPIO_NUM_41 // 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();
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_advance_35;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_advance_50;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_basic_28;
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <Xpt2046Touch.h>
|
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
std::shared_ptr<Xpt2046Touch> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Xpt2046Touch::Configuration>(
|
|
||||||
CROWPANEL_LCD_SPI_HOST,
|
|
||||||
CROWPANEL_TOUCH_PIN_CS,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Xpt2046Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
CROWPANEL_LCD_SPI_HOST,
|
|
||||||
CROWPANEL_LCD_PIN_CS,
|
|
||||||
CROWPANEL_LCD_PIN_DC,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
touch
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->mirrorX = true;
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
auto display = std::make_shared<Ili934xDisplay>(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_33
|
|
||||||
#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();
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_basic_35;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_basic_50;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration lilygo_tlora_pager;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration lilygo_tdeck;
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <St7789Display.h>
|
|
||||||
|
|
||||||
#define TDECK_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define TDECK_LCD_PIN_CS GPIO_NUM_12
|
|
||||||
#define TDECK_LCD_PIN_DC GPIO_NUM_11 // RS
|
|
||||||
#define TDECK_LCD_HORIZONTAL_RESOLUTION 320
|
|
||||||
#define TDECK_LCD_VERTICAL_RESOLUTION 240
|
|
||||||
#define TDECK_LCD_SPI_TRANSFER_HEIGHT (TDECK_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
// Note for future changes: Reset pin is 48 and interrupt pin is 47
|
|
||||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<St7789Display::Configuration>(
|
|
||||||
TDECK_LCD_SPI_HOST,
|
|
||||||
TDECK_LCD_PIN_CS,
|
|
||||||
TDECK_LCD_PIN_DC,
|
|
||||||
320,
|
|
||||||
240,
|
|
||||||
touch,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
auto display = std::make_shared<St7789Display>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#include "axp192/axp192.h"
|
|
||||||
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
#include <Tactility/hal/i2c/I2c.h>
|
|
||||||
#include <Tactility/CoreDefines.h>
|
|
||||||
|
|
||||||
#include <driver/i2c.h>
|
|
||||||
#include <driver/spi_master.h>
|
|
||||||
|
|
||||||
constexpr auto* TAG = "Core2";
|
|
||||||
|
|
||||||
axp192_t axpDevice;
|
|
||||||
|
|
||||||
static int32_t axpI2cRead(TT_UNUSED void* handle, uint8_t address, uint8_t reg, uint8_t* buffer, uint16_t size) {
|
|
||||||
if (tt::hal::i2c::masterReadRegister(I2C_NUM_0, address, reg, buffer, size, 50 / portTICK_PERIOD_MS)) {
|
|
||||||
return AXP192_OK;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t axpI2cWrite(TT_UNUSED void* handle, uint8_t address, uint8_t reg, const uint8_t* buffer, uint16_t size) {
|
|
||||||
if (tt::hal::i2c::masterWriteRegister(I2C_NUM_0, address, reg, buffer, size, 50 / portTICK_PERIOD_MS)) {
|
|
||||||
return AXP192_OK;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void initAxp() {
|
|
||||||
axpDevice.read = axpI2cRead;
|
|
||||||
axpDevice.write = axpI2cWrite;
|
|
||||||
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO2_SET_VOLTAGE, 3300); // LCD + SD
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO3_SET_VOLTAGE, 0); // VIB_MOTOR STOP
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_DCDC3_SET_VOLTAGE, 3300);
|
|
||||||
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO2_ENABLE);
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO3_DISABLE);
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_DCDC3_ENABLE);
|
|
||||||
|
|
||||||
axp192_write(&axpDevice, AXP192_PWM1_DUTY_CYCLE_2, 255); // PWM 255 (LED OFF)
|
|
||||||
axp192_write(&axpDevice, AXP192_GPIO1_CONTROL, 0x02); // GPIO1 PWM
|
|
||||||
// TODO: We could charge at 390mA according to the M5Unified code, but the AXP driver in M5Unified limits to 132mA, so it's unclear what the AXP supports.
|
|
||||||
}
|
|
||||||
|
|
||||||
bool initBoot() {
|
|
||||||
TT_LOG_I(TAG, "initBoot");
|
|
||||||
initAxp();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
bool initBoot();
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_core2;
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/power/PowerDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using tt::hal::power::PowerDevice;
|
|
||||||
|
|
||||||
class Core2Power : public PowerDevice {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Core2Power() = default;
|
|
||||||
~Core2Power() override = default;
|
|
||||||
|
|
||||||
std::string getName() const final { return "AXP192 Power"; }
|
|
||||||
std::string getDescription() const final { return "Power management via I2C"; }
|
|
||||||
|
|
||||||
bool supportsMetric(MetricType type) const override;
|
|
||||||
bool getMetric(MetricType type, MetricData& data) override;
|
|
||||||
|
|
||||||
bool supportsChargeControl() const override { return true; }
|
|
||||||
bool isAllowedToCharge() const override;
|
|
||||||
void setAllowedToCharge(bool canCharge) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<PowerDevice> createPower();
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Ft6x36Touch.h>
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
GPIO_NUM_39,
|
|
||||||
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
CORE2_LCD_VERTICAL_RESOLUTION
|
|
||||||
);
|
|
||||||
|
|
||||||
auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
CORE2_LCD_SPI_HOST,
|
|
||||||
CORE2_LCD_PIN_CS,
|
|
||||||
CORE2_LCD_PIN_DC,
|
|
||||||
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
CORE2_LCD_VERTICAL_RESOLUTION,
|
|
||||||
touch,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#define CORE2_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define CORE2_LCD_PIN_CS GPIO_NUM_5
|
|
||||||
#define CORE2_LCD_PIN_DC GPIO_NUM_15
|
|
||||||
#define CORE2_LCD_HORIZONTAL_RESOLUTION 320
|
|
||||||
#define CORE2_LCD_VERTICAL_RESOLUTION 240
|
|
||||||
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_cores3;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
#define CORES3_LCD_SPI_HOST SPI3_HOST
|
|
||||||
#define CORES3_LCD_PIN_CS GPIO_NUM_3
|
|
||||||
#define CORES3_LCD_PIN_DC GPIO_NUM_35
|
|
||||||
#define CORES3_LCD_HORIZONTAL_RESOLUTION 320
|
|
||||||
#define CORES3_LCD_VERTICAL_RESOLUTION 240
|
|
||||||
#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration unPhone;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration waveshare_s3_touch_43;
|
|
||||||
+14
-6
@@ -1,14 +1,22 @@
|
|||||||
#include "CYD2432S024C.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.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)
|
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
return driver::pwmbacklight::init(TWODOTFOUR_LCD_PIN_BACKLIGHT);
|
// 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_16, GPIO_MODE_OUTPUT)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
||||||
|
|
||||||
|
// 0 on, 1 off
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
||||||
|
|
||||||
|
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
@@ -18,7 +26,7 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const tt::hal::Configuration cyd_2432s024c_config = {
|
extern const tt::hal::Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {
|
.i2c = {
|
||||||
@@ -72,7 +80,7 @@ const tt::hal::Configuration cyd_2432s024c_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#include "Display.h"
|
||||||
|
#include "Cst816Touch.h"
|
||||||
|
|
||||||
|
#include <Ili934xDisplay.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
// Note: GPIO 25 for reset and GPIO 21 for interrupt?
|
||||||
|
auto configuration = std::make_unique<Cst816sTouch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
240,
|
||||||
|
320
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Cst816sTouch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
Ili934xDisplay::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = false,
|
||||||
|
.mirrorX = true,
|
||||||
|
.mirrorY = false,
|
||||||
|
.invertColor = false,
|
||||||
|
.swapBytes = true,
|
||||||
|
.bufferSize = LCD_BUFFER_SIZE,
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC,
|
||||||
|
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
||||||
|
};
|
||||||
|
|
||||||
|
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
||||||
|
.spiHostDevice = LCD_SPI_HOST,
|
||||||
|
.csPin = LCD_PIN_CS,
|
||||||
|
.dcPin = LCD_PIN_DC,
|
||||||
|
.pixelClockFrequency = 40'000'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
#include <driver/spi_common.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Display
|
||||||
|
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27;
|
||||||
|
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||||
|
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
||||||
|
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
||||||
|
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
||||||
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
|
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
||||||
|
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
+1
-1
@@ -16,7 +16,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>(),
|
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SDCARD_SPI_HOST
|
SDCARD_SPI_HOST
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
#include "devices/Display.h"
|
||||||
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
static bool initBoot() {
|
||||||
|
// 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_16, GPIO_MODE_OUTPUT)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
||||||
|
|
||||||
|
// 0 on, 1 off
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
||||||
|
|
||||||
|
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DeviceVector createDevices() {
|
||||||
|
return {
|
||||||
|
createDisplay(),
|
||||||
|
createSdCard()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration hardwareConfiguration = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDevices = createDevices,
|
||||||
|
.i2c = {
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "CN1",
|
||||||
|
.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 {
|
||||||
|
// Display
|
||||||
|
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 = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = tt::lvgl::getSyncLock()
|
||||||
|
},
|
||||||
|
// SDCard
|
||||||
|
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 = 0,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#include "Display.h"
|
||||||
|
#include "Xpt2046SoftSpi.h"
|
||||||
|
#include <Ili934xDisplay.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
||||||
|
TOUCH_MOSI_PIN,
|
||||||
|
TOUCH_MISO_PIN,
|
||||||
|
TOUCH_SCK_PIN,
|
||||||
|
TOUCH_CS_PIN,
|
||||||
|
LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
LCD_VERTICAL_RESOLUTION,
|
||||||
|
false, // swapXY
|
||||||
|
true, // mirrorX
|
||||||
|
false // mirrorY
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
Ili934xDisplay::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = false,
|
||||||
|
.mirrorX = true,
|
||||||
|
.mirrorY = false,
|
||||||
|
.invertColor = false,
|
||||||
|
.swapBytes = true,
|
||||||
|
.bufferSize = LCD_BUFFER_SIZE,
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC,
|
||||||
|
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
||||||
|
};
|
||||||
|
|
||||||
|
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
||||||
|
.spiHostDevice = LCD_SPI_HOST,
|
||||||
|
.csPin = LCD_PIN_CS,
|
||||||
|
.dcPin = LCD_PIN_DC,
|
||||||
|
.pixelClockFrequency = 40'000'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
#include <driver/spi_common.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Display
|
||||||
|
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||||
|
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
||||||
|
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
||||||
|
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
||||||
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
|
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
||||||
|
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||||
|
|
||||||
|
// Display backlight (PWM)
|
||||||
|
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
||||||
|
|
||||||
|
// Touch (Software SPI)
|
||||||
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
||||||
|
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
||||||
|
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
||||||
|
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
||||||
|
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
+1
-1
@@ -11,7 +11,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>(),
|
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||||
|
|
||||||
|
idf_component_register(
|
||||||
|
SRCS ${SOURCE_FILES}
|
||||||
|
INCLUDE_DIRS "Source"
|
||||||
|
REQUIRES Tactility esp_lvgl_port ST7789 XPT2046SoftSPI PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
#include "devices/Display.h"
|
||||||
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
static bool initBoot() {
|
||||||
|
// 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_16, GPIO_MODE_OUTPUT)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
||||||
|
|
||||||
|
// 0 on, 1 off
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
||||||
|
|
||||||
|
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DeviceVector createDevices() {
|
||||||
|
return {
|
||||||
|
createDisplay(),
|
||||||
|
createSdCard()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration hardwareConfiguration = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDevices = createDevices,
|
||||||
|
.i2c = {
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "CN1",
|
||||||
|
.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 {
|
||||||
|
// Display
|
||||||
|
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 = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = tt::lvgl::getSyncLock()
|
||||||
|
},
|
||||||
|
// SDCard
|
||||||
|
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 = 0,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#include "Display.h"
|
||||||
|
#include "Xpt2046SoftSpi.h"
|
||||||
|
#include <St7789Display.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
constexpr auto* TAG = "CYD";
|
||||||
|
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
||||||
|
TOUCH_MOSI_PIN,
|
||||||
|
TOUCH_MISO_PIN,
|
||||||
|
TOUCH_SCK_PIN,
|
||||||
|
TOUCH_CS_PIN,
|
||||||
|
LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
LCD_VERTICAL_RESOLUTION,
|
||||||
|
false, // swapXY
|
||||||
|
true, // mirrorX
|
||||||
|
false // mirrorY
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
St7789Display::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = false,
|
||||||
|
.mirrorX = false,
|
||||||
|
.mirrorY = false,
|
||||||
|
.invertColor = false,
|
||||||
|
.bufferSize = LCD_BUFFER_SIZE,
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
||||||
|
.spiHostDevice = LCD_SPI_HOST,
|
||||||
|
.csPin = LCD_PIN_CS,
|
||||||
|
.dcPin = LCD_PIN_DC,
|
||||||
|
.pixelClockFrequency = 62'500'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
#include <driver/spi_common.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Display
|
||||||
|
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||||
|
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
||||||
|
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
||||||
|
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
||||||
|
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
||||||
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
|
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
||||||
|
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||||
|
|
||||||
|
// Touch (Software SPI)
|
||||||
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
||||||
|
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
||||||
|
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
||||||
|
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
||||||
|
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#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));
|
||||||
|
}
|
||||||
|
|
||||||
+17
-5
@@ -1,17 +1,27 @@
|
|||||||
#include "CYD2432S032C.h"
|
|
||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/kernel/SystemEvents.h>
|
#include <Tactility/kernel/SystemEvents.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
bool initBoot() {
|
bool initBoot() {
|
||||||
if (!driver::pwmbacklight::init(GPIO_NUM_27)) {
|
if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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_16, GPIO_MODE_OUTPUT)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
||||||
|
|
||||||
|
// 0 on, 1 off
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
||||||
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
||||||
|
|
||||||
// This display has a weird glitch with gamma during boot, which results in uneven dark gray colours.
|
// This display has a weird glitch with gamma during boot, which results in uneven dark gray colours.
|
||||||
// Setting gamma curve index to 0 doesn't work at boot for an unknown reason, so we set the curve index to 1:
|
// Setting gamma curve index to 0 doesn't work at boot for an unknown reason, so we set the curve index to 1:
|
||||||
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](auto) {
|
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](auto) {
|
||||||
@@ -32,7 +42,7 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const tt::hal::Configuration cyd_2432S032c_config = {
|
extern const tt::hal::Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {
|
.i2c = {
|
||||||
@@ -55,6 +65,7 @@ const tt::hal::Configuration cyd_2432S032c_config = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.spi {
|
.spi {
|
||||||
|
// Display
|
||||||
tt::hal::spi::Configuration {
|
tt::hal::spi::Configuration {
|
||||||
.device = SPI2_HOST,
|
.device = SPI2_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
@@ -69,7 +80,7 @@ const tt::hal::Configuration cyd_2432S032c_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = 0,
|
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
@@ -78,6 +89,7 @@ const tt::hal::Configuration cyd_2432S032c_config = {
|
|||||||
.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
|
||||||
},
|
},
|
||||||
|
// SD card
|
||||||
tt::hal::spi::Configuration {
|
tt::hal::spi::Configuration {
|
||||||
.device = SPI3_HOST,
|
.device = SPI3_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#include "Display.h"
|
||||||
|
|
||||||
|
#include <Gt911Touch.h>
|
||||||
|
#include <Ili934xDisplay.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
LCD_VERTICAL_RESOLUTION
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
Ili934xDisplay::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = true,
|
||||||
|
.mirrorX = true,
|
||||||
|
.mirrorY = true,
|
||||||
|
.invertColor = true,
|
||||||
|
.swapBytes = true,
|
||||||
|
.bufferSize = LCD_BUFFER_SIZE,
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC,
|
||||||
|
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB
|
||||||
|
};
|
||||||
|
|
||||||
|
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
||||||
|
.spiHostDevice = LCD_SPI_HOST,
|
||||||
|
.csPin = LCD_PIN_CS,
|
||||||
|
.dcPin = LCD_PIN_DC,
|
||||||
|
.pixelClockFrequency = 40'000'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
#include <driver/spi_common.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Display
|
||||||
|
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||||
|
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
||||||
|
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
||||||
|
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27;
|
||||||
|
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
||||||
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
|
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
||||||
|
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
+1
-1
@@ -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>(),
|
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SDCARD_SPI_HOST
|
SDCARD_SPI_HOST
|
||||||
);
|
);
|
||||||
+9
-7
@@ -1,7 +1,9 @@
|
|||||||
#include "CYD4848S040C.h"
|
|
||||||
#include "devices/St7701Display.h"
|
#include "devices/St7701Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
#include <Tactility/kernel/SystemEvents.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@@ -12,12 +14,12 @@ static bool initBoot() {
|
|||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
std::reinterpret_pointer_cast<Device>(std::make_shared<St7701Display>()),
|
std::make_shared<St7701Display>(),
|
||||||
createSdCard()
|
createSdCard()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const Configuration cyd_4848s040c_config = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {
|
.i2c = {
|
||||||
@@ -59,7 +61,7 @@ const Configuration cyd_4848s040c_config = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.spi {
|
.spi {
|
||||||
//SD Card
|
// SD Card & display init
|
||||||
spi::Configuration {
|
spi::Configuration {
|
||||||
.device = SPI2_HOST,
|
.device = SPI2_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
@@ -68,20 +70,20 @@ const Configuration cyd_4848s040c_config = {
|
|||||||
.miso_io_num = GPIO_NUM_41,
|
.miso_io_num = GPIO_NUM_41,
|
||||||
.sclk_io_num = GPIO_NUM_48,
|
.sclk_io_num = GPIO_NUM_48,
|
||||||
.quadwp_io_num = -1,
|
.quadwp_io_num = -1,
|
||||||
.quadhd_io_num = -1,
|
.quadhd_io_num = GPIO_NUM_42,
|
||||||
.data4_io_num = -1,
|
.data4_io_num = -1,
|
||||||
.data5_io_num = -1,
|
.data5_io_num = -1,
|
||||||
.data6_io_num = -1,
|
.data6_io_num = -1,
|
||||||
.data7_io_num = -1,
|
.data7_io_num = -1,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = 8192,
|
.max_transfer_sz = 1024 * 128,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.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 = spi::InitMode::ByTactility,
|
||||||
.isMutable = false,
|
.isMutable = false,
|
||||||
.lock = nullptr
|
.lock = tt::lvgl::getSyncLock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
+3
-1
@@ -11,7 +11,9 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
tt::lvgl::getSyncLock(),
|
||||||
|
std::vector { GPIO_NUM_39 }
|
||||||
);
|
);
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
||||||
+3
-2
@@ -1,8 +1,9 @@
|
|||||||
#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 "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
@@ -17,7 +18,7 @@ static DeviceVector createDevices() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const Configuration cyd_8048s043c_config = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {
|
.i2c = {
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
#include "E32R28T.h"
|
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
#define CYD_SPI_TRANSFER_SIZE_LIMIT (240 * 320 / 4 * 2)
|
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
return driver::pwmbacklight::init(CYD_BACKLIGHT_PIN);
|
return driver::pwmbacklight::init(LCD_BACKLIGHT_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
@@ -17,7 +16,7 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const tt::hal::Configuration cyd_e32r28t_config = {
|
extern const tt::hal::Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {},
|
.i2c = {},
|
||||||
@@ -36,7 +35,7 @@ const tt::hal::Configuration cyd_e32r28t_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
@@ -59,7 +58,7 @@ const tt::hal::Configuration cyd_e32r28t_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = 0,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#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>(
|
||||||
|
TOUCH_MOSI_PIN,
|
||||||
|
TOUCH_MISO_PIN,
|
||||||
|
TOUCH_SCK_PIN,
|
||||||
|
TOUCH_CS_PIN,
|
||||||
|
LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
LCD_VERTICAL_RESOLUTION,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Xpt2046SoftSpi>(std::move(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
Ili934xDisplay::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = false,
|
||||||
|
.mirrorX = true,
|
||||||
|
.mirrorY = false,
|
||||||
|
.invertColor = false,
|
||||||
|
.swapBytes = true,
|
||||||
|
.bufferSize = LCD_BUFFER_SIZE,
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC,
|
||||||
|
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
||||||
|
};
|
||||||
|
|
||||||
|
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
||||||
|
.spiHostDevice = LCD_SPI_HOST,
|
||||||
|
.csPin = LCD_PIN_CS,
|
||||||
|
.dcPin = LCD_PIN_DC,
|
||||||
|
.pixelClockFrequency = 40'000'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
#include <driver/spi_common.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Display
|
||||||
|
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||||
|
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
||||||
|
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
||||||
|
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
||||||
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
|
constexpr auto LCD_BUFFER_HEIGHT = (LCD_VERTICAL_RESOLUTION / 10);
|
||||||
|
constexpr auto LCD_BUFFER_SIZE = (LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT);
|
||||||
|
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||||
|
|
||||||
|
// Touch (Software SPI)
|
||||||
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
||||||
|
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
||||||
|
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
||||||
|
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
||||||
|
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
||||||
|
|
||||||
|
// Backlight
|
||||||
|
constexpr auto LCD_BACKLIGHT_PIN = GPIO_NUM_21;
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
+1
-1
@@ -10,7 +10,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>(),
|
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||||
|
|
||||||
|
idf_component_register(
|
||||||
|
SRCS ${SOURCE_FILES}
|
||||||
|
INCLUDE_DIRS "Source"
|
||||||
|
REQUIRES Tactility esp_lvgl_port ST7789 XPT2046 PwmBacklight EstimatedPower driver vfs fatfs
|
||||||
|
)
|
||||||
+39
-34
@@ -1,45 +1,50 @@
|
|||||||
#include "CYD2432S028R.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
#include "devices/Display.h"
|
||||||
|
#include "devices/Power.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.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() {
|
static bool initBoot() {
|
||||||
//Set the RGB Led Pins to output and turn them off
|
return driver::pwmbacklight::init(DISPLAY_BACKLIGHT_PIN);
|
||||||
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_17, GPIO_MODE_OUTPUT)); //Blue
|
|
||||||
|
|
||||||
//0 on, 1 off... yep it's backwards.
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue
|
|
||||||
|
|
||||||
return driver::pwmbacklight::init(CYD2432S028R_LCD_PIN_BACKLIGHT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
|
createPower(),
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
createSdCard()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const Configuration cyd_2432s028r_config = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {},
|
.i2c = {
|
||||||
.spi {
|
tt::hal::i2c::Configuration {
|
||||||
//Display
|
.name = "External",
|
||||||
spi::Configuration {
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_32,
|
||||||
|
.scl_io_num = GPIO_NUM_25,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// Display
|
||||||
|
.spi = {
|
||||||
|
tt::hal::spi::Configuration {
|
||||||
.device = SPI2_HOST,
|
.device = SPI2_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
.config = {
|
.config = {
|
||||||
@@ -53,18 +58,17 @@ const Configuration cyd_2432s028r_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = DISPLAY_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.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()
|
.lock = tt::lvgl::getSyncLock()
|
||||||
},
|
},
|
||||||
|
// SD Card
|
||||||
// SDCard
|
tt::hal::spi::Configuration {
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
.device = SPI3_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
.config = {
|
.config = {
|
||||||
@@ -78,14 +82,15 @@ const Configuration cyd_2432s028r_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = 0,
|
.max_transfer_sz = 8192,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.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 = nullptr
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#include "Display.h"
|
||||||
|
|
||||||
|
#include <Xpt2046Touch.h>
|
||||||
|
#include <St7789Display.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
#include <Tactility/hal/touch/TouchDevice.h>
|
||||||
|
|
||||||
|
// Create the XPT2046 touch device (hardware/esp_lcd driver)
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
auto config = std::make_unique<Xpt2046Touch::Configuration>(
|
||||||
|
DISPLAY_SPI_HOST, // spi device / bus (SPI2_HOST)
|
||||||
|
TOUCH_CS_PIN, // touch CS (IO33)
|
||||||
|
(uint16_t)DISPLAY_HORIZONTAL_RESOLUTION, // x max
|
||||||
|
(uint16_t)DISPLAY_VERTICAL_RESOLUTION, // y max
|
||||||
|
false, // swapXy
|
||||||
|
true, // mirrorX
|
||||||
|
true // mirrorY
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Xpt2046Touch>(std::move(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
// Create the ST7789 panel configuration
|
||||||
|
St7789Display::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = DISPLAY_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = DISPLAY_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = false,
|
||||||
|
.mirrorX = false,
|
||||||
|
.mirrorY = false,
|
||||||
|
.invertColor = false,
|
||||||
|
.bufferSize = DISPLAY_DRAW_BUFFER_SIZE, // 0 -> default 1/10 screen
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC,
|
||||||
|
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR // BGR for this display
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create the SPI configuration (from EspLcdSpiDisplay base class)
|
||||||
|
auto spi_configuration = std::make_shared<EspLcdSpiDisplay::SpiConfiguration>(EspLcdSpiDisplay::SpiConfiguration {
|
||||||
|
.spiHostDevice = DISPLAY_SPI_HOST,
|
||||||
|
.csPin = DISPLAY_PIN_CS,
|
||||||
|
.dcPin = DISPLAY_PIN_DC,
|
||||||
|
.pixelClockFrequency = 40'000'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "driver/spi_common.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Display (ST7789P3 on this board)
|
||||||
|
constexpr auto DISPLAY_SPI_HOST = SPI2_HOST;
|
||||||
|
constexpr auto DISPLAY_PIN_CS = GPIO_NUM_15;
|
||||||
|
constexpr auto DISPLAY_PIN_DC = GPIO_NUM_2;
|
||||||
|
constexpr auto DISPLAY_HORIZONTAL_RESOLUTION = 240;
|
||||||
|
constexpr auto DISPLAY_VERTICAL_RESOLUTION = 320;
|
||||||
|
constexpr auto DISPLAY_DRAW_BUFFER_HEIGHT = (DISPLAY_VERTICAL_RESOLUTION / 10);
|
||||||
|
constexpr auto DISPLAY_DRAW_BUFFER_SIZE = (DISPLAY_HORIZONTAL_RESOLUTION * DISPLAY_DRAW_BUFFER_HEIGHT);
|
||||||
|
constexpr auto DISPLAY_BACKLIGHT_PIN = GPIO_NUM_27;
|
||||||
|
constexpr auto DISPLAY_SPI_TRANSFER_SIZE_LIMIT = DISPLAY_DRAW_BUFFER_SIZE * sizeof(lv_color_t);
|
||||||
|
|
||||||
|
// Touch (XPT2046, resistive, shared SPI with display)
|
||||||
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_12;
|
||||||
|
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_13;
|
||||||
|
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_14;
|
||||||
|
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
||||||
|
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
||||||
|
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "Power.h"
|
||||||
|
|
||||||
|
#include <ChargeFromAdcVoltage.h>
|
||||||
|
#include <EstimatedPower.h>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::power::PowerDevice> createPower() {
|
||||||
|
ChargeFromAdcVoltage::Configuration configuration;
|
||||||
|
// 2.0 ratio, but +.11 added as display voltage sag compensation.
|
||||||
|
configuration.adcMultiplier = 2.11;
|
||||||
|
|
||||||
|
return std::make_shared<EstimatedPower>(configuration);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <Tactility/hal/power/PowerDevice.h>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "SdCard.h"
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
using SdCardDevice = tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||||
|
SD_CS_PIN, // CS pin (IO5 on the module)
|
||||||
|
GPIO_NUM_NC, // MOSI override: leave NC to use SPI host pins
|
||||||
|
GPIO_NUM_NC, // MISO override: leave NC
|
||||||
|
GPIO_NUM_NC, // SCLK override: leave NC
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
||||||
|
std::vector<gpio_num_t>(),
|
||||||
|
SD_SPI_HOST // SPI host for SD card (SPI3_HOST)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(configuration)
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "driver/spi_common.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
// SD card (microSD)
|
||||||
|
constexpr auto SD_CS_PIN = GPIO_NUM_5;
|
||||||
|
constexpr auto SD_SPI_HOST = SPI3_HOST;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
+3
-6
@@ -1,4 +1,3 @@
|
|||||||
#include "JC2432W328C.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
@@ -8,8 +7,6 @@
|
|||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
#define CYD_SPI_TRANSFER_SIZE_LIMIT (JC2432W328C_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
|
||||||
|
|
||||||
static bool initBoot() {
|
static 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
|
||||||
@@ -21,7 +18,7 @@ static bool initBoot() {
|
|||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue
|
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue
|
||||||
|
|
||||||
return driver::pwmbacklight::init(JC2432W328C_LCD_PIN_BACKLIGHT);
|
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
@@ -31,7 +28,7 @@ static DeviceVector createDevices() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const Configuration cyd_jc2432w328c_config = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {
|
.i2c = {
|
||||||
@@ -88,7 +85,7 @@ const Configuration cyd_jc2432w328c_config = {
|
|||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#include "Display.h"
|
||||||
|
|
||||||
|
#include <Cst816Touch.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
#include <St7789Display.h>
|
||||||
|
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
auto configuration = std::make_unique<Cst816sTouch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
LCD_VERTICAL_RESOLUTION
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Cst816sTouch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
St7789Display::Configuration panel_configuration = {
|
||||||
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||||
|
.gapX = 0,
|
||||||
|
.gapY = 0,
|
||||||
|
.swapXY = false,
|
||||||
|
.mirrorX = false,
|
||||||
|
.mirrorY = false,
|
||||||
|
.invertColor = false,
|
||||||
|
.bufferSize = LCD_BUFFER_SIZE,
|
||||||
|
.touch = createTouch(),
|
||||||
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||||
|
.resetPin = GPIO_NUM_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
||||||
|
.spiHostDevice = LCD_SPI_HOST,
|
||||||
|
.csPin = LCD_PIN_CS,
|
||||||
|
.dcPin = LCD_PIN_DC,
|
||||||
|
.pixelClockFrequency = 62'500'000,
|
||||||
|
.transactionQueueDepth = 10
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user