Compare commits
215 Commits
v0.6.0
..
c8ee763f3d
| Author | SHA1 | Date | |
|---|---|---|---|
| c8ee763f3d | |||
| 8556103eb1 | |||
| 9e3dc3dc15 | |||
| 2496dea5c2 | |||
| a321bfeb4c | |||
| f95cd7df4c | |||
| 1b16184a72 | |||
| a0b2ee7ebc | |||
| 643cbc3806 | |||
| d3656bcd3d | |||
| 7a81b525ed | |||
| 6e5e35610b | |||
| 64fb1a9f52 | |||
| 19b11eb9a8 | |||
| d3556fb536 | |||
| e466b183cc | |||
| bcbf18e363 | |||
| d2442bedb4 | |||
| b7577f2328 | |||
| 020aa471e2 | |||
| 92ca046681 | |||
| c656ee9ffd | |||
| 0ee2415f3b | |||
| ab75d2022d | |||
| db48dfe812 | |||
| 4fea48f433 | |||
| 0ff1627385 | |||
| b03759a111 | |||
| f943c4dd69 | |||
| d6b1d15e56 | |||
| cc8be3faef | |||
| 37c507544b | |||
| dc3f6104b8 | |||
| 564d8af64c | |||
| c6373b79e9 | |||
| d2c69ee7e8 | |||
| 85fe1a319a | |||
| d72d5a0ef2 | |||
| 94deee8875 | |||
| f13c18f398 | |||
| 606b918f9c | |||
| 1cb661469d | |||
| c729e8340f | |||
| de6fc3b346 | |||
| acb2f1d4c7 | |||
| 6e55e71e67 | |||
| bd108cc3c4 | |||
| e6e1dcd0ca | |||
| 58a529cc44 | |||
| d1f06cb774 | |||
| 3354924359 | |||
| 03a6285328 | |||
| f21c0df6fe | |||
| b98a813f3c | |||
| cd2d9d6158 | |||
| d4ef83e316 | |||
| db7468d0c8 | |||
| ca5b071859 | |||
| 2a2558b29a | |||
| 29e80cfd65 | |||
| 429125734a | |||
| 08eac48e64 | |||
| 8b92aa8e5a | |||
| a3fda9ad8f | |||
| 2fbc44466a | |||
| 2d768ef3a1 | |||
| bd30aa046a | |||
| f9453d8956 | |||
| 5f54f7ca3d | |||
| d896657bf9 | |||
| 3b5a401594 | |||
| 6fb2bb736c | |||
| bd8fdfd858 | |||
| 8af6204ba1 | |||
| 955416dac8 | |||
| fa4a6e255c | |||
| 50c0a14a93 | |||
| c4406b24ba | |||
| 0922c4d55b | |||
| 7a7f09be35 | |||
| 16a61a087c | |||
| 1c2806bddf | |||
| dbb96a891c | |||
| d6ac070e30 | |||
| f4f91f81d6 | |||
| cca7224252 | |||
| 66a4eb66d6 | |||
| dfaeb9a2d9 | |||
| 9d5993930d | |||
| ecad2248d9 | |||
| a323f8e148 | |||
| 05720821f8 | |||
| 90afba647e | |||
| 35fd7dd536 | |||
| cd07c64926 | |||
| 2f5e183f18 | |||
| d3439f6f45 | |||
| 599fa46766 | |||
| 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 |
@@ -0,0 +1,65 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
|
||||||
|
|
||||||
|
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
|
||||||
|
|
||||||
|
## 1. Think Before Coding
|
||||||
|
|
||||||
|
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
||||||
|
|
||||||
|
Before implementing:
|
||||||
|
- State your assumptions explicitly. If uncertain, ask.
|
||||||
|
- If multiple interpretations exist, present them - don't pick silently.
|
||||||
|
- If a simpler approach exists, say so. Push back when warranted.
|
||||||
|
- If something is unclear, stop. Name what's confusing. Ask.
|
||||||
|
|
||||||
|
## 2. Simplicity First
|
||||||
|
|
||||||
|
**Minimum code that solves the problem. Nothing speculative.**
|
||||||
|
|
||||||
|
- No features beyond what was asked.
|
||||||
|
- No abstractions for single-use code.
|
||||||
|
- No "flexibility" or "configurability" that wasn't requested.
|
||||||
|
- No error handling for impossible scenarios.
|
||||||
|
- If you write 200 lines and it could be 50, rewrite it.
|
||||||
|
|
||||||
|
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
||||||
|
|
||||||
|
## 3. Surgical Changes
|
||||||
|
|
||||||
|
**Touch only what you must. Clean up only your own mess.**
|
||||||
|
|
||||||
|
When editing existing code:
|
||||||
|
- Don't "improve" adjacent code, comments, or formatting.
|
||||||
|
- Don't refactor things that aren't broken.
|
||||||
|
- Match existing style, even if you'd do it differently.
|
||||||
|
- If you notice unrelated dead code, mention it - don't delete it.
|
||||||
|
|
||||||
|
When your changes create orphans:
|
||||||
|
- Remove imports/variables/functions that YOUR changes made unused.
|
||||||
|
- Don't remove pre-existing dead code unless asked.
|
||||||
|
|
||||||
|
The test: Every changed line should trace directly to the user's request.
|
||||||
|
|
||||||
|
## 4. Goal-Driven Execution
|
||||||
|
|
||||||
|
**Define success criteria. Loop until verified.**
|
||||||
|
|
||||||
|
Transform tasks into verifiable goals:
|
||||||
|
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
||||||
|
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
||||||
|
- "Refactor X" → "Ensure tests pass before and after"
|
||||||
|
|
||||||
|
For multi-step tasks, state a brief plan:
|
||||||
|
```
|
||||||
|
1. [Step] → verify: [check]
|
||||||
|
2. [Step] → verify: [check]
|
||||||
|
3. [Step] → verify: [check]
|
||||||
|
```
|
||||||
|
|
||||||
|
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Architecture: App Framework
|
||||||
|
|
||||||
|
Apps are event-driven, C API (`app-module`, `<app/*.h>`), not a C++ class. Each app has an `AppManifest` (`id`, `name`, `category`, `location`, `flags`) and a `main(argc, argv)` entry point (`AppMainFn`), modelled on a C program's `main()`. Every app instance gets its own dedicated task for its whole lifetime, and blocks in that task until it returns. Use `app_scheduler_current_app_id()` (`app/scheduler.h`) to identify the running instance - it's not passed as a parameter.
|
||||||
|
|
||||||
|
Lifecycle and inter-app communication go through `app_manager_*()` (`app/manager.h`) and `app_event_*()` (`app/event.h`):
|
||||||
|
- `app_manager_start()`/`app_manager_start_with_parameters()` launch a plain instance; `app_manager_start_for_result()` launches a modal child that reports back to a parent instance.
|
||||||
|
- An app subscribes with `app_event_subscribe()` (registers for its own instance's events, no id argument needed), blocks via `task_event_group_wait()`/`task_event_group_wait_any()`, and drains with `app_event_poll()`, reacting to `APP_EVENT_CLOSE` (terminate now) and `APP_EVENT_RESULT` (a child it started reported back).
|
||||||
|
- An app closes itself by calling `app_manager_finish()` right before returning from `main()`; another instance is closed via `app_manager_stop()`.
|
||||||
|
|
||||||
|
Apps are registered at startup via `app_manager_add()`. External apps can be loaded from SD card via `manifest.properties` files, or side-loaded as ELF binaries on ESP32 (see `app/loader.h`'s `AppLoaderApi`).
|
||||||
|
|
||||||
|
Apps can be loaded from:
|
||||||
|
|
||||||
|
- memory (`APP_LOCATION_MEMORY`)
|
||||||
|
- a path pointing to an install folder where an `.app` file was installed (`APP_LOCATION_PATH`)
|
||||||
|
- a path pointing to an `.elf` file (`APP_LOCATION_PATH`)
|
||||||
|
|
||||||
|
An app can build an optional UI via the LVGL window-manager module (see `lvgl.md`).
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Architecture: Device/Driver/Module System (kernel layer, C API)
|
||||||
|
|
||||||
|
The kernel uses a Linux-inspired device model:
|
||||||
|
|
||||||
|
- **Module** (`struct Module`): loadable unit that registers drivers, hardware and symbols. Lifecycle: `module_construct` → `module_add` → `module_start`. Each device board and platform is a module.
|
||||||
|
- **Driver** (`struct Driver`): binds to devices via `compatible` strings (like devicetree). Has `start_device`/`stop_device` callbacks and an `api` pointer for type-specific operations.
|
||||||
|
- **Device** (`struct Device`): represents hardware. Lifecycle: `device_construct` → `device_add` → `device_start`. Has a parent-child tree, driver binding, and locking.
|
||||||
|
- **DeviceType** (`struct DeviceType`): enables discovering devices by category (e.g. `DISPLAY_TYPE`, `TOUCH_TYPE`, `UART_CONTROLLER_TYPE`).
|
||||||
|
|
||||||
|
Devices are defined via **devicetree** `.dts` files in each `Devices/<id>/` folder. A custom devicetree compiler (`Buildscripts/DevicetreeCompiler/compile.py`) generates C code from these files. Each device folder also has a `devicetree.yaml` specifying dependencies and the `.dts` file.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Architecture: Layer Stack (bottom to top)
|
||||||
|
|
||||||
|
- **TactilityKernel** — C API kernel: device/driver/module lifecycle, concurrency primitives (thread, mutex, timer, dispatcher), filesystem, logging. Header convention: `<tactility/*.h>` (lowercase snake_case).
|
||||||
|
- **TactilityFreeRtos** — Thin C++ wrappers around FreeRTOS primitives.
|
||||||
|
- **Tactility** — Main OS layer: app framework, service framework, LVGL integration, networking and services (Wi-Fi, BLE, NTP, ESP-NOW), settings, i18n.
|
||||||
|
- **TactilityC** — C bindings (`tt_*.h`) for Tactility, used by side-loaded ELF apps on ESP32. Deprecated, replaced by TactilityKernel.
|
||||||
|
- **Firmware** — Entry point (`app_main`).
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Architecture: Build System
|
||||||
|
|
||||||
|
The `tactility_add_module()` CMake macro (in `Buildscripts/module.cmake`) wraps ESP-IDF's `idf_component_register` on ESP32 and standard `add_library` on POSIX, allowing the same source to build for both targets.
|
||||||
|
|
||||||
|
`device.py` reads `Devices/<id>/device.properties` and generates the `sdkconfig` file with all necessary ESP-IDF config (target chip, flash size, SPIRAM, LVGL fonts, Bluetooth, USB, etc.).
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
# Building
|
||||||
|
|
||||||
|
## Git
|
||||||
|
|
||||||
|
The repository uses git submodules. Make sure to use `--recurse-submodules` on relevant git commands.
|
||||||
|
|
||||||
|
## Simulator (Linux/macOS, no ESP-IDF needed)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The simulator does **NOT** build or run on native Windows (Win32/PowerShell/cmd). This is
|
||||||
|
> a hard platform limitation, not a missing tool or PATH issue — do not attempt `cmake -B
|
||||||
|
> buildsim` on Windows, it will not work. WSL is a separate, Linux environment and is fine.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake -B buildsim -G Ninja
|
||||||
|
ninja -C buildsim # build firmware + tests
|
||||||
|
./buildsim/Firmware/Tactility # run simulator
|
||||||
|
```
|
||||||
|
|
||||||
|
## ESP32 firmware
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python device.py <device-id> # generate sdkconfig for device (e.g. lilygo-tdeck)
|
||||||
|
python device.py <device-id> --dev # dev mode: force 4MB partition table
|
||||||
|
idf.py build # build firmware
|
||||||
|
idf.py flash monitor # flash and monitor
|
||||||
|
```
|
||||||
|
|
||||||
|
Device IDs are the folder names under `Devices/` (e.g. `lilygo-tdeck`, `m5stack-cores3`, `cyd-2432s028r`).
|
||||||
|
|
||||||
|
### Windows: activating the ESP-IDF environment
|
||||||
|
|
||||||
|
On native Windows, `idf.py` is not on PATH by default — it must be activated per-shell first.
|
||||||
|
The install script places a PowerShell profile activator per IDF version at
|
||||||
|
`%IDF_TOOLS_PATH%\Microsoft.v<version>.PowerShell_profile.ps1` (path controlled by the
|
||||||
|
`IDF_TOOLS_PATH` environment variable, set to wherever ESP-IDF's tools were installed, e.g.
|
||||||
|
`C:\Espressif\tools`). Source it before running any `idf.py` command:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
. "$env:IDF_TOOLS_PATH\Microsoft.v5.5.2.PowerShell_profile.ps1" # match the installed IDF version
|
||||||
|
Set-Location "<repo-root>"
|
||||||
|
idf.py build 2>&1 | Select-Object -Last 250
|
||||||
|
```
|
||||||
|
|
||||||
|
This is Windows-specific setup (the main dev works on Linux, where `idf.py` is normally
|
||||||
|
already on PATH via `export.sh`/`. ./export.sh` or a shell profile).
|
||||||
|
|
||||||
|
## Devicetree
|
||||||
|
|
||||||
|
A device implementation has a `.dts` file.
|
||||||
|
The parser at `Buildscripts/DevicetreeCompiler/` converts DTS into C code.
|
||||||
|
It's called from the `Firmware/` build process.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Tests use Doctest and run on simulator (POSIX) target only:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake -B buildsim -G Ninja
|
||||||
|
ninja -C buildsim build-tests
|
||||||
|
cd buildsim && ctest --test-dir Tests
|
||||||
|
```
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Coding Style
|
||||||
|
|
||||||
|
Two conventions coexist; which one to use depends on the project layer:
|
||||||
|
|
||||||
|
- **C code** (TactilityKernel, drivers): `lower_snake_case` for files, functions, variables. `UpperCamelCase` for types. Files in `source/`, `include/`, `private/` directories.
|
||||||
|
- **C++ code** (Tactility, apps, services): `UpperCamelCase` for files and types. `lowerCamelCase` for functions. Files in `Source/`, `Include/`, `Private/` directories.
|
||||||
|
|
||||||
|
For projects that emit C headers and have a C++ implementation file: the internal C++ function naming should be snake_case.
|
||||||
|
|
||||||
|
Formatting is enforced by `.clang-format` (LLVM-based, 4-space indent, no column limit).
|
||||||
|
Never throw exceptions — use return types for error handling. Use `enum class` over plain `enum` when writing C++ code.
|
||||||
|
Do not add redundant null checks for parameters with an explicit non-null precondition.
|
||||||
|
|
||||||
|
Code Comments:
|
||||||
|
|
||||||
|
- Should be as short as possible, leaving only important context.
|
||||||
|
- Should avoid explaining what the code does, unless the code complexity is high enough to warrant an explanation.
|
||||||
|
- Must avoid explaining how the code was before, or how it was changed.
|
||||||
|
- Should explain why code is implemented.
|
||||||
|
- Should be as brief as possible without losing critical information.
|
||||||
|
- Should avoid explaining what was not implemented.
|
||||||
|
- Should avoid referring to designs of other subsystems.
|
||||||
|
- Must avoid interjections: avoid hyphens or braces to interject. If interjections provide crucial info, use Doxygen entity/anchor references like:
|
||||||
|
/**
|
||||||
|
* A dedicated completion \signal for one app instance's task.
|
||||||
|
* Whichever \side finishes with it last is the one that deletes `semaphore` and frees this struct.
|
||||||
|
*
|
||||||
|
* \signal Not the task's shared default FreeRTOS notification, which app_event.cpp's AppEventSubscription also uses.
|
||||||
|
* An unrelated event delivered to the same task could otherwise unblock a waiter early.
|
||||||
|
* \side The exiting task or a concurrent app_scheduler_stop() that found the entry in time and is waiting on `semaphore`.
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Architecture: Hardware Abstraction Layer
|
||||||
|
|
||||||
|
## Driver
|
||||||
|
|
||||||
|
A driver generally consists of:
|
||||||
|
- Registration of driver in parent module (optional, but desirable)
|
||||||
|
- YAML bindings in the `bindings/` folder
|
||||||
|
- An `#include` that is used in the `.dts` file. The include is in `[projectname]/bindings/[drivername].h`
|
||||||
|
- The driver implementation: a `.cpp` and `.h` file. The implementation is C++, but the header exposes pure C functions. C implementations are allowed, but C++ is preferred.
|
||||||
|
|
||||||
|
Drivers are part of a kernel module.
|
||||||
|
|
||||||
|
A driver whose device sits on a shared SPI controller (parent device type `SPI_CONTROLLER_TYPE`)
|
||||||
|
must bracket its own bus access with `spi_controller_lock()`/`spi_controller_unlock()`
|
||||||
|
(`spi_controller_lock_bus_of()`/`spi_controller_unlock_bus_of()` for the common case of a direct
|
||||||
|
child), at the logical-operation level rather than per primitive. This is not done for you by the
|
||||||
|
kernel's generic device-type wrappers (`display.cpp`, `pointer.cpp`, etc.) - only the driver knows
|
||||||
|
for certain which of its calls touch the bus.
|
||||||
|
|
||||||
|
Modules with drivers can be stored in:
|
||||||
|
- TactilityKernel
|
||||||
|
- A subproject in `Platforms` folder
|
||||||
|
- A subproject in `Devices` folder
|
||||||
|
- A subproject in `Drivers` folder
|
||||||
|
|
||||||
|
## Kernel Modules
|
||||||
|
|
||||||
|
Kernel module names are lower case and postfixed with `-module`.
|
||||||
|
|
||||||
|
Projects that are kernel modules:
|
||||||
|
|
||||||
|
1. Declare a `struct Module`
|
||||||
|
2. Contain a `devicetree.yaml` file that declares a list of dependencies (for parsing the devicetree) and specifies the bindings folder that contains the drivers' YAML definitions. For example:
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
- TactilityKernel
|
||||||
|
bindings: bindings
|
||||||
|
```
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Key Conventions
|
||||||
|
|
||||||
|
- Shared cross-platform code uses `#ifdef ESP_PLATFORM` for ESP32-specific paths.
|
||||||
|
Code in `Platforms/PlatformEsp32/` is already ESP-only and does not need guards around ESP-IDF includes.
|
||||||
|
- The `Drivers/` directory contains hardware drivers (display controllers, touch controllers, PMICs, etc.) — each is its own CMake component.
|
||||||
|
- `Modules/` contains cross-cutting modules. e.g.`lvgl-module` (LVGL task management).
|
||||||
|
- `Data/system/` and `Data/data/` are flashed as FAT filesystem images on ESP32.
|
||||||
|
- Translations are in `Translations/` as CSV files, generated via `generate.py`.
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Architecture: LVGL
|
||||||
|
|
||||||
|
User interfaces should scale well for everything between very large (e.g. 1280x720) and small (e.g. 135x240) displays. Vertical and horizontal layouts are supported.
|
||||||
|
|
||||||
|
Two kernel modules cover LVGL:
|
||||||
|
|
||||||
|
- **`lvgl-module`** (`Modules/lvgl-module/`, `<lvgl/*.h>`) owns LVGL's lifecycle: init/deinit, the LVGL task loop, and `lvgl_lock()`/`lvgl_try_lock()`/`lvgl_unlock()` mutex-based locking that any task must hold before touching LVGL objects. It bridges Tactility's device model to LVGL indevs (`lvgl/devices/*.h`: `display`, `pointer`, `keyboard`, `trackball`), and provides shared fonts (`lvgl/fonts.h`: Montserrat text sizes, Material Symbols icon sets for statusbar/launcher/shared use) and a few shared widgets (`lvgl/widgets/*.h`: `toolbar`, `spinner`, `sliderbox`).
|
||||||
|
- **`lvgl-window-manager-module`** (`Modules/lvgl-window-manager-module/`, `<lvgl_window_manager/*.h>`) manages a single stacked window per app instance on top of `lvgl-module`. `window_manager_start()`/`window_manager_stop()` create/tear down the root widget (plus optional chrome from a configured `WindowManagerScreenInitFn`); `window_manager_create()`/`window_manager_remove()` push/pop an app's window and (re)populate it via a `WindowCreateWidgetsFn`. Only the topmost window ever has live widgets - burying and resurfacing a window deletes and rebuilds its widget tree rather than hiding/showing it. That rebuild-on-remove path can run `create_widgets` on a *different* app's thread (whichever app's `window_manager_remove()` call caused this window to resurface), so `create_widgets` must only rebuild already-committed state, never decide what happens next - state transitions belong in the app's own `main()` event loop, driven by real `APP_EVENT_RESULT`s.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Architecture: Platform Abstraction
|
||||||
|
|
||||||
|
- `Platforms/platform-esp32/` — ESP-IDF specific implementations
|
||||||
|
- `Platforms/platform-posix/` — POSIX simulator implementations (SDL for display)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Project Overview
|
||||||
|
|
||||||
|
Tactility is an operating system for the ESP32 microcontroller family. It runs on 40+ supported devices (CYD boards, LilyGO, M5Stack, Elecrow, etc.) and includes a desktop simulator. Built with C++23, ESP-IDF, LVGL, and FreeRTOS.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Architecture: Service Framework
|
||||||
|
|
||||||
|
Services are a C API (`service-module`, `<service/*.h>`), not a C++ class. Each service has a `ServiceManifest` (`id`, `create_service`/`destroy_service` for its custom data, `on_start`/`on_stop` callbacks) registered via `service_manager_add()`, and is started/stopped via `service_manager_start()`/`service_manager_stop()`. Services are long-running background processes (GUI, Wi-Fi, loader, statusbar, GPS, etc.).
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Tests for projects should be placed in the `Tests/` or `tests/` subfolder of that project.
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -11,21 +11,28 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
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@v1
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.5
|
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
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
persist-credentials: false
|
||||||
|
- name: 'Detect architecture'
|
||||||
|
id: arch
|
||||||
|
shell: bash
|
||||||
|
run: echo "value=$(uname -m)" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: 'Configure'
|
||||||
|
shell: bash
|
||||||
|
run: cmake -S ./ -B buildsim
|
||||||
|
- name: 'Build'
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build buildsim --target TactilityKernel lvgl minitar minmea $(cat Buildscripts/release-sdk-modules.txt)
|
||||||
|
- name: 'Release'
|
||||||
|
shell: bash
|
||||||
|
run: python Buildscripts/release-sdk-posix.py release/TactilitySDK
|
||||||
|
- name: 'Test Integration Prep'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
TACTILITY_ARCH: ${{ steps.arch.outputs.value }}
|
||||||
|
run: |
|
||||||
|
TACTILITY_SDK_NAME="$(cat version.txt)-posix-$TACTILITY_ARCH"
|
||||||
|
mkdir -p test_sdk/$TACTILITY_SDK_NAME
|
||||||
|
cp -r release/TactilitySDK test_sdk/$TACTILITY_SDK_NAME
|
||||||
|
- name: 'Test Integration'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
TACTILITY_ARCH: ${{ steps.arch.outputs.value }}
|
||||||
|
run: cd Tests/SdkIntegration && TACTILITY_SDK_PATH=../../test_sdk python tactility.py build -a posix-$TACTILITY_ARCH --local-sdk
|
||||||
|
- name: 'Upload Artifact'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: TactilitySDK-posix-${{ steps.arch.outputs.value }}
|
||||||
|
path: release/TactilitySDK
|
||||||
|
retention-days: 30
|
||||||
@@ -11,25 +11,39 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
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@v1
|
uses: espressif/esp-idf-ci-action@v1
|
||||||
with:
|
with:
|
||||||
# NOTE: Update with ESP-IDF!
|
# NOTE: Update with ESP-IDF!
|
||||||
esp_idf_version: v5.5
|
esp_idf_version: v5.5.2
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
# NOTE: Update with ESP-IDF!
|
# NOTE: Update with ESP-IDF!
|
||||||
ESP_IDF_VERSION: '5.5'
|
ESP_IDF_VERSION: '5.5.2'
|
||||||
run: Buildscripts/release-sdk.sh release/TactilitySDK
|
run: python Buildscripts/release-sdk-esp32.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="$(cat version.txt)-${{ 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 -a ${{ 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@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install Linux Dependencies for SDL
|
- name: Install Linux Dependencies for SDL
|
||||||
@@ -45,7 +45,7 @@ runs:
|
|||||||
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 FirmwareSim
|
run: cmake --build buildsim --target Tactility
|
||||||
- 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,54 +0,0 @@
|
|||||||
name: Build Firmware
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
types: [ opened, synchronize, reopened ]
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
board: [
|
|
||||||
{ id: cyd-2432s024c, arch: esp32 },
|
|
||||||
{ id: cyd-2432s028r, arch: esp32 },
|
|
||||||
{ id: cyd-2432s028rv3, arch: esp32 },
|
|
||||||
{ id: cyd-e32r28t, arch: esp32 },
|
|
||||||
{ id: cyd-e32r32p, arch: esp32 },
|
|
||||||
{ id: cyd-2432s032c, arch: esp32 },
|
|
||||||
{ id: cyd-jc2432w328c, arch: esp32 },
|
|
||||||
{ id: cyd-8048s043c, arch: esp32s3 },
|
|
||||||
{ id: cyd-jc8048w550c, arch: esp32s3 },
|
|
||||||
{ id: cyd-4848s040c, arch: esp32s3 },
|
|
||||||
{ id: elecrow-crowpanel-advance-28, arch: esp32s3 },
|
|
||||||
{ id: elecrow-crowpanel-advance-35, arch: esp32s3 },
|
|
||||||
{ id: elecrow-crowpanel-advance-50, arch: esp32s3 },
|
|
||||||
{ id: elecrow-crowpanel-basic-28, arch: esp32 },
|
|
||||||
{ id: elecrow-crowpanel-basic-35, arch: esp32 },
|
|
||||||
{ id: elecrow-crowpanel-basic-50, arch: esp32s3 },
|
|
||||||
{ id: lilygo-tdeck, arch: esp32s3 },
|
|
||||||
{ id: lilygo-tdongle-s3, arch: esp32s3 },
|
|
||||||
{ id: lilygo-tlora-pager, arch: esp32s3 },
|
|
||||||
{ id: m5stack-cardputer, arch: esp32s3 },
|
|
||||||
{ id: m5stack-cardputer-adv, arch: esp32s3 },
|
|
||||||
{ id: m5stack-core2, arch: esp32 },
|
|
||||||
{ id: m5stack-cores3, arch: esp32s3 },
|
|
||||||
{ id: m5stack-stickc-plus, arch: esp32 },
|
|
||||||
{ id: m5stack-stickc-plus2, arch: esp32 },
|
|
||||||
{ id: unphone, arch: esp32s3 },
|
|
||||||
{ id: waveshare-s3-touch-lcd-43, arch: esp32s3 },
|
|
||||||
{ id: waveshare-s3-touch-lcd-147, arch: esp32s3 },
|
|
||||||
{ id: waveshare-s3-touch-lcd-128, arch: esp32s3 },
|
|
||||||
{ id: waveshare-s3-lcd-13, arch: esp32s3 }
|
|
||||||
]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: ${{ matrix.board.id }}
|
|
||||||
arch: ${{ matrix.board.arch }}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
name: Build SDK
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
types: [ opened, synchronize, reopened ]
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
board: [
|
|
||||||
{ id: cyd-2432s028r, arch: esp32 },
|
|
||||||
{ id: lilygo-tdeck, arch: esp32s3 },
|
|
||||||
]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-sdk
|
|
||||||
with:
|
|
||||||
board_id: ${{ matrix.board.id }}
|
|
||||||
arch: ${{ matrix.board.arch }}
|
|
||||||
@@ -10,7 +10,9 @@ jobs:
|
|||||||
Linux:
|
Linux:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
uses: ./.github/actions/build-simulator
|
uses: ./.github/actions/build-simulator
|
||||||
with:
|
with:
|
||||||
@@ -20,7 +22,9 @@ jobs:
|
|||||||
macOS:
|
macOS:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
uses: ./.github/actions/build-simulator
|
uses: ./.github/actions/build-simulator
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
name: Build Firmware
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, synchronize, reopened ]
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
BuildSdkEsp32:
|
||||||
|
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@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: "Build SDK"
|
||||||
|
uses: ./.github/actions/build-sdk
|
||||||
|
with:
|
||||||
|
board_id: ${{ matrix.board.id }}
|
||||||
|
arch: ${{ matrix.board.arch }}
|
||||||
|
BuildSdkPosix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: "Build SDK"
|
||||||
|
uses: ./.github/actions/build-sdk-posix
|
||||||
|
GenerateDeviceMatrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ BuildSdkEsp32 ]
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- id: set-matrix
|
||||||
|
run: python3 Buildscripts/gh-generate-device-matrix.py
|
||||||
|
BuildFirmware:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: GenerateDeviceMatrix
|
||||||
|
strategy:
|
||||||
|
matrix: ${{ fromJSON(needs.GenerateDeviceMatrix.outputs.matrix) }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- 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, BuildSdkPosix ]
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
||||||
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- 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@v6
|
||||||
|
- 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@v6
|
||||||
|
- 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@v6
|
||||||
|
- 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@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: "Configure Project"
|
- name: "Configure Project"
|
||||||
@@ -19,7 +19,19 @@ jobs:
|
|||||||
run: cmake -S ./ -B build
|
run: cmake -S ./ -B build
|
||||||
- name: "Build Tests"
|
- name: "Build Tests"
|
||||||
run: cmake --build build --target build-tests
|
run: cmake --build build --target build-tests
|
||||||
- name: "Run TactilityCore Tests"
|
- name: "Run Tests"
|
||||||
run: build/Tests/TactilityCore/TactilityCoreTests --exit
|
run: ctest --test-dir build/Tests
|
||||||
- name: "Run TactilityHeadless Tests"
|
DevicetreeTests:
|
||||||
run: build/Tests/Tactility/TactilityTests --exit
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
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
-5
@@ -1,10 +1,9 @@
|
|||||||
.idea/
|
.idea/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
build/
|
build*/
|
||||||
buildsim/
|
!.github/actions/build*/
|
||||||
build-sim/
|
cmake*/
|
||||||
cmake-build-*/
|
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
*.cbp
|
*.cbp
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
@@ -18,6 +17,14 @@ managed_components/
|
|||||||
dependencies.lock
|
dependencies.lock
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
*.code-workspace
|
||||||
.gitpod.yml
|
.gitpod.yml
|
||||||
|
|
||||||
sdkconfig.board.*.dev
|
sdkconfig.board.*.dev
|
||||||
|
|
||||||
|
.tactility/
|
||||||
|
|
||||||
|
.caveman.json
|
||||||
|
.ai/mcp
|
||||||
|
|
||||||
|
__pycache__
|
||||||
@@ -16,3 +16,6 @@
|
|||||||
[submodule "Libraries/cJSON/cJSON"]
|
[submodule "Libraries/cJSON/cJSON"]
|
||||||
path = Libraries/cJSON/cJSON
|
path = Libraries/cJSON/cJSON
|
||||||
url = https://github.com/DaveGamble/cJSON.git
|
url = https://github.com/DaveGamble/cJSON.git
|
||||||
|
[submodule "Libraries/esp_epaper"]
|
||||||
|
path = Libraries/esp_epaper
|
||||||
|
url = https://github.com/NellowTCS/esp_epaper.git
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility esp_lvgl_port ILI934x CST816S PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
// Set the RGB LED Pins to output and turn them off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
|
||||||
|
|
||||||
// 0 on, 1 off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
|
||||||
|
|
||||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static tt::hal::DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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 = LCD_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,45 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
#include "Cst816Touch.h"
|
|
||||||
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
// Note: GPIO 25 for reset and GPIO 21 for interrupt?
|
|
||||||
auto configuration = std::make_unique<Cst816sTouch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
240,
|
|
||||||
320
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Cst816sTouch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
Ili934xDisplay::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = true,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = false,
|
|
||||||
.swapBytes = true,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC,
|
|
||||||
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 40'000'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27;
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#define TAG "twodotfour_sdcard"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility esp_lvgl_port ILI934x XPT2046SoftSPI PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
// Set the RGB LED Pins to output and turn them off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
|
||||||
|
|
||||||
// 0 on, 1 off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
|
||||||
|
|
||||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.i2c = {
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "CN1",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_27,
|
|
||||||
.scl_io_num = GPIO_NUM_22,
|
|
||||||
.sda_pullup_en = false,
|
|
||||||
.scl_pullup_en = false,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_13,
|
|
||||||
.miso_io_num = GPIO_NUM_12,
|
|
||||||
.sclk_io_num = GPIO_NUM_14,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
},
|
|
||||||
// SDCard
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_23,
|
|
||||||
.miso_io_num = GPIO_NUM_19,
|
|
||||||
.sclk_io_num = GPIO_NUM_18,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 0,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
.uart {
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "P1",
|
|
||||||
.port = UART_NUM_1,
|
|
||||||
.rxPin = GPIO_NUM_1,
|
|
||||||
.txPin = GPIO_NUM_3,
|
|
||||||
.rtsPin = GPIO_NUM_NC,
|
|
||||||
.ctsPin = GPIO_NUM_NC,
|
|
||||||
.rxBufferSize = 1024,
|
|
||||||
.txBufferSize = 1024,
|
|
||||||
.config = {
|
|
||||||
.baud_rate = 115200,
|
|
||||||
.data_bits = UART_DATA_8_BITS,
|
|
||||||
.parity = UART_PARITY_DISABLE,
|
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
|
||||||
.rx_flow_ctrl_thresh = 0,
|
|
||||||
.source_clk = UART_SCLK_DEFAULT,
|
|
||||||
.flags = {
|
|
||||||
.allow_pd = 0,
|
|
||||||
.backup_before_sleep = 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
#include "Xpt2046SoftSpi.h"
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
|
||||||
TOUCH_MOSI_PIN,
|
|
||||||
TOUCH_MISO_PIN,
|
|
||||||
TOUCH_SCK_PIN,
|
|
||||||
TOUCH_CS_PIN,
|
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
LCD_VERTICAL_RESOLUTION,
|
|
||||||
false, // swapXY
|
|
||||||
true, // mirrorX
|
|
||||||
false // mirrorY
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
Ili934xDisplay::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = true,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = false,
|
|
||||||
.swapBytes = true,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC,
|
|
||||||
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 40'000'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
// Display backlight (PWM)
|
|
||||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
|
||||||
|
|
||||||
// Touch (Software SPI)
|
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
|
||||||
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
|
||||||
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
|
||||||
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
|
||||||
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(std::move(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -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 ST7789 XPT2046SoftSPI PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
// Set the RGB LED Pins to output and turn them off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
|
||||||
|
|
||||||
// 0 on, 1 off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
|
||||||
|
|
||||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.i2c = {
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "CN1",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_27,
|
|
||||||
.scl_io_num = GPIO_NUM_22,
|
|
||||||
.sda_pullup_en = false,
|
|
||||||
.scl_pullup_en = false,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_13,
|
|
||||||
.miso_io_num = GPIO_NUM_12,
|
|
||||||
.sclk_io_num = GPIO_NUM_14,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
},
|
|
||||||
// SDCard
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_23,
|
|
||||||
.miso_io_num = GPIO_NUM_19,
|
|
||||||
.sclk_io_num = GPIO_NUM_18,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 0,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
.uart {
|
|
||||||
uart::Configuration {
|
|
||||||
.name = "P1",
|
|
||||||
.port = UART_NUM_1,
|
|
||||||
.rxPin = GPIO_NUM_1,
|
|
||||||
.txPin = GPIO_NUM_3,
|
|
||||||
.rtsPin = GPIO_NUM_NC,
|
|
||||||
.ctsPin = GPIO_NUM_NC,
|
|
||||||
.rxBufferSize = 1024,
|
|
||||||
.txBufferSize = 1024,
|
|
||||||
.config = {
|
|
||||||
.baud_rate = 115200,
|
|
||||||
.data_bits = UART_DATA_8_BITS,
|
|
||||||
.parity = UART_PARITY_DISABLE,
|
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
|
||||||
.rx_flow_ctrl_thresh = 0,
|
|
||||||
.source_clk = UART_SCLK_DEFAULT,
|
|
||||||
.flags = {
|
|
||||||
.allow_pd = 0,
|
|
||||||
.backup_before_sleep = 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
#include "Xpt2046SoftSpi.h"
|
|
||||||
#include <St7789Display.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
constexpr auto* TAG = "CYD";
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
|
||||||
TOUCH_MOSI_PIN,
|
|
||||||
TOUCH_MISO_PIN,
|
|
||||||
TOUCH_SCK_PIN,
|
|
||||||
TOUCH_CS_PIN,
|
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
LCD_VERTICAL_RESOLUTION,
|
|
||||||
false, // swapXY
|
|
||||||
true, // mirrorX
|
|
||||||
false // mirrorY
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Xpt2046SoftSpi>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
St7789Display::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = false,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = false,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 62'500'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
// Touch (Software SPI)
|
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
|
||||||
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
|
||||||
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
|
||||||
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
|
||||||
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(std::move(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility esp_lvgl_port ILI934x GT911 PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/kernel/SystemEvents.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
bool initBoot() {
|
|
||||||
if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the RGB LED Pins to output and turn them off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue
|
|
||||||
|
|
||||||
// 0 on, 1 off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue
|
|
||||||
|
|
||||||
// This display has a weird glitch with gamma during boot, which results in uneven dark gray colours.
|
|
||||||
// Setting gamma curve index to 0 doesn't work at boot for an unknown reason, so we set the curve index to 1:
|
|
||||||
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](auto) {
|
|
||||||
auto display = tt::hal::findFirstDevice<tt::hal::display::DisplayDevice>(tt::hal::Device::Type::Display);
|
|
||||||
assert(display != nullptr);
|
|
||||||
tt::lvgl::lock(portMAX_DELAY);
|
|
||||||
display->setGammaCurve(1U);
|
|
||||||
tt::lvgl::unlock();
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static tt::hal::DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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 {
|
|
||||||
// Display
|
|
||||||
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 = LCD_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
|
|
||||||
},
|
|
||||||
// SD card
|
|
||||||
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,44 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
LCD_VERTICAL_RESOLUTION
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
Ili934xDisplay::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = true,
|
|
||||||
.mirrorX = true,
|
|
||||||
.mirrorY = true,
|
|
||||||
.invertColor = true,
|
|
||||||
.swapBytes = true,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC,
|
|
||||||
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 40'000'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27;
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility EspLcdCompat esp_lcd_st7701 esp_lcd_panel_io_additions GT911 PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
#include "devices/St7701Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/kernel/SystemEvents.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_38, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
std::make_shared<St7701Display>(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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 & display init
|
|
||||||
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 = GPIO_NUM_42,
|
|
||||||
.data4_io_num = -1,
|
|
||||||
.data5_io_num = -1,
|
|
||||||
.data6_io_num = -1,
|
|
||||||
.data7_io_num = -1,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 1024 * 128,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_42,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector { GPIO_NUM_39 }
|
|
||||||
);
|
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(config)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -1,236 +0,0 @@
|
|||||||
#include "St7701Display.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <esp_err.h>
|
|
||||||
#include <esp_lcd_panel_rgb.h>
|
|
||||||
#include <esp_lcd_panel_ops.h>
|
|
||||||
#include <esp_lcd_panel_io_additions.h>
|
|
||||||
#include <esp_lcd_st7701.h>
|
|
||||||
|
|
||||||
constexpr auto TAG = "St7701Display";
|
|
||||||
|
|
||||||
static const st7701_lcd_init_cmd_t st7701_lcd_init_cmds[] = {
|
|
||||||
// {cmd, { data }, data_size, delay_ms}
|
|
||||||
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0},
|
|
||||||
{0xC0, (uint8_t[]) {0x3B, 0x00}, 2, 0},
|
|
||||||
{0xC1, (uint8_t[]) {0x0D, 0x02}, 2, 0},
|
|
||||||
{0xC2, (uint8_t[]) {0x31, 0x05}, 2, 0},
|
|
||||||
{0xCD, (uint8_t[]) {0x00}, 1, 0}, //0x08
|
|
||||||
//Positive Voltage Gamma Control
|
|
||||||
{0xB0, (uint8_t[]) {0x00, 0x11, 0x18, 0x0E, 0x11, 0x06, 0x07, 0x08, 0x07, 0x22, 0x04, 0x12, 0x0F, 0xAA, 0x31, 0x18}, 16, 0},
|
|
||||||
//Negative Voltage Gamma Control
|
|
||||||
{0xB1, (uint8_t[]) {0x00, 0x11, 0x19, 0x0E, 0x12, 0x07, 0x08, 0x08, 0x08, 0x22, 0x04, 0x11, 0x11, 0xA9, 0x32, 0x18}, 16, 0},
|
|
||||||
//Page1
|
|
||||||
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x11}, 5, 0},
|
|
||||||
{0xB0, (uint8_t[]) {0x60}, 1, 0}, //Vop=4.7375v
|
|
||||||
{0xB1, (uint8_t[]) {0x32}, 1, 0}, //VCOM=32
|
|
||||||
{0xB2, (uint8_t[]) {0x07}, 1, 0}, //VGH=15v
|
|
||||||
{0xB3, (uint8_t[]) {0x80}, 1, 0},
|
|
||||||
{0xB5, (uint8_t[]) {0x49}, 1, 0}, //VGL=-10.17v
|
|
||||||
{0xB7, (uint8_t[]) {0x85}, 1, 0},
|
|
||||||
{0xB8, (uint8_t[]) {0x21}, 1, 0}, //AVDD=6.6 & AVCL=-4.6
|
|
||||||
{0xC1, (uint8_t[]) {0x78}, 1, 0},
|
|
||||||
{0xC2, (uint8_t[]) {0x78}, 1, 0},
|
|
||||||
{0xE0, (uint8_t[]) {0x00, 0x1B, 0x02}, 3, 0},
|
|
||||||
{0xE1, (uint8_t[]) {0x08, 0xA0, 0x00, 0x00, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x44, 0x44}, 11, 0},
|
|
||||||
{0xE2, (uint8_t[]) {0x11, 0x11, 0x44, 0x44, 0xED, 0xA0, 0x00, 0x00, 0xEC, 0xA0, 0x00, 0x00}, 12, 0},
|
|
||||||
{0xE3, (uint8_t[]) {0x00, 0x00, 0x11, 0x11}, 4, 0},
|
|
||||||
{0xE4, (uint8_t[]) {0x44, 0x44}, 2, 0},
|
|
||||||
{0xE5, (uint8_t[]) {0x0A, 0xE9, 0xD8, 0xA0, 0x0C, 0xEB, 0xD8, 0xA0, 0x0E, 0xED, 0xD8, 0xA0, 0x10, 0xEF, 0xD8, 0xA0}, 16, 0},
|
|
||||||
{0xE6, (uint8_t[]) {0x00, 0x00, 0x11, 0x11}, 4, 0},
|
|
||||||
{0xE7, (uint8_t[]) {0x44, 0x44}, 2, 0},
|
|
||||||
{0xE8, (uint8_t[]) {0x09, 0xE8, 0xD8, 0xA0, 0x0B, 0xEA, 0xD8, 0xA0, 0x0D, 0xEC, 0xD8, 0xA0, 0x0F, 0xEE, 0xD8, 0xA0}, 16, 0},
|
|
||||||
{0xEB, (uint8_t[]) {0x02, 0x00, 0xE4, 0xE4, 0x88, 0x00, 0x40}, 7, 0},
|
|
||||||
{0xEC, (uint8_t[]) {0x3C, 0x00}, 2, 0},
|
|
||||||
{0xED, (uint8_t[]) {0xAB, 0x89, 0x76, 0x54, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x45, 0x67, 0x98, 0xBA}, 16, 0},
|
|
||||||
//VAP & VAN
|
|
||||||
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0},
|
|
||||||
{0xE5, (uint8_t[]) {0xE4}, 1, 0},
|
|
||||||
{0xFF, (uint8_t[]) {0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0},
|
|
||||||
{0x3A, (uint8_t[]) {0x60}, 1, 10}, //0x70 RGB888, 0x60 RGB666, 0x50 RGB565
|
|
||||||
{0x11, (uint8_t[]) {0x00}, 0, 120}, //Sleep Out
|
|
||||||
{0x29, (uint8_t[]) {0x00}, 0, 0}, //Display On
|
|
||||||
};
|
|
||||||
|
|
||||||
bool St7701Display::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) {
|
|
||||||
spi_line_config_t line_config = {
|
|
||||||
.cs_io_type = IO_TYPE_GPIO,
|
|
||||||
.cs_gpio_num = GPIO_NUM_39,
|
|
||||||
.scl_io_type = IO_TYPE_GPIO,
|
|
||||||
.scl_gpio_num = GPIO_NUM_48,
|
|
||||||
.sda_io_type = IO_TYPE_GPIO,
|
|
||||||
.sda_gpio_num = GPIO_NUM_47,
|
|
||||||
.io_expander = nullptr,
|
|
||||||
};
|
|
||||||
esp_lcd_panel_io_3wire_spi_config_t panel_io_config = ST7701_PANEL_IO_3WIRE_SPI_CONFIG(line_config, 0);
|
|
||||||
return esp_lcd_new_panel_io_3wire_spi(&panel_io_config, &outHandle) == ESP_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) {
|
|
||||||
const esp_lcd_rgb_panel_config_t rgb_config = {
|
|
||||||
.clk_src = LCD_CLK_SRC_DEFAULT,
|
|
||||||
.timings = {
|
|
||||||
.pclk_hz = 14000000,
|
|
||||||
.h_res = 480,
|
|
||||||
.v_res = 480,
|
|
||||||
.hsync_pulse_width = 10,
|
|
||||||
.hsync_back_porch = 10,
|
|
||||||
.hsync_front_porch = 20,
|
|
||||||
.vsync_pulse_width = 10,
|
|
||||||
.vsync_back_porch = 10,
|
|
||||||
.vsync_front_porch = 10,
|
|
||||||
.flags = {
|
|
||||||
.hsync_idle_low = false,
|
|
||||||
.vsync_idle_low = false,
|
|
||||||
.de_idle_high = false,
|
|
||||||
.pclk_active_neg = false,
|
|
||||||
.pclk_idle_high = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.data_width = 16,
|
|
||||||
.bits_per_pixel = 16,
|
|
||||||
.num_fbs = 2,
|
|
||||||
.bounce_buffer_size_px = 480 * 10,
|
|
||||||
.sram_trans_align = 8,
|
|
||||||
.psram_trans_align = 64,
|
|
||||||
.hsync_gpio_num = GPIO_NUM_16,
|
|
||||||
.vsync_gpio_num = GPIO_NUM_17,
|
|
||||||
.de_gpio_num = GPIO_NUM_18,
|
|
||||||
.pclk_gpio_num = GPIO_NUM_21,
|
|
||||||
.disp_gpio_num = GPIO_NUM_NC,
|
|
||||||
.data_gpio_nums = {
|
|
||||||
GPIO_NUM_4, // B1
|
|
||||||
GPIO_NUM_5, // B2
|
|
||||||
GPIO_NUM_6, // B3
|
|
||||||
GPIO_NUM_7, // B4
|
|
||||||
GPIO_NUM_15, // B5
|
|
||||||
GPIO_NUM_8, // G1
|
|
||||||
GPIO_NUM_20, // G2
|
|
||||||
GPIO_NUM_3, // G3
|
|
||||||
GPIO_NUM_46, // G4
|
|
||||||
GPIO_NUM_9, // G5
|
|
||||||
GPIO_NUM_10, // G6
|
|
||||||
GPIO_NUM_11, // R1
|
|
||||||
GPIO_NUM_12, // R2
|
|
||||||
GPIO_NUM_13, // R3
|
|
||||||
GPIO_NUM_14, // R4
|
|
||||||
GPIO_NUM_0 // R5
|
|
||||||
},
|
|
||||||
.flags = {
|
|
||||||
.disp_active_low = false,
|
|
||||||
.refresh_on_demand = false,
|
|
||||||
.fb_in_psram = true,
|
|
||||||
.double_fb = true,
|
|
||||||
.no_fb = false,
|
|
||||||
.bb_invalidate_cache = true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
st7701_vendor_config_t vendor_config = {
|
|
||||||
.init_cmds = st7701_lcd_init_cmds,
|
|
||||||
.init_cmds_size = sizeof(st7701_lcd_init_cmds) / sizeof(st7701_lcd_init_cmd_t),
|
|
||||||
.rgb_config = &rgb_config,
|
|
||||||
.flags = {
|
|
||||||
.use_mipi_interface = 0,
|
|
||||||
.mirror_by_cmd = 1,
|
|
||||||
.auto_del_panel_io = 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const esp_lcd_panel_dev_config_t panel_config = {
|
|
||||||
.reset_gpio_num = GPIO_NUM_NC,
|
|
||||||
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB,
|
|
||||||
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
|
||||||
.bits_per_pixel = 16,
|
|
||||||
.flags = {
|
|
||||||
.reset_active_high = false,
|
|
||||||
},
|
|
||||||
.vendor_config = &vendor_config,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (esp_lcd_new_panel_st7701(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "Failed to create panel");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "Failed to reset panel");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "Failed to init panel");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (esp_lcd_panel_invert_color(panelHandle, false) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "Failed to invert color");
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_lcd_panel_set_gap(panelHandle, 0, 0);
|
|
||||||
|
|
||||||
if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
|
|
||||||
TT_LOG_E(TAG, "Failed to turn display on");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
lvgl_port_display_cfg_t St7701Display::getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) {
|
|
||||||
return {
|
|
||||||
.io_handle = ioHandle,
|
|
||||||
.panel_handle = panelHandle,
|
|
||||||
.control_handle = nullptr,
|
|
||||||
.buffer_size = (480 * 480),
|
|
||||||
.double_buffer = true,
|
|
||||||
.trans_size = 0,
|
|
||||||
.hres = 480,
|
|
||||||
.vres = 480,
|
|
||||||
.monochrome = false,
|
|
||||||
.rotation = {
|
|
||||||
.swap_xy = false,
|
|
||||||
.mirror_x = false,
|
|
||||||
.mirror_y = false,
|
|
||||||
},
|
|
||||||
.color_format = LV_COLOR_FORMAT_RGB565,
|
|
||||||
.flags = {
|
|
||||||
.buff_dma = false,
|
|
||||||
.buff_spiram = true,
|
|
||||||
.sw_rotate = false,
|
|
||||||
.swap_bytes = false,
|
|
||||||
.full_refresh = false,
|
|
||||||
.direct_mode = false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
lvgl_port_display_rgb_cfg_t St7701Display::getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) {
|
|
||||||
return {
|
|
||||||
.flags = {
|
|
||||||
.bb_mode = true,
|
|
||||||
.avoid_tearing = false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable St7701Display::getTouchDevice() {
|
|
||||||
if (touchDevice == nullptr) {
|
|
||||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
480,
|
|
||||||
480
|
|
||||||
);
|
|
||||||
|
|
||||||
touchDevice = std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
return touchDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
void St7701Display::setBacklightDuty(uint8_t backlightDuty) {
|
|
||||||
driver::pwmbacklight::setBacklightDuty(backlightDuty);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/Mutex.h>
|
|
||||||
|
|
||||||
#include <EspLcdDisplay.h>
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
class St7701Display final : public EspLcdDisplay {
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable touchDevice;
|
|
||||||
|
|
||||||
bool createIoHandle(esp_lcd_panel_io_handle_t& outHandle) override;
|
|
||||||
|
|
||||||
bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t& panelHandle) override;
|
|
||||||
|
|
||||||
lvgl_port_display_cfg_t getLvglPortDisplayConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) override;
|
|
||||||
|
|
||||||
bool isRgbPanel() const override { return true; }
|
|
||||||
|
|
||||||
lvgl_port_display_rgb_cfg_t getLvglPortDisplayRgbConfig(esp_lcd_panel_io_handle_t ioHandle, esp_lcd_panel_handle_t panelHandle) override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
St7701Display() : EspLcdDisplay(std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive)) {}
|
|
||||||
|
|
||||||
std::string getName() const override { return "ST7701S"; }
|
|
||||||
|
|
||||||
std::string getDescription() const override { return "ST7701S RGB display"; }
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override;
|
|
||||||
|
|
||||||
void setBacklightDuty(uint8_t backlightDuty) override;
|
|
||||||
|
|
||||||
bool supportsBacklightDuty() const override { return true; }
|
|
||||||
|
|
||||||
// TODO: Find out why it crashes
|
|
||||||
bool supportsDisplayDriver() const override { return false; }
|
|
||||||
};
|
|
||||||
@@ -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 RgbDisplay GT911 PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#include "PwmBacklight.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
// Display backlight
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_2, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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,105 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <RgbDisplay.h>
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
|
||||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
|
||||||
// or INT = NC, schematic and other info floating around is kinda conflicting...
|
|
||||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
800,
|
|
||||||
480
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
constexpr uint32_t bufferPixels = 800 * 10;
|
|
||||||
|
|
||||||
esp_lcd_rgb_panel_config_t rgb_panel_config = {
|
|
||||||
.clk_src = LCD_CLK_SRC_DEFAULT,
|
|
||||||
.timings = {
|
|
||||||
.pclk_hz = 16000000,
|
|
||||||
.h_res = 800,
|
|
||||||
.v_res = 480,
|
|
||||||
.hsync_pulse_width = 4,
|
|
||||||
.hsync_back_porch = 8,
|
|
||||||
.hsync_front_porch = 8,
|
|
||||||
.vsync_pulse_width = 4,
|
|
||||||
.vsync_back_porch = 8,
|
|
||||||
.vsync_front_porch = 8,
|
|
||||||
.flags = {
|
|
||||||
.hsync_idle_low = false,
|
|
||||||
.vsync_idle_low = false,
|
|
||||||
.de_idle_high = false,
|
|
||||||
.pclk_active_neg = true,
|
|
||||||
.pclk_idle_high = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.data_width = 16,
|
|
||||||
.bits_per_pixel = 0,
|
|
||||||
.num_fbs = 2,
|
|
||||||
.bounce_buffer_size_px = bufferPixels,
|
|
||||||
.sram_trans_align = 8,
|
|
||||||
.psram_trans_align = 64,
|
|
||||||
.hsync_gpio_num = GPIO_NUM_39,
|
|
||||||
.vsync_gpio_num = GPIO_NUM_41,
|
|
||||||
.de_gpio_num = GPIO_NUM_40 ,
|
|
||||||
.pclk_gpio_num = GPIO_NUM_42,
|
|
||||||
.disp_gpio_num = GPIO_NUM_NC,
|
|
||||||
.data_gpio_nums = {
|
|
||||||
GPIO_NUM_8, // B3
|
|
||||||
GPIO_NUM_3, // B4
|
|
||||||
GPIO_NUM_46, // B5
|
|
||||||
GPIO_NUM_9, // B6
|
|
||||||
GPIO_NUM_1, // B7
|
|
||||||
GPIO_NUM_5, // G2
|
|
||||||
GPIO_NUM_6, // G3
|
|
||||||
GPIO_NUM_7, // G4
|
|
||||||
GPIO_NUM_15, // G5
|
|
||||||
GPIO_NUM_16, // G6
|
|
||||||
GPIO_NUM_4, // G7
|
|
||||||
GPIO_NUM_45, // R3
|
|
||||||
GPIO_NUM_48, // R4
|
|
||||||
GPIO_NUM_47, // R5
|
|
||||||
GPIO_NUM_21, // R6
|
|
||||||
GPIO_NUM_14, // R7
|
|
||||||
},
|
|
||||||
.flags = {
|
|
||||||
.disp_active_low = false,
|
|
||||||
.refresh_on_demand = false,
|
|
||||||
.fb_in_psram = true,
|
|
||||||
.double_fb = true,
|
|
||||||
.no_fb = false,
|
|
||||||
.bb_invalidate_cache = false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
RgbDisplay::BufferConfiguration buffer_config = {
|
|
||||||
.size = (800 * 480),
|
|
||||||
.useSpi = true,
|
|
||||||
.doubleBuffer = true,
|
|
||||||
.bounceBufferMode = true,
|
|
||||||
.avoidTearing = false
|
|
||||||
};
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<RgbDisplay::Configuration>(
|
|
||||||
rgb_panel_config,
|
|
||||||
buffer_config,
|
|
||||||
touch,
|
|
||||||
LV_COLOR_FORMAT_RGB565,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
driver::pwmbacklight::setBacklightDuty
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<RgbDisplay>(std::move(configuration));
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_10,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot
|
|
||||||
);
|
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(config)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility esp_lvgl_port ILI934x XPT2046SoftSPI PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(LCD_BACKLIGHT_PIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
static tt::hal::DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.i2c = {},
|
|
||||||
.spi = {
|
|
||||||
tt::hal::spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_13,
|
|
||||||
.miso_io_num = GPIO_NUM_12,
|
|
||||||
.sclk_io_num = GPIO_NUM_14,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = tt::hal::spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
},
|
|
||||||
tt::hal::spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_23,
|
|
||||||
.miso_io_num = GPIO_NUM_19,
|
|
||||||
.sclk_io_num = GPIO_NUM_18,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 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()
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Xpt2046SoftSpi.h>
|
|
||||||
#include <Ili934xDisplay.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <Tactility/hal/touch/TouchDevice.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto config = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
|
||||||
TOUCH_MOSI_PIN,
|
|
||||||
TOUCH_MISO_PIN,
|
|
||||||
TOUCH_SCK_PIN,
|
|
||||||
TOUCH_CS_PIN,
|
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
LCD_VERTICAL_RESOLUTION,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Xpt2046SoftSpi>(std::move(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
Ili934xDisplay::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = true,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = false,
|
|
||||||
.swapBytes = true,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC,
|
|
||||||
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 40'000'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = (LCD_VERTICAL_RESOLUTION / 10);
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = (LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT);
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
// Touch (Software SPI)
|
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
|
||||||
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
|
||||||
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
|
||||||
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
|
||||||
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
|
||||||
|
|
||||||
// Backlight
|
|
||||||
constexpr auto LCD_BACKLIGHT_PIN = GPIO_NUM_21;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -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 ST7789 XPT2046 PwmBacklight EstimatedPower driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/Power.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(DISPLAY_BACKLIGHT_PIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
static tt::hal::DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createPower(),
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.i2c = {
|
|
||||||
tt::hal::i2c::Configuration {
|
|
||||||
.name = "External",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_32,
|
|
||||||
.scl_io_num = GPIO_NUM_25,
|
|
||||||
.sda_pullup_en = false,
|
|
||||||
.scl_pullup_en = false,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// Display
|
|
||||||
.spi = {
|
|
||||||
tt::hal::spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_13,
|
|
||||||
.miso_io_num = GPIO_NUM_12,
|
|
||||||
.sclk_io_num = GPIO_NUM_14,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = DISPLAY_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()
|
|
||||||
},
|
|
||||||
// SD Card
|
|
||||||
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 = 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,51 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Xpt2046Touch.h>
|
|
||||||
#include <St7789Display.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <Tactility/hal/touch/TouchDevice.h>
|
|
||||||
|
|
||||||
// Create the XPT2046 touch device (hardware/esp_lcd driver)
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto config = std::make_unique<Xpt2046Touch::Configuration>(
|
|
||||||
DISPLAY_SPI_HOST, // spi device / bus (SPI2_HOST)
|
|
||||||
TOUCH_CS_PIN, // touch CS (IO33)
|
|
||||||
(uint16_t)DISPLAY_HORIZONTAL_RESOLUTION, // x max
|
|
||||||
(uint16_t)DISPLAY_VERTICAL_RESOLUTION, // y max
|
|
||||||
false, // swapXy
|
|
||||||
true, // mirrorX
|
|
||||||
true // mirrorY
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Xpt2046Touch>(std::move(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
// Create the ST7789 panel configuration
|
|
||||||
St7789Display::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = DISPLAY_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = DISPLAY_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = false,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = false,
|
|
||||||
.bufferSize = DISPLAY_DRAW_BUFFER_SIZE, // 0 -> default 1/10 screen
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC,
|
|
||||||
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR // BGR for this display
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the SPI configuration (from EspLcdSpiDisplay base class)
|
|
||||||
auto spi_configuration = std::make_shared<EspLcdSpiDisplay::SpiConfiguration>(EspLcdSpiDisplay::SpiConfiguration {
|
|
||||||
.spiHostDevice = DISPLAY_SPI_HOST,
|
|
||||||
.csPin = DISPLAY_PIN_CS,
|
|
||||||
.dcPin = DISPLAY_PIN_DC,
|
|
||||||
.pixelClockFrequency = 40'000'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "driver/spi_common.h"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
// Display (ST7789P3 on this board)
|
|
||||||
constexpr auto DISPLAY_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto DISPLAY_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto DISPLAY_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto DISPLAY_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto DISPLAY_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto DISPLAY_DRAW_BUFFER_HEIGHT = (DISPLAY_VERTICAL_RESOLUTION / 10);
|
|
||||||
constexpr auto DISPLAY_DRAW_BUFFER_SIZE = (DISPLAY_HORIZONTAL_RESOLUTION * DISPLAY_DRAW_BUFFER_HEIGHT);
|
|
||||||
constexpr auto DISPLAY_BACKLIGHT_PIN = GPIO_NUM_27;
|
|
||||||
constexpr auto DISPLAY_SPI_TRANSFER_SIZE_LIMIT = DISPLAY_DRAW_BUFFER_SIZE * sizeof(lv_color_t);
|
|
||||||
|
|
||||||
// Touch (XPT2046, resistive, shared SPI with display)
|
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_12;
|
|
||||||
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_13;
|
|
||||||
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_14;
|
|
||||||
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
|
||||||
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#include "Power.h"
|
|
||||||
|
|
||||||
#include <ChargeFromAdcVoltage.h>
|
|
||||||
#include <EstimatedPower.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower() {
|
|
||||||
ChargeFromAdcVoltage::Configuration configuration;
|
|
||||||
// 2.0 ratio, but +.11 added as display voltage sag compensation.
|
|
||||||
configuration.adcMultiplier = 2.11;
|
|
||||||
|
|
||||||
return std::make_shared<EstimatedPower>(configuration);
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <Tactility/hal/power/PowerDevice.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
using SdCardDevice = tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SD_CS_PIN, // CS pin (IO5 on the module)
|
|
||||||
GPIO_NUM_NC, // MOSI override: leave NC to use SPI host pins
|
|
||||||
GPIO_NUM_NC, // MISO override: leave NC
|
|
||||||
GPIO_NUM_NC, // SCLK override: leave NC
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SD_SPI_HOST // SPI host for SD card (SPI3_HOST)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "driver/spi_common.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
// SD card (microSD)
|
|
||||||
constexpr auto SD_CS_PIN = GPIO_NUM_5;
|
|
||||||
constexpr auto SD_SPI_HOST = SPI3_HOST;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -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 ST7789 CST816S PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
//Set the RGB Led Pins to output and turn them off
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green
|
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); //Blue
|
|
||||||
|
|
||||||
//0 on, 1 off... 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(LCD_PIN_BACKLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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 = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
},
|
|
||||||
//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,42 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Cst816Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <St7789Display.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
auto configuration = std::make_unique<Cst816sTouch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
LCD_VERTICAL_RESOLUTION
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Cst816sTouch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
St7789Display::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = false,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = false,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 62'500'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
#include <memory>
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
|
|
||||||
// Display backlight (PWM)
|
|
||||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27;
|
|
||||||
|
|
||||||
// Display
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -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 RgbDisplay GT911 PwmBacklight driver vfs fatfs
|
|
||||||
)
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#include "PwmBacklight.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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,105 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Gt911Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <RgbDisplay.h>
|
|
||||||
#include <Tactility/Log.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
|
||||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
|
||||||
// or INT = NC, schematic and other info floating around is kinda conflicting...
|
|
||||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
800,
|
|
||||||
480
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
auto touch = createTouch();
|
|
||||||
|
|
||||||
constexpr uint32_t bufferPixels = 800 * 10;
|
|
||||||
|
|
||||||
esp_lcd_rgb_panel_config_t rgb_panel_config = {
|
|
||||||
.clk_src = LCD_CLK_SRC_DEFAULT,
|
|
||||||
.timings = {
|
|
||||||
.pclk_hz = 16000000,
|
|
||||||
.h_res = 800,
|
|
||||||
.v_res = 480,
|
|
||||||
.hsync_pulse_width = 4,
|
|
||||||
.hsync_back_porch = 8,
|
|
||||||
.hsync_front_porch = 8,
|
|
||||||
.vsync_pulse_width = 4,
|
|
||||||
.vsync_back_porch = 8,
|
|
||||||
.vsync_front_porch = 8,
|
|
||||||
.flags = {
|
|
||||||
.hsync_idle_low = false,
|
|
||||||
.vsync_idle_low = false,
|
|
||||||
.de_idle_high = false,
|
|
||||||
.pclk_active_neg = true,
|
|
||||||
.pclk_idle_high = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.data_width = 16,
|
|
||||||
.bits_per_pixel = 0,
|
|
||||||
.num_fbs = 2,
|
|
||||||
.bounce_buffer_size_px = bufferPixels,
|
|
||||||
.sram_trans_align = 8,
|
|
||||||
.psram_trans_align = 64,
|
|
||||||
.hsync_gpio_num = GPIO_NUM_39,
|
|
||||||
.vsync_gpio_num = GPIO_NUM_41,
|
|
||||||
.de_gpio_num = GPIO_NUM_40 ,
|
|
||||||
.pclk_gpio_num = GPIO_NUM_42,
|
|
||||||
.disp_gpio_num = GPIO_NUM_NC,
|
|
||||||
.data_gpio_nums = {
|
|
||||||
GPIO_NUM_8, // B3
|
|
||||||
GPIO_NUM_3, // B4
|
|
||||||
GPIO_NUM_46, // B5
|
|
||||||
GPIO_NUM_9, // B6
|
|
||||||
GPIO_NUM_1, // B7
|
|
||||||
GPIO_NUM_5, // G2
|
|
||||||
GPIO_NUM_6, // G3
|
|
||||||
GPIO_NUM_7, // G4
|
|
||||||
GPIO_NUM_15, // G5
|
|
||||||
GPIO_NUM_16, // G6
|
|
||||||
GPIO_NUM_4, // G7
|
|
||||||
GPIO_NUM_45, // R3
|
|
||||||
GPIO_NUM_48, // R4
|
|
||||||
GPIO_NUM_47, // R5
|
|
||||||
GPIO_NUM_21, // R6
|
|
||||||
GPIO_NUM_14, // R7
|
|
||||||
},
|
|
||||||
.flags = {
|
|
||||||
.disp_active_low = false,
|
|
||||||
.refresh_on_demand = false,
|
|
||||||
.fb_in_psram = true,
|
|
||||||
.double_fb = true,
|
|
||||||
.no_fb = false,
|
|
||||||
.bb_invalidate_cache = false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
RgbDisplay::BufferConfiguration buffer_config = {
|
|
||||||
.size = (800 * 480),
|
|
||||||
.useSpi = true,
|
|
||||||
.doubleBuffer = true,
|
|
||||||
.bounceBufferMode = true,
|
|
||||||
.avoidTearing = false
|
|
||||||
};
|
|
||||||
|
|
||||||
auto configuration = std::make_unique<RgbDisplay::Configuration>(
|
|
||||||
rgb_panel_config,
|
|
||||||
buffer_config,
|
|
||||||
touch,
|
|
||||||
LV_COLOR_FORMAT_RGB565,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
driver::pwmbacklight::setBacklightDuty
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<RgbDisplay>(std::move(configuration));
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_10,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI2_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(config)
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|
||||||
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Source"
|
|
||||||
REQUIRES Tactility FT5x06 ST7789 PwmBacklight driver
|
|
||||||
)
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
#include "PwmBacklight.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_38);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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 = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock() // 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,46 +0,0 @@
|
|||||||
#include "Display.h"
|
|
||||||
|
|
||||||
#include <Ft5x06Touch.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <St7789Display.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
|
||||||
// Note for future changes: Reset pin is 48 and interrupt pin is 47
|
|
||||||
auto configuration = std::make_unique<Ft5x06Touch::Configuration>(
|
|
||||||
I2C_NUM_0,
|
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
LCD_VERTICAL_RESOLUTION,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<Ft5x06Touch>(std::move(configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
||||||
St7789Display::Configuration panel_configuration = {
|
|
||||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
||||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
||||||
.gapX = 0,
|
|
||||||
.gapY = 0,
|
|
||||||
.swapXY = false,
|
|
||||||
.mirrorX = false,
|
|
||||||
.mirrorY = false,
|
|
||||||
.invertColor = true,
|
|
||||||
.bufferSize = LCD_BUFFER_SIZE,
|
|
||||||
.touch = createTouch(),
|
|
||||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
||||||
.resetPin = GPIO_NUM_NC
|
|
||||||
};
|
|
||||||
|
|
||||||
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
|
||||||
.spiHostDevice = LCD_SPI_HOST,
|
|
||||||
.csPin = LCD_PIN_CS,
|
|
||||||
.dcPin = LCD_PIN_DC,
|
|
||||||
.pixelClockFrequency = 62'500'000,
|
|
||||||
.transactionQueueDepth = 10
|
|
||||||
});
|
|
||||||
|
|
||||||
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
|
||||||
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <driver/spi_common.h>
|
|
||||||
|
|
||||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_40;
|
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_41; // RS
|
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|
||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
|
||||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
CROWPANEL_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -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 ILI9488 GT911 PwmBacklight driver
|
|
||||||
)
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
#include "devices/Display.h"
|
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
|
|
||||||
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
static bool initBoot() {
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_38);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
createDisplay(),
|
|
||||||
createSdCard()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user