Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f9acf04dcb | |||
| a091923353 | |||
| 1593eb80ce | |||
| 869a56125f | |||
| 6116521556 | |||
| 3dfc27e93e | |||
| e4ecec64c9 | |||
| ce96474d84 | |||
| 2691dbb014 | |||
| 74eb830870 | |||
| 870924229a | |||
| b2647f46bb | |||
| d1c1a3a369 | |||
| a5090ec194 | |||
| f67cb241b7 | |||
| b2d4dc5ecb | |||
| a7c5d6a2ee | |||
| 08029a84dd | |||
| eb4e9f9649 | |||
| 3f1bfee3f5 | |||
| d72852a6e2 | |||
| d0ca3b16f8 | |||
| 81ece6f2e7 | |||
| 49a46f6236 | |||
| 358954f8be | |||
| 59ab11d498 | |||
| ebd2c7c6f9 | |||
| 7f33364bf4 | |||
| 0ebc022946 | |||
| f85d0239ff | |||
| 21936f7e9e | |||
| 19521791c5 | |||
| ef410086d9 | |||
| 2d535fec2a | |||
| 778e003d4d | |||
| 85a6ad3bbe | |||
| 13d7e84ef3 | |||
| 83a82be901 | |||
| b85ef7a2e7 | |||
| de46401d85 | |||
| bd2786b122 | |||
| 6d1d08944b | |||
| 70d36131f6 | |||
| b14887d5fb | |||
| 44b366b557 | |||
| ee88a563dc | |||
| 09cdf07b7c | |||
| d29e47f0eb | |||
| 933bc5fb97 | |||
| 6e8fbae62b | |||
| 0563e42dc9 | |||
| 5055fa7822 | |||
| ad2cad3bf1 | |||
| 6e77d5027f | |||
| 55bfb9fe3b | |||
| 2e86d4774b | |||
| b7f39f883d | |||
| 14e459e50f | |||
| 2345ba6d13 | |||
| a7a3b17ff6 | |||
| fd1e31dec4 | |||
| c5fc8790bb | |||
| e1bfdd7c91 | |||
| 5b375c21bb | |||
| c74006f8b6 | |||
| 8ccba15c25 | |||
| c1f55429b6 | |||
| 88b3bfbe3e | |||
| 6337458992 | |||
| 68e34ca740 | |||
| 5ec96f60f1 | |||
| c0f4738abe | |||
| 2e61aea93c | |||
| cff0605b0a | |||
| c87200a80d | |||
| 7856827ecf | |||
| 6c67845645 | |||
| 1bb1260ea0 | |||
| fa54eaa58a | |||
| f9e1f737fd | |||
| 686f7cce83 | |||
| c2edbad0fb | |||
| d86dc40472 | |||
| 3be251d8fb | |||
| bb7e79886f | |||
| 9fb8d45b2e | |||
| b13502170e | |||
| aa85f7d19d | |||
| dc20ed4874 | |||
| 12a9839420 | |||
| 97b8007aca | |||
| c3bcf93698 | |||
| 2bbd44a8b5 | |||
| 72230129bb | |||
| 3ea02d912f | |||
| 3ca0f8cf97 |
+4
-1
@@ -5,6 +5,7 @@ AccessModifierOffset: -4
|
|||||||
AlignAfterOpenBracket: BlockIndent
|
AlignAfterOpenBracket: BlockIndent
|
||||||
AlignConsecutiveAssignments: None
|
AlignConsecutiveAssignments: None
|
||||||
AlignOperands: DontAlign
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments: false
|
||||||
AllowAllArgumentsOnNextLine: false
|
AllowAllArgumentsOnNextLine: false
|
||||||
AllowAllConstructorInitializersOnNextLine: false
|
AllowAllConstructorInitializersOnNextLine: false
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
@@ -37,12 +38,14 @@ BreakInheritanceList: BeforeColon
|
|||||||
ColumnLimit: 0
|
ColumnLimit: 0
|
||||||
CompactNamespaces: false
|
CompactNamespaces: false
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
|
EmptyLineBeforeAccessModifier: Always
|
||||||
|
EmptyLineAfterAccessModifier: Always
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
IndentPPDirectives: None
|
IndentPPDirectives: None
|
||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
MaxEmptyLinesToKeep: 2
|
MaxEmptyLinesToKeep: 2
|
||||||
NamespaceIndentation: All
|
NamespaceIndentation: None
|
||||||
ObjCSpaceAfterProperty: false
|
ObjCSpaceAfterProperty: false
|
||||||
ObjCSpaceBeforeProtocolList: true
|
ObjCSpaceBeforeProtocolList: true
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ByteWelder]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
|
polar: # Replace with a single Polar username
|
||||||
|
buy_me_a_coffee: bytewelder
|
||||||
|
thanks_dev: # Replace with a single thanks.dev username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: 'Bug: '
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Details (please complete the following information):**
|
||||||
|
- ESP type: [e.g. ESP32-S3]
|
||||||
|
- Device: [e.g. LilyGo T-Deck]
|
||||||
|
- Tactility version: [e.g. 0.2.0 or main branch]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
|
Add your oops.tactility.one URL if you had a crash (scanned from QR).
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Question
|
||||||
|
about: Ask a question
|
||||||
|
title: ''
|
||||||
|
labels: question
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
### Checklist
|
||||||
|
|
||||||
|
- [ ] I read [contribution guidelines](https://github.com/ByteWelder/Tactility/blob/main/CONTRIBUTING.md)
|
||||||
|
- [ ] Code adheres to the [coding style](https://github.com/ByteWelder/Tactility/blob/main/CODING_STYLE.md)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
(describe what your changes are)
|
||||||
@@ -18,9 +18,9 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig
|
run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig
|
||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
uses: espressif/esp-idf-ci-action@main
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.3.2
|
esp_idf_version: v5.4
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
@@ -29,12 +29,12 @@ runs:
|
|||||||
- name: 'Upload Artifact: Release'
|
- name: 'Upload Artifact: Release'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: tactility-${{ inputs.board_id }}
|
name: Tactility-${{ inputs.board_id }}
|
||||||
path: release/Tactility-${{ inputs.board_id }}
|
path: release/Tactility-${{ inputs.board_id }}
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
- name: 'Upload Artifact: Release symbols'
|
- name: 'Upload Artifact: Release symbols'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: tactility-${{ inputs.board_id }}-symbols
|
name: Tactility-${{ inputs.board_id }}-symbols
|
||||||
path: release/Tactility-${{ inputs.board_id }}-symbols
|
path: release/Tactility-${{ inputs.board_id }}-symbols
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|||||||
@@ -18,13 +18,17 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig
|
run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig
|
||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
uses: espressif/esp-idf-ci-action@main
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.3.2
|
# NOTE: Update with ESP-IDF!
|
||||||
|
esp_idf_version: v5.4
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
# NOTE: Update with ESP-IDF!
|
||||||
|
ESP_IDF_VERSION: '5.4'
|
||||||
run: Buildscripts/release-sdk.sh release/TactilitySDK
|
run: Buildscripts/release-sdk.sh release/TactilitySDK
|
||||||
- name: 'Upload Artifact'
|
- name: 'Upload Artifact'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
# See Libraries/SDL/docs/README-linux.md
|
# See Libraries/SDL/docs/README-linux.md
|
||||||
run: >
|
run: >
|
||||||
|
sudo apt-get update &&
|
||||||
sudo apt-get install build-essential git make
|
sudo apt-get install build-essential git make
|
||||||
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev
|
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev
|
||||||
libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev
|
libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev
|
||||||
|
|||||||
@@ -1,18 +1,122 @@
|
|||||||
name: Build Firmware
|
name: Build Firmware
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
yellow-board:
|
cyd-2432s024c:
|
||||||
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: yellow-board
|
board_id: cyd-2432s024c
|
||||||
arch: esp32
|
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:
|
lilygo-tdeck:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -40,3 +144,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
board_id: m5stack-cores3
|
board_id: m5stack-cores3
|
||||||
arch: esp32s3
|
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
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
name: Build SDK
|
name: Build SDK
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
@@ -11,7 +16,7 @@ jobs:
|
|||||||
- name: "Build"
|
- name: "Build"
|
||||||
uses: ./.github/actions/build-sdk
|
uses: ./.github/actions/build-sdk
|
||||||
with:
|
with:
|
||||||
board_id: yellow-board
|
board_id: cyd-2432s024c
|
||||||
arch: esp32
|
arch: esp32
|
||||||
esp32s3:
|
esp32s3:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
# Disabled because of issue: https://github.com/libsdl-org/setup-sdl/issues/23
|
# Disabled because of issue: https://github.com/libsdl-org/setup-sdl/issues/23
|
||||||
name: Build Simulator
|
name: Build Simulator
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
jobs:
|
jobs:
|
||||||
Build-Simulator-Linux:
|
Build-Simulator-Linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
name: Tests
|
name: Tests
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
jobs:
|
jobs:
|
||||||
Run:
|
Run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -14,5 +19,7 @@ jobs:
|
|||||||
run: cmake -S ./ -B build
|
run: cmake -S ./ -B build
|
||||||
- name: "Build Tests"
|
- name: "Build Tests"
|
||||||
run: cmake --build build --target build-tests
|
run: cmake --build build --target build-tests
|
||||||
- name: "Run Tests"
|
- name: "Run TactilityCore Tests"
|
||||||
run: build/Tests/TactilityCore/TactilityCoreTests --exit
|
run: build/Tests/TactilityCore/TactilityCoreTests --exit
|
||||||
|
- name: "Run TactilityHeadless Tests"
|
||||||
|
run: build/Tests/Tactility/TactilityTests --exit
|
||||||
|
|||||||
+5
-16
@@ -1,26 +1,16 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
set(BOARD_COMPONENTS Tactility TactilityC)
|
# Read board id/project
|
||||||
|
include("../Buildscripts/board.cmake")
|
||||||
if("${IDF_TARGET}" STREQUAL "esp32")
|
init_tactility_globals("../sdkconfig")
|
||||||
list(APPEND BOARD_COMPONENTS
|
get_property(TACTILITY_BOARD_PROJECT GLOBAL PROPERTY TACTILITY_BOARD_PROJECT)
|
||||||
YellowBoard
|
|
||||||
M5stackCore2
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("${IDF_TARGET}" STREQUAL "esp32s3")
|
|
||||||
list(APPEND BOARD_COMPONENTS
|
|
||||||
LilygoTdeck
|
|
||||||
M5stackCoreS3
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRC_DIRS "Source"
|
SRC_DIRS "Source"
|
||||||
"Source/HelloWorld"
|
"Source/HelloWorld"
|
||||||
REQUIRES ${BOARD_COMPONENTS}
|
REQUIRES ${BOARD_COMPONENTS}
|
||||||
|
REQUIRES Tactility TactilityC ${TACTILITY_BOARD_PROJECT}
|
||||||
)
|
)
|
||||||
else ()
|
else ()
|
||||||
|
|
||||||
@@ -29,7 +19,6 @@ else()
|
|||||||
target_link_libraries(AppSim
|
target_link_libraries(AppSim
|
||||||
PRIVATE Tactility
|
PRIVATE Tactility
|
||||||
PRIVATE TactilityCore
|
PRIVATE TactilityCore
|
||||||
PRIVATE TactilityHeadless
|
|
||||||
PRIVATE Simulator
|
PRIVATE Simulator
|
||||||
PRIVATE SDL2::SDL2-static SDL2-static
|
PRIVATE SDL2::SDL2-static SDL2-static
|
||||||
)
|
)
|
||||||
|
|||||||
+35
-4
@@ -1,19 +1,50 @@
|
|||||||
# Kconfig file for Tactility example app
|
# Kconfig file for Tactility example app
|
||||||
menu "Tactility App"
|
menu "Tactility App"
|
||||||
|
config TT_BOARD_NAME
|
||||||
|
string "Board Name"
|
||||||
|
default ""
|
||||||
|
config TT_BOARD_ID
|
||||||
|
string "Board ID"
|
||||||
|
default ""
|
||||||
choice
|
choice
|
||||||
prompt "Board"
|
prompt "Board"
|
||||||
default TT_BOARD_CUSTOM
|
default TT_BOARD_CUSTOM
|
||||||
|
|
||||||
config TT_BOARD_CUSTOM
|
config TT_BOARD_CUSTOM
|
||||||
bool "Custom"
|
bool "Custom"
|
||||||
config TT_BOARD_YELLOW_BOARD_24_CAP
|
config TT_BOARD_CYD_2432S024C
|
||||||
bool "Yellow Board (2.4\" capacitive)"
|
bool "CYD 2432S024C"
|
||||||
|
config TT_BOARD_CYD_2432S032C
|
||||||
|
bool "CYD 2432S032C"
|
||||||
|
config TT_BOARD_CYD_8048S043C
|
||||||
|
bool "CYD 8048S043C"
|
||||||
|
config TT_BOARD_CYD_JC2432W328C
|
||||||
|
bool "CYD JC2432W328C"
|
||||||
|
config TT_BOARD_CYD_JC8048W550C
|
||||||
|
bool "CYD JC8048W550C"
|
||||||
|
config TT_BOARD_CYD_4848S040C
|
||||||
|
bool "CYD 4848S040C"
|
||||||
|
config TT_BOARD_ELECROW_CROWPANEL_ADVANCE_28
|
||||||
|
bool "Elecrow CrowPanel Advance 2.8"
|
||||||
|
config TT_BOARD_ELECROW_CROWPANEL_ADVANCE_35
|
||||||
|
bool "Elecrow CrowPanel Advance 3.5"
|
||||||
|
config TT_BOARD_ELECROW_CROWPANEL_ADVANCE_50
|
||||||
|
bool "Elecrow CrowPanel Advance 5.0"
|
||||||
|
config TT_BOARD_ELECROW_CROWPANEL_BASIC_28
|
||||||
|
bool "Elecrow CrowPanel Basic 2.8"
|
||||||
|
config TT_BOARD_ELECROW_CROWPANEL_BASIC_35
|
||||||
|
bool "Elecrow CrowPanel Basic 3.5"
|
||||||
|
config TT_BOARD_ELECROW_CROWPANEL_BASIC_50
|
||||||
|
bool "Elecrow CrowPanel Basic 5.0"
|
||||||
config TT_BOARD_LILYGO_TDECK
|
config TT_BOARD_LILYGO_TDECK
|
||||||
bool "LilyGo T-Deck"
|
bool "LilyGo T-Deck"
|
||||||
config TT_BOARD_M5STACK_CORE2
|
config TT_BOARD_M5STACK_CORE2
|
||||||
bool "M5Stack Core2"
|
bool "M5Stack Core2"
|
||||||
config TT_BOARD_M5STACK_CORES3
|
config TT_BOARD_M5STACK_CORES3
|
||||||
bool "M5Stack CoreS3"
|
bool "M5Stack CoreS3"
|
||||||
|
config TT_BOARD_UNPHONE
|
||||||
|
bool "unPhone"
|
||||||
|
config TT_BOARD_WAVESHARE_S3_TOUCH_43
|
||||||
|
bool "Waveshare ESP32 S3 Touch LCD 4.3"
|
||||||
help
|
help
|
||||||
Select a board/hardware configuration.
|
Select a board/hardware configuration.
|
||||||
Use TT_BOARD_CUSTOM if you will manually configure the board in your project.
|
Use TT_BOARD_CUSTOM if you will manually configure the board in your project.
|
||||||
@@ -21,7 +52,7 @@ menu "Tactility App"
|
|||||||
|
|
||||||
config TT_SPLASH_DURATION
|
config TT_SPLASH_DURATION
|
||||||
int "Splash Duration (ms)"
|
int "Splash Duration (ms)"
|
||||||
default 1500
|
default 1000
|
||||||
range 0 3000
|
range 0 3000
|
||||||
help
|
help
|
||||||
The minimum time to show the splash screen in milliseconds.
|
The minimum time to show the splash screen in milliseconds.
|
||||||
|
|||||||
+44
-4
@@ -1,21 +1,61 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
#include "sdkconfig.h"
|
#include <sdkconfig.h>
|
||||||
|
|
||||||
// Supported hardware:
|
// Supported hardware:
|
||||||
#if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
|
#if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
|
||||||
#include "LilygoTdeck.h"
|
#include "LilygoTdeck.h"
|
||||||
#define TT_BOARD_HARDWARE &lilygo_tdeck
|
#define TT_BOARD_HARDWARE &lilygo_tdeck
|
||||||
#elif defined(CONFIG_TT_BOARD_YELLOW_BOARD_24_CAP)
|
#elif defined(CONFIG_TT_BOARD_CYD_2432S024C)
|
||||||
#include "YellowBoard.h"
|
#include "CYD2432S024C.h"
|
||||||
#define TT_BOARD_HARDWARE &yellow_board_24inch_cap
|
#define TT_BOARD_HARDWARE &cyd_2432s024c_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)
|
#elif defined(CONFIG_TT_BOARD_M5STACK_CORE2)
|
||||||
#include "M5stackCore2.h"
|
#include "M5stackCore2.h"
|
||||||
#define TT_BOARD_HARDWARE &m5stack_core2
|
#define TT_BOARD_HARDWARE &m5stack_core2
|
||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
|
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
|
||||||
#include "M5stackCoreS3.h"
|
#include "M5stackCoreS3.h"
|
||||||
#define TT_BOARD_HARDWARE &m5stack_cores3
|
#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
|
#else
|
||||||
#define TT_BOARD_HARDWARE NULL
|
#define TT_BOARD_HARDWARE NULL
|
||||||
#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.
|
#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
#include "lvgl.h"
|
#include <Tactility/app/AppManifest.h>
|
||||||
#include "lvgl/Toolbar.h"
|
#include <Tactility/lvgl/Toolbar.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
static void onShow(tt::app::AppContext& context, lv_obj_t* parent) {
|
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_t* toolbar = tt::lvgl::toolbar_create(parent, context);
|
||||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||||
|
|
||||||
@@ -9,9 +14,10 @@ static void onShow(tt::app::AppContext& context, lv_obj_t* parent) {
|
|||||||
lv_label_set_text(label, "Hello, world!");
|
lv_label_set_text(label, "Hello, world!");
|
||||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
extern const tt::app::AppManifest hello_world_app = {
|
extern const AppManifest hello_world_app = {
|
||||||
.id = "HelloWorld",
|
.id = "HelloWorld",
|
||||||
.name = "Hello World",
|
.name = "Hello World",
|
||||||
.onShow = onShow,
|
.createApp = create<HelloWorldApp>
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
#include "Boards.h"
|
#include "Boards.h"
|
||||||
#include "Tactility.h"
|
#include <Tactility/Tactility.h>
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
#include "tt_init.h"
|
#include "tt_init.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const tt::app::AppManifest hello_world_app;
|
// extern const tt::app::AppManifest hello_world_app;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ void app_main() {
|
|||||||
*/
|
*/
|
||||||
.hardware = TT_BOARD_HARDWARE,
|
.hardware = TT_BOARD_HARDWARE,
|
||||||
.apps = {
|
.apps = {
|
||||||
&hello_world_app,
|
// &hello_world_app,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+13
-4
@@ -1,11 +1,20 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
espressif/esp_lcd_ili9341: "2.0.0"
|
espressif/esp_lcd_ili9341: "2.0.0"
|
||||||
espressif/esp_lcd_touch_cst816s: "1.0.3"
|
atanisoft/esp_lcd_ili9488: "1.0.10"
|
||||||
espressif/esp_lcd_touch_gt911: "1.1.1~2"
|
|
||||||
espressif/esp_lcd_touch_ft5x06: "1.0.6~1"
|
|
||||||
espressif/esp_lcd_touch: "1.1.2"
|
espressif/esp_lcd_touch: "1.1.2"
|
||||||
|
atanisoft/esp_lcd_touch_xpt2046: "1.0.5"
|
||||||
|
espressif/esp_lcd_touch_cst816s: "1.0.3"
|
||||||
|
espressif/esp_lcd_touch_gt911: "1.1.3"
|
||||||
|
espressif/esp_lcd_touch_ft5x06: "1.0.6~1"
|
||||||
|
espressif/esp_io_expander: "1.0.1"
|
||||||
|
espressif/esp_io_expander_tca95xx_16bit: "1.0.1"
|
||||||
|
espressif/esp_lcd_st7701:
|
||||||
|
version: "1.1.1"
|
||||||
|
rules:
|
||||||
|
- if: "target in [esp32s3, esp32p4]"
|
||||||
|
espressif/esp_lcd_panel_io_additions: "1.0.1"
|
||||||
espressif/esp_tinyusb:
|
espressif/esp_tinyusb:
|
||||||
version: "1.5.0"
|
version: "1.5.0"
|
||||||
rules:
|
rules:
|
||||||
- if: "target == esp32s3"
|
- if: "target == esp32s3"
|
||||||
idf: '5.3.2'
|
idf: '5.4'
|
||||||
|
|||||||
@@ -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 ILI934x CST816S PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
#include "CYD2432S024C.h"
|
||||||
|
#include "hal/YellowDisplay.h"
|
||||||
|
#include "hal/YellowDisplayConstants.h"
|
||||||
|
#include "hal/YellowSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
#define CYD_SPI_TRANSFER_SIZE_LIMIT (TWODOTFOUR_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(TWODOTFOUR_LCD_PIN_BACKLIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
const tt::hal::Configuration cyd_2432s024c_config = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createYellowSdCard(),
|
||||||
|
.power = nullptr,
|
||||||
|
.i2c = {
|
||||||
|
tt::hal::i2c::Configuration {
|
||||||
|
.name = "First",
|
||||||
|
.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_33,
|
||||||
|
.scl_io_num = GPIO_NUM_32,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tt::hal::i2c::Configuration {
|
||||||
|
.name = "Second",
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = tt::hal::i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_NC,
|
||||||
|
.scl_io_num = GPIO_NUM_NC,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
tt::hal::spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_13,
|
||||||
|
.miso_io_num = GPIO_NUM_NC,
|
||||||
|
.sclk_io_num = GPIO_NUM_14,
|
||||||
|
.quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||||
|
.quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||||
|
.data4_io_num = GPIO_NUM_NC,
|
||||||
|
.data5_io_num = GPIO_NUM_NC,
|
||||||
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
|
.data_io_default_level = false,
|
||||||
|
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = tt::hal::spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
||||||
|
},
|
||||||
|
tt::hal::spi::Configuration {
|
||||||
|
.device = SPI3_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_23,
|
||||||
|
.miso_io_num = GPIO_NUM_19,
|
||||||
|
.sclk_io_num = GPIO_NUM_18,
|
||||||
|
.quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||||
|
.quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||||
|
.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 = 8192,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = tt::hal::spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
// Capacitive touch version of the 2.4" yellow board
|
||||||
|
extern const tt::hal::Configuration cyd_2432s024c_config;
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#include "YellowDisplay.h"
|
||||||
|
#include "Cst816Touch.h"
|
||||||
|
#include "YellowDisplayConstants.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;
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#include "YellowSdCard.h"
|
||||||
|
|
||||||
|
#define TAG "twodotfour_sdcard"
|
||||||
|
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
|
#define SDCARD_SPI_HOST SPI3_HOST
|
||||||
|
#define SDCARD_PIN_CS GPIO_NUM_5
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createYellowSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
std::make_shared<tt::Mutex>(),
|
||||||
|
std::vector<gpio_num_t>(),
|
||||||
|
SDCARD_SPI_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createYellowSdCard();
|
||||||
|
|
||||||
@@ -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 ILI934x GT911 PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
#include "CYD2432S032C.h"
|
||||||
|
#include "Tactility/lvgl/LvglSync.h"
|
||||||
|
#include "hal/CydDisplay.h"
|
||||||
|
#include "hal/CydSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/kernel/SystemEvents.h>
|
||||||
|
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
if (!driver::pwmbacklight::init(GPIO_NUM_27)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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:
|
||||||
|
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootInitLvglEnd, [](auto event) {
|
||||||
|
auto display = tt::hal::findFirstDevice<tt::hal::display::DisplayDevice>(tt::hal::Device::Type::Display);
|
||||||
|
assert(display != nullptr);
|
||||||
|
tt::lvgl::lock(portMAX_DELAY);
|
||||||
|
display->setGammaCurve(1U);
|
||||||
|
tt::lvgl::unlock();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tt::hal::Configuration cyd_2432S032c_config = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.power = nullptr,
|
||||||
|
.i2c = {
|
||||||
|
tt::hal::i2c::Configuration {
|
||||||
|
.name = "Internal",
|
||||||
|
.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_33,
|
||||||
|
.scl_io_num = GPIO_NUM_32,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
tt::hal::spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_13,
|
||||||
|
.miso_io_num = GPIO_NUM_NC,
|
||||||
|
.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 = 0,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = tt::hal::spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
||||||
|
},
|
||||||
|
tt::hal::spi::Configuration {
|
||||||
|
.device = SPI3_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_23,
|
||||||
|
.miso_io_num = GPIO_NUM_19,
|
||||||
|
.sclk_io_num = GPIO_NUM_18,
|
||||||
|
.quadwp_io_num = GPIO_NUM_NC,
|
||||||
|
.quadhd_io_num = GPIO_NUM_NC,
|
||||||
|
.data4_io_num = GPIO_NUM_NC,
|
||||||
|
.data5_io_num = GPIO_NUM_NC,
|
||||||
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
|
.data_io_default_level = false,
|
||||||
|
.max_transfer_sz = 0,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = tt::hal::spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
// Capacitive touch version of the 2.4" yellow board
|
||||||
|
extern const tt::hal::Configuration cyd_2432S032c_config;
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include "CydDisplay.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;
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#include "CydSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
|
#define SDCARD_SPI_HOST SPI3_HOST
|
||||||
|
#define SDCARD_PIN_CS GPIO_NUM_5
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
std::make_shared<tt::Mutex>(),
|
||||||
|
std::vector<gpio_num_t>(),
|
||||||
|
SDCARD_SPI_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
|
|
||||||
@@ -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 esp_lcd esp_lcd_st7701 esp_lcd_panel_io_additions GT911 PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#include "CYD4848S040C.h"
|
||||||
|
#include "hal/CydDisplay.h"
|
||||||
|
#include "hal/CydSdCard.h"
|
||||||
|
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_38, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Configuration cyd_4848s040c_config = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.power = nullptr,
|
||||||
|
.i2c = {
|
||||||
|
//Touch
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Internal",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_19,
|
||||||
|
.scl_io_num = GPIO_NUM_45,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//H1 header,
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "External",
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_NC,
|
||||||
|
.scl_io_num = GPIO_NUM_NC,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
//SD Card
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_47,
|
||||||
|
.miso_io_num = GPIO_NUM_41,
|
||||||
|
.sclk_io_num = GPIO_NUM_48,
|
||||||
|
.quadwp_io_num = -1,
|
||||||
|
.quadhd_io_num = -1,
|
||||||
|
.data4_io_num = -1,
|
||||||
|
.data5_io_num = -1,
|
||||||
|
.data6_io_num = -1,
|
||||||
|
.data7_io_num = -1,
|
||||||
|
.data_io_default_level = false,
|
||||||
|
.max_transfer_sz = 8192,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
// Capacitive touch version of the 4" square yellow board
|
||||||
|
extern const tt::hal::Configuration cyd_4848s040c_config;
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
#include "CydDisplay.h"
|
||||||
|
#include "PwmBacklight.h"
|
||||||
|
|
||||||
|
#include <Gt911Touch.h>
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
#include <esp_err.h>
|
||||||
|
#include <esp_lcd_panel_rgb.h>
|
||||||
|
#include <esp_lcd_panel_ops.h>
|
||||||
|
#include <esp_lcd_panel_io.h>
|
||||||
|
#include <esp_lcd_panel_io_additions.h>
|
||||||
|
#include <esp_lcd_st7701.h>
|
||||||
|
#include <esp_lvgl_port.h>
|
||||||
|
|
||||||
|
#define TAG "cyd_display"
|
||||||
|
|
||||||
|
static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = {
|
||||||
|
// {cmd, { data }, data_size, delay_ms}
|
||||||
|
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0},
|
||||||
|
{0xC0, (uint8_t[]) {0x3B, 0x00}, 2, 0},
|
||||||
|
{0xC1, (uint8_t[]) {0x0D, 0x02}, 2, 0},
|
||||||
|
{0xC2, (uint8_t[]) {0x31, 0x05}, 2, 0},
|
||||||
|
{0xCD, (uint8_t[]) {0x00}, 1, 0}, //0x08
|
||||||
|
//Positive Voltage Gamma Control
|
||||||
|
{0xB0, (uint8_t[]) {0x00, 0x11, 0x18, 0x0E, 0x11, 0x06, 0x07, 0x08, 0x07, 0x22, 0x04, 0x12, 0x0F, 0xAA, 0x31, 0x18}, 16, 0},
|
||||||
|
//Negative Voltage Gamma Control
|
||||||
|
{0xB1, (uint8_t[]) {0x00, 0x11, 0x19, 0x0E, 0x12, 0x07, 0x08, 0x08, 0x08, 0x22, 0x04, 0x11, 0x11, 0xA9, 0x32, 0x18}, 16, 0},
|
||||||
|
//Page1
|
||||||
|
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x11}, 5, 0},
|
||||||
|
{0xB0, (uint8_t[]) {0x60}, 1, 0}, //Vop=4.7375v
|
||||||
|
{0xB1, (uint8_t[]) {0x32}, 1, 0}, //VCOM=32
|
||||||
|
{0xB2, (uint8_t[]) {0x07}, 1, 0}, //VGH=15v
|
||||||
|
{0xB3, (uint8_t[]) {0x80}, 1, 0},
|
||||||
|
{0xB5, (uint8_t[]) {0x49}, 1, 0}, //VGL=-10.17v
|
||||||
|
{0xB7, (uint8_t[]) {0x85}, 1, 0},
|
||||||
|
{0xB8, (uint8_t[]) {0x21}, 1, 0}, //AVDD=6.6 & AVCL=-4.6
|
||||||
|
{0xC1, (uint8_t[]) {0x78}, 1, 0},
|
||||||
|
{0xC2, (uint8_t[]) {0x78}, 1, 0},
|
||||||
|
{0xE0, (uint8_t[]) {0x00, 0x1B, 0x02}, 3, 0},
|
||||||
|
{0xE1, (uint8_t[]) {0x08, 0xA0, 0x00, 0x00, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x44, 0x44}, 11, 0},
|
||||||
|
{0xE2, (uint8_t[]) {0x11, 0x11, 0x44, 0x44, 0xED, 0xA0, 0x00, 0x00, 0xEC, 0xA0, 0x00, 0x00}, 12, 0},
|
||||||
|
{0xE3, (uint8_t[]) {0x00, 0x00, 0x11, 0x11}, 4, 0},
|
||||||
|
{0xE4, (uint8_t[]) {0x44, 0x44}, 2, 0},
|
||||||
|
{0xE5, (uint8_t[]) {0x0A, 0xE9, 0xD8, 0xA0, 0x0C, 0xEB, 0xD8, 0xA0, 0x0E, 0xED, 0xD8, 0xA0, 0x10, 0xEF, 0xD8, 0xA0}, 16, 0},
|
||||||
|
{0xE6, (uint8_t[]) {0x00, 0x00, 0x11, 0x11}, 4, 0},
|
||||||
|
{0xE7, (uint8_t[]) {0x44, 0x44}, 2, 0},
|
||||||
|
{0xE8, (uint8_t[]) {0x09, 0xE8, 0xD8, 0xA0, 0x0B, 0xEA, 0xD8, 0xA0, 0x0D, 0xEC, 0xD8, 0xA0, 0x0F, 0xEE, 0xD8, 0xA0}, 16, 0},
|
||||||
|
{0xEB, (uint8_t[]) {0x02, 0x00, 0xE4, 0xE4, 0x88, 0x00, 0x40}, 7, 0},
|
||||||
|
{0xEC, (uint8_t[]) {0x3C, 0x00}, 2, 0},
|
||||||
|
{0xED, (uint8_t[]) {0xAB, 0x89, 0x76, 0x54, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x45, 0x67, 0x98, 0xBA}, 16, 0},
|
||||||
|
//VAP & VAN
|
||||||
|
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0},
|
||||||
|
{0xE5, (uint8_t[]) {0xE4}, 1, 0},
|
||||||
|
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0},
|
||||||
|
{0x3A, (uint8_t[]) {0x60}, 1, 10}, //0x70 RGB888, 0x60 RGB666, 0x50 RGB565
|
||||||
|
{0x11, (uint8_t[]) {0x00}, 0, 120}, //Sleep Out
|
||||||
|
{0x29, (uint8_t[]) {0x00}, 0, 0}, //Display On
|
||||||
|
};
|
||||||
|
|
||||||
|
bool CydDisplay::start() {
|
||||||
|
TT_LOG_I(TAG, "Starting");
|
||||||
|
|
||||||
|
spi_line_config_t line_config = {
|
||||||
|
.cs_io_type = IO_TYPE_GPIO,
|
||||||
|
.cs_gpio_num = GPIO_NUM_39,
|
||||||
|
.scl_io_type = IO_TYPE_GPIO,
|
||||||
|
.scl_gpio_num = GPIO_NUM_48,
|
||||||
|
.sda_io_type = IO_TYPE_GPIO,
|
||||||
|
.sda_gpio_num = GPIO_NUM_47,
|
||||||
|
.io_expander = NULL,
|
||||||
|
};
|
||||||
|
esp_lcd_panel_io_3wire_spi_config_t panel_io_config = ST7701_PANEL_IO_3WIRE_SPI_CONFIG(line_config, 0);
|
||||||
|
ESP_ERROR_CHECK(esp_lcd_new_panel_io_3wire_spi(&panel_io_config, &ioHandle));
|
||||||
|
|
||||||
|
const esp_lcd_rgb_panel_config_t rgb_config = {
|
||||||
|
.clk_src = LCD_CLK_SRC_DEFAULT,
|
||||||
|
.timings = {
|
||||||
|
.pclk_hz = 14000000,
|
||||||
|
.h_res = 480,
|
||||||
|
.v_res = 480,
|
||||||
|
.hsync_pulse_width = 10,
|
||||||
|
.hsync_back_porch = 10,
|
||||||
|
.hsync_front_porch = 20,
|
||||||
|
.vsync_pulse_width = 10,
|
||||||
|
.vsync_back_porch = 10,
|
||||||
|
.vsync_front_porch = 10,
|
||||||
|
.flags = {
|
||||||
|
.hsync_idle_low = false,
|
||||||
|
.vsync_idle_low = false,
|
||||||
|
.de_idle_high = false,
|
||||||
|
.pclk_active_neg = false,
|
||||||
|
.pclk_idle_high = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.data_width = 16,
|
||||||
|
.bits_per_pixel = 16,
|
||||||
|
.num_fbs = 2,
|
||||||
|
.bounce_buffer_size_px = 480 * 10,
|
||||||
|
.sram_trans_align = 8,
|
||||||
|
.psram_trans_align = 64,
|
||||||
|
.hsync_gpio_num = GPIO_NUM_16,
|
||||||
|
.vsync_gpio_num = GPIO_NUM_17,
|
||||||
|
.de_gpio_num = GPIO_NUM_18,
|
||||||
|
.pclk_gpio_num = GPIO_NUM_21,
|
||||||
|
.disp_gpio_num = GPIO_NUM_NC,
|
||||||
|
.data_gpio_nums = {
|
||||||
|
GPIO_NUM_4, // B1
|
||||||
|
GPIO_NUM_5, // B2
|
||||||
|
GPIO_NUM_6, // B3
|
||||||
|
GPIO_NUM_7, // B4
|
||||||
|
GPIO_NUM_15, // B5
|
||||||
|
GPIO_NUM_8, // G1
|
||||||
|
GPIO_NUM_20, // G2
|
||||||
|
GPIO_NUM_3, // G3
|
||||||
|
GPIO_NUM_46, // G4
|
||||||
|
GPIO_NUM_9, // G5
|
||||||
|
GPIO_NUM_10, // G6
|
||||||
|
GPIO_NUM_11, // R1
|
||||||
|
GPIO_NUM_12, // R2
|
||||||
|
GPIO_NUM_13, // R3
|
||||||
|
GPIO_NUM_14, // R4
|
||||||
|
GPIO_NUM_0 // R5
|
||||||
|
},
|
||||||
|
.flags = {
|
||||||
|
.disp_active_low = false,
|
||||||
|
.refresh_on_demand = false,
|
||||||
|
.fb_in_psram = true,
|
||||||
|
.double_fb = true,
|
||||||
|
.no_fb = false,
|
||||||
|
.bb_invalidate_cache = true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
st7701_vendor_config_t vendor_config = {
|
||||||
|
.init_cmds = st7701_lcd_init_cmds,
|
||||||
|
.init_cmds_size = sizeof(st7701_lcd_init_cmds) / sizeof(st7701_lcd_init_cmd_t),
|
||||||
|
.rgb_config = &rgb_config,
|
||||||
|
.flags = {
|
||||||
|
.use_mipi_interface = 0,
|
||||||
|
.mirror_by_cmd = 1,
|
||||||
|
.auto_del_panel_io = 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const esp_lcd_panel_dev_config_t panel_config = {
|
||||||
|
.reset_gpio_num = GPIO_NUM_NC,
|
||||||
|
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB,
|
||||||
|
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
||||||
|
.bits_per_pixel = 16,
|
||||||
|
.flags = {
|
||||||
|
.reset_active_high = false,
|
||||||
|
},
|
||||||
|
.vendor_config = &vendor_config,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (esp_lcd_new_panel_st7701(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
|
||||||
|
TT_LOG_E(TAG, "Failed to create panel");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
|
||||||
|
TT_LOG_E(TAG, "Failed to reset panel");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
|
||||||
|
TT_LOG_E(TAG, "Failed to init panel");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esp_lcd_panel_invert_color(panelHandle, false) != ESP_OK) {
|
||||||
|
TT_LOG_E(TAG, "Failed to invert color");
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_lcd_panel_set_gap(panelHandle, 0, 0);
|
||||||
|
|
||||||
|
if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
|
||||||
|
TT_LOG_E(TAG, "Failed to turn display on");
|
||||||
|
}
|
||||||
|
|
||||||
|
const lvgl_port_display_cfg_t disp_cfg = {
|
||||||
|
.io_handle = ioHandle,
|
||||||
|
.panel_handle = panelHandle,
|
||||||
|
.control_handle = nullptr,
|
||||||
|
.buffer_size = (480 * 480),
|
||||||
|
.double_buffer = true,
|
||||||
|
.trans_size = 0,
|
||||||
|
.hres = 480,
|
||||||
|
.vres = 480,
|
||||||
|
.monochrome = false,
|
||||||
|
.rotation = {
|
||||||
|
.swap_xy = false,
|
||||||
|
.mirror_x = false,
|
||||||
|
.mirror_y = false,
|
||||||
|
},
|
||||||
|
.color_format = LV_COLOR_FORMAT_RGB565,
|
||||||
|
.flags = {
|
||||||
|
.buff_dma = false,
|
||||||
|
.buff_spiram = true,
|
||||||
|
.sw_rotate = false,
|
||||||
|
.swap_bytes = false,
|
||||||
|
.full_refresh = false,
|
||||||
|
.direct_mode = false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const lvgl_port_display_rgb_cfg_t rgb_cfg = {
|
||||||
|
.flags = {
|
||||||
|
.bb_mode = true,
|
||||||
|
.avoid_tearing = false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
displayHandle = lvgl_port_add_disp_rgb(&disp_cfg, &rgb_cfg);
|
||||||
|
TT_LOG_I(TAG, "Finished");
|
||||||
|
return displayHandle != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CydDisplay::stop() {
|
||||||
|
assert(displayHandle != nullptr);
|
||||||
|
|
||||||
|
lvgl_port_remove_disp(displayHandle);
|
||||||
|
|
||||||
|
if (esp_lcd_panel_del(panelHandle) != ESP_OK) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esp_lcd_panel_io_del(ioHandle) != ESP_OK) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayHandle = nullptr;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable CydDisplay::createTouch() {
|
||||||
|
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
480,
|
||||||
|
480
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CydDisplay::setBacklightDuty(uint8_t backlightDuty) {
|
||||||
|
driver::pwmbacklight::setBacklightDuty(backlightDuty);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
return std::make_shared<CydDisplay>();
|
||||||
|
}
|
||||||
+9
-11
@@ -1,12 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "lvgl.h"
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
#include "hal/Display.h"
|
#include <esp_lcd_types.h>
|
||||||
#include "esp_lcd_panel_io.h"
|
#include <lvgl.h>
|
||||||
|
|
||||||
extern lv_disp_t* displayHandle;
|
class CydDisplay : public tt::hal::display::DisplayDevice {
|
||||||
|
|
||||||
class YellowDisplay : public tt::hal::Display {
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -16,19 +14,19 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
std::string getName() const final { return "ST7701S"; }
|
||||||
|
std::string getDescription() const final { return "RGB Display"; }
|
||||||
|
|
||||||
bool start() override;
|
bool start() override;
|
||||||
|
|
||||||
bool stop() override;
|
bool stop() override;
|
||||||
|
|
||||||
tt::hal::Touch* _Nullable createTouch() override;
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
||||||
|
|
||||||
void setBacklightDuty(uint8_t backlightDuty) override;
|
void setBacklightDuty(uint8_t backlightDuty) override;
|
||||||
bool supportsBacklightDuty() const override { return true; }
|
bool supportsBacklightDuty() const override { return true; }
|
||||||
|
|
||||||
void setGammaCurve(uint8_t index) override;
|
|
||||||
uint8_t getGammaCurveCount() const override { return 4; };
|
|
||||||
|
|
||||||
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||||
};
|
};
|
||||||
|
|
||||||
tt::hal::Display* createDisplay();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include "CydSdCard.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_42,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
|
);
|
||||||
|
|
||||||
|
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(config)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
|
|
||||||
@@ -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 esp_lcd RgbDisplay GT911 PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
#include "CYD8048S043C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_8048s043c_config'" - GCC bug?)
|
||||||
|
#include "PwmBacklight.h"
|
||||||
|
#include "hal/CydDisplay.h"
|
||||||
|
#include "hal/CydSdCard.h"
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_2, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Configuration cyd_8048s043c_config = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.power = nullptr,
|
||||||
|
.i2c = {
|
||||||
|
//Touch
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Internal",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_19,
|
||||||
|
.scl_io_num = GPIO_NUM_20,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//P4 header, JST SH 1.0, GND / 3.3V / IO17 / IO18
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "External",
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_17,
|
||||||
|
.scl_io_num = GPIO_NUM_18,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
//SD Card
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_11,
|
||||||
|
.miso_io_num = GPIO_NUM_13,
|
||||||
|
.sclk_io_num = GPIO_NUM_12,
|
||||||
|
.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 = 8192,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
//P4 header, JST SH 1.0, GND / 3.3V / IO17 / IO18
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_17,
|
||||||
|
.txPin = GPIO_NUM_18,
|
||||||
|
.rtsPin = GPIO_NUM_NC,
|
||||||
|
.ctsPin = GPIO_NUM_NC,
|
||||||
|
.rxBufferSize = 1024,
|
||||||
|
.txBufferSize = 1024,
|
||||||
|
.config = {
|
||||||
|
.baud_rate = 9600,
|
||||||
|
.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,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
// Capacitive touch version of the 4.3" yellow board
|
||||||
|
extern const tt::hal::Configuration cyd_8048s043c_config;
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
#include "CydDisplay.h"
|
||||||
|
|
||||||
|
#include <Gt911Touch.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
#include <RgbDisplay.h>
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||||
|
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||||
|
// or INT = NC, schematic and other info floating around is kinda conflicting...
|
||||||
|
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
800,
|
||||||
|
480
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
auto touch = createTouch();
|
||||||
|
|
||||||
|
constexpr uint32_t bufferPixels = 800 * 10;
|
||||||
|
|
||||||
|
esp_lcd_rgb_panel_config_t rgb_panel_config = {
|
||||||
|
.clk_src = LCD_CLK_SRC_DEFAULT,
|
||||||
|
.timings = {
|
||||||
|
.pclk_hz = 16000000,
|
||||||
|
.h_res = 800,
|
||||||
|
.v_res = 480,
|
||||||
|
.hsync_pulse_width = 4,
|
||||||
|
.hsync_back_porch = 8,
|
||||||
|
.hsync_front_porch = 8,
|
||||||
|
.vsync_pulse_width = 4,
|
||||||
|
.vsync_back_porch = 8,
|
||||||
|
.vsync_front_porch = 8,
|
||||||
|
.flags = {
|
||||||
|
.hsync_idle_low = false,
|
||||||
|
.vsync_idle_low = false,
|
||||||
|
.de_idle_high = false,
|
||||||
|
.pclk_active_neg = true,
|
||||||
|
.pclk_idle_high = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.data_width = 16,
|
||||||
|
.bits_per_pixel = 0,
|
||||||
|
.num_fbs = 2,
|
||||||
|
.bounce_buffer_size_px = bufferPixels,
|
||||||
|
.sram_trans_align = 8,
|
||||||
|
.psram_trans_align = 64,
|
||||||
|
.hsync_gpio_num = GPIO_NUM_39,
|
||||||
|
.vsync_gpio_num = GPIO_NUM_41,
|
||||||
|
.de_gpio_num = GPIO_NUM_40 ,
|
||||||
|
.pclk_gpio_num = GPIO_NUM_42,
|
||||||
|
.disp_gpio_num = GPIO_NUM_NC,
|
||||||
|
.data_gpio_nums = {
|
||||||
|
GPIO_NUM_8, // B3
|
||||||
|
GPIO_NUM_3, // B4
|
||||||
|
GPIO_NUM_46, // B5
|
||||||
|
GPIO_NUM_9, // B6
|
||||||
|
GPIO_NUM_1, // B7
|
||||||
|
GPIO_NUM_5, // G2
|
||||||
|
GPIO_NUM_6, // G3
|
||||||
|
GPIO_NUM_7, // G4
|
||||||
|
GPIO_NUM_15, // G5
|
||||||
|
GPIO_NUM_16, // G6
|
||||||
|
GPIO_NUM_4, // G7
|
||||||
|
GPIO_NUM_45, // R3
|
||||||
|
GPIO_NUM_48, // R4
|
||||||
|
GPIO_NUM_47, // R5
|
||||||
|
GPIO_NUM_21, // R6
|
||||||
|
GPIO_NUM_14, // R7
|
||||||
|
},
|
||||||
|
.flags = {
|
||||||
|
.disp_active_low = false,
|
||||||
|
.refresh_on_demand = false,
|
||||||
|
.fb_in_psram = true,
|
||||||
|
.double_fb = true,
|
||||||
|
.no_fb = false,
|
||||||
|
.bb_invalidate_cache = false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
RgbDisplay::BufferConfiguration buffer_config = {
|
||||||
|
.size = (800 * 480),
|
||||||
|
.useSpi = true,
|
||||||
|
.doubleBuffer = true,
|
||||||
|
.bounceBufferMode = true,
|
||||||
|
.avoidTearing = false
|
||||||
|
};
|
||||||
|
|
||||||
|
auto configuration = std::make_unique<RgbDisplay::Configuration>(
|
||||||
|
rgb_panel_config,
|
||||||
|
buffer_config,
|
||||||
|
touch,
|
||||||
|
LV_COLOR_FORMAT_RGB565,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
driver::pwmbacklight::setBacklightDuty
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<RgbDisplay>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "CydSdCard.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_10,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
|
);
|
||||||
|
|
||||||
|
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(config)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@@ -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 CST816S PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
#include "JC2432W328C.h"
|
||||||
|
#include "hal/YellowDisplay.h"
|
||||||
|
#include "hal/YellowDisplayConstants.h"
|
||||||
|
#include "hal/YellowSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
#define CYD_SPI_TRANSFER_SIZE_LIMIT (JC2432W328C_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
||||||
|
|
||||||
|
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... 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(JC2432W328C_LCD_PIN_BACKLIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Configuration cyd_jc2432w328c_config = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createYellowSdCard(),
|
||||||
|
.power = nullptr,
|
||||||
|
.i2c = {
|
||||||
|
//Touch
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Internal",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_33,
|
||||||
|
.scl_io_num = GPIO_NUM_32,
|
||||||
|
.sda_pullup_en = false,
|
||||||
|
.scl_pullup_en = false,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "External",
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_21,
|
||||||
|
.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_NC,
|
||||||
|
.sclk_io_num = GPIO_NUM_14,
|
||||||
|
.quadwp_io_num = GPIO_NUM_NC,
|
||||||
|
.quadhd_io_num = GPIO_NUM_NC,
|
||||||
|
.data4_io_num = GPIO_NUM_NC,
|
||||||
|
.data5_io_num = GPIO_NUM_NC,
|
||||||
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
|
.data_io_default_level = false,
|
||||||
|
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = tt::lvgl::getSyncLock()
|
||||||
|
},
|
||||||
|
//SD Card
|
||||||
|
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 = 8192,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
//CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_21,
|
||||||
|
.txPin = GPIO_NUM_22,
|
||||||
|
.rtsPin = GPIO_NUM_NC,
|
||||||
|
.ctsPin = GPIO_NUM_NC,
|
||||||
|
.rxBufferSize = 1024,
|
||||||
|
.txBufferSize = 1024,
|
||||||
|
.config = {
|
||||||
|
.baud_rate = 9600,
|
||||||
|
.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,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
// Capacitive touch version of the 2.8" yellow board
|
||||||
|
extern const tt::hal::Configuration cyd_jc2432w328c_config;
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#include "YellowDisplay.h"
|
||||||
|
#include "Cst816Touch.h"
|
||||||
|
#include "YellowDisplayConstants.h"
|
||||||
|
|
||||||
|
#include <St7789Display.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
|
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<St7789Display::Configuration>(
|
||||||
|
JC2432W328C_LCD_SPI_HOST,
|
||||||
|
JC2432W328C_LCD_PIN_CS,
|
||||||
|
JC2432W328C_LCD_PIN_DC,
|
||||||
|
JC2432W328C_LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
JC2432W328C_LCD_VERTICAL_RESOLUTION,
|
||||||
|
touch,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
JC2432W328C_LCD_DRAW_BUFFER_SIZE
|
||||||
|
);
|
||||||
|
|
||||||
|
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||||
|
|
||||||
|
return std::make_shared<St7789Display>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#include "YellowSdCard.h"
|
||||||
|
|
||||||
|
#define TAG "jc2432w328c_sdcard"
|
||||||
|
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
|
#define SDCARD_SPI_HOST SPI3_HOST
|
||||||
|
#define SDCARD_PIN_CS GPIO_NUM_5
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createYellowSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
std::make_shared<tt::Mutex>(),
|
||||||
|
std::vector<gpio_num_t>(),
|
||||||
|
SDCARD_SPI_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createYellowSdCard();
|
||||||
|
|
||||||
@@ -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 esp_lcd RgbDisplay GT911 PwmBacklight driver vfs fatfs
|
||||||
|
)
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
#include "JC8048W550C.h" // Don't remove, or we get a linker error ("undefined reference to `cyd_jc8048w550c_config'" - GCC bug?)
|
||||||
|
#include "PwmBacklight.h"
|
||||||
|
#include "hal/CydDisplay.h"
|
||||||
|
#include "hal/CydSdCard.h"
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Configuration cyd_jc8048w550c_config = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.power = nullptr,
|
||||||
|
.i2c = {
|
||||||
|
//Touch
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Internal",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_19,
|
||||||
|
.scl_io_num = GPIO_NUM_20,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//P4 header, JST SH 1.25, GND / 3.3V / IO17 / IO18 or
|
||||||
|
//P5 header, JST SH 1.0, GND / 3.3V / IO17 / IO18
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "External",
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_17,
|
||||||
|
.scl_io_num = GPIO_NUM_18,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
//SD Card
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_11,
|
||||||
|
.miso_io_num = GPIO_NUM_13,
|
||||||
|
.sclk_io_num = GPIO_NUM_12,
|
||||||
|
.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 = 8192,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
//P4 header, JST SH 1.0, GND / 3.3V / IO17 / IO18
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_17,
|
||||||
|
.txPin = GPIO_NUM_18,
|
||||||
|
.rtsPin = GPIO_NUM_NC,
|
||||||
|
.ctsPin = GPIO_NUM_NC,
|
||||||
|
.rxBufferSize = 1024,
|
||||||
|
.txBufferSize = 1024,
|
||||||
|
.config = {
|
||||||
|
.baud_rate = 9600,
|
||||||
|
.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,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
// Capacitive touch version of the 5" black board
|
||||||
|
extern const tt::hal::Configuration cyd_jc8048w550c_config;
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
#include "RgbDisplay.h"
|
||||||
|
|
||||||
|
#include "CydDisplay.h"
|
||||||
|
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
#include <Gt911Touch.h>
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||||
|
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||||
|
// or INT = NC, schematic and other info floating around is kinda conflicting...
|
||||||
|
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
800,
|
||||||
|
480
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
auto touch = createTouch();
|
||||||
|
|
||||||
|
constexpr uint32_t bufferPixels = 800 * 10;
|
||||||
|
|
||||||
|
esp_lcd_rgb_panel_config_t rgb_panel_config = {
|
||||||
|
.clk_src = LCD_CLK_SRC_DEFAULT,
|
||||||
|
.timings = {
|
||||||
|
.pclk_hz = 16000000,
|
||||||
|
.h_res = 800,
|
||||||
|
.v_res = 480,
|
||||||
|
.hsync_pulse_width = 4,
|
||||||
|
.hsync_back_porch = 8,
|
||||||
|
.hsync_front_porch = 8,
|
||||||
|
.vsync_pulse_width = 4,
|
||||||
|
.vsync_back_porch = 8,
|
||||||
|
.vsync_front_porch = 8,
|
||||||
|
.flags = {
|
||||||
|
.hsync_idle_low = false,
|
||||||
|
.vsync_idle_low = false,
|
||||||
|
.de_idle_high = false,
|
||||||
|
.pclk_active_neg = true,
|
||||||
|
.pclk_idle_high = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.data_width = 16,
|
||||||
|
.bits_per_pixel = 0,
|
||||||
|
.num_fbs = 2,
|
||||||
|
.bounce_buffer_size_px = bufferPixels,
|
||||||
|
.sram_trans_align = 8,
|
||||||
|
.psram_trans_align = 64,
|
||||||
|
.hsync_gpio_num = GPIO_NUM_39,
|
||||||
|
.vsync_gpio_num = GPIO_NUM_41,
|
||||||
|
.de_gpio_num = GPIO_NUM_40 ,
|
||||||
|
.pclk_gpio_num = GPIO_NUM_42,
|
||||||
|
.disp_gpio_num = GPIO_NUM_NC,
|
||||||
|
.data_gpio_nums = {
|
||||||
|
GPIO_NUM_8, // B3
|
||||||
|
GPIO_NUM_3, // B4
|
||||||
|
GPIO_NUM_46, // B5
|
||||||
|
GPIO_NUM_9, // B6
|
||||||
|
GPIO_NUM_1, // B7
|
||||||
|
GPIO_NUM_5, // G2
|
||||||
|
GPIO_NUM_6, // G3
|
||||||
|
GPIO_NUM_7, // G4
|
||||||
|
GPIO_NUM_15, // G5
|
||||||
|
GPIO_NUM_16, // G6
|
||||||
|
GPIO_NUM_4, // G7
|
||||||
|
GPIO_NUM_45, // R3
|
||||||
|
GPIO_NUM_48, // R4
|
||||||
|
GPIO_NUM_47, // R5
|
||||||
|
GPIO_NUM_21, // R6
|
||||||
|
GPIO_NUM_14, // R7
|
||||||
|
},
|
||||||
|
.flags = {
|
||||||
|
.disp_active_low = false,
|
||||||
|
.refresh_on_demand = false,
|
||||||
|
.fb_in_psram = true,
|
||||||
|
.double_fb = true,
|
||||||
|
.no_fb = false,
|
||||||
|
.bb_invalidate_cache = false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
RgbDisplay::BufferConfiguration buffer_config = {
|
||||||
|
.size = (800 * 480),
|
||||||
|
.useSpi = true,
|
||||||
|
.doubleBuffer = true,
|
||||||
|
.bounceBufferMode = true,
|
||||||
|
.avoidTearing = false
|
||||||
|
};
|
||||||
|
|
||||||
|
auto configuration = std::make_unique<RgbDisplay::Configuration>(
|
||||||
|
rgb_panel_config,
|
||||||
|
buffer_config,
|
||||||
|
touch,
|
||||||
|
LV_COLOR_FORMAT_RGB565,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
driver::pwmbacklight::setBacklightDuty
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<RgbDisplay>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#include "CydSdCard.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_10,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
std::make_shared<tt::Mutex>(),
|
||||||
|
std::vector<gpio_num_t>(),
|
||||||
|
SPI2_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(config)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@@ -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 FT5x06 ST7789 PwmBacklight driver
|
||||||
|
)
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#include "PwmBacklight.h"
|
||||||
|
#include "Tactility/lvgl/LvglSync.h"
|
||||||
|
#include "hal/CrowPanelDisplay.h"
|
||||||
|
#include "hal/CrowPanelDisplayConstants.h"
|
||||||
|
#include "hal/CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_38);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration crowpanel_advance_28 = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.i2c = {
|
||||||
|
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
|
||||||
|
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Main",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_15,
|
||||||
|
.scl_io_num = GPIO_NUM_16,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
// Display
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_DISABLED,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_39,
|
||||||
|
.miso_io_num = GPIO_NUM_NC,
|
||||||
|
.sclk_io_num = GPIO_NUM_42,
|
||||||
|
.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 = CROWPANEL_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() // esp_lvgl_port owns the lock for the display
|
||||||
|
},
|
||||||
|
// SD card
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI3_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_6,
|
||||||
|
.miso_io_num = GPIO_NUM_4,
|
||||||
|
.sclk_io_num = GPIO_NUM_5,
|
||||||
|
.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 = 32768,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr // No custom lock needed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
// "UART0-IN"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART0",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_44,
|
||||||
|
.txPin = GPIO_NUM_43,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// "UART1-OUT"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_2,
|
||||||
|
.rxPin = GPIO_NUM_18,
|
||||||
|
.txPin = GPIO_NUM_17,
|
||||||
|
.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,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration crowpanel_advance_28;
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#include "CrowPanelDisplay.h"
|
||||||
|
#include "CrowPanelDisplayConstants.h"
|
||||||
|
|
||||||
|
#include <Ft5x06Touch.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
#include <St7789Display.h>
|
||||||
|
|
||||||
|
#define TAG "crowpanel_display"
|
||||||
|
|
||||||
|
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,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
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,
|
||||||
|
320,
|
||||||
|
240,
|
||||||
|
touch,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||||
|
|
||||||
|
return std::make_shared<St7789Display>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <esp_lcd_types.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
class CrowPanelDisplay : public tt::hal::display::DisplayDevice {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
esp_lcd_panel_io_handle_t ioHandle = nullptr;
|
||||||
|
esp_lcd_panel_handle_t panelHandle = nullptr;
|
||||||
|
lv_display_t* displayHandle = nullptr;
|
||||||
|
bool poweredOn = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
std::string getName() const final { return "ST7789"; }
|
||||||
|
std::string getDescription() const final { return "SPI display"; }
|
||||||
|
|
||||||
|
bool start() override;
|
||||||
|
|
||||||
|
bool stop() override;
|
||||||
|
|
||||||
|
void setPowerOn(bool turnOn) override;
|
||||||
|
bool isPoweredOn() const override { return poweredOn; };
|
||||||
|
bool supportsPowerControl() const override { return true; }
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
||||||
|
|
||||||
|
void setBacklightDuty(uint8_t backlightDuty) override;
|
||||||
|
bool supportsBacklightDuty() const override { return true; }
|
||||||
|
|
||||||
|
void setGammaCurve(uint8_t index) override;
|
||||||
|
uint8_t getGammaCurveCount() const override { return 4; };
|
||||||
|
|
||||||
|
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#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)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#include "CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
|
#include <esp_vfs_fat.h>
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
#define CROWPANEL_SDCARD_PIN_CS GPIO_NUM_7
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
CROWPANEL_SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
tt::lvgl::getSyncLock(),
|
||||||
|
{},
|
||||||
|
SPI3_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@@ -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 ILI9488 GT911 PwmBacklight driver
|
||||||
|
)
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#include "PwmBacklight.h"
|
||||||
|
#include "Tactility/lvgl/LvglSync.h"
|
||||||
|
#include "hal/CrowPanelDisplay.h"
|
||||||
|
#include "hal/CrowPanelDisplayConstants.h"
|
||||||
|
#include "hal/CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_38);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration crowpanel_advance_35 = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.i2c = {
|
||||||
|
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
|
||||||
|
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Main",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_15,
|
||||||
|
.scl_io_num = GPIO_NUM_16,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
// Display
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_DISABLED,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_39,
|
||||||
|
.miso_io_num = GPIO_NUM_NC,
|
||||||
|
.sclk_io_num = GPIO_NUM_42,
|
||||||
|
.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 = CROWPANEL_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() // esp_lvgl_port owns the lock for the display
|
||||||
|
},
|
||||||
|
// SD card
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI3_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_6,
|
||||||
|
.miso_io_num = GPIO_NUM_4,
|
||||||
|
.sclk_io_num = GPIO_NUM_5,
|
||||||
|
.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 = 32768,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr // No custom lock needed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
// "UART0-IN"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART0",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_44,
|
||||||
|
.txPin = GPIO_NUM_43,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// "UART1-OUT"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_2,
|
||||||
|
.rxPin = GPIO_NUM_18,
|
||||||
|
.txPin = GPIO_NUM_17,
|
||||||
|
.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,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration crowpanel_advance_35;
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#include "CrowPanelDisplay.h"
|
||||||
|
#include "CrowPanelDisplayConstants.h"
|
||||||
|
|
||||||
|
#include <Gt911Touch.h>
|
||||||
|
#include <PwmBacklight.h>
|
||||||
|
#include <Ili9488Display.h>
|
||||||
|
|
||||||
|
#define TAG "crowpanel_display"
|
||||||
|
|
||||||
|
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,
|
||||||
|
320,
|
||||||
|
480
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
auto touch = createTouch();
|
||||||
|
|
||||||
|
auto configuration = std::make_unique<Ili9488Display::Configuration>(
|
||||||
|
CROWPANEL_LCD_SPI_HOST,
|
||||||
|
CROWPANEL_LCD_PIN_CS,
|
||||||
|
CROWPANEL_LCD_PIN_DC,
|
||||||
|
CROWPANEL_LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
CROWPANEL_LCD_VERTICAL_RESOLUTION,
|
||||||
|
touch,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||||
|
|
||||||
|
return std::make_shared<Ili9488Display>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <esp_lcd_types.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
class CrowPanelDisplay : public tt::hal::display::DisplayDevice {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
esp_lcd_panel_io_handle_t ioHandle = nullptr;
|
||||||
|
esp_lcd_panel_handle_t panelHandle = nullptr;
|
||||||
|
lv_display_t* displayHandle = nullptr;
|
||||||
|
bool poweredOn = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
std::string getName() const final { return "ST7789"; }
|
||||||
|
std::string getDescription() const final { return "SPI display"; }
|
||||||
|
|
||||||
|
bool start() override;
|
||||||
|
|
||||||
|
bool stop() override;
|
||||||
|
|
||||||
|
void setPowerOn(bool turnOn) override;
|
||||||
|
bool isPoweredOn() const override { return poweredOn; };
|
||||||
|
bool supportsPowerControl() const override { return true; }
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
||||||
|
|
||||||
|
void setBacklightDuty(uint8_t backlightDuty) override;
|
||||||
|
bool supportsBacklightDuty() const override { return true; }
|
||||||
|
|
||||||
|
void setGammaCurve(uint8_t index) override;
|
||||||
|
uint8_t getGammaCurveCount() const override { return 4; };
|
||||||
|
|
||||||
|
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#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 480
|
||||||
|
#define CROWPANEL_LCD_SPI_TRANSFER_HEIGHT (CROWPANEL_LCD_VERTICAL_RESOLUTION / 10)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#include "CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
|
#include <esp_vfs_fat.h>
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
#define CROWPANEL_SDCARD_PIN_CS GPIO_NUM_7
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
CROWPANEL_SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
tt::lvgl::getSyncLock(),
|
||||||
|
{},
|
||||||
|
SPI3_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@@ -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 RgbDisplay GT911 TCA9534 driver
|
||||||
|
)
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
#include "hal/CrowPanelDisplay.h"
|
||||||
|
#include "hal/CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
#include <TCA9534.h>
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
TCA9534_IO_EXP io_expander = {
|
||||||
|
.I2C_ADDR = 0x18,
|
||||||
|
.i2c_master_port = I2C_NUM_0,
|
||||||
|
.interrupt_pin = GPIO_NUM_NC,
|
||||||
|
.interrupt_task = nullptr
|
||||||
|
};
|
||||||
|
|
||||||
|
// Enable LCD backlight
|
||||||
|
set_tca9534_io_pin_direction(&io_expander, TCA9534_IO1, TCA9534_OUTPUT);
|
||||||
|
set_tca9534_io_pin_output_state(&io_expander, TCA9534_IO1, 255);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration crowpanel_advance_50 = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.i2c = {
|
||||||
|
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
|
||||||
|
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Main",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_15,
|
||||||
|
.scl_io_num = GPIO_NUM_16,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
// SD card
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_6,
|
||||||
|
.miso_io_num = GPIO_NUM_4,
|
||||||
|
.sclk_io_num = GPIO_NUM_5,
|
||||||
|
.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 = 8192,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr // No custom lock needed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
// "UART0-OUT"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART0",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_44,
|
||||||
|
.txPin = GPIO_NUM_43,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// "UART1-OUT"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_2,
|
||||||
|
.rxPin = GPIO_NUM_19,
|
||||||
|
.txPin = GPIO_NUM_20,
|
||||||
|
.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,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration crowpanel_advance_50;
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
#include "CrowPanelDisplay.h"
|
||||||
|
|
||||||
|
#include <Gt911Touch.h>
|
||||||
|
#include <RgbDisplay.h>
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||||
|
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||||
|
// or INT = NC, schematic and other info floating around is kinda conflicting...
|
||||||
|
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
800,
|
||||||
|
480
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
auto touch = createTouch();
|
||||||
|
|
||||||
|
constexpr uint32_t bufferPixels = 800 * 10;
|
||||||
|
|
||||||
|
esp_lcd_rgb_panel_config_t rgb_panel_config = {
|
||||||
|
.clk_src = LCD_CLK_SRC_DEFAULT,
|
||||||
|
.timings = {
|
||||||
|
.pclk_hz = 15000000, // TODO: 21 MHz was too much and caused drift when opening wifi/SD/apps. Try something inbetween 15 and 21 MHz.
|
||||||
|
.h_res = 800,
|
||||||
|
.v_res = 480,
|
||||||
|
.hsync_pulse_width = 4,
|
||||||
|
.hsync_back_porch = 8,
|
||||||
|
.hsync_front_porch = 8,
|
||||||
|
.vsync_pulse_width = 4,
|
||||||
|
.vsync_back_porch = 8,
|
||||||
|
.vsync_front_porch = 8,
|
||||||
|
.flags = {
|
||||||
|
.hsync_idle_low = false,
|
||||||
|
.vsync_idle_low = false,
|
||||||
|
.de_idle_high = false,
|
||||||
|
.pclk_active_neg = true,
|
||||||
|
.pclk_idle_high = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.data_width = 16,
|
||||||
|
.bits_per_pixel = 0,
|
||||||
|
.num_fbs = 2,
|
||||||
|
.bounce_buffer_size_px = bufferPixels,
|
||||||
|
.sram_trans_align = 8,
|
||||||
|
.psram_trans_align = 64,
|
||||||
|
.hsync_gpio_num = GPIO_NUM_40,
|
||||||
|
.vsync_gpio_num = GPIO_NUM_41,
|
||||||
|
.de_gpio_num = GPIO_NUM_42 ,
|
||||||
|
.pclk_gpio_num = GPIO_NUM_39,
|
||||||
|
.disp_gpio_num = GPIO_NUM_NC,
|
||||||
|
.data_gpio_nums = {
|
||||||
|
GPIO_NUM_21, // B3
|
||||||
|
GPIO_NUM_47, // B4
|
||||||
|
GPIO_NUM_48, // B5
|
||||||
|
GPIO_NUM_45, // B6
|
||||||
|
GPIO_NUM_38, // B7
|
||||||
|
GPIO_NUM_9, // G2
|
||||||
|
GPIO_NUM_10, // G3
|
||||||
|
GPIO_NUM_11, // G4
|
||||||
|
GPIO_NUM_12, // G5
|
||||||
|
GPIO_NUM_13, // G6
|
||||||
|
GPIO_NUM_14, // G7
|
||||||
|
GPIO_NUM_7, // R3
|
||||||
|
GPIO_NUM_17, // R4
|
||||||
|
GPIO_NUM_18, // R5
|
||||||
|
GPIO_NUM_3, // R6
|
||||||
|
GPIO_NUM_46, // R7
|
||||||
|
},
|
||||||
|
.flags = {
|
||||||
|
.disp_active_low = false,
|
||||||
|
.refresh_on_demand = false,
|
||||||
|
.fb_in_psram = true,
|
||||||
|
.double_fb = true,
|
||||||
|
.no_fb = false,
|
||||||
|
.bb_invalidate_cache = false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
RgbDisplay::BufferConfiguration buffer_config = {
|
||||||
|
.size = (800 * 480),
|
||||||
|
.useSpi = true,
|
||||||
|
.doubleBuffer = true,
|
||||||
|
.bounceBufferMode = true,
|
||||||
|
.avoidTearing = false
|
||||||
|
};
|
||||||
|
|
||||||
|
auto configuration = std::make_unique<RgbDisplay::Configuration>(
|
||||||
|
rgb_panel_config,
|
||||||
|
buffer_config,
|
||||||
|
touch,
|
||||||
|
LV_COLOR_FORMAT_RGB565,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<RgbDisplay>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#include "CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
|
#include <esp_vfs_fat.h>
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
// See https://github.com/Elecrow-RD/CrowPanel-Advance-HMI-ESP32-AI-Display/blob/master/5.0/factory_code/factory_code.ino
|
||||||
|
GPIO_NUM_0, // It's actually not connected, but in the demo pin 0 is used
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@@ -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 ILI934x XPT2046 PwmBacklight driver
|
||||||
|
)
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
#include "PwmBacklight.h"
|
||||||
|
#include "Tactility/lvgl/LvglSync.h"
|
||||||
|
#include "hal/CrowPanelDisplay.h"
|
||||||
|
#include "hal/CrowPanelDisplayConstants.h"
|
||||||
|
#include "hal/CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Xpt2046Power.h>
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_27);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration crowpanel_basic_28 = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.power = getOrCreatePower,
|
||||||
|
.i2c = {
|
||||||
|
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
|
||||||
|
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Main",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_22,
|
||||||
|
.scl_io_num = GPIO_NUM_21,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
// Display
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_DISABLED,
|
||||||
|
.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 = CROWPANEL_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() // esp_lvgl_port owns the lock for the display
|
||||||
|
},
|
||||||
|
// SD card
|
||||||
|
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 = 32768,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr // No custom lock needed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
// "UART1"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_16,
|
||||||
|
.txPin = GPIO_NUM_17,
|
||||||
|
.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,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration crowpanel_basic_28;
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include "CrowPanelDisplay.h"
|
||||||
|
#include "CrowPanelDisplayConstants.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;
|
||||||
|
|
||||||
|
return std::make_shared<Ili934xDisplay>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <esp_lcd_types.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
class CrowPanelDisplay : public tt::hal::display::DisplayDevice {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
esp_lcd_panel_io_handle_t ioHandle = nullptr;
|
||||||
|
esp_lcd_panel_handle_t panelHandle = nullptr;
|
||||||
|
lv_display_t* displayHandle = nullptr;
|
||||||
|
bool poweredOn = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
std::string getName() const final { return "ST7789"; }
|
||||||
|
std::string getDescription() const final { return "SPI display"; }
|
||||||
|
|
||||||
|
bool start() override;
|
||||||
|
|
||||||
|
bool stop() override;
|
||||||
|
|
||||||
|
void setPowerOn(bool turnOn) override;
|
||||||
|
bool isPoweredOn() const override { return poweredOn; };
|
||||||
|
bool supportsPowerControl() const override { return true; }
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
||||||
|
|
||||||
|
void setBacklightDuty(uint8_t backlightDuty) override;
|
||||||
|
bool supportsBacklightDuty() const override { return true; }
|
||||||
|
|
||||||
|
void setGammaCurve(uint8_t index) override;
|
||||||
|
uint8_t getGammaCurveCount() const override { return 4; };
|
||||||
|
|
||||||
|
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#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)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#include "CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
|
#include <esp_vfs_fat.h>
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto* configuration = new SpiSdCardDevice::Config(
|
||||||
|
GPIO_NUM_5,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
tt::lvgl::getSyncLock(),
|
||||||
|
{},
|
||||||
|
SPI3_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||||
|
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@@ -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 ILI9488 XPT2046 PwmBacklight driver
|
||||||
|
)
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
#include "PwmBacklight.h"
|
||||||
|
#include "Tactility/lvgl/LvglSync.h"
|
||||||
|
#include "hal/CrowPanelDisplay.h"
|
||||||
|
#include "hal/CrowPanelDisplayConstants.h"
|
||||||
|
#include "hal/CrowPanelSdCard.h"
|
||||||
|
|
||||||
|
#include <Xpt2046Power.h>
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
return driver::pwmbacklight::init(GPIO_NUM_27);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration crowpanel_basic_35 = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDisplay = createDisplay,
|
||||||
|
.sdcard = createSdCard(),
|
||||||
|
.power = getOrCreatePower,
|
||||||
|
.i2c = {
|
||||||
|
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
|
||||||
|
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Main",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_22,
|
||||||
|
.scl_io_num = GPIO_NUM_21,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
// Display
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI2_HOST,
|
||||||
|
.dma = SPI_DMA_DISABLED,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_13,
|
||||||
|
.miso_io_num = GPIO_NUM_33,
|
||||||
|
.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 = CROWPANEL_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() // esp_lvgl_port owns the lock for the display
|
||||||
|
},
|
||||||
|
// SD card
|
||||||
|
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 = 32768,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = nullptr // No custom lock needed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
// "UART1"
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "UART1",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_3,
|
||||||
|
.txPin = GPIO_NUM_1,
|
||||||
|
.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,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration crowpanel_basic_35;
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#include "CrowPanelDisplay.h"
|
||||||
|
#include "CrowPanelDisplayConstants.h"
|
||||||
|
|
||||||
|
#include <Ili9488Display.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,
|
||||||
|
320,
|
||||||
|
480,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<Xpt2046Touch>(std::move(configuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
auto touch = createTouch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This display is mirrored on X, but that doesn't seem to work with the driver.
|
||||||
|
* Instead, we swap XY, which does work. That results in a landscape image.
|
||||||
|
*/
|
||||||
|
auto configuration = std::make_unique<Ili9488Display::Configuration>(
|
||||||
|
CROWPANEL_LCD_SPI_HOST,
|
||||||
|
CROWPANEL_LCD_PIN_CS,
|
||||||
|
CROWPANEL_LCD_PIN_DC,
|
||||||
|
480,
|
||||||
|
320,
|
||||||
|
touch,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
configuration->mirrorX = true;
|
||||||
|
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||||
|
|
||||||
|
return std::make_shared<Ili9488Display>(std::move(configuration));
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
|
#include <esp_lcd_types.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
class CrowPanelDisplay : public tt::hal::display::DisplayDevice {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
esp_lcd_panel_io_handle_t ioHandle = nullptr;
|
||||||
|
esp_lcd_panel_handle_t panelHandle = nullptr;
|
||||||
|
lv_display_t* displayHandle = nullptr;
|
||||||
|
bool poweredOn = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
std::string getName() const final { return "ST7789"; }
|
||||||
|
std::string getDescription() const final { return "SPI display"; }
|
||||||
|
|
||||||
|
bool start() override;
|
||||||
|
|
||||||
|
bool stop() override;
|
||||||
|
|
||||||
|
void setPowerOn(bool turnOn) override;
|
||||||
|
bool isPoweredOn() const override { return poweredOn; };
|
||||||
|
bool supportsPowerControl() const override { return true; }
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
||||||
|
|
||||||
|
void setBacklightDuty(uint8_t backlightDuty) override;
|
||||||
|
bool supportsBacklightDuty() const override { return true; }
|
||||||
|
|
||||||
|
void setGammaCurve(uint8_t index) override;
|
||||||
|
uint8_t getGammaCurveCount() const override { return 4; };
|
||||||
|
|
||||||
|
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user