Compare commits
219 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 047c7c87d7 | |||
| 94b5cdbfc4 | |||
| 5c535490ea | |||
| e50659a3fb | |||
| aeccc15ab6 | |||
| 594b8bd27e | |||
| e8b9a1f2a9 | |||
| a35c88c8fd | |||
| 8dabda2b5b | |||
| 8dd9bee8d0 | |||
| 543390a977 | |||
| 62266dff58 | |||
| 3dcc95f6f3 | |||
| a59fbf4ed5 | |||
| 5c78d55b04 | |||
| 895e6bc50d | |||
| 4170b86137 | |||
| be2cdc0b90 | |||
| 10ba4f58e2 | |||
| 4dd2762b79 | |||
| e64f4ff16b | |||
| e560cc7df2 | |||
| aa7530e515 | |||
| 2de35b2d2d | |||
| 9fc0aa51d7 | |||
| 2426c387eb | |||
| 33caf09856 | |||
| d2048e01b6 | |||
| f0f764baff | |||
| d860ba1f34 | |||
| 3a24d058c9 | |||
| 72b55b221e | |||
| 9a11e6f47b | |||
| 72c9b2b113 | |||
| 4ab29ae466 | |||
| 8ff990d635 | |||
| 49632d15c9 | |||
| 26c17986c6 | |||
| dff93cb655 | |||
| 25c3f19e5d | |||
| 93efadd5e3 | |||
| d27404964a | |||
| 74127a5f6c | |||
| 7e24105d0c | |||
| 2aa41cb562 | |||
| 0042ce6d32 | |||
| 79e43b093a | |||
| 1757af859c | |||
| 626d0d9776 | |||
| ecc0a9c076 | |||
| 4fe4faf422 | |||
| a1c835e073 | |||
| 9a672a30ff | |||
| 9cc96fd32b | |||
| a935410f82 | |||
| 1a61eac8e0 | |||
| 1f9e7f82fd | |||
| 9f721e6655 | |||
| 3fe1dc0312 | |||
| 5993ceb232 | |||
| 399dca5e14 | |||
| c9185740d7 | |||
| d62314f41f | |||
| 87ca888bb4 | |||
| 71f8369377 | |||
| f6ddb14ec1 | |||
| d551e467b8 | |||
| c05d46a28c | |||
| e6abd496f9 | |||
| 619b5aa53b | |||
| 10381b10cd | |||
| dfe2c865d1 | |||
| 96eccbdc8d | |||
| 2839ea4c35 | |||
| 51b9547e99 | |||
| d3797abf4e | |||
| 4b6ed871a9 | |||
| 0d16eb606f | |||
| b8214fd378 | |||
| 01ffe420eb | |||
| c98cb2bf10 | |||
| f620255c41 | |||
| 719f7bcece | |||
| 2ca8ae62fb | |||
| fa544f9b3c | |||
| 812c2901db | |||
| 524b197105 | |||
| 7283920def | |||
| a4dc633063 | |||
| feaeb11e49 | |||
| 3fc2ff8bc6 | |||
| f48654d3dc | |||
| 261796068e | |||
| 134e0b34b6 | |||
| 6c4a9975a4 | |||
| 776e3cd4c0 | |||
| 76686e5c90 | |||
| cbaa32c27e | |||
| 65d3d55cc4 | |||
| 62124541e9 | |||
| 8de88dd3fd | |||
| c6cc4034df | |||
| b565d56029 | |||
| fec8033fd7 | |||
| 6ab6ae5686 | |||
| eba1f8955a | |||
| a4f4784ed9 | |||
| dddca1ea76 | |||
| c1ff024657 | |||
| c7c9618f48 | |||
| 0df6b78bd6 | |||
| 7918451699 | |||
| 8335611796 | |||
| 0d8c0a37cc | |||
| ab2aa2c4d4 | |||
| e2ec39304c | |||
| 569cce38fa | |||
| 9ae3e48600 | |||
| 388c2cfe4b | |||
| adea6678a5 | |||
| 4a343e58cc | |||
| 61277e74b8 | |||
| efd3c6041c | |||
| 647678ff82 | |||
| 8115ca4fd9 | |||
| db6d3b4acb | |||
| 37420db000 | |||
| b067978c16 | |||
| 09f8031bff | |||
| 1450ca319d | |||
| c139300a58 | |||
| d0d05c67ca | |||
| f660550f86 | |||
| e9384e0c11 | |||
| 9c5a427a34 | |||
| d8346998ce | |||
| 3a59540365 | |||
| d25603166a | |||
| 17b4fc6a47 | |||
| 45a8379426 | |||
| 1e4234d895 | |||
| 2cb413c3d1 | |||
| 5777a1381b | |||
| 15de4e20b8 | |||
| 3802679de4 | |||
| a05a6afaaf | |||
| efd9662cfc | |||
| 00347cbd29 | |||
| b214a3358e | |||
| c7621b5e4c | |||
| 6dc4f698c9 | |||
| f97ca26b01 | |||
| 98bbea3e9c | |||
| f6cdabf3c0 | |||
| dcf28d0868 | |||
| 9cc58099b4 | |||
| 1216862aec | |||
| 7ad0a3cb04 | |||
| bab3eb19bc | |||
| a4d15b2a1e | |||
| 41ad569154 | |||
| faab6d825f | |||
| a2af95b92d | |||
| 53b711584f | |||
| ce8ac61d42 | |||
| d5c94c7a8a | |||
| 7027da00b8 | |||
| 095c8146c3 | |||
| 62c613477a | |||
| d83b98e99b | |||
| ade86c99b4 | |||
| 980b115f1d | |||
| 84049658db | |||
| 068600f98c | |||
| fe7fdd8583 | |||
| f26266ba76 | |||
| 35a918c82b | |||
| 63866fb371 | |||
| 457c21ffd8 | |||
| 65335578a4 | |||
| c0ed8f0a44 | |||
| a9b69010d8 | |||
| 1627b9fa85 | |||
| 1deaf4c426 | |||
| 0f8380e8fe | |||
| 5cc5b50694 | |||
| 5dfc6d70da | |||
| 50007ea9ed | |||
| e9f72490fc | |||
| 8c8ccd8783 | |||
| ee5a5a7181 | |||
| fbaff8cbac | |||
| d875ade8cb | |||
| 15f4fbfdc6 | |||
| 982fce9207 | |||
| 00b62a2831 | |||
| ab4cf79a47 | |||
| d06197a6aa | |||
| efd3dc43ed | |||
| 6de0f442fb | |||
| 29e4350517 | |||
| f9acf04dcb | |||
| a091923353 | |||
| 1593eb80ce | |||
| 869a56125f | |||
| 6116521556 | |||
| 3dfc27e93e | |||
| e4ecec64c9 | |||
| ce96474d84 | |||
| 2691dbb014 | |||
| 74eb830870 | |||
| 870924229a | |||
| b2647f46bb | |||
| d1c1a3a369 | |||
| a5090ec194 | |||
| f67cb241b7 | |||
| b2d4dc5ecb | |||
| a7c5d6a2ee | |||
| 08029a84dd |
@@ -30,4 +30,4 @@ If applicable, add screenshots to help explain your problem.
|
|||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
Add your oops.tactility.one URL if you had a crash (scanned from QR).
|
Add your oops.tactilityproject.org URL if you had a crash (scanned from QR).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
### Checklist
|
### Checklist
|
||||||
|
|
||||||
- [ ] I read [contribution guidelines](https://github.com/ByteWelder/Tactility/blob/main/CONTRIBUTING.md)
|
- [ ] I read [contribution guidelines](https://github.com/TactilityProject/Tactility/blob/main/CONTRIBUTING.md)
|
||||||
- [ ] Code adheres to the [coding style](https://github.com/ByteWelder/Tactility/blob/main/CODING_STYLE.md)
|
- [ ] Code adheres to the [coding style](https://github.com/TactilityProject/Tactility/blob/main/CODING_STYLE.md)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
|
|||||||
@@ -16,16 +16,23 @@ runs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: 'Board select'
|
- name: 'Board select'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig
|
run: python device.py ${{ inputs.board_id }}
|
||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
uses: espressif/esp-idf-ci-action@main
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.4
|
esp_idf_version: v5.5.2
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: Buildscripts/release.sh ${{ inputs.board_id }}
|
run: Buildscripts/release.sh ${{ inputs.board_id }}
|
||||||
|
- name: 'Merge binary'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python -m pip install esptool
|
||||||
|
cd release/Tactility-${{ inputs.board_id }}
|
||||||
|
bash ./merge.sh ${{ inputs.arch }}
|
||||||
|
mv Binaries/merged_binary.bin ../Tactility-${{ inputs.board_id }}.bin
|
||||||
- name: 'Upload Artifact: Release'
|
- name: 'Upload Artifact: Release'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -38,3 +45,9 @@ runs:
|
|||||||
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
|
||||||
|
- name: 'Upload Artifact: Merged binary'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: Tactility-${{ inputs.board_id }}.bin
|
||||||
|
path: release/Tactility-${{ inputs.board_id }}.bin
|
||||||
|
retention-days: 30
|
||||||
|
|||||||
@@ -16,16 +16,34 @@ runs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: 'Board select'
|
- name: 'Board select'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig
|
run: python device.py ${{ inputs.board_id }}
|
||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
uses: espressif/esp-idf-ci-action@main
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.4
|
# NOTE: Update with ESP-IDF!
|
||||||
|
esp_idf_version: v5.5.2
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: Buildscripts/release-sdk.sh release/TactilitySDK
|
env:
|
||||||
|
# NOTE: Update with ESP-IDF!
|
||||||
|
ESP_IDF_VERSION: '5.5.2'
|
||||||
|
run: python Buildscripts/release-sdk.py release/TactilitySDK
|
||||||
|
- name: 'Test Integration Prep'
|
||||||
|
shell: bash
|
||||||
|
# The manifest.properties of our integration test uses version 0.0.0 to indicate that it is not using a normal SDK
|
||||||
|
# This way, it only works with our custom build. That means we have to create a copy of the SDK with the correct folder structure:
|
||||||
|
run: |
|
||||||
|
TACTILITY_SDK_NAME="0.0.0-${{ inputs.arch }}"
|
||||||
|
mkdir -p test_sdk/$TACTILITY_SDK_NAME
|
||||||
|
cp -r release/TactilitySDK test_sdk/$TACTILITY_SDK_NAME
|
||||||
|
- name: 'Test Integration'
|
||||||
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
|
with:
|
||||||
|
esp_idf_version: v5.5.2
|
||||||
|
target: ${{ inputs.arch }}
|
||||||
|
command: export TACTILITY_SDK_PATH=../../test_sdk && cd Tests/SdkIntegration && python tactility.py build ${{ inputs.arch }} --local-sdk
|
||||||
- name: 'Upload Artifact'
|
- name: 'Upload Artifact'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ runs:
|
|||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repo"
|
- name: "Checkout repo"
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install Linux Dependencies for SDL
|
- name: Install Linux Dependencies for SDL
|
||||||
@@ -36,14 +36,16 @@ runs:
|
|||||||
WLR_LIBINPUT_NO_DEVICES: 1
|
WLR_LIBINPUT_NO_DEVICES: 1
|
||||||
WAYLAND_DISPLAY: wayland-1
|
WAYLAND_DISPLAY: wayland-1
|
||||||
GTK_USE_PORTAL: 0
|
GTK_USE_PORTAL: 0
|
||||||
- name: "Configure Project"
|
- name: Setup cmake
|
||||||
uses: threeal/cmake-action@v1.3.0
|
uses: jwlawson/actions-setup-cmake@v2
|
||||||
|
with:
|
||||||
|
cmake-version: '3.31.x'
|
||||||
- name: "Prepare Project"
|
- name: "Prepare Project"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake -S ./ -B buildsim
|
run: cmake -S ./ -B buildsim
|
||||||
- name: "Build Tests"
|
- name: "Build Tests"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build buildsim --target AppSim
|
run: cmake --build buildsim --target FirmwareSim
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: Buildscripts/release-simulator.sh buildsim release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}
|
run: Buildscripts/release-simulator.sh buildsim release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
name: Bundle All
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: 'Download artifacts'
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
- name: 'Upload Artifact'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'all-artifacts'
|
||||||
|
path: artifacts/
|
||||||
|
retention-days: 3
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: Publish Firmware
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
cdn_version:
|
||||||
|
description: The version that determines the path on the CDN
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: 'Download all-artifacts'
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'all-artifacts'
|
||||||
|
path: artifacts
|
||||||
|
- name: 'Install boto3'
|
||||||
|
shell: bash
|
||||||
|
run: pip install boto3
|
||||||
|
- name: 'Generate files'
|
||||||
|
shell: bash
|
||||||
|
run: version=`cat version.txt` && python Buildscripts/CDN/generate-firmware-files.py artifacts artifacts-cdn $version
|
||||||
|
- name: 'Upload files'
|
||||||
|
shell: bash
|
||||||
|
run: python Buildscripts/CDN/upload-firmware-files.py artifacts-cdn ${{ inputs.cdn_version }} ${{ env.CDN_ID }} ${{ env.CDN_TOKEN_NAME }} ${{ env.CDN_TOKEN_VALUE }}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
name: Publish SDK
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: 'Download all-artifacts'
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'all-artifacts'
|
||||||
|
path: artifacts
|
||||||
|
- name: 'Install boto3'
|
||||||
|
shell: bash
|
||||||
|
run: pip install boto3
|
||||||
|
- name: 'Generate files'
|
||||||
|
shell: bash
|
||||||
|
run: version=`cat version.txt` && python Buildscripts/CDN/generate-sdk-files.py artifacts artifacts-cdn $version
|
||||||
|
- name: 'Upload files'
|
||||||
|
shell: bash
|
||||||
|
run: version=`cat version.txt` && python Buildscripts/CDN/upload-sdk-files.py artifacts-cdn $version ${{ env.CDN_ID }} ${{ env.CDN_TOKEN_NAME }} ${{ env.CDN_TOKEN_VALUE }}
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
name: Build Firmware
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cyd-2432s024c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-2432s024c
|
|
||||||
arch: esp32
|
|
||||||
cyd-2432s032c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-2432s032c
|
|
||||||
arch: esp32
|
|
||||||
cyd-jc2432w328c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-jc2432w328c
|
|
||||||
arch: esp32
|
|
||||||
cyd-8048s043c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-8048s043c
|
|
||||||
arch: esp32s3
|
|
||||||
cyd-jc8048w550c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-jc8048w550c
|
|
||||||
arch: esp32s3
|
|
||||||
cyd-4848s040c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: cyd-4848s040c
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-advance-28:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-advance-28
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-advance-35:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-advance-35
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-advance-50:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-advance-50
|
|
||||||
arch: esp32s3
|
|
||||||
elecrow-crowpanel-basic-28:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-basic-28
|
|
||||||
arch: esp32
|
|
||||||
elecrow-crowpanel-basic-35:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-basic-35
|
|
||||||
arch: esp32
|
|
||||||
elecrow-crowpanel-basic-50:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: elecrow-crowpanel-basic-50
|
|
||||||
arch: esp32s3
|
|
||||||
lilygo-tdeck:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: lilygo-tdeck
|
|
||||||
arch: esp32s3
|
|
||||||
m5stack-core2:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: m5stack-core2
|
|
||||||
arch: esp32
|
|
||||||
m5stack-cores3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: m5stack-cores3
|
|
||||||
arch: esp32s3
|
|
||||||
unphone:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: unphone
|
|
||||||
arch: esp32s3
|
|
||||||
waveshare-s3-touch-43:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: waveshare-s3-touch-43
|
|
||||||
arch: esp32s3
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
name: Build SDK
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
esp32:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-sdk
|
|
||||||
with:
|
|
||||||
board_id: cyd-2432s024c
|
|
||||||
arch: esp32
|
|
||||||
esp32s3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-sdk
|
|
||||||
with:
|
|
||||||
board_id: lilygo-tdeck
|
|
||||||
arch: esp32s3
|
|
||||||
@@ -5,9 +5,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [ opened, synchronize, reopened ]
|
||||||
jobs:
|
jobs:
|
||||||
Build-Simulator-Linux:
|
Linux:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
os_name: linux
|
os_name: linux
|
||||||
platform_name: amd64
|
platform_name: amd64
|
||||||
publish: true
|
publish: true
|
||||||
Build-Simulator-macOS:
|
macOS:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
name: Build Firmware
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, synchronize, reopened ]
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
BuildSdk:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
board: [
|
||||||
|
{ id: generic-esp32, arch: esp32 },
|
||||||
|
{ id: generic-esp32c6, arch: esp32c6 },
|
||||||
|
{ id: generic-esp32p4, arch: esp32p4 },
|
||||||
|
{ id: generic-esp32s3, arch: esp32s3 },
|
||||||
|
]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: "Build SDK"
|
||||||
|
uses: ./.github/actions/build-sdk
|
||||||
|
with:
|
||||||
|
board_id: ${{ matrix.board.id }}
|
||||||
|
arch: ${{ matrix.board.arch }}
|
||||||
|
BuildFirmware:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
board: [
|
||||||
|
{ id: btt-panda-touch, arch: esp32s3 },
|
||||||
|
{ id: cyd-2432s024c, arch: esp32 },
|
||||||
|
{ id: cyd-2432s024r, arch: esp32 },
|
||||||
|
{ id: cyd-2432s028r, arch: esp32 },
|
||||||
|
{ id: cyd-2432s028rv3, arch: esp32 },
|
||||||
|
{ id: cyd-e32r28t, arch: esp32 },
|
||||||
|
{ id: cyd-e32r32p, arch: esp32 },
|
||||||
|
{ id: cyd-2432s032c, arch: esp32 },
|
||||||
|
{ id: cyd-3248s035c, arch: esp32 },
|
||||||
|
{ id: cyd-8048s043c, arch: esp32s3 },
|
||||||
|
{ id: cyd-4848s040c, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-advance-28, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-advance-35, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-advance-50, arch: esp32s3 },
|
||||||
|
{ id: elecrow-crowpanel-basic-28, arch: esp32 },
|
||||||
|
{ id: elecrow-crowpanel-basic-35, arch: esp32 },
|
||||||
|
{ id: elecrow-crowpanel-basic-50, arch: esp32s3 },
|
||||||
|
{ id: guition-jc1060p470ciwy, arch: esp32p4 },
|
||||||
|
{ id: guition-jc2432w328c, arch: esp32 },
|
||||||
|
{ id: guition-jc3248w535c, arch: esp32s3 },
|
||||||
|
{ id: guition-jc8048w550c, arch: esp32s3 },
|
||||||
|
{ id: heltec-wifi-lora-32-v3, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tdeck, arch: esp32s3 },
|
||||||
|
{ id: lilygo-thmi, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tdongle-s3, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tdisplay-s3, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tlora-pager, arch: esp32s3 },
|
||||||
|
{ id: lilygo-tdisplay, arch: esp32 },
|
||||||
|
{ id: m5stack-cardputer, arch: esp32s3 },
|
||||||
|
{ id: m5stack-cardputer-adv, arch: esp32s3 },
|
||||||
|
{ id: m5stack-core2, arch: esp32 },
|
||||||
|
{ id: m5stack-cores3, arch: esp32s3 },
|
||||||
|
{ id: m5stack-papers3, arch: esp32s3 },
|
||||||
|
{ id: m5stack-stackchan, arch: esp32s3 },
|
||||||
|
{ id: m5stack-stickc-plus, arch: esp32 },
|
||||||
|
{ id: m5stack-stickc-plus2, arch: esp32 },
|
||||||
|
{ id: m5stack-sticks3, arch: esp32s3 },
|
||||||
|
{ id: m5stack-tab5, arch: esp32p4 },
|
||||||
|
{ id: unphone, arch: esp32s3 },
|
||||||
|
{ id: waveshare-esp32-s3-geek, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-lcd-13, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-touch-lcd-128, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-touch-lcd-147, arch: esp32s3 },
|
||||||
|
{ id: waveshare-s3-touch-lcd-43, arch: esp32s3 },
|
||||||
|
{ id: wireless-tag-wt32-sc01-plus, arch: esp32s3 }
|
||||||
|
]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ BuildSdk ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: "Build Firmware"
|
||||||
|
uses: ./.github/actions/build-firmware
|
||||||
|
with:
|
||||||
|
board_id: ${{ matrix.board.id }}
|
||||||
|
arch: ${{ matrix.board.arch }}
|
||||||
|
BundleArtifacts:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ BuildFirmware ]
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
||||||
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: "Bundle Artifacts"
|
||||||
|
uses: ./.github/actions/bundle-artifacts
|
||||||
|
PublishFirmwareSnapshot:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ BundleArtifacts ]
|
||||||
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: "Publish Firmware Snapshot"
|
||||||
|
env:
|
||||||
|
CDN_ID: ${{ secrets.CDN_ID }}
|
||||||
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||||
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
||||||
|
uses: ./.github/actions/publish-firmware
|
||||||
|
with:
|
||||||
|
cdn_version: snapshot
|
||||||
|
PublishFirmwareStable:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ BundleArtifacts ]
|
||||||
|
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: "Publish Firmware Stable"
|
||||||
|
env:
|
||||||
|
CDN_ID: ${{ secrets.CDN_ID }}
|
||||||
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||||
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
||||||
|
uses: ./.github/actions/publish-firmware
|
||||||
|
with:
|
||||||
|
cdn_version: stable
|
||||||
|
PublishSdk:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ BundleArtifacts ]
|
||||||
|
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: "Publish SDKs"
|
||||||
|
env:
|
||||||
|
CDN_ID: ${{ secrets.CDN_ID }}
|
||||||
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||||
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
||||||
|
uses: ./.github/actions/publish-sdk
|
||||||
@@ -4,13 +4,13 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [ opened, synchronize, reopened ]
|
||||||
jobs:
|
jobs:
|
||||||
Run:
|
TactilityTests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repo"
|
- name: "Checkout repo"
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: "Configure Project"
|
- name: "Configure Project"
|
||||||
@@ -20,6 +20,24 @@ jobs:
|
|||||||
- name: "Build Tests"
|
- name: "Build Tests"
|
||||||
run: cmake --build build --target build-tests
|
run: cmake --build build --target build-tests
|
||||||
- name: "Run TactilityCore Tests"
|
- name: "Run TactilityCore Tests"
|
||||||
run: build/Tests/TactilityCore/TactilityCoreTests --exit
|
run: build/Tests/TactilityCore/TactilityCoreTests
|
||||||
|
- name: "Run TactilityFreeRtos Tests"
|
||||||
|
run: build/Tests/TactilityFreeRtos/TactilityFreeRtosTests
|
||||||
- name: "Run TactilityHeadless Tests"
|
- name: "Run TactilityHeadless Tests"
|
||||||
run: build/Tests/Tactility/TactilityTests --exit
|
run: build/Tests/Tactility/TactilityTests
|
||||||
|
- name: "Run TactilityKernel Tests"
|
||||||
|
run: build/Tests/TactilityKernel/TactilityKernelTests
|
||||||
|
DevicetreeTests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout repo"
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: "Install Python Dependencies"
|
||||||
|
shell: bash
|
||||||
|
run: pip install lark==1.3.1 pyyaml==6.0.3
|
||||||
|
- name: "Run Devicetree Tests"
|
||||||
|
shell: bash
|
||||||
|
working-directory: Buildscripts/DevicetreeCompiler/tests
|
||||||
|
run: python test_integration.py
|
||||||
|
|||||||
+12
-2
@@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
build/
|
build/
|
||||||
buildsim/
|
buildsim/
|
||||||
build-sim/
|
cmake-*/
|
||||||
cmake-build-*/
|
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
*.cbp
|
*.cbp
|
||||||
|
CMakeFiles
|
||||||
|
|
||||||
release/
|
release/
|
||||||
|
|
||||||
@@ -16,3 +16,13 @@ sdkconfig.old
|
|||||||
managed_components/
|
managed_components/
|
||||||
dependencies.lock
|
dependencies.lock
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
*.code-workspace
|
||||||
|
.gitpod.yml
|
||||||
|
|
||||||
|
sdkconfig.board.*.dev
|
||||||
|
|
||||||
|
.tactility/
|
||||||
|
|
||||||
|
.caveman.json
|
||||||
|
.ai/mcp
|
||||||
@@ -10,3 +10,9 @@
|
|||||||
[submodule "Libraries/SDL"]
|
[submodule "Libraries/SDL"]
|
||||||
path = Libraries/SDL
|
path = Libraries/SDL
|
||||||
url = https://github.com/libsdl-org/SDL.git
|
url = https://github.com/libsdl-org/SDL.git
|
||||||
|
[submodule "Libraries/minitar/minitar"]
|
||||||
|
path = Libraries/minitar/minitar
|
||||||
|
url = https://github.com/ByteWelder/minitar.git
|
||||||
|
[submodule "Libraries/cJSON/cJSON"]
|
||||||
|
path = Libraries/cJSON/cJSON
|
||||||
|
url = https://github.com/DaveGamble/cJSON.git
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
||||||
# Read board id/project
|
|
||||||
include("../Buildscripts/board.cmake")
|
|
||||||
init_tactility_globals("../sdkconfig")
|
|
||||||
get_property(TACTILITY_BOARD_PROJECT GLOBAL PROPERTY TACTILITY_BOARD_PROJECT)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRC_DIRS "Source"
|
|
||||||
"Source/HelloWorld"
|
|
||||||
REQUIRES ${BOARD_COMPONENTS}
|
|
||||||
REQUIRES Tactility TactilityC ${TACTILITY_BOARD_PROJECT}
|
|
||||||
)
|
|
||||||
else ()
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCES "Source/*.c*")
|
|
||||||
add_executable(AppSim ${SOURCES})
|
|
||||||
target_link_libraries(AppSim
|
|
||||||
PRIVATE Tactility
|
|
||||||
PRIVATE TactilityCore
|
|
||||||
PRIVATE Simulator
|
|
||||||
PRIVATE SDL2::SDL2-static SDL2-static
|
|
||||||
)
|
|
||||||
|
|
||||||
add_definitions(-D_Nullable=)
|
|
||||||
add_definitions(-D_Nonnull=)
|
|
||||||
endif ()
|
|
||||||
-60
@@ -1,60 +0,0 @@
|
|||||||
# Kconfig file for Tactility example app
|
|
||||||
menu "Tactility App"
|
|
||||||
config TT_BOARD_NAME
|
|
||||||
string "Board Name"
|
|
||||||
default ""
|
|
||||||
config TT_BOARD_ID
|
|
||||||
string "Board ID"
|
|
||||||
default ""
|
|
||||||
choice
|
|
||||||
prompt "Board"
|
|
||||||
default TT_BOARD_CUSTOM
|
|
||||||
config TT_BOARD_CUSTOM
|
|
||||||
bool "Custom"
|
|
||||||
config TT_BOARD_CYD_2432S024C
|
|
||||||
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
|
|
||||||
bool "LilyGo T-Deck"
|
|
||||||
config TT_BOARD_M5STACK_CORE2
|
|
||||||
bool "M5Stack Core2"
|
|
||||||
config TT_BOARD_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
|
|
||||||
Select a board/hardware configuration.
|
|
||||||
Use TT_BOARD_CUSTOM if you will manually configure the board in your project.
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
config TT_SPLASH_DURATION
|
|
||||||
int "Splash Duration (ms)"
|
|
||||||
default 1000
|
|
||||||
range 0 3000
|
|
||||||
help
|
|
||||||
The minimum time to show the splash screen in milliseconds.
|
|
||||||
When set to 0, startup will continue to desktop as soon as boot operations are finished.
|
|
||||||
endmenu
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
|
||||||
#include <sdkconfig.h>
|
|
||||||
|
|
||||||
// Supported hardware:
|
|
||||||
#if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
|
|
||||||
#include "LilygoTdeck.h"
|
|
||||||
#define TT_BOARD_HARDWARE &lilygo_tdeck
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_2432S024C)
|
|
||||||
#include "CYD2432S024C.h"
|
|
||||||
#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)
|
|
||||||
#include "M5stackCore2.h"
|
|
||||||
#define TT_BOARD_HARDWARE &m5stack_core2
|
|
||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
|
|
||||||
#include "M5stackCoreS3.h"
|
|
||||||
#define TT_BOARD_HARDWARE &m5stack_cores3
|
|
||||||
#elif defined(CONFIG_TT_BOARD_UNPHONE)
|
|
||||||
#include "UnPhone.h"
|
|
||||||
#define TT_BOARD_HARDWARE &unPhone
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_JC2432W328C)
|
|
||||||
#include "JC2432W328C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_jc2432w328c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_8048S043C)
|
|
||||||
#include "CYD8048S043C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_8048s043c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_JC8048W550C)
|
|
||||||
#include "JC8048W550C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_jc8048w550c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_CYD_4848S040C)
|
|
||||||
#include "CYD4848S040C.h"
|
|
||||||
#define TT_BOARD_HARDWARE &cyd_4848s040c_config
|
|
||||||
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43)
|
|
||||||
#include "WaveshareS3Touch43.h"
|
|
||||||
#define TT_BOARD_HARDWARE &waveshare_s3_touch_43
|
|
||||||
#else
|
|
||||||
#define TT_BOARD_HARDWARE NULL
|
|
||||||
#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // else simulator
|
|
||||||
|
|
||||||
#include "Simulator.h"
|
|
||||||
|
|
||||||
extern tt::hal::Configuration hardware;
|
|
||||||
#define TT_BOARD_HARDWARE &hardware
|
|
||||||
|
|
||||||
#endif // ESP_PLATFORM
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#include <Tactility/app/AppManifest.h>
|
|
||||||
#include <Tactility/lvgl/Toolbar.h>
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
using namespace tt::app;
|
|
||||||
|
|
||||||
class HelloWorldApp : public App {
|
|
||||||
|
|
||||||
void onShow(AppContext& context, lv_obj_t* parent) override {
|
|
||||||
lv_obj_t* toolbar = tt::lvgl::toolbar_create(parent, context);
|
|
||||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
|
||||||
|
|
||||||
lv_obj_t* label = lv_label_create(parent);
|
|
||||||
lv_label_set_text(label, "Hello, world!");
|
|
||||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const AppManifest hello_world_app = {
|
|
||||||
.id = "HelloWorld",
|
|
||||||
.name = "Hello World",
|
|
||||||
.createApp = create<HelloWorldApp>
|
|
||||||
};
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
dependencies:
|
|
||||||
espressif/esp_lcd_ili9341: "2.0.0"
|
|
||||||
atanisoft/esp_lcd_ili9488: "1.0.10"
|
|
||||||
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:
|
|
||||||
version: "1.5.0"
|
|
||||||
rules:
|
|
||||||
- if: "target == esp32s3"
|
|
||||||
idf: '5.4'
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
#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
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 2.4" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_2432s024c_config;
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#include "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));
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#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
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// Touch
|
|
||||||
#define TWODOTFOUR_TOUCH_I2C_PORT I2C_NUM_0
|
|
||||||
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
#include "CYD2432S032C.h"
|
|
||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
#include "hal/CydDisplay.h"
|
|
||||||
#include "hal/CydSdCard.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(GPIO_NUM_27);
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 2.4" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_2432S032c_config;
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#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));
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility esp_lvgl_port esp_lcd esp_lcd_st7701 esp_lcd_panel_io_additions GT911 PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
#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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 4" square yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_4848s040c_config;
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <esp_lcd_types.h>
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
class CydDisplay : 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;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
std::string getName() const final { return "ST7701S"; }
|
|
||||||
std::string getDescription() const final { return "RGB Display"; }
|
|
||||||
|
|
||||||
bool start() override;
|
|
||||||
|
|
||||||
bool stop() override;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
|
||||||
|
|
||||||
void setBacklightDuty(uint8_t backlightDuty) override;
|
|
||||||
bool supportsBacklightDuty() const override { return true; }
|
|
||||||
|
|
||||||
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 4.3" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_8048s043c_config;
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 2.8" yellow board
|
|
||||||
extern const tt::hal::Configuration cyd_jc2432w328c_config;
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#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));
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#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
|
|
||||||
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
// Capacitive touch version of the 5" black board
|
|
||||||
extern const tt::hal::Configuration cyd_jc8048w550c_config;
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_advance_28;
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#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));
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#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();
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#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)
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#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);
|
|
||||||
}
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_advance_35;
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#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();
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#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);
|
|
||||||
}
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_advance_50;
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_basic_28;
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#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));
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#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();
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#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)
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
#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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_basic_35;
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#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();
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#include "hal/CrowPanelDisplay.h"
|
|
||||||
#include "hal/CrowPanelSdCard.h"
|
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration crowpanel_basic_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_19,
|
|
||||||
.scl_io_num = GPIO_NUM_20,
|
|
||||||
.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 {
|
|
||||||
// "UART1"
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "UART1",
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration crowpanel_basic_50;
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#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(
|
|
||||||
GPIO_NUM_10,
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
#include "PwmBacklight.h"
|
|
||||||
#include "Tactility/kernel/SystemEvents.h"
|
|
||||||
#include "Tactility/service/gps/GpsService.h"
|
|
||||||
|
|
||||||
#include <Tactility/TactilityCore.h>
|
|
||||||
#include <Tactility/hal/gps/GpsConfiguration.h>
|
|
||||||
|
|
||||||
#define TAG "tdeck"
|
|
||||||
|
|
||||||
// Power on
|
|
||||||
#define TDECK_POWERON_GPIO GPIO_NUM_10
|
|
||||||
|
|
||||||
static bool powerOn() {
|
|
||||||
gpio_config_t device_power_signal_config = {
|
|
||||||
.pin_bit_mask = BIT64(TDECK_POWERON_GPIO),
|
|
||||||
.mode = GPIO_MODE_OUTPUT,
|
|
||||||
.pull_up_en = GPIO_PULLUP_DISABLE,
|
|
||||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
|
||||||
.intr_type = GPIO_INTR_DISABLE,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (gpio_config(&device_power_signal_config) != ESP_OK) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gpio_set_level(TDECK_POWERON_GPIO, 1) != ESP_OK) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool tdeckInit() {
|
|
||||||
ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START);
|
|
||||||
if (!powerOn()) {
|
|
||||||
TT_LOG_E(TAG, LOG_MESSAGE_POWER_ON_FAILED);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 32 Khz and higher gives an issue where the screen starts dimming again above 80% brightness
|
|
||||||
* when moving the brightness slider rapidly from a lower setting to 100%.
|
|
||||||
* This is not a slider bug (data was debug-traced) */
|
|
||||||
if (!driver::pwmbacklight::init(GPIO_NUM_42, 30000)) {
|
|
||||||
TT_LOG_E(TAG, "Backlight init failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent event) {
|
|
||||||
auto gps_service = tt::service::gps::findGpsService();
|
|
||||||
if (gps_service != nullptr) {
|
|
||||||
std::vector<tt::hal::gps::GpsConfiguration> gps_configurations;
|
|
||||||
gps_service->getGpsConfigurations(gps_configurations);
|
|
||||||
if (gps_configurations.empty()) {
|
|
||||||
if (gps_service->addGpsConfiguration(tt::hal::gps::GpsConfiguration {.uartName = "Grove", .baudRate = 38400, .model = tt::hal::gps::GpsModel::UBLOX10})) {
|
|
||||||
TT_LOG_I(TAG, "Configured internal GPS");
|
|
||||||
} else {
|
|
||||||
TT_LOG_E(TAG, "Failed to configure internal GPS");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
#include "hal/TdeckDisplay.h"
|
|
||||||
#include "hal/TdeckDisplayConstants.h"
|
|
||||||
#include "hal/TdeckKeyboard.h"
|
|
||||||
#include "hal/TdeckPower.h"
|
|
||||||
#include "hal/TdeckSdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
#define TDECK_SPI_TRANSFER_SIZE_LIMIT (TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
|
||||||
|
|
||||||
bool tdeckInit();
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
extern const Configuration lilygo_tdeck = {
|
|
||||||
.initBoot = tdeckInit,
|
|
||||||
.createDisplay = createDisplay,
|
|
||||||
.createKeyboard = createKeyboard,
|
|
||||||
.sdcard = createTdeckSdCard(),
|
|
||||||
.power = tdeck_get_power,
|
|
||||||
.i2c = {
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Internal",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_18,
|
|
||||||
.scl_io_num = GPIO_NUM_8,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
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_43,
|
|
||||||
.scl_io_num = GPIO_NUM_44,
|
|
||||||
.sda_pullup_en = false,
|
|
||||||
.scl_pullup_en = false,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_41,
|
|
||||||
.miso_io_num = GPIO_NUM_38,
|
|
||||||
.sclk_io_num = GPIO_NUM_40,
|
|
||||||
.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 = TDECK_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
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.uart {
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "Grove",
|
|
||||||
.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 = 38400,
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration lilygo_tdeck;
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#include "TdeckDisplay.h"
|
|
||||||
#include "TdeckDisplayConstants.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <St7789Display.h>
|
|
||||||
|
|
||||||
#include <driver/spi_master.h>
|
|
||||||
|
|
||||||
#define TAG "tdeck_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,
|
|
||||||
240,
|
|
||||||
320,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<St7789Display::Configuration>(
|
|
||||||
TDECK_LCD_SPI_HOST,
|
|
||||||
TDECK_LCD_PIN_CS,
|
|
||||||
TDECK_LCD_PIN_DC,
|
|
||||||
320,
|
|
||||||
240,
|
|
||||||
touch,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
|
||||||
|
|
||||||
return std::make_shared<St7789Display>(std::move(configuration));
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <esp_lcd_types.h>
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
class TdeckDisplay : 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();
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#define TDECK_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define TDECK_LCD_PIN_CS GPIO_NUM_12
|
|
||||||
#define TDECK_LCD_PIN_DC GPIO_NUM_11 // RS
|
|
||||||
#define TDECK_LCD_HORIZONTAL_RESOLUTION 320
|
|
||||||
#define TDECK_LCD_VERTICAL_RESOLUTION 240
|
|
||||||
#define TDECK_LCD_SPI_TRANSFER_HEIGHT (TDECK_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
#include "TdeckKeyboard.h"
|
|
||||||
#include <Tactility/hal/i2c/I2c.h>
|
|
||||||
#include <driver/i2c.h>
|
|
||||||
|
|
||||||
#define TAG "tdeck_keyboard"
|
|
||||||
|
|
||||||
#define TDECK_KEYBOARD_I2C_BUS_HANDLE I2C_NUM_0
|
|
||||||
#define TDECK_KEYBOARD_SLAVE_ADDRESS 0x55
|
|
||||||
|
|
||||||
static inline bool keyboard_i2c_read(uint8_t* output) {
|
|
||||||
return tt::hal::i2c::masterRead(TDECK_KEYBOARD_I2C_BUS_HANDLE, TDECK_KEYBOARD_SLAVE_ADDRESS, output, 1, 100 / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The callback simulates press and release events, because the T-Deck
|
|
||||||
* keyboard only publishes press events on I2C.
|
|
||||||
* LVGL currently works without those extra release events, but they
|
|
||||||
* are implemented for correctness and future compatibility.
|
|
||||||
*
|
|
||||||
* @param indev_drv
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
static void keyboard_read_callback(TT_UNUSED lv_indev_t* indev, lv_indev_data_t* data) {
|
|
||||||
static uint8_t last_buffer = 0x00;
|
|
||||||
uint8_t read_buffer = 0x00;
|
|
||||||
|
|
||||||
// Defaults
|
|
||||||
data->key = 0;
|
|
||||||
data->state = LV_INDEV_STATE_RELEASED;
|
|
||||||
|
|
||||||
if (keyboard_i2c_read(&read_buffer)) {
|
|
||||||
if (read_buffer == 0 && read_buffer != last_buffer) {
|
|
||||||
TT_LOG_D(TAG, "Released %d", last_buffer);
|
|
||||||
data->key = last_buffer;
|
|
||||||
data->state = LV_INDEV_STATE_RELEASED;
|
|
||||||
} else if (read_buffer != 0) {
|
|
||||||
TT_LOG_D(TAG, "Pressed %d", read_buffer);
|
|
||||||
data->key = read_buffer;
|
|
||||||
data->state = LV_INDEV_STATE_PRESSED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
last_buffer = read_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TdeckKeyboard::start(lv_display_t* display) {
|
|
||||||
deviceHandle = lv_indev_create();
|
|
||||||
lv_indev_set_type(deviceHandle, LV_INDEV_TYPE_KEYPAD);
|
|
||||||
lv_indev_set_read_cb(deviceHandle, &keyboard_read_callback);
|
|
||||||
lv_indev_set_display(deviceHandle, display);
|
|
||||||
lv_indev_set_user_data(deviceHandle, this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TdeckKeyboard::stop() {
|
|
||||||
lv_indev_delete(deviceHandle);
|
|
||||||
deviceHandle = nullptr;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TdeckKeyboard::isAttached() const {
|
|
||||||
return tt::hal::i2c::masterHasDeviceAtAddress(TDECK_KEYBOARD_I2C_BUS_HANDLE, TDECK_KEYBOARD_SLAVE_ADDRESS, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::keyboard::KeyboardDevice> createKeyboard() {
|
|
||||||
return std::make_shared<TdeckKeyboard>();
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/keyboard/KeyboardDevice.h>
|
|
||||||
#include <Tactility/TactilityCore.h>
|
|
||||||
#include <esp_lcd_panel_io_interface.h>
|
|
||||||
#include <esp_lcd_touch.h>
|
|
||||||
|
|
||||||
class TdeckKeyboard : public tt::hal::keyboard::KeyboardDevice {
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
lv_indev_t* _Nullable deviceHandle = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
std::string getName() const final { return "T-Deck Keyboard"; }
|
|
||||||
std::string getDescription() const final { return "I2C keyboard"; }
|
|
||||||
|
|
||||||
bool start(lv_display_t* display) override;
|
|
||||||
bool stop() override;
|
|
||||||
bool isAttached() const override;
|
|
||||||
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::keyboard::KeyboardDevice> createKeyboard();
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
#include "TdeckPower.h"
|
|
||||||
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
|
|
||||||
#define TAG "power"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 2.0 ratio, but +.11 added as display voltage sag compensation.
|
|
||||||
*/
|
|
||||||
#define ADC_MULTIPLIER 2.11
|
|
||||||
|
|
||||||
#define ADC_REF_VOLTAGE 3.3f
|
|
||||||
#define BATTERY_VOLTAGE_MIN 3.2f
|
|
||||||
#define BATTERY_VOLTAGE_MAX 4.2f
|
|
||||||
|
|
||||||
static adc_oneshot_unit_init_cfg_t adcConfig = {
|
|
||||||
.unit_id = ADC_UNIT_1,
|
|
||||||
.clk_src = ADC_RTC_CLK_SRC_DEFAULT,
|
|
||||||
.ulp_mode = ADC_ULP_MODE_DISABLE,
|
|
||||||
};
|
|
||||||
|
|
||||||
static adc_oneshot_chan_cfg_t adcChannelConfig = {
|
|
||||||
.atten = ADC_ATTEN_DB_12,
|
|
||||||
.bitwidth = ADC_BITWIDTH_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static uint8_t estimateChargeLevelFromVoltage(uint32_t milliVolt) {
|
|
||||||
float volts = std::min((float)milliVolt / 1000.f, BATTERY_VOLTAGE_MAX);
|
|
||||||
float voltage_percentage = (volts - BATTERY_VOLTAGE_MIN) / (BATTERY_VOLTAGE_MAX - BATTERY_VOLTAGE_MIN);
|
|
||||||
float voltage_factor = std::min(1.0f, voltage_percentage);
|
|
||||||
auto charge_level = (uint8_t) (voltage_factor * 100.f);
|
|
||||||
TT_LOG_V(TAG, "mV = %lu, scaled = %.2f, factor = %.2f, result = %d", milliVolt, volts, voltage_factor, charge_level);
|
|
||||||
return charge_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
TdeckPower::TdeckPower() {
|
|
||||||
if (adc_oneshot_new_unit(&adcConfig, &adcHandle) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "ADC config failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adc_oneshot_config_channel(adcHandle, ADC_CHANNEL_3, &adcChannelConfig) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "ADC channel config failed");
|
|
||||||
|
|
||||||
adc_oneshot_del_unit(adcHandle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TdeckPower::~TdeckPower() {
|
|
||||||
if (adcHandle) {
|
|
||||||
adc_oneshot_del_unit(adcHandle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TdeckPower::supportsMetric(MetricType type) const {
|
|
||||||
switch (type) {
|
|
||||||
using enum MetricType;
|
|
||||||
case BatteryVoltage:
|
|
||||||
case ChargeLevel:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // Safety guard for when new enum values are introduced
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TdeckPower::getMetric(MetricType type, MetricData& data) {
|
|
||||||
switch (type) {
|
|
||||||
using enum MetricType;
|
|
||||||
case BatteryVoltage:
|
|
||||||
return readBatteryVoltageSampled(data.valueAsUint32);
|
|
||||||
case ChargeLevel:
|
|
||||||
if (readBatteryVoltageSampled(data.valueAsUint32)) {
|
|
||||||
data.valueAsUint32 = estimateChargeLevelFromVoltage(data.valueAsUint32);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // Safety guard for when new enum values are introduced
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TdeckPower::readBatteryVoltageOnce(uint32_t& output) {
|
|
||||||
int raw;
|
|
||||||
if (adc_oneshot_read(adcHandle, ADC_CHANNEL_3, &raw) == ESP_OK) {
|
|
||||||
output = ADC_MULTIPLIER * ((1000.f * ADC_REF_VOLTAGE) / 4096.f) * (float)raw;
|
|
||||||
TT_LOG_V(TAG, "Raw = %d, voltage = %lu", raw, output);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
TT_LOG_E(TAG, "Read failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAX_VOLTAGE_SAMPLES 15
|
|
||||||
|
|
||||||
bool TdeckPower::readBatteryVoltageSampled(uint32_t& output) {
|
|
||||||
size_t samples_read = 0;
|
|
||||||
uint32_t sample_accumulator = 0;
|
|
||||||
uint32_t sample_read_buffer;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < MAX_VOLTAGE_SAMPLES; ++i) {
|
|
||||||
if (readBatteryVoltageOnce(sample_read_buffer)) {
|
|
||||||
sample_accumulator += sample_read_buffer;
|
|
||||||
samples_read++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (samples_read > 0) {
|
|
||||||
output = sample_accumulator / samples_read;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<PowerDevice> power;
|
|
||||||
|
|
||||||
std::shared_ptr<PowerDevice> tdeck_get_power() {
|
|
||||||
if (power == nullptr) {
|
|
||||||
power = std::make_shared<TdeckPower>();
|
|
||||||
}
|
|
||||||
return power;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/power/PowerDevice.h"
|
|
||||||
#include <esp_adc/adc_oneshot.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using tt::hal::power::PowerDevice;
|
|
||||||
|
|
||||||
class TdeckPower : public PowerDevice {
|
|
||||||
|
|
||||||
adc_oneshot_unit_handle_t adcHandle = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TdeckPower();
|
|
||||||
~TdeckPower();
|
|
||||||
|
|
||||||
std::string getName() const final { return "ADC Power Measurement"; }
|
|
||||||
std::string getDescription() const final { return "Power measurement interface via ADC pin"; }
|
|
||||||
|
|
||||||
bool supportsMetric(MetricType type) const override;
|
|
||||||
bool getMetric(MetricType type, MetricData& data) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
bool readBatteryVoltageSampled(uint32_t& output);
|
|
||||||
bool readBatteryVoltageOnce(uint32_t& output);
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<PowerDevice> tdeck_get_power();
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#include "TdeckSdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
#include <esp_vfs_fat.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
#define TDECK_SDCARD_PIN_CS GPIO_NUM_39
|
|
||||||
#define TDECK_LCD_PIN_CS GPIO_NUM_12
|
|
||||||
#define TDECK_RADIO_PIN_CS GPIO_NUM_9
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createTdeckSdCard() {
|
|
||||||
auto* configuration = new SpiSdCardDevice::Config(
|
|
||||||
TDECK_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
{
|
|
||||||
TDECK_RADIO_PIN_CS,
|
|
||||||
TDECK_LCD_PIN_CS
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
|
||||||
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::shared_ptr<SdCardDevice>(sdcard);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# M5Stack Core2
|
|
||||||
|
|
||||||
This board implementation concerns the original Core2 hardware and **not** the v1.1 variant.
|
|
||||||
|
|
||||||
Reference implementations:
|
|
||||||
- [ESP-BSP](https://github.com/espressif/esp-bsp/tree/master/bsp/m5stack_core_2)
|
|
||||||
|
|
||||||
Docs:
|
|
||||||
- [M5Stack.com](https://docs.m5stack.com/en/core/Core2)
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#include "axp192/axp192.h"
|
|
||||||
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
#include <Tactility/hal/i2c/I2c.h>
|
|
||||||
#include <Tactility/CoreDefines.h>
|
|
||||||
|
|
||||||
#include <driver/i2c.h>
|
|
||||||
#include <driver/spi_master.h>
|
|
||||||
|
|
||||||
#define TAG "core2"
|
|
||||||
|
|
||||||
axp192_t axpDevice;
|
|
||||||
|
|
||||||
static int32_t axpI2cRead(TT_UNUSED void* handle, uint8_t address, uint8_t reg, uint8_t* buffer, uint16_t size) {
|
|
||||||
if (tt::hal::i2c::masterReadRegister(I2C_NUM_0, address, reg, buffer, size, 50 / portTICK_PERIOD_MS)) {
|
|
||||||
return AXP192_OK;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t axpI2cWrite(TT_UNUSED void* handle, uint8_t address, uint8_t reg, const uint8_t* buffer, uint16_t size) {
|
|
||||||
if (tt::hal::i2c::masterWriteRegister(I2C_NUM_0, address, reg, buffer, size, 50 / portTICK_PERIOD_MS)) {
|
|
||||||
return AXP192_OK;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void initAxp() {
|
|
||||||
axpDevice.read = axpI2cRead;
|
|
||||||
axpDevice.write = axpI2cWrite;
|
|
||||||
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO2_SET_VOLTAGE, 3300); // LCD + SD
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO3_SET_VOLTAGE, 0); // VIB_MOTOR STOP
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_DCDC3_SET_VOLTAGE, 3300);
|
|
||||||
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO2_ENABLE);
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_LDO3_DISABLE);
|
|
||||||
axp192_ioctl(&axpDevice, AXP192_DCDC3_ENABLE);
|
|
||||||
|
|
||||||
axp192_write(&axpDevice, AXP192_PWM1_DUTY_CYCLE_2, 255); // PWM 255 (LED OFF)
|
|
||||||
axp192_write(&axpDevice, AXP192_GPIO1_CONTROL, 0x02); // GPIO1 PWM
|
|
||||||
// TODO: We could charge at 390mA according to the M5Unified code, but the AXP driver in M5Unified limits to 132mA, so it's unclear what the AXP supports.
|
|
||||||
}
|
|
||||||
|
|
||||||
bool initBoot() {
|
|
||||||
TT_LOG_I(TAG, "initBoot");
|
|
||||||
initAxp();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
bool initBoot();
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
#include "M5stackCore2.h"
|
|
||||||
#include "InitBoot.h"
|
|
||||||
#include "hal/Core2Display.h"
|
|
||||||
#include "hal/Core2Power.h"
|
|
||||||
#include "hal/Core2SdCard.h"
|
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#define CORE2_SPI_TRANSFER_SIZE_LIMIT (CORE2_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_core2 = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDisplay = createDisplay,
|
|
||||||
.sdcard = createSdCard(),
|
|
||||||
.power = createPower,
|
|
||||||
.i2c = {
|
|
||||||
tt::hal::i2c::Configuration {
|
|
||||||
.name = "Internal",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_21,
|
|
||||||
.scl_io_num = GPIO_NUM_22,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tt::hal::i2c::Configuration {
|
|
||||||
.name = "External", // (Grove)
|
|
||||||
.port = I2C_NUM_1,
|
|
||||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_32,
|
|
||||||
.scl_io_num = GPIO_NUM_33,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.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_23,
|
|
||||||
.miso_io_num = GPIO_NUM_38,
|
|
||||||
.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 = CORE2_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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_core2;
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#include "Core2Display.h"
|
|
||||||
|
|
||||||
#include <Ft6x36Touch.h>
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
GPIO_NUM_39
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Ft6x36Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
CORE2_LCD_SPI_HOST,
|
|
||||||
CORE2_LCD_PIN_CS,
|
|
||||||
CORE2_LCD_PIN_DC,
|
|
||||||
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
CORE2_LCD_VERTICAL_RESOLUTION,
|
|
||||||
touch,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Ili934xDisplay>(std::move(configuration));
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#define CORE2_LCD_SPI_HOST SPI2_HOST
|
|
||||||
#define CORE2_LCD_PIN_CS GPIO_NUM_5
|
|
||||||
#define CORE2_LCD_PIN_DC GPIO_NUM_15
|
|
||||||
#define CORE2_LCD_HORIZONTAL_RESOLUTION 320
|
|
||||||
#define CORE2_LCD_VERTICAL_RESOLUTION 240
|
|
||||||
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/power/PowerDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using tt::hal::power::PowerDevice;
|
|
||||||
|
|
||||||
class Core2Power : public PowerDevice {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Core2Power() = default;
|
|
||||||
~Core2Power() override = default;
|
|
||||||
|
|
||||||
std::string getName() const final { return "AXP192 Power"; }
|
|
||||||
std::string getDescription() const final { return "Power management via I2C"; }
|
|
||||||
|
|
||||||
bool supportsMetric(MetricType type) const override;
|
|
||||||
bool getMetric(MetricType type, MetricData& data) override;
|
|
||||||
|
|
||||||
bool supportsChargeControl() const override { return true; }
|
|
||||||
bool isAllowedToCharge() const override;
|
|
||||||
void setAllowedToCharge(bool canCharge) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<PowerDevice> createPower();
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#include "Core2SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#include <esp_vfs_fat.h>
|
|
||||||
|
|
||||||
#define CORE2_SDCARD_PIN_CS GPIO_NUM_4
|
|
||||||
#define CORE2_LCD_PIN_CS GPIO_NUM_5
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto* configuration = new SpiSdCardDevice::Config(
|
|
||||||
CORE2_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
{
|
|
||||||
CORE2_LCD_PIN_CS
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
|
||||||
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::shared_ptr<SdCardDevice>(sdcard);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# M5Stack CoreS3
|
|
||||||
|
|
||||||
Reference implementations:
|
|
||||||
- [ESP-BSP](https://github.com/espressif/esp-bsp/tree/master/bsp/m5stack_core_s3)
|
|
||||||
|
|
||||||
Docs:
|
|
||||||
- [M5Stack.com](https://docs.m5stack.com/en/core/CoreS3)
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#define AXP2101_ADDRESS 0x34
|
|
||||||
#define AW9523_ADDRESS 0x58
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
bool initBoot();
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
#include "M5stackCoreS3.h"
|
|
||||||
#include "InitBoot.h"
|
|
||||||
#include "hal/CoreS3Display.h"
|
|
||||||
#include "hal/CoreS3DisplayConstants.h"
|
|
||||||
#include "hal/CoreS3Power.h"
|
|
||||||
#include "hal/CoreS3SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/uart/Uart.h>
|
|
||||||
|
|
||||||
#define CORES3_TRANSACTION_SIZE (CORES3_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
const Configuration m5stack_cores3 = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDisplay = createDisplay,
|
|
||||||
.sdcard = createSdCard(),
|
|
||||||
.power = createPower,
|
|
||||||
.i2c = {
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Internal",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_12,
|
|
||||||
.scl_io_num = GPIO_NUM_11,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Port A", // Grove
|
|
||||||
.port = I2C_NUM_1,
|
|
||||||
.initMode = i2c::InitMode::Disabled,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_2,
|
|
||||||
.scl_io_num = GPIO_NUM_1,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Port B", // Grove
|
|
||||||
.port = I2C_NUM_1,
|
|
||||||
.initMode = i2c::InitMode::Disabled,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_9,
|
|
||||||
.scl_io_num = GPIO_NUM_8,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Port C", // Grove
|
|
||||||
.port = I2C_NUM_1,
|
|
||||||
.initMode = i2c::InitMode::Disabled,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_18,
|
|
||||||
.scl_io_num = GPIO_NUM_17,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_37,
|
|
||||||
.miso_io_num = GPIO_NUM_35,
|
|
||||||
.sclk_io_num = GPIO_NUM_36,
|
|
||||||
.data2_io_num = GPIO_NUM_NC,
|
|
||||||
.data3_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 = CORES3_TRANSACTION_SIZE,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.uart {
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "Port A",
|
|
||||||
.port = UART_NUM_1,
|
|
||||||
.rxPin = GPIO_NUM_2,
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "Port B",
|
|
||||||
.port = UART_NUM_1,
|
|
||||||
.rxPin = GPIO_NUM_9,
|
|
||||||
.txPin = GPIO_NUM_8,
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "Port C",
|
|
||||||
.port = UART_NUM_1,
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_cores3;
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#include "CoreS3Display.h"
|
|
||||||
|
|
||||||
#include "CoreS3Constants.h"
|
|
||||||
|
|
||||||
#include <Ft5x06Touch.h>
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
#include <Tactility/hal/i2c/I2c.h>
|
|
||||||
|
|
||||||
#define TAG "cores3"
|
|
||||||
|
|
||||||
static void setBacklightDuty(uint8_t backlightDuty) {
|
|
||||||
const uint8_t voltage = 20 + ((8 * backlightDuty) / 255); // [0b00000, 0b11100] - under 20 is too dark
|
|
||||||
// TODO: Refactor to use Axp2102 driver subproject. Reference: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/AXP2101_Class.cpp#L42
|
|
||||||
if (!tt::hal::i2c::masterWriteRegister(I2C_NUM_0, AXP2101_ADDRESS, 0x99, &voltage, 1, 1000)) { // Sets DLD01
|
|
||||||
TT_LOG_E(TAG, "Failed to set display backlight voltage");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
320,
|
|
||||||
240
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Ft5x06Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
|
||||||
SPI3_HOST,
|
|
||||||
GPIO_NUM_3,
|
|
||||||
GPIO_NUM_35,
|
|
||||||
320,
|
|
||||||
240,
|
|
||||||
touch,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = ::setBacklightDuty;
|
|
||||||
|
|
||||||
return std::make_shared<Ili934xDisplay>(std::move(configuration));
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// Display
|
|
||||||
#define CORES3_LCD_SPI_HOST SPI3_HOST
|
|
||||||
#define CORES3_LCD_PIN_CS GPIO_NUM_3
|
|
||||||
#define CORES3_LCD_PIN_DC GPIO_NUM_35
|
|
||||||
#define CORES3_LCD_HORIZONTAL_RESOLUTION 320
|
|
||||||
#define CORES3_LCD_VERTICAL_RESOLUTION 240
|
|
||||||
#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10)
|
|
||||||
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#include "CoreS3SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
#include <esp_vfs_fat.h>
|
|
||||||
|
|
||||||
#define CORES3_SDCARD_PIN_CS GPIO_NUM_4
|
|
||||||
#define CORES3_LCD_PIN_CS GPIO_NUM_3
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto* configuration = new SpiSdCardDevice::Config(
|
|
||||||
CORES3_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
{
|
|
||||||
CORES3_LCD_PIN_CS
|
|
||||||
},
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
|
||||||
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::shared_ptr<SdCardDevice>(sdcard);
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
#include "LvglTask.h"
|
|
||||||
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/Mutex.h>
|
|
||||||
#include <Tactility/Thread.h>
|
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
#define TAG "lvgl_task"
|
|
||||||
|
|
||||||
// Mutex for LVGL drawing
|
|
||||||
static tt::Mutex lvgl_mutex(tt::Mutex::Type::Recursive);
|
|
||||||
static tt::Mutex task_mutex(tt::Mutex::Type::Recursive);
|
|
||||||
|
|
||||||
static uint32_t task_max_sleep_ms = 10;
|
|
||||||
// Mutex for LVGL task state (to modify task_running state)
|
|
||||||
static bool task_running = false;
|
|
||||||
|
|
||||||
lv_disp_t* displayHandle = nullptr;
|
|
||||||
|
|
||||||
static void lvgl_task(void* arg);
|
|
||||||
|
|
||||||
static bool task_lock(TickType_t timeout) {
|
|
||||||
return task_mutex.lock(timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void task_unlock() {
|
|
||||||
task_mutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void task_set_running(bool running) {
|
|
||||||
assert(task_lock(configTICK_RATE_HZ / 100));
|
|
||||||
task_running = running;
|
|
||||||
task_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool lvgl_task_is_running() {
|
|
||||||
assert(task_lock(configTICK_RATE_HZ / 100));
|
|
||||||
bool result = task_running;
|
|
||||||
task_unlock();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool lvgl_lock(uint32_t timeoutMillis) {
|
|
||||||
return lvgl_mutex.lock(pdMS_TO_TICKS(timeoutMillis));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void lvgl_unlock() {
|
|
||||||
lvgl_mutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void lvgl_task_interrupt() {
|
|
||||||
tt_check(task_lock(portMAX_DELAY));
|
|
||||||
task_set_running(false); // interrupt task with boolean as flag
|
|
||||||
task_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void lvgl_task_start() {
|
|
||||||
TT_LOG_I(TAG, "lvgl task starting");
|
|
||||||
|
|
||||||
tt::lvgl::syncSet(&lvgl_lock, &lvgl_unlock);
|
|
||||||
|
|
||||||
// Create the main app loop, like ESP-IDF
|
|
||||||
BaseType_t task_result = xTaskCreate(
|
|
||||||
lvgl_task,
|
|
||||||
"lvgl",
|
|
||||||
8192,
|
|
||||||
nullptr,
|
|
||||||
static_cast<UBaseType_t>(tt::Thread::Priority::High), // Should be higher than main app task
|
|
||||||
nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
assert(task_result == pdTRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void lvgl_task(TT_UNUSED void* arg) {
|
|
||||||
TT_LOG_I(TAG, "lvgl task started");
|
|
||||||
|
|
||||||
/** Ideally. the display handle would be created during Simulator.start(),
|
|
||||||
* but somehow that doesn't work. Waiting here from a ThreadFlag when that happens
|
|
||||||
* also doesn't work. It seems that it must be called from this task. */
|
|
||||||
displayHandle = lv_sdl_window_create(320, 240);
|
|
||||||
lv_sdl_window_set_title(displayHandle, "Tactility");
|
|
||||||
|
|
||||||
uint32_t task_delay_ms = task_max_sleep_ms;
|
|
||||||
|
|
||||||
task_set_running(true);
|
|
||||||
|
|
||||||
while (lvgl_task_is_running()) {
|
|
||||||
if (lvgl_lock(10)) {
|
|
||||||
task_delay_ms = lv_timer_handler();
|
|
||||||
lvgl_unlock();
|
|
||||||
}
|
|
||||||
if ((task_delay_ms > task_max_sleep_ms) || (1 == task_delay_ms)) {
|
|
||||||
task_delay_ms = task_max_sleep_ms;
|
|
||||||
} else if (task_delay_ms < 1) {
|
|
||||||
task_delay_ms = 1;
|
|
||||||
}
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(task_delay_ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_disp_remove(displayHandle);
|
|
||||||
displayHandle = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
void lvgl_task_start();
|
|
||||||
bool lvgl_task_is_running();
|
|
||||||
void lvgl_task_interrupt();
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#include "Main.h"
|
|
||||||
#include <Tactility/TactilityCore.h>
|
|
||||||
#include <Tactility/Thread.h>
|
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include "task.h"
|
|
||||||
|
|
||||||
#define TAG "freertos"
|
|
||||||
|
|
||||||
namespace simulator {
|
|
||||||
|
|
||||||
MainFunction mainFunction = nullptr;
|
|
||||||
|
|
||||||
void setMain(MainFunction newMainFunction) {
|
|
||||||
mainFunction = newMainFunction;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void freertosMainTask(TT_UNUSED void* parameter) {
|
|
||||||
TT_LOG_I(TAG, "starting app_main()");
|
|
||||||
assert(simulator::mainFunction);
|
|
||||||
mainFunction();
|
|
||||||
TT_LOG_I(TAG, "returned from app_main()");
|
|
||||||
vTaskDelete(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void freertosMain() {
|
|
||||||
BaseType_t task_result = xTaskCreate(
|
|
||||||
freertosMainTask,
|
|
||||||
"main",
|
|
||||||
8192,
|
|
||||||
nullptr,
|
|
||||||
static_cast<UBaseType_t>(tt::Thread::Priority::Normal),
|
|
||||||
nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
assert(task_result == pdTRUE);
|
|
||||||
|
|
||||||
// Blocks forever
|
|
||||||
vTaskStartScheduler();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assert implementation as defined in the FreeRTOSConfig.h
|
|
||||||
* It allows you to set breakpoints and debug asserts.
|
|
||||||
*/
|
|
||||||
void vAssertCalled(unsigned long line, const char* const file) {
|
|
||||||
static portBASE_TYPE xPrinted = pdFALSE;
|
|
||||||
volatile uint32_t set_to_nonzero_in_debugger_to_continue = 0;
|
|
||||||
|
|
||||||
TT_LOG_E(TAG, "assert triggered at %s:%d", file, line);
|
|
||||||
taskENTER_CRITICAL();
|
|
||||||
{
|
|
||||||
// Step out by attaching a debugger and setting set_to_nonzero_in_debugger_to_continue
|
|
||||||
while (set_to_nonzero_in_debugger_to_continue == 0) {
|
|
||||||
// NO-OP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
taskEXIT_CRITICAL();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#include "LvglTask.h"
|
|
||||||
#include "hal/SdlDisplay.h"
|
|
||||||
#include "hal/SdlKeyboard.h"
|
|
||||||
#include "hal/SimulatorPower.h"
|
|
||||||
#include "hal/SimulatorSdCard.h"
|
|
||||||
|
|
||||||
#include <src/lv_init.h> // LVGL
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
#define TAG "hardware"
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
lv_init();
|
|
||||||
lvgl_task_start();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
TT_UNUSED static void deinitPower() {
|
|
||||||
lvgl_task_interrupt();
|
|
||||||
while (lvgl_task_is_running()) {
|
|
||||||
tt::kernel::delayMillis(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if LV_ENABLE_GC || !LV_MEM_CUSTOM
|
|
||||||
lv_deinit();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardware = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDisplay = createDisplay,
|
|
||||||
.createKeyboard = createKeyboard,
|
|
||||||
.sdcard = std::make_shared<SimulatorSdCard>(),
|
|
||||||
.power = simulatorPower,
|
|
||||||
.i2c = {
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Internal",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = 1,
|
|
||||||
.scl_io_num = 2,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "External",
|
|
||||||
.port = I2C_NUM_1,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = 3,
|
|
||||||
.scl_io_num = 2,
|
|
||||||
.sda_pullup_en = false,
|
|
||||||
.scl_pullup_en = false,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.uart = {
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "/dev/ttyUSB0",
|
|
||||||
.baudRate = 115200
|
|
||||||
},
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "/dev/ttyACM0",
|
|
||||||
.baudRate = 115200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "SdlTouch.h"
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
/** Hack: variable comes from LvglTask.cpp */
|
|
||||||
extern lv_disp_t* displayHandle;
|
|
||||||
|
|
||||||
class SdlDisplay final : public tt::hal::display::DisplayDevice {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
std::string getName() const final { return "SDL Display"; }
|
|
||||||
std::string getDescription() const final { return ""; }
|
|
||||||
|
|
||||||
bool start() override {
|
|
||||||
return displayHandle != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool stop() override { tt_crash("Not supported"); }
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override { return std::make_shared<SdlTouch>(); }
|
|
||||||
|
|
||||||
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
return std::make_shared<SdlDisplay>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/keyboard/KeyboardDevice.h>
|
|
||||||
#include <Tactility/TactilityCore.h>
|
|
||||||
|
|
||||||
class SdlKeyboard final : public tt::hal::keyboard::KeyboardDevice {
|
|
||||||
private:
|
|
||||||
lv_indev_t* _Nullable handle = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
std::string getName() const final { return "SDL Keyboard"; }
|
|
||||||
std::string getDescription() const final { return "SDL keyboard device"; }
|
|
||||||
|
|
||||||
bool start(lv_display_t* display) override {
|
|
||||||
handle = lv_sdl_keyboard_create();
|
|
||||||
return handle != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool stop() override { tt_crash("Not supported"); }
|
|
||||||
|
|
||||||
bool isAttached() const override { return true; }
|
|
||||||
|
|
||||||
lv_indev_t* _Nullable getLvglIndev() override { return handle; }
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::keyboard::KeyboardDevice> createKeyboard() {
|
|
||||||
return std::make_shared<SdlKeyboard>();
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user