mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Merge pull request #251 from HASwitchPlate/freetype
Merge freetype #249
This commit is contained in:
commit
c5d405cafa
112
.github/workflows/build.yaml
vendored
112
.github/workflows/build.yaml
vendored
@ -9,32 +9,44 @@ on:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build_esp32:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
environments:
|
||||
- d1-mini-esp8266_ili9341
|
||||
- arduitouch-esp32_ili9341
|
||||
- d1-mini-esp32_ili9341
|
||||
- esp32-one_st7796
|
||||
- esp32-touchdown
|
||||
- freetouchdeck
|
||||
- huzzah32-featherwing-24
|
||||
- huzzah32-featherwing-35
|
||||
- lanbon_l8
|
||||
- lolin-d32-pro_ili9341
|
||||
- m5stack-core2
|
||||
- makerfabs-tft35-cap
|
||||
- ttgo-t7-v1.5_ili9341
|
||||
- wt32-sc01
|
||||
- yeacreate-nscreen32
|
||||
- linux_sdl_64bits
|
||||
environment:
|
||||
- env: arduitouch-esp32_ili9341
|
||||
out: arduitouch
|
||||
- env: d1-mini-esp32_ili9341
|
||||
out: d1-mini-esp32
|
||||
- env: esp32-one_st7796
|
||||
out: esp32-one
|
||||
- env: esp32-touchdown
|
||||
out: esp32-touchdown
|
||||
- env: freetouchdeck
|
||||
out: freetouchdeck
|
||||
- out: featherwing
|
||||
env: "huzzah32-featherwing-24 -e huzzah32-featherwing-35"
|
||||
- env: lanbon_l8
|
||||
out: lanbon_l8
|
||||
- env: lolin-d32-pro_ili9341
|
||||
out: lolin-d32-pro
|
||||
- env: m5stack-core2
|
||||
out: m5stack
|
||||
- env: makerfabs-tft35-cap
|
||||
out: makerfabs-tft
|
||||
- env: ttgo-t7-v1.5_ili9341
|
||||
out: ttgo-t7
|
||||
- env: wt32-sc01
|
||||
out: wt32-sc01
|
||||
- env: yeacreate-nscreen32
|
||||
out: yeacreate
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
@ -53,17 +65,9 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade platformio
|
||||
- name: Enable ESP platforms from platformio_override-template.ini
|
||||
- name: Enable ESP32 platforms from platformio_override-template.ini
|
||||
run: |
|
||||
sed 's/; user_setups\/esp/user_setups\/esp/g' platformio_override-template.ini > platformio_override.ini
|
||||
- name: Enable Linux platform from platformio_override.ini
|
||||
run: |
|
||||
sed -i 's/; user_setups\/linux/user_setups\/linux/g' platformio_override.ini
|
||||
mkdir -p .pio/libdeps/linux_sdl_64bits/paho/src
|
||||
- name: Install SDL2 library
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsdl2-dev
|
||||
sed 's/; user_setups\/esp32/user_setups\/esp32/g' platformio_override-template.ini > platformio_override.ini
|
||||
- name: List all files in current folder
|
||||
run: |
|
||||
ls -la
|
||||
@ -71,11 +75,11 @@ jobs:
|
||||
run: |
|
||||
cat platformio_override.ini
|
||||
- name: Run PlatformIO
|
||||
run: pio run -e ${{ matrix.environments }}
|
||||
run: pio run -e ${{ matrix.environment.env }}
|
||||
- name: Upload output file
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ matrix.environments }}
|
||||
name: ${{ matrix.environment.out }}
|
||||
path: build_output/firmware/*.bin
|
||||
#- name: Create release and upload firmware
|
||||
# run: |
|
||||
@ -88,3 +92,51 @@ jobs:
|
||||
# hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
linux_build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Cache PlatformIO
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade platformio
|
||||
- name: Enable Linux platform from platformio_override.ini
|
||||
run: |
|
||||
sed 's/; user_setups\/linux/user_setups\/linux/g' platformio_override-template.ini > platformio_override.ini
|
||||
mkdir -p .pio/libdeps/linux_sdl_64bits/paho/src
|
||||
- name: Install SDL2 library
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsdl2-dev
|
||||
- name: List all files in current folder
|
||||
run: |
|
||||
ls -la
|
||||
- name: Cat platformio_override.ini
|
||||
run: |
|
||||
cat platformio_override.ini
|
||||
- name: Enable Linux platform from platformio_override.ini
|
||||
run: |
|
||||
sed -i 's/; user_setups\/linux/user_setups\/linux/g' platformio_override.ini
|
||||
mkdir -p .pio/libdeps/linux_sdl_64bits/paho/src
|
||||
- name: Install SDL2 library
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsdl2-dev
|
||||
- name: Run PlatformIO
|
||||
run: pio run -e linux_sdl_64bits
|
74
.github/workflows/build_linux.yaml
vendored
Normal file
74
.github/workflows/build_linux.yaml
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
name: Build branch
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
environments:
|
||||
- linux_sdl_64bits
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Cache PlatformIO
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade platformio
|
||||
# - name: Enable ESP platforms from platformio_override-template.ini
|
||||
# run: |
|
||||
# sed 's/; user_setups\/esp/user_setups\/esp/g' platformio_override-template.ini > platformio_override.ini
|
||||
- name: Enable Linux platform from platformio_override.ini
|
||||
run: |
|
||||
sed -i 's/; user_setups\/linux/user_setups\/linux/g' platformio_override.ini
|
||||
mkdir -p .pio/libdeps/linux_sdl_64bits/paho/src
|
||||
- name: Install SDL2 library
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsdl2-dev
|
||||
- name: List all files in current folder
|
||||
run: |
|
||||
ls -la
|
||||
- name: Cat platformio_override.ini
|
||||
run: |
|
||||
cat platformio_override.ini
|
||||
- name: Run PlatformIO
|
||||
run: pio run -e ${{ matrix.environments }}
|
||||
# - name: Upload output file
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: ${{ matrix.environments }}
|
||||
# path: build_output/firmware/*.bin
|
||||
#- name: Create release and upload firmware
|
||||
# run: |
|
||||
# set -x
|
||||
# assets=()
|
||||
# for asset in build_output/firmware/*.bin; do
|
||||
# assets+=("-a" "$asset")
|
||||
# done
|
||||
# tag_name="${GITHUB_REF##*/}"
|
||||
# hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -48,7 +48,7 @@ jobs:
|
||||
run: |
|
||||
cat platformio_override.ini
|
||||
- name: Run PlatformIO
|
||||
run: pio run -e lolin-d32-pro_ili9341 -e arduitouch-esp32_ili9341 -e esp32-one_st7796 -e makerfabs-tft35-cap -e yeacreate-nscreen32 -e d1-mini-esp32_ili9341 -e esp32-touchdown -e freetouchdeck -e huzzah32-featherwing-24 -e huzzah32-featherwing-35 -e lanbon_l8 -e m5stack-core2 -e wt32-sc01 -e d1-mini-esp8266_ili9341 -e linux_sdl_64bits
|
||||
run: pio run -e lolin-d32-pro_ili9341 -e arduitouch-esp32_ili9341 -e esp32-one_st7796 -e makerfabs-tft35-cap -e yeacreate-nscreen32 -e d1-mini-esp32_ili9341 -e esp32-touchdown -e freetouchdeck -e huzzah32-featherwing-24 -e huzzah32-featherwing-35 -e lanbon_l8 -e m5stack-core2 -e wt32-sc01 -e linux_sdl_64bits
|
||||
- name: Upload output file
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,6 +10,8 @@ data/*
|
||||
!data/vars.css
|
||||
!data/style.css
|
||||
!data/style.css.gz
|
||||
!data/script.js
|
||||
!data/script.js.gz
|
||||
src/user_setups/active/*
|
||||
include/user_config_override.h
|
||||
src/user_config_override.h
|
||||
|
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
[submodule "lib/freetype"]
|
||||
path = lib/freetype
|
||||
url = https://github.com/fvanroie/freetype
|
||||
|
@ -1,5 +1,33 @@
|
||||
# openHASP Changelog
|
||||
|
||||
## v0.7.0
|
||||
|
||||
### Fonts
|
||||
- Use FreeType fonts from flash
|
||||
- Use LVGL binary fonts from flash, loaded into PSram
|
||||
- Removed defunct .zi font support
|
||||
- Breaking: The UTF codes for the built-in icons have changed from the previous list!
|
||||
- _Breaking: Font ID is replaced by xxxx?_
|
||||
|
||||
### Web UI
|
||||
- Updated to modern responsive design
|
||||
- Allow for a customizible `vars.css`, `style.css`, `script.js` and `edit.htm`
|
||||
- _Selectable dark/light theme?_
|
||||
|
||||
### Commands
|
||||
- Hide cursor during `antiburn` and `idle` if the pointer is enabled
|
||||
|
||||
### Custom component
|
||||
- Expose `antiburn` for the CC
|
||||
- Expose the device URL in discovery messages
|
||||
|
||||
### Architecture
|
||||
- Moved to Arduino 2.0 with native LittleFS library
|
||||
- Moved to ESP-IDF 4.4 with fix for FragAttacks CVEs
|
||||
- Prepare support for ESP32S2
|
||||
- Breaking: Removed support for ESP8266
|
||||
|
||||
|
||||
## v0.6.2
|
||||
|
||||
### Initial Setup
|
||||
|
27
README.md
27
README.md
@ -14,7 +14,7 @@ This project is a re-implementation of the popular HASwitchPlate sketch created
|
||||
The [HASPone][1] project uses a Wemos D1 mini and requires a Nextion/TJC HMI display.
|
||||
This rewrite removes the Nextion/TJC hardware requirement by using the [Light and Versatile Graphics Library][2] on the MCU to drive a commodity display.
|
||||
|
||||
openHASP also adds ESP32 and STM32F4 support to take advantage of the additional hardware capabilities.
|
||||
openHASP uses the ESP32 and STM32F4 to take advantage of the hardware capabilities.
|
||||
|
||||
|
||||
## Demo Screens
|
||||
@ -25,19 +25,18 @@ openHASP also adds ESP32 and STM32F4 support to take advantage of the additional
|
||||
|
||||
## Features
|
||||
|
||||
| Feature (v0.6.x) | ESP8266 | ESP32 | STM32F4
|
||||
|-------------------------|---------|---------|----------
|
||||
| SPI display | :white_check_mark: yes | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Parallel display | :x: no | :white_check_mark: yes | :white_check_mark: yes
|
||||
| PWM Screen dimming | :white_check_mark: yes | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Maximum Page Count | 4 | 12 | 12
|
||||
| [Object Types / Widgets][7]| 20 | 20 | 20
|
||||
| Dynamic Objects | :white_check_mark: yes | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Theme Support | yes | yes | yes
|
||||
| [Custom .zi V5 font][4] | :white_check_mark: yes (latin1) | :white_check_mark: yes (latin1) | no
|
||||
| MDI Icons | :white_check_mark: yes | :white_check_mark: yes | no
|
||||
| [PNG images][8] | :x: no | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Network | :white_check_mark: Wi-Fi | :white_check_mark: Wi-Fi | :white_check_mark: Ethernet
|
||||
| Feature (v0.6.x) | ESP32 | STM32F4
|
||||
|-------------------------|---------|---------
|
||||
| SPI display | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Parallel display | :white_check_mark: yes | :white_check_mark: yes
|
||||
| PWM Screen dimming | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Maximum Page Count | 12 | 12
|
||||
| [Object Types / Widgets][7]| 20 | 20
|
||||
| Dynamic Objects | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Theme Support | yes | yes
|
||||
| MDI Icons | :white_check_mark: yes | :white_check_mark: yes
|
||||
| [PNG images][8] | :white_check_mark: yes | :white_check_mark: yes
|
||||
| Network | :white_check_mark: Wi-Fi | :white_check_mark: Ethernet
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
1
data/script.js
Normal file
1
data/script.js
Normal file
@ -0,0 +1 @@
|
||||
function aref(e){setTimeout(function(){ref("")},1e3*e)}function ref(e){var o=(new Date).getTime();return document.getElementById("bmp").src="?a="+e+"&q="+o,!1}function about(){document.getElementById("doc").innerHTML='<h3>openHASP</h3>Copyright© 2019-2021 Francis Van Roie</br>MIT License</p><p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p><p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p><p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p><hr><p>Based on the previous work of the following open source developers:</p><h3>HASwitchPlate</h3><p>Copyright© 2019 Allen Derusha allen @derusha.org</b></br>MIT License</p><h3>LVGL</h3><p>Copyright© 2021 LVGL Kft</br>MIT License</p><h3>zi Font Engine</h3><p>Copyright© 2020-2021 Francis Van Roie</br>MIT License</p><h3>TFT_eSPI Library</h3><p>Copyright© 2020 Bodmer (https://github.com/Bodmer) All rights reserved.</br>FreeBSD License</p><p><i>includes parts from the <b>Adafruit_GFX library</b></br>Copyright© 2012 Adafruit Industries. All rights reserved</br>BSD License</i></p><h3>ArduinoJson</h3><p>Copyright© 2014-2021 Benoit BLANCHON</br>MIT License</p><h3>PubSubClient</h3><p>Copyright© 2008-2015 Nicholas O'Leary</br>MIT License</p><h3>ArduinoLog</h3><p>Copyright© 2017,2018 Thijs Elenbaas, MrRobot62, rahuldeo2047, NOX73, dhylands, Josha blemasle, mfalkvidd</br>MIT License</p><h3>QR Code generator</h3><p>Copyright© Project Nayuki</br>MIT License</p><h3>AceButton</h3><p>Copyright© 2018 Brian T. Park</br>MIT License</p>'}
|
BIN
data/script.js.gz
Normal file
BIN
data/script.js.gz
Normal file
Binary file not shown.
270
data/style.css
270
data/style.css
@ -1 +1,269 @@
|
||||
:root{--star:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -6 16 16"><line y1="-3" y2="3" stroke="red" transform="rotate(15)"></line><line y1="-3" y2="3" stroke="red" transform="rotate(75)"></line><line y1="-3" y2="3" stroke="red" transform="rotate(-45)"></line></svg>')}a.foot:link,a.foot:visited{color:var(--footfg)}input:not([type=file]){background-color:var(--fldbg);color:var(--fldfg)}input[type=checkbox],input[type=radio]{width:1em}select{background-color:var(--fldbg);color:var(--fldfg)}input:invalid{border:1px solid var(--fldred)}body{font-family:verdana;margin:auto;background:var(--bg);color:var(--txt)}.c,body{text-align:center}.clear{clear:both}.foot{background-color:transparent!important;all:revert;float:right;margin:0;font-size:.6em}.red{background-color:var(--btnred)}.red:focus,.red:hover{background-color:var(--btnredhi)}#doc{text-align:left;margin:0 auto;display:inline-block;color:var(--txt);width:80%;min-width:300px;max-width:600px;display:table}td{font-size:.87rem;padding-bottom:0;padding-top:0}th{padding-top:.5em}*{box-sizing:border-box}a,input,select,textarea{width:100%;padding:12px;border:1px solid #ccc;border-radius:.6rem;resize:vertical}label{padding:12px 18px 12px 0;display:inline-block}.required{background-image:var(--star);background-size:1.5em 1.5em;background-position:right;background-repeat:no-repeat}a,button,input[type=submit]{padding:12px;border:1px solid var(--btnbrd);border-radius:.6rem;background-color:var(--btnbg);color:var(--btnfg);font-size:1rem;width:100%;margin:12px 0;display:flex;align-items:center;justify-content:center;text-align:center;text-decoration:none}a:hover,button:hover,input[type=submit]:hover{background-color:var(--btnbghi)}.container{background-color:var(--grpbg);color:var(--grpfg);border-radius:.6rem;padding:10px;margin:20px 0}.dist{display:flex;justify-content:space-between;width:100%}.dist > a{flex-grow:1;margin:0 6px}.dist>a:first-child{margin-left:0}.dist>a:last-child{margin-right:0}.col-25{float:left;width:25%;text-align:right;margin:0}.col-75{margin:0;float:left;width:75%}.row:after{content:"";display:table;clear:both}.row{font-size:.833rem;margin:5px}.gap,.row:last-of-type{margin:5px 5px 20px}.error,.info,.success,.validation,.warning{border:1px solid;margin:10px auto;padding:15px 10px 15px 50px;background-repeat:no-repeat;background-position:10px center;max-width:500px}.info{color:#00529B;background-color:#BDE5F8}.success{color:#4F8A10;background-color:#DFF2BF}.warning{color:#9F6000;background-color:#FEEFB3}.error{color:#D8000C;background-color:#FFD2D2}@media screen and (max-width:800px){.col-25,.col-75,input[type=submit]{width:100%;margin-top:0}.col-25{text-align:left}label{padding:5px 18px 5px 0}}
|
||||
:root {
|
||||
--star: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -6 16 16"><line y1="-3" y2="3" stroke="red" transform="rotate(15)"></line><line y1="-3" y2="3" stroke="red" transform="rotate(75)"></line><line y1="-3" y2="3" stroke="red" transform="rotate(-45)"></line></svg>');
|
||||
--trash: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" id="mdi-trash-can-outline" width="24" height="24" viewBox="0 0 24 24"><path d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /></svg>')
|
||||
}
|
||||
|
||||
a.foot:link,
|
||||
a.foot:visited {
|
||||
color: var(--footfg)
|
||||
}
|
||||
|
||||
input:not([type=file]) {
|
||||
background-color: var(--fldbg);
|
||||
color: var(--fldfg)
|
||||
}
|
||||
|
||||
input[type=checkbox],
|
||||
input[type=radio] {
|
||||
width: 1em
|
||||
}
|
||||
|
||||
select {
|
||||
background-color: var(--fldbg);
|
||||
color: var(--fldfg)
|
||||
}
|
||||
|
||||
input:invalid {
|
||||
border: 1px solid var(--fldred)
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: verdana;
|
||||
margin: auto;
|
||||
background: var(--bg);
|
||||
color: var(--txt)
|
||||
}
|
||||
|
||||
.c,
|
||||
body {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both
|
||||
}
|
||||
|
||||
.foot {
|
||||
background-color: transparent!important;
|
||||
all: revert;
|
||||
float: right;
|
||||
margin: 0;
|
||||
font-size: .6em
|
||||
}
|
||||
|
||||
#doc>a.red,
|
||||
button.red {
|
||||
background-color: var(--btnred)
|
||||
}
|
||||
|
||||
#doc>a.red:focus,
|
||||
#doc>a.red:hover,
|
||||
button.red:focus,
|
||||
button.red:hover {
|
||||
background-color: var(--btnredhi)
|
||||
}
|
||||
|
||||
#doc {
|
||||
text-align: left;
|
||||
margin: 0 auto;
|
||||
display: inline-block;
|
||||
color: var(--txt);
|
||||
width: 80%;
|
||||
min-width: 300px;
|
||||
max-width: 600px;
|
||||
display: table
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: .87rem;
|
||||
padding-bottom: 0;
|
||||
padding-top: 0
|
||||
}
|
||||
|
||||
th {
|
||||
padding-top: .5em
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: .6rem;
|
||||
resize: vertical
|
||||
}
|
||||
|
||||
label {
|
||||
padding: 12px 18px 12px 0;
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.required {
|
||||
background-image: var(--star);
|
||||
background-size: 1.5em 1.5em;
|
||||
background-position: right;
|
||||
background-repeat: no-repeat
|
||||
}
|
||||
|
||||
.edit::before {
|
||||
content: "\0000a0"
|
||||
}
|
||||
|
||||
.edit {
|
||||
background-image: var(--edit);
|
||||
background-size: 1.5em 1.5em;
|
||||
background-position: left;
|
||||
background-repeat: no-repeat;
|
||||
width: 1.5em;
|
||||
display: inline-block;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
.trash::before {
|
||||
content: "\0000a0"
|
||||
}
|
||||
|
||||
.trash {
|
||||
background-image: var(--trash);
|
||||
background-size: 1.5em 1.5em;
|
||||
background-position: left;
|
||||
background-repeat: no-repeat;
|
||||
width: 1.5em;
|
||||
display: inline-block;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
#doc>a,
|
||||
.dist>a,
|
||||
button,
|
||||
input[type=submit] {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--btnbrd);
|
||||
border-radius: .6rem;
|
||||
background-color: var(--btnbg);
|
||||
color: var(--btnfg);
|
||||
font-size: 1rem;
|
||||
width: 100%;
|
||||
margin: 12px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
#doc>a:hover,
|
||||
.dist>a:hover,
|
||||
button:hover,
|
||||
input[type=submit]:hover {
|
||||
background-color: var(--btnbghi)
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: var(--grpbg);
|
||||
color: var(--grpfg);
|
||||
border-radius: .6rem;
|
||||
padding: 10px;
|
||||
margin: 20px 0
|
||||
}
|
||||
|
||||
.dist {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.dist>a {
|
||||
flex-grow: 1;
|
||||
margin: 0 6px
|
||||
}
|
||||
|
||||
.dist>a:first-child {
|
||||
margin-left: 0
|
||||
}
|
||||
|
||||
.dist>a:last-child {
|
||||
margin-right: 0
|
||||
}
|
||||
|
||||
.col-25 {
|
||||
float: left;
|
||||
width: 25%;
|
||||
text-align: right;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
.col-75 {
|
||||
margin: 0;
|
||||
float: left;
|
||||
width: 75%
|
||||
}
|
||||
|
||||
.row:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both
|
||||
}
|
||||
|
||||
.row {
|
||||
font-size: .833rem;
|
||||
margin: 5px
|
||||
}
|
||||
|
||||
.gap,
|
||||
.row:last-of-type {
|
||||
margin: 5px 5px 20px
|
||||
}
|
||||
|
||||
.error,
|
||||
.info,
|
||||
.success,
|
||||
.validation,
|
||||
.warning {
|
||||
border: 1px solid;
|
||||
margin: 10px auto;
|
||||
padding: 15px 10px 15px 50px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 10px center;
|
||||
max-width: 500px
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #00529B;
|
||||
background-color: #BDE5F8
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #4F8A10;
|
||||
background-color: #DFF2BF
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: #9F6000;
|
||||
background-color: #FEEFB3
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #D8000C;
|
||||
background-color: #FFD2D2
|
||||
}
|
||||
|
||||
@media screen and (max-width:800px) {
|
||||
.col-25,
|
||||
.col-75,
|
||||
input[type=submit] {
|
||||
width: 100%;
|
||||
margin-top: 0
|
||||
}
|
||||
.col-25 {
|
||||
text-align: left
|
||||
}
|
||||
label {
|
||||
padding: 5px 18px 5px 0
|
||||
}
|
||||
}
|
Binary file not shown.
@ -11,6 +11,17 @@
|
||||
// language specific defines
|
||||
#include "lang/lang.h"
|
||||
|
||||
// Lengths
|
||||
#ifndef MAX_PASSWORD_LENGTH
|
||||
#define MAX_PASSWORD_LENGTH 64
|
||||
#endif
|
||||
#ifndef MAX_USERNAME_LENGTH
|
||||
#define MAX_USERNAME_LENGTH 32
|
||||
#endif
|
||||
#ifndef MAX_HOSTNAME_LENGTH
|
||||
#define MAX_HOSTNAME_LENGTH 128
|
||||
#endif
|
||||
|
||||
// TFT defines
|
||||
#ifndef TFT_BACKLIGHT_ON
|
||||
#define TFT_BACKLIGHT_ON HIGH
|
||||
@ -192,7 +203,7 @@
|
||||
|
||||
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
#include "lv_zifont.h"
|
||||
// #include "lv_zifont.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* lodepng_calloc(size_t num,size_t size);
|
||||
void* lodepng_malloc(size_t size);
|
||||
void* lodepng_realloc(void* ptr, size_t new_size);
|
||||
void lodepng_free(void* ptr);
|
1
lib/freetype
Submodule
1
lib/freetype
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit aa40dd17b51500448a5601478a4278d21ac74386
|
21
lib/lv_lib_freetype/LICENSE
Normal file
21
lib/lv_lib_freetype/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 LittlevGL
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
44
lib/lv_lib_freetype/README.md
Normal file
44
lib/lv_lib_freetype/README.md
Normal file
@ -0,0 +1,44 @@
|
||||
# FreeType integration with LVGL
|
||||
Interface to FreeType to generate font bitmaps run time
|
||||
|
||||
## Install FreeType
|
||||
- Download Freetype from [here](https://sourceforge.net/projects/freetype/files/)
|
||||
- `make`
|
||||
- `sudo make install`
|
||||
|
||||
## Add FreeType to your project
|
||||
- Add include path: `/usr/include/freetype2` (for GCC: `-I/usr/include/freetype2 -L/usr/local/lib`)
|
||||
- Add library: `freetype` (for GCC: `-L/usr/local/lib -lfreetype`)
|
||||
|
||||
## Usage in LVGL
|
||||
|
||||
To enable cache, set`LV_USE_FT_CACHE_MANAGER 1`in lv_freetype.h.
|
||||
|
||||
```c
|
||||
/* init freetype library */
|
||||
lv_freetype_init(64, 1, 0);
|
||||
|
||||
/*Create a font*/
|
||||
lv_ft_info_t info;
|
||||
info.name = "./lv_lib_freetype/arial.ttf"";
|
||||
info.size = 16;
|
||||
info.style = FT_FONT_STYLE_NORMAL;
|
||||
lv_ft_font_init(&info);
|
||||
|
||||
/*Create style with the new font*/
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_style_set_text_font(&style, LV_STATE_DEFAULT, info.font);
|
||||
|
||||
/*Create a label with the new style*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_add_style(label, LV_LABEL_PART_MAIN, &style);
|
||||
lv_label_set_text(label, "Hello world");
|
||||
|
||||
/* free font */
|
||||
//lv_ft_font_destroy(info.font);
|
||||
```
|
||||
|
||||
## Learn more
|
||||
- FreeType [tutorial](https://www.freetype.org/freetype2/docs/tutorial/step1.html)
|
||||
- LVGL's [font interface](https://docs.lvgl.io/v7/en/html/overview/font.html#add-a-new-font-engine)
|
BIN
lib/lv_lib_freetype/arial.ttf
Normal file
BIN
lib/lv_lib_freetype/arial.ttf
Normal file
Binary file not shown.
473
lib/lv_lib_freetype/lv_freetype.c
Normal file
473
lib/lv_lib_freetype/lv_freetype.c
Normal file
@ -0,0 +1,473 @@
|
||||
/**
|
||||
* @file lv_freetype.c
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_freetype.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#if CONFIG_FREERTOS_UNICORE
|
||||
#define ARDUINO_RUNNING_CORE 0
|
||||
#else
|
||||
#define ARDUINO_RUNNING_CORE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FreeType requires up to 32KB of stack to run, which overflows the stack of 8KB.
|
||||
*
|
||||
* We delegate to a FreeRTOS sub-task with a bigger stack.
|
||||
*
|
||||
* Parameters are passed via a RequestQueue, and response back via ResponseQueue
|
||||
*
|
||||
* The function that uses this scheme is `get_glyph_dsc_cb()``
|
||||
*
|
||||
*/
|
||||
|
||||
QueueHandle_t FTRequestQueue;
|
||||
QueueHandle_t FTResponseQueue;
|
||||
TaskHandle_t FTTaskHandle;
|
||||
void FT_loop_task(void *pvParameters);
|
||||
|
||||
typedef struct FT_glyph_dsc_request {
|
||||
const lv_font_t * font;
|
||||
lv_font_glyph_dsc_t * dsc_out;
|
||||
uint32_t unicode_letter;
|
||||
uint32_t unicode_letter_next;
|
||||
} FT_glyph_dsc_request;
|
||||
|
||||
typedef bool FT_glyph_dsc_response;
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static FT_Face face_find_in_list(lv_ft_info_t *info);
|
||||
static void face_add_to_list(FT_Face face);
|
||||
static void face_remove_from_list(FT_Face face);
|
||||
|
||||
static void face_generic_finalizer(void* object);
|
||||
static bool get_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out,
|
||||
uint32_t unicode_letter, uint32_t unicode_letter_next);
|
||||
static const uint8_t * get_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter);
|
||||
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
static FT_Error font_face_requester(FTC_FaceID face_id,
|
||||
FT_Library library_is,FT_Pointer req_data,FT_Face* aface);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static FT_Library library;
|
||||
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
static FTC_Manager cache_manager;
|
||||
static FTC_CMapCache cmap_cache;
|
||||
static FTC_SBitCache sbit_cache;
|
||||
static FTC_SBit sbit;
|
||||
#endif
|
||||
|
||||
static lv_faces_control_t face_control;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
bool lv_freetype_init(FT_UInt max_faces, FT_UInt max_sizes, FT_ULong max_bytes)
|
||||
{
|
||||
face_control.cnt = 0;
|
||||
face_control.num = max_faces;
|
||||
_lv_ll_init(&face_control.face_ll, sizeof(FT_Face *));
|
||||
|
||||
FT_Error error = FT_Init_FreeType(&library);
|
||||
if (error) {
|
||||
LV_LOG_ERROR("init freeType error(%d)", error);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
error = FTC_Manager_New(library, max_faces, max_sizes,
|
||||
max_bytes, font_face_requester, NULL, &cache_manager);
|
||||
if (error) {
|
||||
FT_Done_FreeType(library);
|
||||
LV_LOG_ERROR("Failed to open cache manager");
|
||||
return false;
|
||||
}
|
||||
|
||||
error = FTC_CMapCache_New(cache_manager, &cmap_cache);
|
||||
if(error) {
|
||||
LV_LOG_ERROR("Failed to open Cmap Cache");
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
error = FTC_SBitCache_New(cache_manager, &sbit_cache);
|
||||
if(error){
|
||||
LV_LOG_ERROR("Failed to open sbit cache");
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
// initialize the queues to send request and receive response
|
||||
FTRequestQueue = xQueueCreate(1, sizeof(FT_glyph_dsc_request));
|
||||
FTResponseQueue = xQueueCreate(1, sizeof(FT_glyph_dsc_response));
|
||||
|
||||
xTaskCreatePinnedToCore(FT_loop_task, "FreeType_task", LV_USE_FT_STACK_SIZE, NULL, 1, &FTTaskHandle, ARDUINO_RUNNING_CORE);
|
||||
|
||||
if (FTRequestQueue && FTResponseQueue) {
|
||||
return true;
|
||||
}
|
||||
Fail:
|
||||
FTC_Manager_Done(cache_manager);
|
||||
FT_Done_FreeType(library);
|
||||
return false;
|
||||
#else
|
||||
LV_UNUSED(max_sizes);
|
||||
LV_UNUSED(max_bytes);
|
||||
return true;
|
||||
#endif/* LV_USE_FT_CACHE_MANAGER */
|
||||
}
|
||||
|
||||
void lv_freetype_destroy(void)
|
||||
{
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
FTC_Manager_Done(cache_manager);
|
||||
#endif
|
||||
FT_Done_FreeType(library);
|
||||
}
|
||||
|
||||
bool lv_ft_font_init(lv_ft_info_t *info)
|
||||
{
|
||||
lv_font_fmt_ft_dsc_t * dsc = lv_mem_alloc(sizeof(lv_font_fmt_ft_dsc_t));
|
||||
if(dsc == NULL) return false;
|
||||
|
||||
dsc->font = lv_mem_alloc(sizeof(lv_font_t));
|
||||
if(dsc->font == NULL) {
|
||||
lv_mem_free(dsc);
|
||||
return false;
|
||||
}
|
||||
|
||||
lv_face_info_t *face_info = NULL;
|
||||
FT_Face face = face_find_in_list(info);
|
||||
if (face == NULL) {
|
||||
if (face_control.cnt == face_control.num - 1) {
|
||||
LV_LOG_WARN("face full");
|
||||
goto Fail;
|
||||
}
|
||||
face_info = lv_mem_alloc(sizeof(lv_face_info_t) + strlen(info->name) + 1);
|
||||
if(face_info == NULL) {
|
||||
goto Fail;
|
||||
}
|
||||
FT_Error error = FT_New_Face(library, info->name, 0, &face);
|
||||
if(error){
|
||||
lv_mem_free(face_info);
|
||||
LV_LOG_WARN("create face error(%d)", error);
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
face_info->name = ((char *)face_info) + sizeof(lv_face_info_t);
|
||||
strcpy(face_info->name, info->name);
|
||||
face_info->cnt = 1;
|
||||
face->generic.data = face_info;
|
||||
face->generic.finalizer = face_generic_finalizer;
|
||||
face_add_to_list(face);
|
||||
}
|
||||
else {
|
||||
#if LV_USE_FT_CACHE_MANAGER == 0
|
||||
FT_Size size;
|
||||
FT_Error error = FT_New_Size(face, &size);
|
||||
if (error) {
|
||||
goto Fail;
|
||||
}
|
||||
FT_Activate_Size(size);
|
||||
FT_Reference_Face(face);
|
||||
#else
|
||||
face_info = (lv_face_info_t *)face->generic.data;
|
||||
face_info->cnt++;
|
||||
#endif
|
||||
}
|
||||
FT_Set_Pixel_Sizes(face, 0, info->weight);
|
||||
|
||||
dsc->face = face;
|
||||
dsc->size = face->size;
|
||||
dsc->weight = info->weight;
|
||||
dsc->style = info->style;
|
||||
lv_font_t *font = dsc->font;
|
||||
font->user_data = dsc;
|
||||
font->get_glyph_dsc = get_glyph_dsc_cb;
|
||||
font->get_glyph_bitmap = get_glyph_bitmap_cb;
|
||||
font->line_height = (dsc->face->size->metrics.height >> 6);
|
||||
font->base_line = -(dsc->face->size->metrics.descender >> 6);
|
||||
font->subpx = LV_FONT_SUBPX_NONE;
|
||||
font->underline_position = dsc->face->underline_position;
|
||||
font->underline_thickness = dsc->face->underline_thickness;
|
||||
font->dsc = NULL;
|
||||
info->font = font;
|
||||
return true;
|
||||
|
||||
Fail:
|
||||
lv_mem_free(dsc->font);
|
||||
lv_mem_free(dsc);
|
||||
return false;
|
||||
}
|
||||
|
||||
void lv_ft_font_destroy(lv_font_t* font)
|
||||
{
|
||||
if (font == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
lv_font_fmt_ft_dsc_t * dsc = (lv_font_fmt_ft_dsc_t *)(font->user_data);
|
||||
if (dsc) {
|
||||
#if LV_USE_FT_CACHE_MANAGER == 0
|
||||
FT_Done_Size(dsc->size);
|
||||
FT_Done_Face(dsc->face);
|
||||
#else
|
||||
lv_face_info_t *face_info = (lv_face_info_t *)dsc->face->generic.data;
|
||||
face_info->cnt--;
|
||||
if(face_info->cnt == 0){
|
||||
FTC_Manager_RemoveFaceID(cache_manager, (FTC_FaceID)dsc->face);
|
||||
}
|
||||
#endif
|
||||
lv_mem_free(dsc->font);
|
||||
lv_mem_free(dsc);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
static void face_generic_finalizer(void* object)
|
||||
{
|
||||
FT_Face face = (FT_Face)object;
|
||||
face_remove_from_list(face);
|
||||
if(face->generic.data){
|
||||
lv_face_info_t *face_info = (lv_face_info_t *)face->generic.data;
|
||||
lv_mem_free(face_info);
|
||||
}
|
||||
LV_LOG_INFO("face finalizer(%p)\n", face);
|
||||
}
|
||||
|
||||
static FT_Face face_find_in_list(lv_ft_info_t *info)
|
||||
{
|
||||
lv_face_info_t *face_info;
|
||||
FT_Face *pface = _lv_ll_get_head(&face_control.face_ll);
|
||||
while(pface) {
|
||||
face_info = (lv_face_info_t *)(*pface)->generic.data;
|
||||
if (strcmp(face_info->name, info->name) == 0) {
|
||||
return *pface;
|
||||
}
|
||||
pface = _lv_ll_get_next(&face_control.face_ll, pface);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void face_add_to_list(FT_Face face)
|
||||
{
|
||||
FT_Face *pface;
|
||||
pface = (FT_Face *)_lv_ll_ins_tail(&face_control.face_ll);
|
||||
*pface = face;
|
||||
face_control.cnt++;
|
||||
}
|
||||
|
||||
static void face_remove_from_list(FT_Face face)
|
||||
{
|
||||
FT_Face *pface = _lv_ll_get_head(&face_control.face_ll);
|
||||
while(pface) {
|
||||
if (*pface == face) {
|
||||
_lv_ll_remove(&face_control.face_ll, pface);
|
||||
lv_mem_free(pface);
|
||||
face_control.cnt--;
|
||||
break;
|
||||
}
|
||||
pface = _lv_ll_get_next(&face_control.face_ll, pface);
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
|
||||
static FT_Error font_face_requester(FTC_FaceID face_id,
|
||||
FT_Library library_is,FT_Pointer req_data,FT_Face* aface)
|
||||
{
|
||||
LV_UNUSED(library_is);
|
||||
LV_UNUSED(req_data);
|
||||
*aface = face_id;
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
static bool get_glyph_dsc_cb_cache(const lv_font_t * font,
|
||||
lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
|
||||
{
|
||||
LV_UNUSED(unicode_letter_next);
|
||||
if(unicode_letter < 0x20) {
|
||||
dsc_out->adv_w = 0;
|
||||
dsc_out->box_h = 0;
|
||||
dsc_out->box_w = 0;
|
||||
dsc_out->ofs_x = 0;
|
||||
dsc_out->ofs_y = 0;
|
||||
dsc_out->bpp = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
lv_font_fmt_ft_dsc_t * dsc = (lv_font_fmt_ft_dsc_t *)(font->user_data);
|
||||
FT_Face face = dsc->face;
|
||||
|
||||
static FTC_ImageTypeRec desc_sbit_type;
|
||||
desc_sbit_type.face_id = (FTC_FaceID)face;
|
||||
desc_sbit_type.flags = FT_LOAD_RENDER | FT_LOAD_TARGET_NORMAL;
|
||||
desc_sbit_type.height = dsc->weight;
|
||||
desc_sbit_type.width = dsc->weight;
|
||||
FT_UInt charmap_index = FT_Get_Charmap_Index(face->charmap);
|
||||
FT_UInt glyph_index = FTC_CMapCache_Lookup(cmap_cache, (FTC_FaceID)face, charmap_index, unicode_letter);
|
||||
FT_Error error = FTC_SBitCache_Lookup(sbit_cache, &desc_sbit_type, glyph_index, &sbit, NULL);
|
||||
|
||||
dsc_out->adv_w = sbit->xadvance;
|
||||
dsc_out->box_h = sbit->height; /*Height of the bitmap in [px]*/
|
||||
dsc_out->box_w = sbit->width; /*Width of the bitmap in [px]*/
|
||||
dsc_out->ofs_x = sbit->left; /*X offset of the bitmap in [pf]*/
|
||||
dsc_out->ofs_y = sbit->top - sbit->height; /*Y offset of the bitmap measured from the as line*/
|
||||
dsc_out->bpp = 8; /*Bit per pixel: 1/2/4/8*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const uint8_t * get_glyph_bitmap_cb_cache(const lv_font_t * font, uint32_t unicode_letter)
|
||||
{
|
||||
LV_UNUSED(font);
|
||||
LV_UNUSED(unicode_letter);
|
||||
return (const uint8_t *)sbit->buffer;
|
||||
}
|
||||
|
||||
#else/* LV_USE_FT_CACHE_MANAGER */
|
||||
// extern void berry_log_C(const char * berry_buf, ...);
|
||||
|
||||
static bool get_glyph_dsc_cb_nocache(const lv_font_t * font,
|
||||
lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
|
||||
{
|
||||
// berry_log_C(">> get_glyph_dsc_cb_nocache %i %i", unicode_letter, unicode_letter_next);
|
||||
LV_UNUSED(unicode_letter_next);
|
||||
if(unicode_letter < 0x20) {
|
||||
dsc_out->adv_w = 0;
|
||||
dsc_out->box_h = 0;
|
||||
dsc_out->box_w = 0;
|
||||
dsc_out->ofs_x = 0;
|
||||
dsc_out->ofs_y = 0;
|
||||
dsc_out->bpp = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
FT_Error error;
|
||||
FT_Face face;
|
||||
lv_font_fmt_ft_dsc_t * dsc = (lv_font_fmt_ft_dsc_t *)(font->user_data);
|
||||
face = dsc->face;
|
||||
|
||||
FT_UInt glyph_index = FT_Get_Char_Index( face, unicode_letter );
|
||||
|
||||
if (face->size != dsc->size) {
|
||||
// berry_log_C(">> FT_Activate_Size %i", dsc->size);
|
||||
FT_Activate_Size(dsc->size);
|
||||
}
|
||||
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT );
|
||||
// berry_log_C(">> after FT_Load_Glyph error = %i", error);
|
||||
if (error){
|
||||
return false;
|
||||
}
|
||||
|
||||
error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL);
|
||||
// berry_log_C(">> after FT_Render_Glyph error = %i", error);
|
||||
if (error){
|
||||
return false;
|
||||
}
|
||||
|
||||
dsc_out->adv_w = (face->glyph->metrics.horiAdvance >> 6);
|
||||
dsc_out->box_h = face->glyph->bitmap.rows; /*Height of the bitmap in [px]*/
|
||||
dsc_out->box_w = face->glyph->bitmap.width; /*Width of the bitmap in [px]*/
|
||||
dsc_out->ofs_x = face->glyph->bitmap_left; /*X offset of the bitmap in [pf]*/
|
||||
dsc_out->ofs_y = face->glyph->bitmap_top - face->glyph->bitmap.rows; /*Y offset of the bitmap measured from the as line*/
|
||||
dsc_out->bpp = 8; /*Bit per pixel: 1/2/4/8*/
|
||||
|
||||
// berry_log_C("+++ adv_w %i, h %i, w %i, x %i, y %i", dsc_out->adv_w, dsc_out->box_h, dsc_out->box_w, dsc_out->ofs_x, dsc_out->ofs_y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const uint8_t * get_glyph_bitmap_cb_nocache(const lv_font_t * font, uint32_t unicode_letter)
|
||||
{
|
||||
LV_UNUSED(unicode_letter);
|
||||
lv_font_fmt_ft_dsc_t * dsc = (lv_font_fmt_ft_dsc_t *)(font->user_data);
|
||||
FT_Face face = dsc->face;
|
||||
return (const uint8_t *)(face->glyph->bitmap.buffer);
|
||||
}
|
||||
|
||||
#endif/* LV_USE_FT_CACHE_MANAGER */
|
||||
|
||||
static bool get_glyph_dsc_cb(const lv_font_t * font,
|
||||
lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
|
||||
{
|
||||
// #if LV_USE_FT_CACHE_MANAGER
|
||||
// return get_glyph_dsc_cb_cache(font, dsc_out, unicode_letter, unicode_letter_next);
|
||||
// #else
|
||||
// return get_glyph_dsc_cb_nocache(font, dsc_out, unicode_letter, unicode_letter_next);
|
||||
// #endif
|
||||
static FT_glyph_dsc_request request;
|
||||
static FT_glyph_dsc_response response;
|
||||
|
||||
request.font = font;
|
||||
request.dsc_out = dsc_out;
|
||||
request.unicode_letter = unicode_letter;
|
||||
request.unicode_letter_next = unicode_letter_next;
|
||||
xQueueSendToBack(FTRequestQueue, &request, portMAX_DELAY);
|
||||
if (xQueueReceive(FTResponseQueue, &response, portMAX_DELAY)) {
|
||||
return response;
|
||||
} else {
|
||||
return false; // should never happen
|
||||
}
|
||||
}
|
||||
|
||||
static const uint8_t * get_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter)
|
||||
{
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
return get_glyph_bitmap_cb_cache(font, unicode_letter);
|
||||
#else
|
||||
return get_glyph_bitmap_cb_nocache(font, unicode_letter);
|
||||
#endif
|
||||
}
|
||||
|
||||
void FT_loop_task(void *pvParameters) {
|
||||
(void) pvParameters;
|
||||
|
||||
while (1) {
|
||||
FT_glyph_dsc_request request;
|
||||
FT_glyph_dsc_response response;
|
||||
|
||||
if (xQueueReceive(FTRequestQueue, &request, portMAX_DELAY)) {
|
||||
#if LV_USE_FT_CACHE_MANAGER
|
||||
response = get_glyph_dsc_cb_cache(request.font, request.dsc_out, request.unicode_letter, request.unicode_letter_next);
|
||||
#else
|
||||
response = get_glyph_dsc_cb_nocache(request.font, request.dsc_out, request.unicode_letter, request.unicode_letter_next);
|
||||
#endif
|
||||
xQueueSendToBack(FTResponseQueue, &response, portMAX_DELAY); // send back response
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
110
lib/lv_lib_freetype/lv_freetype.h
Normal file
110
lib/lv_lib_freetype/lv_freetype.h
Normal file
@ -0,0 +1,110 @@
|
||||
/**
|
||||
* @file lv_freetype.h
|
||||
*
|
||||
*/
|
||||
#ifndef _LV_FONT_TTF_H
|
||||
#define _LV_FONT_TTF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
// #include "lvgl/lvgl.h" // TODO
|
||||
#include "lvgl.h"
|
||||
#include "ft2build.h"
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
#include FT_CACHE_H
|
||||
#include FT_SIZES_H
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#ifndef LV_USE_FT_CACHE_MANAGER
|
||||
#define LV_USE_FT_CACHE_MANAGER 0
|
||||
#endif
|
||||
|
||||
#define LV_USE_FT_STACK_SIZE 24*1024 // FreeType consumes a large amount of stack
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
uint16_t cnt;
|
||||
char* name;
|
||||
} lv_face_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t num;
|
||||
uint16_t cnt;
|
||||
lv_ll_t face_ll;
|
||||
} lv_faces_control_t;
|
||||
|
||||
typedef enum {
|
||||
FT_FONT_STYLE_NORMAL = 0,
|
||||
FT_FONT_STYLE_ITALIC = 1 << 0,
|
||||
FT_FONT_STYLE_BOLD = 1 << 1
|
||||
} LV_FT_FONT_STYLE;
|
||||
|
||||
typedef struct {
|
||||
const char* name; /* The name of the font file */
|
||||
lv_font_t* font; /* point to lvgl font */
|
||||
uint16_t weight; /* font size */
|
||||
uint16_t style; /* font style */
|
||||
} lv_ft_info_t;
|
||||
|
||||
typedef struct {
|
||||
FT_Face face;
|
||||
FT_Size size;
|
||||
lv_font_t* font;
|
||||
uint16_t style;
|
||||
uint16_t weight;
|
||||
} lv_font_fmt_freetype_dsc_t;
|
||||
|
||||
typedef lv_font_fmt_freetype_dsc_t lv_font_fmt_ft_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* init freetype library
|
||||
* @param max_faces Maximum number of opened FT_Face objects managed by this cache instance. Use 0 for defaults.
|
||||
* @param max_sizes Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults.
|
||||
* @param max_bytes Maximum number of bytes to use for cached data nodes. Use 0 for defaults.
|
||||
* Note that this value does not account for managed FT_Face and FT_Size objects.
|
||||
* @return true on success, otherwise false.
|
||||
*/
|
||||
bool lv_freetype_init(FT_UInt max_faces, FT_UInt max_sizes, FT_ULong max_bytes);
|
||||
|
||||
/**
|
||||
* Destroy freetype library
|
||||
*/
|
||||
void lv_freetype_destroy(void);
|
||||
|
||||
/**
|
||||
* Creates a font with info parameter specified.
|
||||
* @param info See lv_ft_info_t for details.
|
||||
* when success, lv_ft_info_t->font point to the font you created.
|
||||
* @return true on success, otherwise false.
|
||||
*/
|
||||
bool lv_ft_font_init(lv_ft_info_t *info);
|
||||
|
||||
/**
|
||||
* Destroy a font that has been created.
|
||||
* @param font pointer to font.
|
||||
*/
|
||||
void lv_ft_font_destroy(lv_font_t* font);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
134
lib/lv_lib_freetype/lv_fs_freetype.c
Normal file
134
lib/lv_lib_freetype/lv_fs_freetype.c
Normal file
@ -0,0 +1,134 @@
|
||||
/**
|
||||
* @file lv_fs_freetype.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdlib.h>
|
||||
#include "lv_fs_freetype.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#if LV_USE_FS_IF
|
||||
#include "lv_fs_if.h"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
// FILE * fopen ( const char * filename, const char * mode );
|
||||
lv_ft_stream_t* lv_ft_fopen(const char* filename, const char* mode)
|
||||
{
|
||||
lv_fs_file_t* file_p = malloc(sizeof(lv_fs_file_t)); // reserve memory
|
||||
|
||||
if(file_p) {
|
||||
lv_fs_mode_t rw = mode[0] == 'r' ? LV_FS_MODE_RD : LV_FS_MODE_WR;
|
||||
lv_fs_res_t res = lv_fs_open(file_p, filename, rw);
|
||||
|
||||
if(res == LV_FS_RES_OK) { // success
|
||||
return (lv_ft_stream_t*)file_p;
|
||||
} else { // error
|
||||
free(file_p); // release memory
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// int fclose ( FILE * stream );
|
||||
int lv_ft_fclose(lv_ft_stream_t* stream)
|
||||
{
|
||||
lv_fs_file_t* f_ptr = (lv_fs_file_t*)stream;
|
||||
|
||||
lv_fs_close(f_ptr);
|
||||
free(f_ptr); // release memory
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// size_t fread ( void * ptr, size_t size, size_t count, FILE * stream );
|
||||
size_t lv_ft_fread(void* ptr, size_t size, size_t count, lv_ft_stream_t* stream)
|
||||
{
|
||||
lv_fs_file_t* f_ptr = (lv_fs_file_t*)stream;
|
||||
uint32_t bytes_read;
|
||||
|
||||
lv_fs_res_t res = lv_fs_read(f_ptr, ptr, size * count, &bytes_read);
|
||||
if(res != LV_FS_RES_OK) { // error
|
||||
bytes_read = 0;
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
// long int ftell ( FILE * stream );
|
||||
int lv_ft_ftell(lv_ft_stream_t* stream)
|
||||
{
|
||||
lv_fs_file_t* f_ptr = (lv_fs_file_t*)stream;
|
||||
uint32_t pos;
|
||||
|
||||
lv_fs_res_t res = lv_fs_tell(f_ptr, &pos);
|
||||
if(res == LV_FS_RES_OK) return pos;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// int fseek ( FILE * stream, long int offset, int origin );
|
||||
int lv_ft_fseek(lv_ft_stream_t* stream, long int offset, int origin)
|
||||
{
|
||||
lv_fs_file_t* f_ptr = (lv_fs_file_t*)stream;
|
||||
uint32_t start = 0;
|
||||
|
||||
switch(origin) {
|
||||
case SEEK_SET:
|
||||
start = 0;
|
||||
break;
|
||||
|
||||
case SEEK_CUR: {
|
||||
int pos = lv_ft_ftell(f_ptr);
|
||||
if(pos < 0) { // error
|
||||
return -1;
|
||||
}
|
||||
start = pos;
|
||||
} break;
|
||||
|
||||
case SEEK_END: {
|
||||
lv_fs_res_t res = lv_fs_size(f_ptr, &start);
|
||||
if(res != LV_FS_RES_OK) { // error
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return -1; // Unknown origin
|
||||
}
|
||||
|
||||
if(start + offset < 0) { // underflow, go to beginning of the file
|
||||
start = 0;
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
lv_fs_res_t res = lv_fs_seek(f_ptr, start + offset);
|
||||
return res == LV_FS_RES_OK ? 0 : -1;
|
||||
}
|
||||
|
||||
#endif // LV_USE_FS_IF
|
77
lib/lv_lib_freetype/lv_fs_freetype.h
Normal file
77
lib/lv_lib_freetype/lv_fs_freetype.h
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @file lv_fs_freetype.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_FS_FREETYPE_H
|
||||
#define LV_FS_FREETYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_fs_if.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#if LV_USE_FILESYSTEM
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef void lv_ft_stream_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
/**
|
||||
* fopen glue for freetype library to access lv_fs api
|
||||
* @param filename The full path to the file including lv_fs drive letter
|
||||
* @param mode "r" for read, "w" fro write.
|
||||
* @return A file stream pointer on success, NULL on error.
|
||||
*/
|
||||
lv_ft_stream_t* lv_ft_fopen(const char* filename, const char* mode);
|
||||
|
||||
/**
|
||||
* fclose glue for freetype library to access lv_fs api
|
||||
* @param stream The file stream to close.
|
||||
* @return Always 0.
|
||||
*/
|
||||
int lv_ft_fclose(lv_ft_stream_t* stream);
|
||||
|
||||
/**
|
||||
* fread glue for freetype library to access lv_fs api
|
||||
* @param ptr The buffer read to.
|
||||
* @param size Size of the read buffer.
|
||||
* @param count The number of bytes to read.
|
||||
* @param stream The file stream to read.
|
||||
* @return The number of bytes read on success, otherwise 0.
|
||||
*/
|
||||
size_t lv_ft_fread(void* ptr, size_t size, size_t count, lv_ft_stream_t* stream);
|
||||
|
||||
/**
|
||||
* fseek glue for freetype library to access lv_fs api
|
||||
* @param stream The file stream to seek.
|
||||
* @param offset The offset from the origin position.
|
||||
* @param origin The start position within the file, either SEEK_SET, SEEK_CUR or SEEK_END.
|
||||
* @return 1 on success, otherwise 0.
|
||||
*/
|
||||
int lv_ft_fseek(lv_ft_stream_t* stream, long int offset, int origin);
|
||||
|
||||
/**
|
||||
* ftell glue for freetype library to access lv_fs api
|
||||
* @param stream The file stream to tell.
|
||||
* @return The current file cursor position on success, otherwise -1.
|
||||
*/
|
||||
int lv_ft_ftell(lv_ft_stream_t* stream);
|
||||
|
||||
#endif // LV_USE_FILESYSTEM
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LV_FS_FREETYPE_H
|
@ -16,7 +16,6 @@ extra_configs =
|
||||
; -- Base configurations per platform
|
||||
user_setups/esp32/_esp32.ini
|
||||
user_setups/esp32s2/_esp32s2.ini
|
||||
user_setups/es98266/_esp8266.ini
|
||||
; -- Put active [env] files in this dir to be included in the build menu
|
||||
user_setups/active/*.ini
|
||||
; -- Add customizations to this file only:
|
||||
@ -65,8 +64,8 @@ build_flags =
|
||||
|
||||
; -- Hasp build options ----------------------------
|
||||
-D HASP_VER_MAJ=0
|
||||
-D HASP_VER_MIN=6
|
||||
-D HASP_VER_REV=3
|
||||
-D HASP_VER_MIN=7
|
||||
-D HASP_VER_REV=0
|
||||
${override.build_flags}
|
||||
|
||||
; -- Shared library dependencies in all environments
|
||||
|
@ -8,7 +8,7 @@ extra_configs =
|
||||
; Uncomment or edit the lines to show more User Setups in the PIO sidebar
|
||||
; user_setups/darwin_sdl/*.ini
|
||||
; user_setups/esp32/*.ini
|
||||
; user_setups/esp8266/*.ini
|
||||
; user_setups/esp32s2/*.ini
|
||||
; user_setups/linux_sdl/*.ini
|
||||
; user_setups/stm32f4xx/*.ini
|
||||
; user_setups/win32/*.ini
|
||||
@ -24,7 +24,6 @@ extra_default_envs =
|
||||
; Uncomment specific environments or create extra:
|
||||
; arduitouch-esp32_ili9341
|
||||
; d1-mini-esp32_ili9341
|
||||
; d1-mini-esp8266_ili9341
|
||||
; d1-r32-unoshield
|
||||
; esp32-9341-unoshield-analog
|
||||
; esp12e-st7735
|
||||
@ -45,10 +44,6 @@ extra_default_envs =
|
||||
monitor_port = COM6 ; Change to the correct port
|
||||
upload_port = ${env:d1-mini-esp32_ili9341.monitor_port}
|
||||
|
||||
[env:d1-mini-esp8266_ili9341]
|
||||
monitor_port = COM4 ; Change to the correct port
|
||||
upload_port = ${env:d1-mini-esp8266_ili9341.monitor_port}
|
||||
|
||||
[env:esp32dev-mrb3511]
|
||||
monitor_port = COM3 ; Change to the correct port
|
||||
upload_port = ${env:esp32dev-mrb3511.monitor_port}
|
||||
|
@ -9,6 +9,11 @@
|
||||
#include "dev/esp32/esp32.h"
|
||||
|
||||
#include "driver/pcnt.h" // Pulse count driver
|
||||
#include "hal/pcnt_hal.h"
|
||||
#include "hal/gpio_hal.h"
|
||||
#include "soc/pcnt_periph.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
|
||||
#include "driver/adc.h"
|
||||
#include "esp_adc_cal.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace dev {
|
||||
|
||||
void M5StackCore2::init(void)
|
||||
{
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL);
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||
Axp.begin();
|
||||
|
||||
Axp.SetCHGCurrent(AXP192::kCHG_100mA);
|
||||
|
@ -94,7 +94,7 @@ void GT911_init()
|
||||
{
|
||||
// Wire.setClock(400000);
|
||||
// Wire.begin();
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||
delay(300);
|
||||
|
||||
touch.setHandler(GT911_setXY);
|
||||
|
@ -61,7 +61,7 @@ HASP_ATTRIBUTE_FAST_MEM bool STMPE610_getXY(int16_t* touchX, int16_t* touchY, ui
|
||||
|
||||
void STMPE610_init()
|
||||
{
|
||||
LOG_INFO(TAG_DRVR, F("STMPE610 " D_SERVICE_STARTING));
|
||||
LOG_TRACE(TAG_DRVR, F("STMPE610 " D_SERVICE_STARTING));
|
||||
if(!touch.begin()) {
|
||||
LOG_ERROR(TAG_DRVR, F("STMPE610 " D_SERVICE_START_FAILED));
|
||||
} else {
|
||||
|
@ -91,7 +91,7 @@ class TouchGt911 : public BaseTouch {
|
||||
|
||||
void init(int w, int h)
|
||||
{
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||
// delay(300); // already happens in touch.begin()
|
||||
touch_scan(Wire);
|
||||
|
||||
|
@ -58,7 +58,7 @@ class TouchLovyanGfx : public BaseTouch {
|
||||
|
||||
void init(int w, int h)
|
||||
{
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
|
||||
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY);
|
||||
// delay(300); // already happens in touch.begin()
|
||||
touch_scan(Wire);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class TouchStmpe610 : public BaseTouch {
|
||||
|
||||
void init(int w, int h)
|
||||
{
|
||||
LOG_INFO(TAG_DRVR, F("STMPE610 " D_SERVICE_STARTING));
|
||||
LOG_TRACE(TAG_DRVR, F("STMPE610 " D_SERVICE_STARTING));
|
||||
if(!stmpe610_touchpanel.begin()) {
|
||||
LOG_ERROR(TAG_DRVR, F("STMPE610 " D_SERVICE_START_FAILED));
|
||||
} else {
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user