first commit
42
libraries/LovyanGFX/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# CMakeLists for ESP-IDF
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
src
|
||||
)
|
||||
file(GLOB SRCS
|
||||
src/lgfx/Fonts/efont/*.c
|
||||
src/lgfx/Fonts/IPA/*.c
|
||||
src/lgfx/utility/*.c
|
||||
src/lgfx/v0/*.cpp
|
||||
src/lgfx/v0/panel/*.cpp
|
||||
src/lgfx/v0/platforms/*.cpp
|
||||
src/lgfx/v0/touch/*.cpp
|
||||
src/lgfx/v1/*.cpp
|
||||
src/lgfx/v1/misc/*.cpp
|
||||
src/lgfx/v1/panel/*.cpp
|
||||
src/lgfx/v1/platforms/arduino_default/*.cpp
|
||||
src/lgfx/v1/platforms/esp32/*.cpp
|
||||
src/lgfx/v1/platforms/esp32c3/*.cpp
|
||||
src/lgfx/v1/platforms/esp32s2/*.cpp
|
||||
src/lgfx/v1/platforms/esp32s3/*.cpp
|
||||
src/lgfx/v1/touch/*.cpp
|
||||
)
|
||||
|
||||
set(COMPONENT_SRCS ${SRCS})
|
||||
|
||||
if (IDF_VERSION_MAJOR GREATER_EQUAL 5)
|
||||
set(COMPONENT_REQUIRES nvs_flash efuse esp_lcd driver esp_timer)
|
||||
elseif ((IDF_VERSION_MAJOR EQUAL 4) AND (IDF_VERSION_MINOR GREATER 3) OR IDF_VERSION_MAJOR GREATER 4)
|
||||
set(COMPONENT_REQUIRES nvs_flash efuse esp_lcd)
|
||||
else()
|
||||
set(COMPONENT_REQUIRES nvs_flash efuse)
|
||||
endif()
|
||||
|
||||
|
||||
### If you use arduino-esp32 components, please activate next comment line.
|
||||
# list(APPEND COMPONENT_REQUIRES arduino-esp32)
|
||||
|
||||
|
||||
message(STATUS "LovyanGFX use components = ${COMPONENT_REQUIRES}")
|
||||
|
||||
register_component()
|
||||
20
libraries/LovyanGFX/LGFX_AUTODETECT.hpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*----------------------------------------------------------------------------/
|
||||
Lovyan GFX - Graphics library for embedded devices.
|
||||
|
||||
Original Source:
|
||||
https://github.com/lovyan03/LovyanGFX/
|
||||
|
||||
Licence:
|
||||
[FreeBSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
|
||||
|
||||
Author:
|
||||
[lovyan03](https://twitter.com/lovyan03)
|
||||
|
||||
Contributors:
|
||||
[ciniml](https://github.com/ciniml)
|
||||
[mongonta0716](https://github.com/mongonta0716)
|
||||
[tobozo](https://github.com/tobozo)
|
||||
/----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "lgfx/v1_autodetect/common.hpp"
|
||||
11
libraries/LovyanGFX/LGFX_TFT_eSPI.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "LGFX_TFT_eSPI.hpp"
|
||||
|
||||
#else
|
||||
|
||||
#error LovyanGFX requires a C++ compiler, please change file extension to .cc or .cpp
|
||||
|
||||
#endif
|
||||
145
libraries/LovyanGFX/LGFX_TFT_eSPI.hpp
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*----------------------------------------------------------------------------/
|
||||
Lovyan GFX - Graphics library for embedded devices.
|
||||
|
||||
Original Source:
|
||||
https://github.com/lovyan03/LovyanGFX/
|
||||
|
||||
Licence:
|
||||
[FreeBSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
|
||||
|
||||
Author:
|
||||
[lovyan03](https://twitter.com/lovyan03)
|
||||
|
||||
Contributors:
|
||||
[ciniml](https://github.com/ciniml)
|
||||
[mongonta0716](https://github.com/mongonta0716)
|
||||
[tobozo](https://github.com/tobozo)
|
||||
|
||||
|
||||
This is a wrapper to make LovyanGFX behave like TFT_eSPI.
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LGFX_TFT_ESPI_HPP_
|
||||
#define LGFX_TFT_ESPI_HPP_
|
||||
|
||||
#include "LovyanGFX.hpp"
|
||||
|
||||
using TFT_eSPI = LGFX;
|
||||
|
||||
class TFT_eSprite : public LGFX_Sprite {
|
||||
public:
|
||||
TFT_eSprite() : LGFX_Sprite() { _psram = true; }
|
||||
TFT_eSprite(LovyanGFX* parent) : LGFX_Sprite(parent) { _psram = true; }
|
||||
|
||||
void* frameBuffer(uint8_t) { return getBuffer(); }
|
||||
};
|
||||
|
||||
namespace lgfx
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
namespace ili9341_colors // Color definitions for backwards compatibility with old sketches
|
||||
{
|
||||
#ifdef ILI9341_BLACK
|
||||
#undef ILI9341_BLACK
|
||||
#undef ILI9341_NAVY
|
||||
#undef ILI9341_DARKGREEN
|
||||
#undef ILI9341_DARKCYAN
|
||||
#undef ILI9341_MAROON
|
||||
#undef ILI9341_PURPLE
|
||||
#undef ILI9341_OLIVE
|
||||
#undef ILI9341_LIGHTGREY
|
||||
#undef ILI9341_DARKGREY
|
||||
#undef ILI9341_BLUE
|
||||
#undef ILI9341_GREEN
|
||||
#undef ILI9341_CYAN
|
||||
#undef ILI9341_RED
|
||||
#undef ILI9341_MAGENTA
|
||||
#undef ILI9341_YELLOW
|
||||
#undef ILI9341_WHITE
|
||||
#undef ILI9341_ORANGE
|
||||
#undef ILI9341_GREENYELLOW
|
||||
#undef ILI9341_PINK
|
||||
#endif
|
||||
|
||||
#ifdef BLACK
|
||||
#undef BLACK
|
||||
#undef NAVY
|
||||
#undef DARKGREEN
|
||||
#undef DARKCYAN
|
||||
#undef MAROON
|
||||
#undef PURPLE
|
||||
#undef OLIVE
|
||||
#undef LIGHTGREY
|
||||
#undef DARKGREY
|
||||
#undef BLUE
|
||||
#undef GREEN
|
||||
#undef CYAN
|
||||
#undef RED
|
||||
#undef MAGENTA
|
||||
#undef YELLOW
|
||||
#undef WHITE
|
||||
#undef ORANGE
|
||||
#undef GREENYELLOW
|
||||
#undef PINK
|
||||
#endif
|
||||
|
||||
static constexpr int ILI9341_BLACK = 0x0000; /* 0, 0, 0 */
|
||||
static constexpr int ILI9341_NAVY = 0x000F; /* 0, 0, 128 */
|
||||
static constexpr int ILI9341_DARKGREEN = 0x03E0; /* 0, 128, 0 */
|
||||
static constexpr int ILI9341_DARKCYAN = 0x03EF; /* 0, 128, 128 */
|
||||
static constexpr int ILI9341_MAROON = 0x7800; /* 128, 0, 0 */
|
||||
static constexpr int ILI9341_PURPLE = 0x780F; /* 128, 0, 128 */
|
||||
static constexpr int ILI9341_OLIVE = 0x7BE0; /* 128, 128, 0 */
|
||||
static constexpr int ILI9341_LIGHTGREY = 0xC618; /* 192, 192, 192 */
|
||||
static constexpr int ILI9341_DARKGREY = 0x7BEF; /* 128, 128, 128 */
|
||||
static constexpr int ILI9341_BLUE = 0x001F; /* 0, 0, 255 */
|
||||
static constexpr int ILI9341_GREEN = 0x07E0; /* 0, 255, 0 */
|
||||
static constexpr int ILI9341_CYAN = 0x07FF; /* 0, 255, 255 */
|
||||
static constexpr int ILI9341_RED = 0xF800; /* 255, 0, 0 */
|
||||
static constexpr int ILI9341_MAGENTA = 0xF81F; /* 255, 0, 255 */
|
||||
static constexpr int ILI9341_YELLOW = 0xFFE0; /* 255, 255, 0 */
|
||||
static constexpr int ILI9341_WHITE = 0xFFFF; /* 255, 255, 255 */
|
||||
static constexpr int ILI9341_ORANGE = 0xFD20; /* 255, 165, 0 */
|
||||
static constexpr int ILI9341_GREENYELLOW = 0xAFE5; /* 173, 255, 47 */
|
||||
static constexpr int ILI9341_PINK = 0xF81F;
|
||||
|
||||
static constexpr int BLACK = 0x0000; /* 0, 0, 0 */
|
||||
static constexpr int NAVY = 0x000F; /* 0, 0, 128 */
|
||||
static constexpr int DARKGREEN = 0x03E0; /* 0, 128, 0 */
|
||||
static constexpr int DARKCYAN = 0x03EF; /* 0, 128, 128 */
|
||||
static constexpr int MAROON = 0x7800; /* 128, 0, 0 */
|
||||
static constexpr int PURPLE = 0x780F; /* 128, 0, 128 */
|
||||
static constexpr int OLIVE = 0x7BE0; /* 128, 128, 0 */
|
||||
static constexpr int LIGHTGREY = 0xC618; /* 192, 192, 192 */
|
||||
static constexpr int DARKGREY = 0x7BEF; /* 128, 128, 128 */
|
||||
static constexpr int BLUE = 0x001F; /* 0, 0, 255 */
|
||||
static constexpr int GREEN = 0x07E0; /* 0, 255, 0 */
|
||||
static constexpr int CYAN = 0x07FF; /* 0, 255, 255 */
|
||||
static constexpr int RED = 0xF800; /* 255, 0, 0 */
|
||||
static constexpr int MAGENTA = 0xF81F; /* 255, 0, 255 */
|
||||
static constexpr int YELLOW = 0xFFE0; /* 255, 255, 0 */
|
||||
static constexpr int WHITE = 0xFFFF; /* 255, 255, 255 */
|
||||
static constexpr int ORANGE = 0xFD20; /* 255, 165, 0 */
|
||||
static constexpr int GREENYELLOW = 0xAFE5; /* 173, 255, 47 */
|
||||
static constexpr int PINK = 0xF81F;
|
||||
}
|
||||
|
||||
namespace tft_command
|
||||
{
|
||||
static constexpr int TFT_DISPOFF = 0x28;
|
||||
static constexpr int TFT_DISPON = 0x29;
|
||||
static constexpr int TFT_SLPIN = 0x10;
|
||||
static constexpr int TFT_SLPOUT = 0x11;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
using namespace lgfx::textdatum;
|
||||
using namespace lgfx::attribute;
|
||||
using namespace lgfx::ili9341_colors;
|
||||
using namespace lgfx::tft_command;
|
||||
|
||||
|
||||
#endif
|
||||
11
libraries/LovyanGFX/LovyanGFX.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "LovyanGFX.hpp"
|
||||
|
||||
#else
|
||||
|
||||
#error LovyanGFX requires a C++ compiler, please change file extension to .cc or .cpp
|
||||
|
||||
#endif
|
||||
41
libraries/LovyanGFX/LovyanGFX.hpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*----------------------------------------------------------------------------/
|
||||
Lovyan GFX library - LCD graphics library .
|
||||
|
||||
Original Source:
|
||||
https://github.com/lovyan03/LovyanGFX/
|
||||
|
||||
Licence:
|
||||
[BSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt)
|
||||
|
||||
Author:
|
||||
[lovyan03](https://twitter.com/lovyan03)
|
||||
|
||||
Contributors:
|
||||
[ciniml](https://github.com/ciniml)
|
||||
[mongonta0716](https://github.com/mongonta0716)
|
||||
[tobozo](https://github.com/tobozo)
|
||||
/----------------------------------------------------------------------------*/
|
||||
#ifndef LOVYANGFX_HPP_
|
||||
#define LOVYANGFX_HPP_
|
||||
|
||||
#ifdef setFont
|
||||
#undef setFont
|
||||
#endif
|
||||
|
||||
#if defined ( LGFX_USE_V0 ) && __has_include("lgfx/v0_init.hpp")
|
||||
|
||||
#include "lgfx/v0_init.hpp"
|
||||
|
||||
#else
|
||||
|
||||
#include "lgfx/v1_init.hpp"
|
||||
|
||||
#if defined ( LGFX_AUTODETECT )
|
||||
|
||||
#include "LGFX_AUTODETECT.hpp"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
42
libraries/LovyanGFX/LovyanGFX/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# CMakeLists for ESP-IDF
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
src
|
||||
)
|
||||
file(GLOB SRCS
|
||||
src/lgfx/Fonts/efont/*.c
|
||||
src/lgfx/Fonts/IPA/*.c
|
||||
src/lgfx/utility/*.c
|
||||
src/lgfx/v0/*.cpp
|
||||
src/lgfx/v0/panel/*.cpp
|
||||
src/lgfx/v0/platforms/*.cpp
|
||||
src/lgfx/v0/touch/*.cpp
|
||||
src/lgfx/v1/*.cpp
|
||||
src/lgfx/v1/misc/*.cpp
|
||||
src/lgfx/v1/panel/*.cpp
|
||||
src/lgfx/v1/platforms/arduino_default/*.cpp
|
||||
src/lgfx/v1/platforms/esp32/*.cpp
|
||||
src/lgfx/v1/platforms/esp32c3/*.cpp
|
||||
src/lgfx/v1/platforms/esp32s2/*.cpp
|
||||
src/lgfx/v1/platforms/esp32s3/*.cpp
|
||||
src/lgfx/v1/touch/*.cpp
|
||||
)
|
||||
|
||||
set(COMPONENT_SRCS ${SRCS})
|
||||
|
||||
if (IDF_VERSION_MAJOR GREATER_EQUAL 5)
|
||||
set(COMPONENT_REQUIRES nvs_flash efuse esp_lcd driver esp_timer)
|
||||
elseif ((IDF_VERSION_MAJOR EQUAL 4) AND (IDF_VERSION_MINOR GREATER 3) OR IDF_VERSION_MAJOR GREATER 4)
|
||||
set(COMPONENT_REQUIRES nvs_flash efuse esp_lcd)
|
||||
else()
|
||||
set(COMPONENT_REQUIRES nvs_flash efuse)
|
||||
endif()
|
||||
|
||||
|
||||
### If you use arduino-esp32 components, please activate next comment line.
|
||||
# list(APPEND COMPONENT_REQUIRES arduino-esp32)
|
||||
|
||||
|
||||
message(STATUS "LovyanGFX use components = ${COMPONENT_REQUIRES}")
|
||||
|
||||
register_component()
|
||||
569
libraries/LovyanGFX/LovyanGFX/README.md
Normal file
|
|
@ -0,0 +1,569 @@
|
|||
# LovyanGFX
|
||||
|
||||
[](https://www.ardu-badge.com/LovyanGFX)
|
||||
[](https://registry.platformio.org/packages/libraries/lovyan03/LovyanGFX)
|
||||
|
||||
[](https://github.com/lovyan03/LovyanGFX/actions/workflows/ArduinoBuild.yml)
|
||||
[](https://github.com/lovyan03/LovyanGFX/actions/workflows/PlatformioBuild.yml)
|
||||
[](https://github.com/lovyan03/LovyanGFX/actions/workflows/IDFBuild.yml)
|
||||
|
||||
|
||||
|
||||
Display (LCD / OLED / EPD) graphics library (for ESP32 SPI, I2C, 8bitParallel / ESP8266 SPI, I2C / ATSAMD51 SPI).
|
||||
M5Stack / M5StickC / TTGO T-Watch / ODROID-GO / ESP-WROVER-KIT / WioTerminal / and more...
|
||||
[](http://www.youtube.com/watch?v=SMOHRPqUZcQ "examples")
|
||||
[](http://www.youtube.com/watch?v=F5gsp41Elac "MultiPanel")
|
||||
|
||||
概要 Overview.
|
||||
----------------
|
||||
ESP32とSPI, I2C, 8ビットパラレル接続のディスプレイ / ESP8266とSPI接続のディスプレイ / ATSAMD51とSPI接続のディスプレイの組み合わせで動作するグラフィックライブラリです。
|
||||
This is a graphics library that works with a combination of ESP32 with SPI, I2C, 8-bit parallel / ESP8266 with SPI / ATSAMD51 with SPI to the Display. (see compatibility list below).
|
||||
|
||||
[AdafruitGFX](https://github.com/adafruit/Adafruit-GFX-Library) や [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) と互換性をある程度持ちつつ、より高機能・高速動作を目標としています。
|
||||
|
||||
This library mimics [AdafruitGFX](https://github.com/adafruit/Adafruit-GFX-Library) and [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) APIs while aiming for higher functional coverage and performances.
|
||||
|
||||
既存のライブラリに対して、以下のアドバンテージがあります。
|
||||
- ArduinoESP32 / ESP-IDF 対応
|
||||
- 16bit / 24bitカラーモード両対応(実際の色数はディスプレイの仕様によります)
|
||||
- DMA転送を用いた通信動作中の別処理実行
|
||||
- オフスクリーンバッファ(スプライト)の高速な回転/拡縮描画
|
||||
- 複数ディスプレイの同時利用
|
||||
- モノクロディスプレイに対する減色描画の自動処理
|
||||
- [OpenCV,SDL2を描画先として利用でき、PC上で動作可能](examples_for_PC/README.md)
|
||||
- [コンポジットビデオ信号(NTSC,PAL)を出力できます (ESP32のみ)](doc/Panel_CVBS.md)
|
||||
|
||||
This library has the following advantages.
|
||||
- ArduinoESP32 and ESP-IDF are supported.
|
||||
- Both 16bit and 24bit color modes are supported. (actual number of colors depends on display specifications)
|
||||
- Execute another process during communication operation using DMA transfer.
|
||||
- Fast rotation/expansion of the off-screen buffer (sprite).
|
||||
- Simultaneous use of multiple displays.
|
||||
- Automatic processing of color reduction drawing for monochrome displays.
|
||||
- OpenCV,SDL2 can be used as a drawing destination and can run on a PC.
|
||||
- Composite video signal (NTSC, PAL) output (only ESP32)
|
||||
|
||||
|
||||
| | SPI | I2C | 8bit Para |16bit Para | RGB | CVBS |
|
||||
|:------:|:---:|:---:|:---------:|:---------:|:---------:|:--------:|
|
||||
|ESP32 | HW | HW | HW (I2S) | --- | --- |HW(I2SDAC)|
|
||||
|ESP32-S2| HW | HW | HW (I2S) | HW (I2S) | --- | --- |
|
||||
|ESP32-S3| HW | HW |HW(LCD/CAM)|HW(LCD/CAM)|HW(LCD/CAM)| --- |
|
||||
|ESP32-C3| HW | HW | SW | --- | --- | --- |
|
||||
|ESP8266 | HW | SW | --- | --- | --- | --- |
|
||||
|SAMD51 | HW | HW | --- | --- | --- | --- |
|
||||
|SAMD21 | HW | HW | --- | --- | --- | --- |
|
||||
|RP2040 | HW | --- | --- | --- | --- | --- |
|
||||
|
||||
※ HW = HardWare Peripheral / SW = SoftWare implementation
|
||||
|
||||
| |TouchScreens|
|
||||
|:------:|:----------:|
|
||||
|ESP32 | supported |
|
||||
|ESP32-S2| supported |
|
||||
|ESP32-S3| supported |
|
||||
|ESP32-C3| supported |
|
||||
|ESP8266 | supported |
|
||||
|SAMD51 | supported |
|
||||
|SAMD21 | supported |
|
||||
|RP2040 | --- |
|
||||
|
||||
対応環境 Supported environments
|
||||
---------------
|
||||
- プラットフォーム Platform
|
||||
- ESP-IDF
|
||||
- Arduino ESP32
|
||||
- Arduino ATSAMD51 (Seeed)
|
||||
- Arduino RP2040
|
||||
|
||||
- ディスプレイ Displays
|
||||
- GC9107 (M5AtomS3)
|
||||
- GC9A01
|
||||
- GDEW0154M09 (M5Stack CoreInk)
|
||||
- HX8357
|
||||
- ILI9163
|
||||
- ILI9225
|
||||
- ILI9341 (WioTerminal, ESP-WROVER-KIT, ODROID-GO, LoLin D32 Pro, WiFiBoy Pro)
|
||||
- ILI9342 (M5Stack, M5Stack Core2, ESP32-S3-BOX)
|
||||
- ILI9481
|
||||
- ILI9486
|
||||
- ILI9488 (Makerfabs Touch with Camera)
|
||||
- IT8951 (M5Paper)
|
||||
- NT35510/OTM8009A
|
||||
- R61529
|
||||
- RA8875
|
||||
- RM68120
|
||||
- SH110x (SH1106, SH1107, M5Stack Unit OLED)
|
||||
- S6D04K1
|
||||
- SSD1306 (SSD1309)
|
||||
- SSD1327
|
||||
- SSD1331
|
||||
- SSD1351 (SSD1357)
|
||||
- SSD1963
|
||||
- ST7735 (M5StickC, TTGO T-Wristband, TTGO TS, LoLin D32 Pro, WiFiBoy mini, ESPboy, PyBadge)
|
||||
- ST7789 (M5StickCPlus, TTGO T-Watch, ESP-WROVER-KIT, Makerfabs MakePython, DSTIKE D-duino-32 XS)
|
||||
- ST7796 (WT32-SC01)
|
||||
|
||||
- M5Stack Unit LCD
|
||||
- M5Stack AtomDisplay
|
||||
|
||||
- タッチスクリーン TouchScreens
|
||||
- I2C CST816S
|
||||
- I2C FT5x06 (FT5206, FT5306, FT5406, FT6206, FT6236, FT6336, FT6436)
|
||||
- I2C GSLx680 (GSL1680)
|
||||
- I2C GT911
|
||||
- I2C NS2009
|
||||
- I2C TT21xxx (TT21100)
|
||||
- SPI XPT2046
|
||||
- SPI STMPE610
|
||||
|
||||
|
||||
設定方法のサンプルは[src/lgfx_user](src/lgfx_user)にあります。
|
||||
上記対応機種とコマンド体系の類似したディスプレイであれば対応可能ですが、当方で入手し動作確認が取れたもののみ正式対応としています。
|
||||
対応要望を頂けた機種には優先的に対応を検討致します。
|
||||
|
||||
setting examples is [src/lgfx_user](src/lgfx_user)
|
||||
This library is also compatible with the above models and display panels with a similar command system,
|
||||
but only those that have been obtained and confirmed to work are officially supported.
|
||||
|
||||
使い方 How to use
|
||||
----------------
|
||||
[examples](examples/)に具体的なサンプルがあります。
|
||||
### 基本的な使い方
|
||||
```c
|
||||
|
||||
// ※ もし対応機種を ArduinoIDE以外の環境で使用する場合や、
|
||||
// 対応機種がボードマネージャに無い場合 ( TTGO T-Wristband や ESP-WROVER-KIT等 ) は、
|
||||
// LovyanGFX.hppのincludeより前に、define LGFX_~ の定義を記述してください。
|
||||
|
||||
// #define LGFX_M5STACK // M5Stack M5Stack Basic / Gray / Go / Fire
|
||||
// #define LGFX_M5STACK_CORE2 // M5Stack M5Stack Core2
|
||||
// #define LGFX_M5STACK_COREINK // M5Stack M5Stack CoreInk
|
||||
// #define LGFX_M5STICK_C // M5Stack M5Stick C / CPlus
|
||||
// #define LGFX_M5PAPER // M5Stack M5Paper
|
||||
// #define LGFX_M5TOUGH // M5Stack M5Tough
|
||||
// #define LGFX_M5ATOMS3 // M5Stack M5ATOMS3
|
||||
// #define LGFX_ODROID_GO // ODROID-GO
|
||||
// #define LGFX_TTGO_TS // TTGO TS
|
||||
// #define LGFX_TTGO_TWATCH // TTGO T-Watch
|
||||
// #define LGFX_TTGO_TWRISTBAND // TTGO T-Wristband
|
||||
// #define LGFX_TTGO_TDISPLAY // TTGO T-Display
|
||||
// #define LGFX_DDUINO32_XS // DSTIKE D-duino-32 XS
|
||||
// #define LGFX_LOLIN_D32_PRO // LoLin D32 Pro
|
||||
// #define LGFX_LOLIN_S3_PRO // LoLin S3 Pro
|
||||
// #define LGFX_ESP_WROVER_KIT // Espressif ESP-WROVER-KIT
|
||||
// #define LGFX_ESP32_S3_BOX // Espressif ESP32-S3-BOX
|
||||
// #define LGFX_ESP32_S3_BOX_LITE // Espressif ESP32-S3-BOX Lite
|
||||
// #define LGFX_WIFIBOY_PRO // WiFiBoy Pro
|
||||
// #define LGFX_WIFIBOY_MINI // WiFiBoy mini
|
||||
// #define LGFX_MAKERFABS_TOUCHCAMERA // Makerfabs Touch with Camera
|
||||
// #define LGFX_MAKERFABS_MAKEPYTHON // Makerfabs MakePython
|
||||
// #define LGFX_MAKERFABS_TFT_TOUCH_SPI // Makerfabs TFT Touch SPI
|
||||
// #define LGFX_MAKERFABS_TFT_TOUCH_PARALLEL16// Makerfabs TFT Touch Parallel 16
|
||||
// #define LGFX_WT32_SC01 // Seeed WT32-SC01
|
||||
// #define LGFX_WIO_TERMINAL // Seeed Wio Terminal
|
||||
// #define LGFX_PYBADGE // Adafruit PyBadge
|
||||
// #define LGFX_FUNHOUSE // Adafruit FunHouse
|
||||
// #define LGFX_FEATHER_ESP32_S2_TFT // Adafruit Feather ESP32 S2 TFT
|
||||
// #define LGFX_FEATHER_ESP32_S3_TFT // Adafruit Feather ESP32 S3 TFT
|
||||
// #define LGFX_ESPBOY // ESPboy
|
||||
// #define LGFX_WYWY_ESP32S3_HMI_DEVKIT // wywy ESP32S3 HMI DevKit
|
||||
// #define LGFX_ESP32_2432S028 // Sunton ESP32 2432S028
|
||||
|
||||
#define LGFX_AUTODETECT // 自動認識 (D-duino-32 XS, WT32-SC01, PyBadge はパネルID読取りが出来ないため自動認識の対象から外れています)
|
||||
|
||||
// 複数機種の定義を行うか、LGFX_AUTODETECTを定義することで、実行時にボードを自動認識します。
|
||||
|
||||
|
||||
// ヘッダをincludeします。
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#include <LGFX_AUTODETECT.hpp> // クラス"LGFX"を用意します
|
||||
// #include <lgfx_user/LGFX_ESP32_sample.hpp> // またはユーザ自身が用意したLGFXクラスを準備します
|
||||
|
||||
static LGFX lcd; // LGFXのインスタンスを作成。
|
||||
static LGFX_Sprite sprite(&lcd); // スプライトを使う場合はLGFX_Spriteのインスタンスを作成。
|
||||
|
||||
// もし現在 TFT_eSPI を使用中で、ソースをなるべく変更したくない場合は、こちらのヘッダを利用できます。
|
||||
// #include <LGFX_TFT_eSPI.hpp>
|
||||
// static TFT_eSPI lcd; // TFT_eSPIがLGFXの別名として定義されます。
|
||||
// static TFT_eSprite sprite(&lcd); // TFT_eSpriteがLGFX_Spriteの別名として定義されます。
|
||||
|
||||
|
||||
// 対応機種に無い構成で使う場合は、 examples/HowToUse/2_user_setting.ino を参照してください。
|
||||
// また設定例はsrc/lgfx_userフォルダにもあります。
|
||||
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// 最初に初期化関数を呼び出します。
|
||||
lcd.init();
|
||||
|
||||
|
||||
// 回転方向を 0~3 の4方向から設定します。(4~7を使用すると上下反転になります。)
|
||||
lcd.setRotation(1);
|
||||
|
||||
|
||||
// バックライトの輝度を 0~255 の範囲で設定します。
|
||||
lcd.setBrightness(128);
|
||||
|
||||
|
||||
// 必要に応じてカラーモードを設定します。(初期値は16)
|
||||
// 16の方がSPI通信量が少なく高速に動作しますが、赤と青の諧調が5bitになります。
|
||||
// 24の方がSPI通信量が多くなりますが、諧調表現が綺麗になります。
|
||||
//lcd.setColorDepth(16); // RGB565の16ビットに設定
|
||||
lcd.setColorDepth(24); // RGB888の24ビットに設定(表示される色数はパネル性能によりRGB666の18ビットになります)
|
||||
|
||||
|
||||
// 基本的な図形の描画関数は以下の通りです。
|
||||
/*
|
||||
fillScreen ( color); // 画面全体の塗り潰し
|
||||
drawPixel ( x, y , color); // 点
|
||||
drawFastVLine ( x, y , h , color); // 垂直線
|
||||
drawFastHLine ( x, y, w , color); // 水平線
|
||||
drawRect ( x, y, w, h , color); // 矩形の外周
|
||||
fillRect ( x, y, w, h , color); // 矩形の塗り
|
||||
drawRoundRect ( x, y, w, h, r, color); // 角丸の矩形の外周
|
||||
fillRoundRect ( x, y, w, h, r, color); // 角丸の矩形の塗り
|
||||
drawCircle ( x, y , r, color); // 円の外周
|
||||
fillCircle ( x, y , r, color); // 円の塗り
|
||||
drawEllipse ( x, y, rx, ry , color); // 楕円の外周
|
||||
fillEllipse ( x, y, rx, ry , color); // 楕円の塗り
|
||||
drawLine ( x0, y0, x1, y1 , color); // 2点間の直線
|
||||
drawTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の外周
|
||||
fillTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の塗り
|
||||
drawBezier ( x0, y0, x1, y1, x2, y2, color); // 3点間のベジエ曲線
|
||||
drawBezier ( x0, y0, x1, y1, x2, y2, x3, y3, color); // 4点間のベジエ曲線
|
||||
drawArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の外周
|
||||
fillArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の塗り
|
||||
*/
|
||||
|
||||
|
||||
// 例えばdrawPixelで点を書く場合は、引数は X座標,Y座標,色 の3つ。
|
||||
lcd.drawPixel(0, 0, 0xFFFF); // 座標0:0に白の点を描画
|
||||
|
||||
|
||||
// カラーコードを生成する関数が用意されており、色の指定に使用できます。
|
||||
// 引数は、赤,緑,青をそれぞれ 0~255で指定します。
|
||||
// 色情報の欠落を防ぐため、color888を使う事を推奨します。
|
||||
lcd.drawFastVLine(2, 0, 100, lcd.color888(255, 0, 0)); // 赤で垂直の線を描画
|
||||
lcd.drawFastVLine(4, 0, 100, lcd.color565( 0, 255, 0)); // 緑で垂直の線を描画
|
||||
lcd.drawFastVLine(6, 0, 100, lcd.color332( 0, 0, 255)); // 青で垂直の線を描画
|
||||
|
||||
|
||||
// カラーコード生成関数を使用しない場合は以下のようになります。
|
||||
// RGB888 24ビットで指定 uint32_t型
|
||||
// RGB565 16ビットで指定 uint16_t型、int32_t型
|
||||
// RGB332 8ビットで指定 uint8_t型
|
||||
|
||||
// uint32_t型を使用すると、RGB888の24ビットとして扱われます。
|
||||
// 16進数2桁で赤緑青の順に記述できます。
|
||||
// uint32_t型の変数を使うか、末尾にUを付けるか、uint32_t型にキャストして使用します。
|
||||
uint32_t red = 0xFF0000;
|
||||
lcd.drawFastHLine(0, 2, 100, red); // 赤で水平の線を描画
|
||||
lcd.drawFastHLine(0, 4, 100, 0x00FF00U); // 緑で水平の線を描画
|
||||
lcd.drawFastHLine(0, 6, 100, (uint32_t)0xFF); // 青で水平の線を描画
|
||||
|
||||
|
||||
// uint16_t型およびint32_t型を使用すると、RGB565の16ビットとして扱われます。
|
||||
// 特別な書き方をしない場合はint32_t型として扱われるので、この方式になります。
|
||||
// (AdafruitGFX や TFT_eSPI との互換性のために、このようにしています。)
|
||||
uint16_t green = 0x07E0;
|
||||
lcd.drawRect(10, 10, 50, 50, 0xF800); // 赤で矩形の外周を描画
|
||||
lcd.drawRect(12, 12, 50, 50, green); // 緑で矩形の外周を描画
|
||||
lcd.drawRect(14, 14, 50, 50, (uint16_t)0x1F); // 青で矩形の外周を描画
|
||||
|
||||
|
||||
// int8_t型、uint8_t型を使用すると、RGB332の8ビットとして扱われます。
|
||||
uint8_t blue = 0x03;
|
||||
lcd.fillRect(20, 20, 20, 20, (uint8_t)0xE0); // 赤で矩形の塗りを描画
|
||||
lcd.fillRect(30, 30, 20, 20, (uint8_t)0x1C); // 緑で矩形の塗りを描画
|
||||
lcd.fillRect(40, 40, 20, 20, blue); // 青で矩形の塗りを描画
|
||||
|
||||
|
||||
// 描画関数の引数の色は省略できます。
|
||||
// 省略した場合、setColor関数で設定した色 または最後に使用した色を描画色として使用します。
|
||||
// 同じ色で繰り返し描画する場合は、省略した方がわずかに速く動作します。
|
||||
lcd.setColor(0xFF0000U); // 描画色に赤色を指定
|
||||
lcd.fillCircle ( 40, 80, 20 ); // 赤色で円の塗り
|
||||
lcd.fillEllipse( 80, 40, 10, 20); // 赤色で楕円の塗り
|
||||
lcd.fillArc ( 80, 80, 20, 10, 0, 90); // 赤色で円弧の塗り
|
||||
lcd.fillTriangle(80, 80, 60, 80, 80, 60); // 赤色で三角の塗り
|
||||
lcd.setColor(0x0000FFU); // 描画色に青色を指定
|
||||
lcd.drawCircle ( 40, 80, 20 ); // 青色で円の外周
|
||||
lcd.drawEllipse( 80, 40, 10, 20); // 青色で楕円の外周
|
||||
lcd.drawArc ( 80, 80, 20, 10, 0, 90); // 青色で円弧の外周
|
||||
lcd.drawTriangle(60, 80, 80, 80, 80, 60); // 青色で三角の外周
|
||||
lcd.setColor(0x00FF00U); // 描画色に緑色を指定
|
||||
lcd.drawBezier( 60, 80, 80, 80, 80, 60); // 緑色で二次ベジエ曲線
|
||||
lcd.drawBezier( 60, 80, 80, 20, 20, 80, 80, 60);// 緑色で三次ベジエ曲線
|
||||
|
||||
// グラデーションの線を描画するdrawGradientLine は色の指定を省略できません。
|
||||
lcd.drawGradientLine( 0, 80, 80, 0, 0xFF0000U, 0x0000FFU);// 赤から青へのグラデーション直線
|
||||
|
||||
delay(1000);
|
||||
|
||||
// clearまたはfillScreenで画面全体を塗り潰せます。
|
||||
// fillScreenはfillRectの画面全体を指定したのと同じで、色の指定は描画色の扱いになります。
|
||||
lcd.fillScreen(0xFFFFFFu); // 白で塗り潰し
|
||||
lcd.setColor(0x00FF00u); // 描画色に緑色を指定
|
||||
lcd.fillScreen(); // 緑で塗り潰し
|
||||
|
||||
// clearは描画系の関数とは別で背景色という扱いで色を保持しています。
|
||||
// 背景色は出番が少ないですが、スクロール機能使用時の隙間を塗る色としても使用されます。
|
||||
lcd.clear(0xFFFFFFu); // 背景色に白を指定して塗り潰し
|
||||
lcd.setBaseColor(0x000000u);// 背景色に黒を指定
|
||||
lcd.clear(); // 黒で塗り潰し
|
||||
|
||||
|
||||
// SPIバスの確保と解放は描画関数を呼び出した時に自動的に行われますが、
|
||||
// 描画スピードを重視する場合は、描画処理の前後に startWriteとendWriteを使用します。
|
||||
// SPIバスの確保と解放が抑制され、速度が向上します。
|
||||
// 電子ペーパー(EPD)の場合、startWrite()以降の描画は、endWrite()を呼ぶ事で画面に反映されます。
|
||||
lcd.drawLine(0, 1, 39, 40, red); // SPIバス確保、線を描画、SPIバス解放
|
||||
lcd.drawLine(1, 0, 40, 39, blue); // SPIバス確保、線を描画、SPIバス解放
|
||||
lcd.startWrite(); // SPIバス確保
|
||||
lcd.drawLine(38, 0, 0, 38, 0xFFFF00U); // 線を描画
|
||||
lcd.drawLine(39, 1, 1, 39, 0xFF00FFU); // 線を描画
|
||||
lcd.drawLine(40, 2, 2, 40, 0x00FFFFU); // 線を描画
|
||||
lcd.endWrite(); // SPIバス解放
|
||||
|
||||
|
||||
// startWriteとendWriteは呼出し回数を内部でカウントしており、
|
||||
// 繰り返し呼び出した場合は最初と最後のみ動作します。
|
||||
// startWriteとendWriteは必ず対になるように使用してください。
|
||||
// (SPIバスを占有して構わない場合は、最初にstartWriteを一度呼び、endWriteしない使い方も可能です。)
|
||||
lcd.startWrite(); // カウント+1、SPIバス確保
|
||||
lcd.startWrite(); // カウント+1
|
||||
lcd.startWrite(); // カウント+1
|
||||
lcd.endWrite(); // カウント-1
|
||||
lcd.endWrite(); // カウント-1
|
||||
lcd.endWrite(); // カウント-1、SPIバス解放
|
||||
lcd.endWrite(); // 何もしない
|
||||
// なお過剰にendWriteを呼び出した場合は何も行わず、カウントがマイナスになることもありません。
|
||||
|
||||
|
||||
// startWriteのカウントの状態に依らず、強制的にSPIバスを解放・確保したい場合は、
|
||||
// endTransaction・beginTransactionを使用します。
|
||||
// カウントはクリアされないので、辻褄が合わなくならないよう注意してください。
|
||||
lcd.startWrite(); // カウント+1、SPIバス確保
|
||||
lcd.startWrite(); // カウント+1
|
||||
lcd.drawPixel(0, 0); // 描画
|
||||
lcd.endTransaction(); // SPIバス解放
|
||||
// ここで他のSPIデバイスの使用が可能
|
||||
// 同じSPIバスの別のデバイス(SDカード等)を使う場合、
|
||||
// 必ずSPIバスが解放された状態で行ってください。
|
||||
lcd.beginTransaction(); // SPIバスの確保
|
||||
lcd.drawPixel(0, 0); // 描画
|
||||
lcd.endWrite(); // カウント-1
|
||||
lcd.endWrite(); // カウント-1、SPIバス解放
|
||||
|
||||
|
||||
|
||||
// drawPixelとは別に、writePixelという点を描画する関数があります。
|
||||
// drawPixelは必要に応じてSPIバスの確保を行うのに対し、
|
||||
// writePixelはSPIバスの状態をチェックしません。
|
||||
lcd.startWrite(); // SPIバス確保
|
||||
for (uint32_t x = 0; x < 128; ++x) {
|
||||
for (uint32_t y = 0; y < 128; ++y) {
|
||||
lcd.writePixel(x, y, lcd.color888( x*2, x + y, y*2));
|
||||
}
|
||||
}
|
||||
lcd.endWrite(); // SPIバス解放
|
||||
// 名前が write~ で始まる関数は全て明示的にstartWriteを呼び出しておく必要があります。
|
||||
// writePixel、writeFastVLine、writeFastHLine、writeFillRect が該当します。
|
||||
|
||||
delay(1000);
|
||||
|
||||
// スプライト(オフスクリーン)への描画も同様の描画関数が使えます。
|
||||
// 最初にスプライトの色深度をsetColorDepthで指定します。(省略した場合は16として扱われます。)
|
||||
//sprite.setColorDepth(1); // 1ビット( 2色)パレットモードに設定
|
||||
//sprite.setColorDepth(2); // 2ビット( 4色)パレットモードに設定
|
||||
//sprite.setColorDepth(4); // 4ビット(16色)パレットモードに設定
|
||||
//sprite.setColorDepth(8); // RGB332の8ビットに設定
|
||||
//sprite.setColorDepth(16); // RGB565の16ビットに設定
|
||||
sprite.setColorDepth(24); // RGB888の24ビットに設定
|
||||
|
||||
|
||||
// ※ setColorDepth(8);を設定後に createPalette()を呼ぶ事で、256色パレットモードになります
|
||||
// sprite.createPalette();
|
||||
|
||||
|
||||
// createSpriteで幅と高さを指定してメモリを確保します。
|
||||
// 消費するメモリは色深度と面積に比例します。大きすぎるとメモリ確保に失敗しますので注意してください。
|
||||
sprite.createSprite(65, 65); // 幅65、高さ65でスプライトを作成。
|
||||
|
||||
for (uint32_t x = 0; x < 64; ++x) {
|
||||
for (uint32_t y = 0; y < 64; ++y) {
|
||||
sprite.drawPixel(x, y, lcd.color888(3 + x*4, (x + y)*2, 3 + y*4)); // スプライトに描画
|
||||
}
|
||||
}
|
||||
sprite.drawRect(0, 0, 65, 65, 0xFFFF);
|
||||
|
||||
// 作成したスプライトはpushSpriteで任意の座標に出力できます。
|
||||
// 出力先はインスタンス作成時に引数で渡したLGFXになります。
|
||||
sprite.pushSprite(64, 0); // lcdの座標64,0にスプライトを描画
|
||||
|
||||
// spriteのインスタンス作成時に描画先のポインタを渡していない場合や、
|
||||
// 複数のLGFXがある場合などは、出力先を第一引数に指定してpushSpriteすることもできます。
|
||||
sprite.pushSprite(&lcd, 0, 64); // lcdの座標0,64にスプライトを描画
|
||||
|
||||
delay(1000);
|
||||
|
||||
// pushRotateZoomでスプライトを回転拡大縮小して描画できます。
|
||||
// setPivotで設定した座標が回転中心として扱われ、描画先の座標に回転中心が位置するように描画されます。
|
||||
sprite.setPivot(32, 32); // 座標32,32を中心として扱う
|
||||
int32_t center_x = lcd.width()/2;
|
||||
int32_t center_y = lcd.height()/2;
|
||||
lcd.startWrite();
|
||||
for (int angle = 0; angle <= 360; ++angle) {
|
||||
sprite.pushRotateZoom(center_x, center_y, angle, 2.5, 3); // 画面中心に角度angle、幅2.5倍、高さ3倍で描画
|
||||
|
||||
if ((angle % 36) == 0) lcd.display(); // 電子ペーパーの場合の表示更新を 36回に一度行う
|
||||
}
|
||||
lcd.endWrite();
|
||||
|
||||
delay(1000);
|
||||
|
||||
// 使用しなくなったスプライトのメモリを解放するには deleteSprite を使用します。
|
||||
sprite.deleteSprite();
|
||||
|
||||
// deleteSprite の後でも、同じインスタンスの再利用が可能です。
|
||||
sprite.setColorDepth(4); // 4ビット(16色)パレットモードに設定
|
||||
sprite.createSprite(65, 65);
|
||||
|
||||
// パレットモードのスプライトでは、描画関数の引数の色をパレット番号として扱います。
|
||||
// pushSprite等で描画する際に、パレットを参照して実際の描画色が決まります。
|
||||
|
||||
// 4ビット(16色)パレットモードの場合、パレット番号は0~15が使用可能です。
|
||||
// パレットの初期色は、0が黒,末尾のパレットが白で、0から末尾にかけてグラデーションになっています。
|
||||
// パレットの色を設定するには setPaletteColor を使用します。
|
||||
sprite.setPaletteColor(1, 0x0000FFU); // パレット1番を青に設定
|
||||
sprite.setPaletteColor(2, 0x00FF00U); // パレット2番を緑に設定
|
||||
sprite.setPaletteColor(3, 0xFF0000U); // パレット3番を赤に設定
|
||||
|
||||
sprite.fillRect(10, 10, 45, 45, 1); // パレット1番で矩形の塗り
|
||||
sprite.fillCircle(32, 32, 22, 2); // パレット2番で円の塗り
|
||||
sprite.fillTriangle(32, 12, 15, 43, 49, 43, 3); // パレット3番で三角の塗り
|
||||
|
||||
// pushSpriteの最後の引数で、描画しない色を指定することができます。
|
||||
sprite.pushSprite( 0, 0, 0); // パレット0を透過扱いでスプライトを描画
|
||||
sprite.pushSprite(65, 0, 1); // パレット1を透過扱いでスプライトを描画
|
||||
sprite.pushSprite( 0, 65, 2); // パレット2を透過扱いでスプライトを描画
|
||||
sprite.pushSprite(65, 65, 3); // パレット3を透過扱いでスプライトを描画
|
||||
|
||||
delay(5000);
|
||||
|
||||
lcd.startWrite(); // ここでstartWrite()することで、SPIバスを占有したままにする。
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static int count = 0;
|
||||
static int a = 0;
|
||||
static int x = 0;
|
||||
static int y = 0;
|
||||
static float zoom = 3;
|
||||
++count;
|
||||
if ((a += 1) >= 360) a -= 360;
|
||||
if ((x += 2) >= lcd.width()) x -= lcd.width();
|
||||
if ((y += 1) >= lcd.height()) y -= lcd.height();
|
||||
sprite.setPaletteColor(1, lcd.color888( 0, 0, count & 0xFF));
|
||||
sprite.setPaletteColor(2, lcd.color888( 0,~count & 0xFF, 0));
|
||||
sprite.setPaletteColor(3, lcd.color888( count & 0xFF, 0, 0));
|
||||
|
||||
sprite.pushRotateZoom(x, y, a, zoom, zoom, 0);
|
||||
|
||||
if ((count % 100) == 0) lcd.display(); // 電子ペーパーの場合の表示更新を 100回に一度行う
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# 注意・制限事項
|
||||
## M5Stack.h(M5StickC.h)と共存させる方法
|
||||
### 方法1
|
||||
include <M5Stack.h> より後に include <LovyanGFX.hpp> を書いてください。
|
||||
M5.Lcdは使わずに、別途LGFXのインスタンスを用意して使用してください。
|
||||
### 方法2
|
||||
[ESP32-Chimera-Core](https://github.com/tobozo/ESP32-Chimera-Core) を利用すると、M5.Lcd が LovyanGFX になります。
|
||||
|
||||
|
||||
作成動機 Motivation behind this library
|
||||
----------------
|
||||
TFT_eSPIは素晴らしいライブラリです。しかし、複数のアーキテクチャを対象とするため構造的に複雑となっており、ESP-IDFへの対応や18bitカラーへの対応など、求める機能の追加を行う事が非常に困難となっていました。
|
||||
LovyanGFX はこれらの機能の追加とパフォーマンスの最適化を実現するために作成しました。
|
||||
|
||||
TFT_eSPI is a great library. However, it is structurally complex because it targets multiple architectures, making it very difficult to add required functions such as ESP-IDF support and 18-bit color support.
|
||||
LovyanGFX has been created to add these features and optimize performance.
|
||||
|
||||
|
||||
謝辞 Acknowledgements
|
||||
----------------
|
||||
このライブラリを作成するにあたり、インスピレーションを頂いた[TFT_eSPI](https://github.com/Bodmer/TFT_eSPI)ライブラリの作者[Bodmer](https://github.com/Bodmer/)氏へ感謝いたします。
|
||||
TFT_eSPIのベースとなった、[AdafruitGFX](https://github.com/adafruit/Adafruit-GFX-Library)を公開されている[Adafruit Industries](https://github.com/adafruit/)へ感謝いたします。
|
||||
[TJpgDec](http://elm-chan.org/fsw/tjpgd/00index.html) (Tiny JPEG Decompressor) の作者 [ChaN](http://elm-chan.org/)氏へ感謝いたします。
|
||||
[Pngle](https://github.com/kikuchan/pngle) (PNG Loader for Embedding) の作者 [kikuchan](https://github.com/kikuchan/)氏へ感謝いたします。
|
||||
[QRCode](https://github.com/ricmoo/QRCode/) (QR code generation library) の作者 [Richard Moore](https://github.com/ricmoo/)氏へ感謝いたします。
|
||||
多くの技術的なアドバイスやESP-IDF環境での検証に協力してくださった[ciniml](https://github.com/ciniml)氏へ感謝いたします。
|
||||
不具合の多い開発初期からの動作検証および多数の助言をくださった[mongonta0716](https://github.com/mongonta0716)氏へ感謝いたします。
|
||||
多数のボードでの動作検証や英語への翻訳および多数の助言をくださった[tobozo](https://github.com/tobozo)氏へ感謝いたします。
|
||||
フォントデータの作成に協力してくださった[TANAKA Masayuki](https://github.com/tanakamasayuki)氏へ感謝いたします。
|
||||
[日本語フォントサブセットジェネレーター](https://github.com/yamamaya/lgfxFontSubsetGenerator)を製作してくださった[YAMANEKO](https://github.com/yamamaya)氏へ感謝いたします。
|
||||
Raspberry pi pico (RP2040)対応に協力してくださった[yasuhirok](https://github.com/yasuhirok-git)氏へ感謝いたします。
|
||||
Linux FrameBuffer対応に協力してくださった[IAMLIUBO](https://github.com/imliubo)氏へ感謝いたします。
|
||||
コンポジットビデオ信号をESP32で出力するプロジェクトを公開されている[rossum](https://github.com/rossumur)氏と[Roger Cheng](https://github.com/Roger-random)氏へ感謝いたします。
|
||||
|
||||
|
||||
Thanks to [Bodmer](https://github.com/Bodmer/), author of the [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) library, for the inspiration to create this library.
|
||||
Thanks to [Adafruit Industries](https://github.com/adafruit/) for publishing [AdafruitGFX](https://github.com/adafruit/Adafruit-GFX-Library), which is the basis for TFT_eSPI.
|
||||
Thanks to [ChaN](http://elm-chan.org/), author of [TJpgDec](http://elm-chan.org/fsw/tjpgd/00index.html) (Tiny JPEG Decompressor).
|
||||
Thanks to [kikuchan](https://github.com/kikuchan/), author of [Pngle](https://github.com/kikuchan/pngle) (PNG Loader for Embedding).
|
||||
Thanks to [Richard Moore](https://github.com/ricmoo/), author of [QRCode](https://github.com/ricmoo/QRCode/) (QR code generation library).
|
||||
Thanks to [ciniml](https://github.com/ciniml), for many technical tips and help with validation in the ESP-IDF environment.
|
||||
Thanks to [mongonta0716](https://github.com/mongonta0716), for verifying the work from the beginning of the development with many bugs and for his advice.
|
||||
Thanks to [tobozo](https://github.com/tobozo), for testing it on various boards, translating it into English and giving me a lot of advice.
|
||||
Thanks to [TANAKA Masayuki](https://github.com/tanakamasayuki), for creating the font data.
|
||||
Thanks to [YAMANEKO](https://github.com/yamamaya), for creating the [lgfxFontSubsetGenerator](https://github.com/yamamaya/lgfxFontSubsetGenerator).
|
||||
Thanks to [yasuhirok](https://github.com/yasuhirok-git), for add Raspberry pi pico (RP2040) support.
|
||||
Thanks to [IAMLIUBO](https://github.com/imliubo), for add Linux FrameBuffer support.
|
||||
Thanks to [rossum](https://github.com/rossumur) and [Roger Cheng](https://github.com/Roger-random), published the project to output a composite video signal from ESP32.
|
||||
|
||||
|
||||
使用ライブラリ included library
|
||||
----------------
|
||||
[TJpgDec](http://elm-chan.org/fsw/tjpgd/00index.html) [ChaN](http://elm-chan.org/)
|
||||
[Pngle](https://github.com/kikuchan/pngle) [kikuchan](https://github.com/kikuchan/)
|
||||
[QRCode](https://github.com/ricmoo/QRCode/) [Richard Moore](https://github.com/ricmoo/) and [Nayuki](https://www.nayuki.io/page/qr-code-generator-library)
|
||||
|
||||
|
||||
クレジット Credits
|
||||
----------------
|
||||
- Inspiration: [Bodmer](https://github.com/Bodmer)
|
||||
- Author: [lovyan03](https://github.com/lovyan03)
|
||||
- Contributors:
|
||||
- [ciniml](https://github.com/ciniml)
|
||||
- [mongonta0716](https://github.com/mongonta0716)
|
||||
- [tobozo](https://github.com/tobozo)
|
||||
|
||||
|
||||
ライセンス License
|
||||
----------------
|
||||
main : [FreeBSD](license.txt)
|
||||
TJpgDec : [original](src/lgfx/utility/lgfx_tjpgd.c) ChaN
|
||||
Pngle : [MIT](https://github.com/kikuchan/pngle/blob/master/LICENSE) kikuchan
|
||||
QRCode : [MIT](https://github.com/ricmoo/QRCode/blob/master/LICENSE.txt) Richard Moore and Nayuki
|
||||
result : [MIT](https://github.com/bitwizeshift/result/blob/master/LICENSE) Matthew Rodusek
|
||||
GFX font and GLCD font : [2-clause BSD](https://github.com/adafruit/Adafruit-GFX-Library/blob/master/license.txt) Adafruit Industries
|
||||
Font 2,4,6,7,8 : [FreeBSD](https://github.com/Bodmer/TFT_eSPI/blob/master/license.txt) Bodmer
|
||||
converted IPA font : [IPA Font License](src/lgfx/Fonts/IPA/IPA_Font_License_Agreement_v1.0.txt) IPA
|
||||
efont : [3-clause BSD](src/lgfx/Fonts/efont/COPYRIGHT.txt) The Electronic Font Open Laboratory
|
||||
TomThumb font : [3-clause BSD](src/lgfx/Fonts/GFXFF/TomThumb.h) Brian J. Swetland / Vassilii Khachaturov / Dan Marks
|
||||
|
||||
|
||||
実装予定 Unimplemented request
|
||||
----------------
|
||||
- ディスプレイ Displays
|
||||
- SEPS525
|
||||
- LT7680A / LT7685
|
||||
- RA8873 / RA8876
|
||||
|
||||
7
libraries/LovyanGFX/LovyanGFX/component.mk
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# Main Makefile. This is basically the same as a component makefile.
|
||||
#
|
||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||
|
||||
COMPONENT_SRCDIRS := src
|
||||
COMPONENT_ADD_INCLUDEDIRS := src
|
||||
208
libraries/LovyanGFX/LovyanGFX/doc/Panel_CVBS.md
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
# lgfx::Panel_CVBS for ESP32
|
||||
|
||||
- ESP32の GPIO25, または GPIO26 からビデオ信号を出力できます。(ESP32-S2,S3,C3には対応していません)
|
||||
- I2S の channel0 と DAC を利用してビデオ信号を生成しています。
|
||||
- ESP32のメモリ上に映像フレームバッファを確保するためメモリ消費は多めです。(PSRAMの利用が可能です)
|
||||
|
||||
|
||||
出力可能な信号の種類 (Types of signals that can be output)
|
||||
----------------
|
||||
|
||||
- NTSC
|
||||
- NTSC-J
|
||||
- PAL
|
||||
- PAL-M
|
||||
- PAL-N
|
||||
|
||||
NTSCとNTSC-Jは黒の信号レベルが異なっており、NTSCは7.5IRE、NTSC-Jは0IREに設定されています。<br>
|
||||
NTSCを使用した際に黒が僅かに白浮きしていると感じる場合はNTSC-Jに変更してみてください。
|
||||
|
||||
|
||||
|
||||
出力解像度 (Output resolution)
|
||||
----------------
|
||||
|
||||
- 出力できる最大解像度は信号タイプによって差があります。
|
||||
- 720 x 480 (PAL-M,NTSC,NTSC-J)
|
||||
- 864 x 576 (PAL)
|
||||
- 720 x 576 (PAL-N)
|
||||
- 最大解像度以下であれば、任意の解像度を設定可能です。
|
||||
- 最大解像度を整数で約分した解像度の指定を推奨します。
|
||||
- それ以外の解像度を指定した場合はピクセルの比率が場所によって差が生じ、表示が少し歪になります。
|
||||
|
||||
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TH></TH>
|
||||
<TH> PAL-M <BR> NTSC <BR> NTSC-J </TH>
|
||||
<TH> PAL-N </TH>
|
||||
<TH> PAL </TH>
|
||||
</TR>
|
||||
<TR align="center">
|
||||
<TH> max width </TH>
|
||||
<TD colspan="2"> 720 </TD>
|
||||
<TD> 864 </TD>
|
||||
</TR>
|
||||
<TR align="center">
|
||||
<TH> max height </TH>
|
||||
<TD> 480 </TD>
|
||||
<TD colspan="2"> 576 </TD>
|
||||
</TR>
|
||||
<TR align="center">
|
||||
<TH> recommended<BR>width<BR>推奨 幅</TH>
|
||||
<TD colspan="2">
|
||||
720/1 = 720<br>
|
||||
720/1.5=480<br>
|
||||
720/2 = 360<br>
|
||||
720/3 = 240<br>
|
||||
720/4 = 180<br>
|
||||
720/5 = 144<br>
|
||||
720/6 = 120
|
||||
</TD>
|
||||
<TD>
|
||||
864/1 = 864<br>
|
||||
864/1.5=576<br>
|
||||
864/2 = 432<br>
|
||||
864/3 = 288<br>
|
||||
864/4 = 216<br>
|
||||
864/5 = 173<br>
|
||||
864/6 = 144
|
||||
</TD>
|
||||
</TR>
|
||||
<TR align="center">
|
||||
<TH> recommended<BR>height<BR>推奨 高さ</TH>
|
||||
<TD>
|
||||
480/1 = 480<br>
|
||||
480/2 = 240<br>
|
||||
480/3 = 160<br>
|
||||
480/4 = 120<br>
|
||||
480/5 = 96<br>
|
||||
480/6 = 80<br>
|
||||
480/8 = 60
|
||||
</TD>
|
||||
<TD colspan="2">
|
||||
576/1 = 576<br>
|
||||
576/2 = 288<br>
|
||||
576/3 = 192<br>
|
||||
576/4 = 144<br>
|
||||
576/5 = 113<br>
|
||||
576/6 = 96<br>
|
||||
576/8 = 72
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
|
||||
|
||||
|
||||
使い方 How to use
|
||||
----------------
|
||||
```c
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
class LGFX : public lgfx::LGFX_Device
|
||||
{
|
||||
public:
|
||||
|
||||
lgfx::Panel_CVBS _panel_instance;
|
||||
|
||||
LGFX(void)
|
||||
{
|
||||
{ // 表示パネル制御の設定を行います。
|
||||
auto cfg = _panel_instance.config(); // 表示パネル設定用の構造体を取得します。
|
||||
|
||||
// 出力解像度を設定;
|
||||
cfg.memory_width = 240; // 出力解像度 幅
|
||||
cfg.memory_height = 160; // 出力解像度 高さ
|
||||
|
||||
// 実際に利用する解像度を設定;
|
||||
cfg.panel_width = 208; // 実際に使用する幅 (memory_width と同値か小さい値を設定する)
|
||||
cfg.panel_height = 128; // 実際に使用する高さ (memory_heightと同値か小さい値を設定する)
|
||||
|
||||
// 表示位置オフセット量を設定;
|
||||
cfg.offset_x = 16; // 表示位置を右にずらす量 (初期値 0)
|
||||
cfg.offset_y = 16; // 表示位置を下にずらす量 (初期値 0)
|
||||
|
||||
_panel_instance.config(cfg);
|
||||
|
||||
|
||||
// 通常は memory_width と panel_width に同じ値を指定し、 offset_x = 0 で使用します。;
|
||||
// 画面端の表示が画面外に隠れるのを防止したい場合は、 panel_width の値をmemory_widthより小さくし、offset_x で左右の位置調整をします。;
|
||||
// 例えば memory_width より panel_width を 32 小さい値に設定した場合、offset_x に 16 を設定することで左右位置が中央寄せになります。;
|
||||
// 上下方向 (memory_height , panel_height , offset_y ) についても同様に、必要に応じて調整してください。;
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
auto cfg = _panel_instance.config_detail();
|
||||
|
||||
// 出力信号の種類を設定;
|
||||
// cfg.signal_type = cfg.signal_type_t::NTSC;
|
||||
cfg.signal_type = cfg.signal_type_t::NTSC_J;
|
||||
// cfg.signal_type = cfg.signal_type_t::PAL;
|
||||
// cfg.signal_type = cfg.signal_type_t::PAL_M;
|
||||
// cfg.signal_type = cfg.signal_type_t::PAL_N;
|
||||
|
||||
// 出力先のGPIO番号を設定;
|
||||
cfg.pin_dac = 26; // DACを使用するため、 25 または 26 のみが選択できます;
|
||||
|
||||
// PSRAMメモリ割当の設定;
|
||||
cfg.use_psram = 1; // 0=PSRAM不使用 / 1=PSRAMとSRAMを半々使用 / 2=全部PSRAM使用;
|
||||
|
||||
// 出力信号の振幅の強さを設定;
|
||||
cfg.output_level = 128; // 初期値128
|
||||
// ※ GPIOに保護抵抗が付いている等の理由で信号が減衰する場合は数値を上げる。;
|
||||
// ※ M5StackCore2 はGPIOに保護抵抗が付いているため 200 を推奨。;
|
||||
|
||||
// 彩度信号の振幅の強さを設定;
|
||||
cfg.chroma_level = 128; // 初期値128
|
||||
// 数値を下げると彩度が下がり、0で白黒になります。数値を上げると彩度が上がります。;
|
||||
|
||||
// バックグラウンドでPSRAMの読出しを行うタスクの優先度を設定;
|
||||
// cfg.task_priority = 25;
|
||||
|
||||
// バックグラウンドでPSRAMの読出しを行うタスクを実行するCPUを選択 (APP_CPU_NUM or PRO_CPU_NUM);
|
||||
// cfg.task_pinned_core = PRO_CPU_NUM;
|
||||
|
||||
_panel_instance.config_detail(cfg);
|
||||
}
|
||||
|
||||
setPanel(&_panel_instance);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
LGFX gfx;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// 色数の指定 (省略時は rgb332_1Byte)
|
||||
//gfx.setColorDepth( 8); // RGB332 256色
|
||||
//gfx.setColorDepth(16); // RGB565 65536色
|
||||
//gfx.setColorDepth(lgfx::color_depth_t::rgb332_1Byte); // RGB332 256色
|
||||
//gfx.setColorDepth(lgfx::color_depth_t::rgb565_2Byte); // RGB565 65536色
|
||||
//gfx.setColorDepth(lgfx::color_depth_t::grayscale_8bit); // モノクロ 256階調
|
||||
|
||||
//※ 実行中に setColorDepth で色数を変更することも可能ですが、
|
||||
// メモリの再割当を実行するため描画内容は無効になります。
|
||||
|
||||
gfx.init();
|
||||
|
||||
for (int x = 0; x < gfx.width(); ++x)
|
||||
{
|
||||
int v = x * 256 / gfx.width();
|
||||
gfx.fillRect(x, 0 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(v, v, v));
|
||||
gfx.fillRect(x, 1 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(v, 0 ,0));
|
||||
gfx.fillRect(x, 2 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(0, v, 0));
|
||||
gfx.fillRect(x, 3 * gfx.height() >> 3, 7, gfx.height() >> 3, gfx.color888(0, 0, v));
|
||||
}
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
gfx.fillRect(rand() % gfx.width() - 8, rand() % gfx.height() - 8, 16, 16, rand());
|
||||
}
|
||||
```
|
||||
316
libraries/LovyanGFX/LovyanGFX/examples/Advanced/EPD/EPD.ino
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
|
||||
// M5PaperやCoreInkのライブラリと同時に利用する場合はLovyanGFX.hppより前にincludeします。
|
||||
// If you use it with M5Paper or CoreInk libraries, include it before LovyanGFX.hpp.
|
||||
// #include <M5EPD.h>
|
||||
// #include <M5CoreInk.h>
|
||||
|
||||
// 使用するボードに応じた define を記述します。
|
||||
// (ボードマネージャで該当ボードを選択している場合は省略しても構いません)
|
||||
// #define LGFX_M5PAPER
|
||||
// #define LGFX_M5STACK_COREINK
|
||||
#define LGFX_AUTODETECT // 自動検出を使用する場合はこちらの記述だけで動作します。
|
||||
|
||||
// 使用ボードのdefineより後にLovyanGFX.hppをincludeします。
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
LGFX gfx;
|
||||
LGFX_Sprite sp(&gfx);
|
||||
|
||||
int w = 200;
|
||||
int h = 200;
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// M5.begin();
|
||||
|
||||
gfx.init(); // 初期化を行います。LCDもEPDも共通です。
|
||||
|
||||
gfx.setRotation(0); // 回転方向の設定はLCDもEPDも共通です。0~3で右回りに90度ずつ回転します。4~7は上下反転になります。
|
||||
|
||||
w = gfx.width();
|
||||
h = gfx.height();
|
||||
|
||||
gfx.setBrightness(128); // バックライトの輝度設定はEPDでは効果を持ちません。
|
||||
|
||||
// EPDの動作モードを設定できます。描画用途に応じて 都度、変更してください。
|
||||
// ※ M5Stack CoreInk では epd_quality以外は差はありません。
|
||||
gfx.setEpdMode(epd_mode_t::epd_fastest); // 最速更新、白黒反転なし、残像が残りやすい
|
||||
gfx.setEpdMode(epd_mode_t::epd_fast); // 高速更新、白黒反転なし、残像が残りやすい
|
||||
gfx.setEpdMode(epd_mode_t::epd_text); // 高品質更新、白黒反転が一瞬起きる(白背景用)
|
||||
gfx.setEpdMode(epd_mode_t::epd_quality); // 高品質更新、白黒反転が一瞬起きる
|
||||
|
||||
// M5Paper (IT8951)での各モードの特徴は以下の通りです。
|
||||
// epd_fastest = DU4 更新時間 120msec 完全な白と黒のみ描画でき、中間階調は描画されない。また、中間階調で表示されている箇所を更新できない。
|
||||
// epd_fast = DU 更新時間 260msec 完全な白と黒のみ描画でき、中間階調は描画されない。
|
||||
// epd_text = GL16 更新時間 450msec グレースケール16階調で描画できる。白背景・黒文字 用途
|
||||
// epd_quality = GC16 更新時間 450msec グレースケール16階調で描画できる。画像用途
|
||||
|
||||
|
||||
// 描画関数はすべてLCDと同様に利用可能です。
|
||||
// 色指定もLCDと同様に指定できますが、自動的にグレースケールに変換されます。
|
||||
// (グレースケール変換時の比率は R1:G2:B1 です。緑色がやや明るく表現されます。)
|
||||
|
||||
int rectwidth = std::min(w, h) / 2;
|
||||
gfx.fillTriangle( w / 2, 0, 0, h - 1, w - 1, h - 1, TFT_RED);
|
||||
gfx.fillCircle(w/2, h/2, rectwidth, TFT_GREEN);
|
||||
gfx.fillRect((w-rectwidth)/2, (h-rectwidth)/2, rectwidth, rectwidth, TFT_BLUE);
|
||||
|
||||
delay(3000);
|
||||
|
||||
|
||||
// 描画処理をstartWrite/endWriteで囲むと、endWrite() のタイミングでまとめて画面に反映できます。
|
||||
// または、display() を呼んだ時点でも画面に反映できます。
|
||||
|
||||
gfx.startWrite(); // 描画内容の即時反映を抑止。
|
||||
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
gfx.drawLine(i * w / 20, 0, w - 1, i * h / 20, TFT_BLACK); // この時点では画面に反映されない。
|
||||
gfx.drawLine(0, i * h / 20, i * w / 20, h - 1, TFT_BLACK);
|
||||
}
|
||||
|
||||
gfx.endWrite(); // ここで画面に反映される。
|
||||
|
||||
delay(3000);
|
||||
|
||||
gfx.startWrite(); // 描画内容の即時反映を抑止。
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
gfx.fillRect(random(w-20), random(h-20), 20, 20, random(65535)); // この時点では画面に反映されない。
|
||||
}
|
||||
gfx.display(); // ここで画面に反映される。
|
||||
}
|
||||
|
||||
gfx.endWrite(); // すでに画面に反映済みの場合は、この時点では何も起きない。
|
||||
|
||||
delay(3000);
|
||||
|
||||
// ※ 正確には、 display() を呼んだ時にのみ 画面に反映される仕組みなのですが、
|
||||
// SPIバス解放のタイミングで display() を呼ぶ仕組みを用意しており、初期値で有効にしています。
|
||||
// この仕組みにより、描画関数やendWriteを呼んだ直後に自動で画面に反映されています。
|
||||
// なお、 setAutoDisplay(bool) でこの自動display呼出しの有効/無効を変更できます。
|
||||
|
||||
gfx.setAutoDisplay(false); // 自動表示更新を無効にする。(以降は display()を呼ぶまで画面に反映されない。)
|
||||
|
||||
gfx.setFont(&fonts::Font4);
|
||||
gfx.setTextColor(TFT_BLACK, TFT_WHITE); // 文字色を黒、背景色を白に指定
|
||||
gfx.setTextDatum(textdatum_t::top_center);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
gfx.drawString("Hello World !!", w / 2, i * h / 10);
|
||||
}
|
||||
gfx.qrcode("Hello world !", (w-rectwidth)/2, (h-rectwidth)/2, rectwidth);
|
||||
|
||||
gfx.display(); // ここで画面に反映される。
|
||||
|
||||
gfx.setAutoDisplay(true); // 自動表示更新を有効にする。
|
||||
|
||||
delay(3000);
|
||||
|
||||
gfx.fillScreen(TFT_WHITE);
|
||||
|
||||
// M5Paper (IT8951)では epd_quality/epd_text を使用するとグレースケール16階調の表示が可能ですが、
|
||||
// epd_fast/epd_fastestを使用した場合は白黒2階調のみに制限されます。
|
||||
// この場合でもLovyanGFXのタイルパターン処理により疑似的に17階調を表現できます。
|
||||
|
||||
gfx.setEpdMode(epd_mode_t::epd_quality); // 高品質更新モードに設定(以後の描画はグレースケールを使用する)
|
||||
gfx.startWrite();
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
int level = 8 + i * 16;
|
||||
gfx.fillRect(i * w / 16, 0, w / 16 + 1, h / 2, gfx.color888(level, level, level));
|
||||
}
|
||||
gfx.display(); // ここでの表示更新は高品質モードとなる。
|
||||
|
||||
gfx.waitDisplay(); // EPDの表示更新の完了待機。
|
||||
// ※ 待機せずに表示更新中かどうかを調べたい場合は displayBusy() を使用します。
|
||||
// 他の処理の合間に描画を行いたい場合などにご利用ください。
|
||||
// 例 : while (gfx.displayBusy()) delay(10); // delayの代わりに何か他の処理を指定
|
||||
|
||||
|
||||
gfx.setEpdMode(epd_mode_t::epd_fast); // 高速更新モードに設定(以後の描画は白黒2値を使用する)
|
||||
for (int i = 0; i < 17; i++)
|
||||
{
|
||||
int level = std::min(255, i * 16);
|
||||
gfx.fillRect(i * w / 17, h / 2, w / 17+1, h / 2, gfx.color888(level, level, level));
|
||||
}
|
||||
gfx.display(); // ここでの描画は高速モードとなる。
|
||||
|
||||
delay(3000);
|
||||
|
||||
// M5Paper (IT8951)の高品質モードではグレースケール16階調+タイルパターン処理により241階調が表現できます。
|
||||
gfx.setEpdMode(epd_mode_t::epd_quality);
|
||||
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
gfx.fillRect(0, (i * h) / 256, w, 4, gfx.color888(i, i, i));
|
||||
}
|
||||
gfx.display();
|
||||
|
||||
gfx.endWrite();
|
||||
|
||||
delay(3000);
|
||||
|
||||
// M5Paper (IT8951)の表示更新は複数個所を同時に行う事が可能です。
|
||||
gfx.startWrite();
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
std::int32_t y1 = (i * h) / 16, y2 = ((i + 1) * h) / 16;
|
||||
std::int32_t x1 = 0, x2 = 0;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
x2 = ((j + 1) * w) / 16;
|
||||
std::int_fast8_t l = 255 - (i * 16 + j);
|
||||
gfx.fillRect(x1, y1, x2 - x1, y2 - y1, gfx.color888(l, l, l));
|
||||
x1 = x2;
|
||||
if ((j & 7) == 7) gfx.display(); // 8回に1回 表示更新を行う
|
||||
}
|
||||
}
|
||||
gfx.endWrite();
|
||||
|
||||
// ※ 表示更新中の範囲への描画をしないように注意してください。
|
||||
// 表示更新の途中で内容が変更されると正しく描画されなくなります。
|
||||
|
||||
delay(3000);
|
||||
|
||||
gfx.fillScreen(TFT_WHITE);
|
||||
|
||||
// 前回の表示更新範囲と重なる範囲に描画する場合、
|
||||
// LovyanGFX内部で表示更新が完了するのを待機する仕組みになっています。
|
||||
// そのため特に意識しなくても表示が乱れることがありません。
|
||||
gfx.setEpdMode(epd_mode_t::epd_quality);
|
||||
gfx.fillRect(0, 0, w/2, h/2, TFT_BLUE); // これらの描画は範囲が重なっているが、
|
||||
gfx.fillRect(0, 0, w/3, h/3, TFT_YELLOW);// 表示更新を待機する仕組みが機能するため
|
||||
gfx.fillRect(0, 0, w/4, h/4, TFT_BLUE); // 特に意識しなくても描画が乱れることがない
|
||||
gfx.fillRect(0, 0, w/5, h/5, TFT_YELLOW);
|
||||
gfx.fillRect(0, 0, w/6, h/6, TFT_BLUE);
|
||||
gfx.fillRect(0, 0, w/7, h/7, TFT_YELLOW);
|
||||
|
||||
gfx.waitDisplay();
|
||||
|
||||
// しかし自動チェックは完全ではありません。「前回の表示更新範囲」と比較する仕組みのため、
|
||||
// 別の範囲への描画を間に挟むと範囲チェックが十分に機能しなくなります。
|
||||
gfx.fillRect(w/2, 0, w/2, h/2, TFT_BLUE); // 範囲が重ならない描画を交互に行うと、
|
||||
gfx.drawPixel(0, 0); // 表示更新を待機する仕組みが機能せず、
|
||||
gfx.fillRect(w/2, 0, w/3, h/3, TFT_YELLOW);// 正しく描画されないようになる。
|
||||
gfx.drawPixel(0, 0);
|
||||
gfx.fillRect(w/2, 0, w/4, h/4, TFT_BLUE); // ※ 先の例と同じ色で描画しているのに
|
||||
gfx.drawPixel(0, 0); // 表示される階調が違っていたり、
|
||||
gfx.fillRect(w/2, 0, w/5, h/5, TFT_YELLOW);// 正しい描画が行われていないことを確認してください
|
||||
gfx.drawPixel(0, 0);
|
||||
gfx.fillRect(w/2, 0, w/6, h/6, TFT_BLUE);
|
||||
gfx.drawPixel(0, 0);
|
||||
gfx.fillRect(w/2, 0, w/7, h/7, TFT_YELLOW);
|
||||
|
||||
gfx.waitDisplay();
|
||||
|
||||
// また、表示更新モードが epd_fastest モードの場合は、レスポンスを最優先とするため、
|
||||
// 表示更新範囲のチェック処理を省略するようになります。
|
||||
gfx.setEpdMode(epd_mode_t::epd_fastest); // 最速更新モードに設定する。
|
||||
gfx.fillRect(0, h/2, w/2, h/2, TFT_BLUE); // 以後の描画は表示更新範囲と重複していても、
|
||||
gfx.fillRect(0, h/2, w/3, h/3, TFT_YELLOW); // 一切待機せずに描画するようになる。
|
||||
gfx.fillRect(0, h/2, w/4, h/4, TFT_BLUE); // そのため範囲の重なった描画を続けて行うと、
|
||||
gfx.fillRect(0, h/2, w/5, h/5, TFT_YELLOW); // 表示更新中に内容を書き換えてしまい
|
||||
gfx.fillRect(0, h/2, w/6, h/6, TFT_BLUE); // 意図した描画結果にならない。
|
||||
gfx.fillRect(0, h/2, w/7, h/7, TFT_YELLOW);
|
||||
|
||||
gfx.fillRect(w/2, h/2, w/2, h/2, TFT_BLUE);
|
||||
gfx.waitDisplay(); // 必要に応じてwaitDisplayで待機させる。
|
||||
gfx.fillRect(w/2, h/2, w/3, h/3, TFT_YELLOW);// 正しく待機することで、
|
||||
gfx.waitDisplay(); // 描画結果の乱れを防止できる。
|
||||
gfx.fillRect(w/2, h/2, w/4, h/4, TFT_BLUE);
|
||||
gfx.waitDisplay(); // 表示結果が先の例と違うことを確認してください
|
||||
gfx.fillRect(w/2, h/2, w/5, h/5, TFT_YELLOW);
|
||||
gfx.waitDisplay();
|
||||
gfx.fillRect(w/2, h/2, w/6, h/6, TFT_BLUE);
|
||||
gfx.waitDisplay();
|
||||
gfx.fillRect(w/2, h/2, w/7, h/7, TFT_YELLOW);
|
||||
|
||||
delay(3000);
|
||||
|
||||
|
||||
gfx.setEpdMode(epd_mode_t::epd_quality);
|
||||
|
||||
gfx.fillScreen(TFT_WHITE);
|
||||
|
||||
if (gfx.touch()) // touch関数の戻り値がnullかどうかでタッチコントローラの有無を判定できます。
|
||||
{
|
||||
gfx.startWrite();
|
||||
for (int i = 0; i < 1024; i++)
|
||||
{
|
||||
if ((i & 255) == 0)
|
||||
{
|
||||
gfx.setEpdMode(epd_mode_t::epd_fast);
|
||||
gfx.fillScreen(TFT_WHITE);
|
||||
gfx.setTextColor(TFT_BLACK, TFT_WHITE);
|
||||
gfx.setTextSize(3, 3);
|
||||
gfx.drawString("Touch Test", w / 2, h / 2);
|
||||
gfx.display();
|
||||
delay(100);
|
||||
gfx.waitDisplay();
|
||||
gfx.setEpdMode(epd_mode_t::epd_fastest);
|
||||
}
|
||||
delay(15);
|
||||
|
||||
std::int32_t x, y, number = 0;
|
||||
while (gfx.getTouch(&x, &y, number)) // getTouch関数でタッチ中の座標を取得できます。
|
||||
{
|
||||
gfx.fillCircle(x, y, 5, (std::uint32_t)(number * 0x333333u));
|
||||
gfx.display();
|
||||
++number;
|
||||
}
|
||||
}
|
||||
gfx.endWrite();
|
||||
}
|
||||
|
||||
gfx.setEpdMode(epd_mode_t::epd_fast);
|
||||
gfx.fillScreen(TFT_WHITE);
|
||||
|
||||
sp.setColorDepth(4);
|
||||
if (!sp.createSprite(w / 2, h / 2)) sp.createSprite(w / 4, h / 4);
|
||||
sp.setFont(&fonts::Font8);
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static int count = 0;
|
||||
|
||||
if (0 == (count & 15))
|
||||
{
|
||||
switch ((count >> 4) & 3)
|
||||
{
|
||||
case 0: gfx.setEpdMode(epd_mode_t::epd_quality); break;
|
||||
case 1: gfx.setEpdMode(epd_mode_t::epd_text ); break;
|
||||
case 2: gfx.setEpdMode(epd_mode_t::epd_fast ); break;
|
||||
case 3: gfx.setEpdMode(epd_mode_t::epd_fastest); break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < sp.height(); y += 4) {
|
||||
for (int x = 0; x < sp.width(); x += 4) {
|
||||
std::uint32_t val = ((x+count*4)|(y+count*4)) >> 4;
|
||||
sp.fillRect(x, y, 4, 4, val);
|
||||
}
|
||||
}
|
||||
|
||||
int x = 2;
|
||||
int y = 2;
|
||||
sp.setTextColor(TFT_BLACK);
|
||||
sp.drawNumber(count, x-2, y-2);
|
||||
sp.drawNumber(count, x+2, y-2);
|
||||
sp.drawNumber(count, x+2, y+2);
|
||||
sp.drawNumber(count, x-2, y+2);
|
||||
sp.setTextColor(TFT_WHITE);
|
||||
sp.drawNumber(count, x, y);
|
||||
|
||||
gfx.waitDisplay();
|
||||
sp.pushSprite(count & 1 ? w / 2 : 0, count & 2 ? h / 2 : 0);
|
||||
++count;
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
#define LGFX_USE_V1
|
||||
#define LGFX_AUTODETECT
|
||||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#include <driver/rtc_io.h>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
RTC_DATA_ATTR int bootCount = 0; // 起動回数を保持(deepsleepしても値は消えない)
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
switch(esp_sleep_get_wakeup_cause())
|
||||
{
|
||||
case ESP_SLEEP_WAKEUP_EXT0 :
|
||||
case ESP_SLEEP_WAKEUP_EXT1 :
|
||||
case ESP_SLEEP_WAKEUP_TIMER :
|
||||
case ESP_SLEEP_WAKEUP_TOUCHPAD :
|
||||
case ESP_SLEEP_WAKEUP_ULP :
|
||||
lcd.init_without_reset(); // deep sleep からの復帰時はinit_without_resetを呼び出す。
|
||||
break;
|
||||
|
||||
default :
|
||||
lcd.init(); // 通常起動時はinitを呼び出す。
|
||||
lcd.clear(TFT_WHITE);
|
||||
lcd.clear(TFT_BLACK);
|
||||
lcd.startWrite(); // 背景を描画しておく
|
||||
lcd.setColorDepth(24);
|
||||
{
|
||||
LGFX_Sprite sp(&lcd);
|
||||
sp.createSprite(128, 128);
|
||||
sp.createPalette();
|
||||
for (int y = 0; y < 128; y++)
|
||||
for (int x = 0; x < 128; x++)
|
||||
sp.writePixel(x, y, sp.color888(x << 1, x + y, y << 1));
|
||||
for (int y = 0; y < lcd.height(); y += 128)
|
||||
for (int x = 0; x < lcd.width(); x += 128)
|
||||
sp.pushSprite(x, y);
|
||||
}
|
||||
lcd.endWrite();
|
||||
break;
|
||||
}
|
||||
|
||||
++bootCount;
|
||||
lcd.setCursor(bootCount*6, bootCount*8);
|
||||
lcd.setTextColor(TFT_WHITE, TFT_BLACK); // 一度白黒反転した状態を描画する
|
||||
lcd.print("DeepSleep test : " + String(bootCount));
|
||||
lcd.setCursor(bootCount*6, bootCount*8);
|
||||
lcd.setTextColor(TFT_BLACK, TFT_WHITE);
|
||||
lcd.print("DeepSleep test : " + String(bootCount));
|
||||
lcd.powerSaveOn(); // 省電力指定 M5Stack CoreInkで電源オフ時に色が薄くならないようにする
|
||||
lcd.waitDisplay(); // 待機
|
||||
|
||||
auto pin_rst = (gpio_num_t)lcd.getPanel()->config().pin_rst;
|
||||
if ((uint32_t)pin_rst < GPIO_NUM_MAX)
|
||||
{
|
||||
// RSTピンをRTC_GPIOで管理しhigh状態を維持する
|
||||
rtc_gpio_set_level(pin_rst, 1);
|
||||
rtc_gpio_set_direction(pin_rst, RTC_GPIO_MODE_OUTPUT_ONLY);
|
||||
rtc_gpio_init(pin_rst);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||
}
|
||||
|
||||
auto light = lcd.getPanel()->getLight();
|
||||
if (light)
|
||||
{
|
||||
auto pin_bl = (gpio_num_t)((lgfx::Light_PWM*)light)->config().pin_bl;
|
||||
if ((uint32_t)pin_bl < GPIO_NUM_MAX)
|
||||
{
|
||||
// BackLightピンをRTC_GPIOで管理しhigh状態を維持する
|
||||
rtc_gpio_set_level(pin_bl, 1);
|
||||
rtc_gpio_set_direction(pin_bl, RTC_GPIO_MODE_OUTPUT_ONLY);
|
||||
rtc_gpio_init(pin_bl);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGW("sleep");
|
||||
esp_sleep_enable_timer_wakeup(1 * 1000 * 1000); // micro sec
|
||||
|
||||
esp_deep_sleep_start();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
delay(10000);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:m5stack-core2]
|
||||
platform = espressif32
|
||||
board = m5stack-core2
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
build_flags =
|
||||
-Isrc/
|
||||
-DLV_CONF_INCLUDE_SIMPLE
|
||||
-DLV_DEMO_CONF_INCLUDE_SIMPLE
|
||||
-DLV_USE_DEMO_BENCHMARK
|
||||
lib_deps =
|
||||
lovyan03/LovyanGFX
|
||||
lvgl/lvgl@^8.3.4
|
||||
lvgl/lv_demos@^8.1.0
|
||||
|
|
@ -0,0 +1,677 @@
|
|||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v8.3.0-dev
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copy this file as `lv_conf.h`
|
||||
* 1. simply next to the `lvgl` folder
|
||||
* 2. or any other places and
|
||||
* - define `LV_CONF_INCLUDE_SIMPLE`
|
||||
* - add the path as include path
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
#if 1 /*Set it to "1" to enable content*/
|
||||
|
||||
#ifndef LV_CONF_H
|
||||
#define LV_CONF_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*====================
|
||||
COLOR SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
|
||||
#define LV_COLOR_DEPTH 16
|
||||
|
||||
/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_16_SWAP 1
|
||||
|
||||
/*Enable more complex drawing routines to manage screens transparency.
|
||||
*Can be used if the UI is above another layer, e.g. an OSD menu or video player.
|
||||
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
|
||||
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
|
||||
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
|
||||
#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128)
|
||||
|
||||
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
|
||||
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
|
||||
|
||||
/*=========================
|
||||
MEMORY SETTINGS
|
||||
*=========================*/
|
||||
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/
|
||||
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
#define LV_MEM_ADR 0 /*0: unused*/
|
||||
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
|
||||
#if LV_MEM_ADR == 0
|
||||
//#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/
|
||||
//#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/
|
||||
#endif
|
||||
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc
|
||||
#define LV_MEM_CUSTOM_FREE free
|
||||
#define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.
|
||||
*You will see an error log message if there wasn't enough buffers. */
|
||||
#define LV_MEM_BUF_MAX_NUM 16
|
||||
|
||||
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
|
||||
#define LV_MEMCPY_MEMSET_STD 0
|
||||
|
||||
/*====================
|
||||
HAL SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*Default display refresh period. LVG will redraw changed areas with this period time*/
|
||||
#define LV_DISP_DEF_REFR_PERIOD 16 /*[ms]*/
|
||||
|
||||
/*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
|
||||
|
||||
/*Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#define LV_TICK_CUSTOM 1
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
*(Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
#define LV_DPI_DEF 130 /*[px/inch]*/
|
||||
|
||||
/*=======================
|
||||
* FEATURE CONFIGURATION
|
||||
*=======================*/
|
||||
|
||||
/*-------------
|
||||
* Drawing
|
||||
*-----------*/
|
||||
|
||||
/*Enable complex draw engine.
|
||||
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
|
||||
#define LV_DRAW_COMPLEX 1
|
||||
#if LV_DRAW_COMPLEX != 0
|
||||
|
||||
/*Allow buffering some shadow calculation.
|
||||
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
|
||||
/* Set number of maximally cached circle data.
|
||||
* The circumference of 1/4 circle are saved for anti-aliasing
|
||||
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
|
||||
* 0: to disable caching */
|
||||
#define LV_CIRCLE_CACHE_SIZE 4
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
*However the opened images might consume additional RAM.
|
||||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Number of stops allowed per gradient. Increase this to allow more stops.
|
||||
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
|
||||
#define LV_GRADIENT_MAX_STOPS 2
|
||||
|
||||
/*Default gradient buffer size.
|
||||
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
|
||||
*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.
|
||||
*If the cache is too small the map will be allocated only while it's required for the drawing.
|
||||
*0 mean no caching.*/
|
||||
#define LV_GRAD_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
|
||||
*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface
|
||||
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
|
||||
#define LV_DITHER_GRADIENT 0
|
||||
#if LV_DITHER_GRADIENT
|
||||
/*Add support for error diffusion dithering.
|
||||
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
|
||||
*The increase in memory consumption is (24 bits * object's width)*/
|
||||
#define LV_DITHER_ERROR_DIFFUSION 0
|
||||
#endif
|
||||
|
||||
/*Maximum buffer size to allocate for rotation.
|
||||
*Only used if software rotation is enabled in the display driver.*/
|
||||
#define LV_DISP_ROT_MAX_BUF (10*1024)
|
||||
|
||||
/*-------------
|
||||
* GPU
|
||||
*-----------*/
|
||||
|
||||
/*Use Arm's 2D acceleration library Arm-2D */
|
||||
#define LV_USE_GPU_ARM2D 0
|
||||
|
||||
/*Use STM32's DMA2D (aka Chrom Art) GPU*/
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Use NXP's PXP GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_PXP 0
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
|
||||
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
|
||||
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
|
||||
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
|
||||
*/
|
||||
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
|
||||
#endif
|
||||
|
||||
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_VG_LITE 0
|
||||
|
||||
/*Use SDL renderer API*/
|
||||
#define LV_USE_GPU_SDL 0
|
||||
#if LV_USE_GPU_SDL
|
||||
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
/*Texture cache size, 8MB by default*/
|
||||
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
|
||||
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
* Logging
|
||||
*-----------*/
|
||||
|
||||
/*Enable the log module*/
|
||||
#define LV_USE_LOG 0
|
||||
#if LV_USE_LOG
|
||||
|
||||
/*How important log should be added:
|
||||
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||
*LV_LOG_LEVEL_INFO Log important events
|
||||
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
*LV_LOG_LEVEL_USER Only logs added by the user
|
||||
*LV_LOG_LEVEL_NONE Do not log anything*/
|
||||
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
|
||||
/*1: Print the log with 'printf';
|
||||
*0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
#define LV_LOG_PRINTF 0
|
||||
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
|
||||
#define LV_LOG_TRACE_MEM 1
|
||||
#define LV_LOG_TRACE_TIMER 1
|
||||
#define LV_LOG_TRACE_INDEV 1
|
||||
#define LV_LOG_TRACE_DISP_REFR 1
|
||||
#define LV_LOG_TRACE_EVENT 1
|
||||
#define LV_LOG_TRACE_OBJ_CREATE 1
|
||||
#define LV_LOG_TRACE_LAYOUT 1
|
||||
#define LV_LOG_TRACE_ANIM 1
|
||||
|
||||
#endif /*LV_USE_LOG*/
|
||||
|
||||
/*-------------
|
||||
* Asserts
|
||||
*-----------*/
|
||||
|
||||
/*Enable asserts if an operation is failed or an invalid data is found.
|
||||
*If LV_USE_LOG is enabled an error message will be printed on failure*/
|
||||
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
|
||||
#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
|
||||
|
||||
/*Add a custom handler when assert happens e.g. to restart the MCU*/
|
||||
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
|
||||
#define LV_ASSERT_HANDLER while(1); /*Halt by default*/
|
||||
|
||||
/*-------------
|
||||
* Others
|
||||
*-----------*/
|
||||
|
||||
/*1: Show CPU usage and FPS count*/
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
#if LV_USE_PERF_MONITOR
|
||||
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
|
||||
#endif
|
||||
|
||||
/*1: Show the used memory and the memory fragmentation
|
||||
* Requires LV_MEM_CUSTOM = 0*/
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#if LV_USE_MEM_MONITOR
|
||||
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
|
||||
#endif
|
||||
|
||||
/*1: Draw random colored rectangles over the redrawn areas*/
|
||||
#define LV_USE_REFR_DEBUG 0
|
||||
|
||||
/*Change the built in (v)snprintf functions*/
|
||||
#define LV_SPRINTF_CUSTOM 0
|
||||
#if LV_SPRINTF_CUSTOM
|
||||
#define LV_SPRINTF_INCLUDE <stdio.h>
|
||||
#define lv_snprintf snprintf
|
||||
#define lv_vsnprintf vsnprintf
|
||||
#else /*LV_SPRINTF_CUSTOM*/
|
||||
#define LV_SPRINTF_USE_FLOAT 0
|
||||
#endif /*LV_SPRINTF_CUSTOM*/
|
||||
|
||||
#define LV_USE_USER_DATA 1
|
||||
|
||||
/*Garbage Collector settings
|
||||
*Used if lvgl is bound to higher level language and the memory is managed by that language*/
|
||||
#define LV_ENABLE_GC 0
|
||||
#if LV_ENABLE_GC != 0
|
||||
#define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*=====================
|
||||
* COMPILER SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*For big endian systems set to 1*/
|
||||
#define LV_BIG_ENDIAN_SYSTEM 0
|
||||
|
||||
/*Define a custom attribute to `lv_tick_inc` function*/
|
||||
#define LV_ATTRIBUTE_TICK_INC
|
||||
|
||||
/*Define a custom attribute to `lv_timer_handler` function*/
|
||||
#define LV_ATTRIBUTE_TIMER_HANDLER
|
||||
|
||||
/*Define a custom attribute to `lv_disp_flush_ready` function*/
|
||||
#define LV_ATTRIBUTE_FLUSH_READY
|
||||
|
||||
/*Required alignment size for buffers*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
|
||||
|
||||
/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
|
||||
* E.g. __attribute__((aligned(4)))*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
|
||||
/*Attribute to mark large constant arrays for example font's bitmaps*/
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
|
||||
/*Compiler prefix for a big array declaration in RAM*/
|
||||
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
|
||||
|
||||
/*Place performance critical functions into a faster memory (e.g RAM)*/
|
||||
#define LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
|
||||
#define LV_ATTRIBUTE_DMA
|
||||
|
||||
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
|
||||
*should also appear on LVGL binding API such as Micropython.*/
|
||||
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
|
||||
|
||||
/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/
|
||||
#define LV_USE_LARGE_COORD 0
|
||||
|
||||
/*==================
|
||||
* FONT USAGE
|
||||
*===================*/
|
||||
|
||||
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
|
||||
*https://fonts.google.com/specimen/Montserrat*/
|
||||
#define LV_FONT_MONTSERRAT_8 0
|
||||
#define LV_FONT_MONTSERRAT_10 0
|
||||
#define LV_FONT_MONTSERRAT_12 1
|
||||
#define LV_FONT_MONTSERRAT_14 1
|
||||
#define LV_FONT_MONTSERRAT_16 1
|
||||
#define LV_FONT_MONTSERRAT_18 0
|
||||
#define LV_FONT_MONTSERRAT_20 0
|
||||
#define LV_FONT_MONTSERRAT_22 0
|
||||
#define LV_FONT_MONTSERRAT_24 0
|
||||
#define LV_FONT_MONTSERRAT_26 0
|
||||
#define LV_FONT_MONTSERRAT_28 0
|
||||
#define LV_FONT_MONTSERRAT_30 0
|
||||
#define LV_FONT_MONTSERRAT_32 0
|
||||
#define LV_FONT_MONTSERRAT_34 0
|
||||
#define LV_FONT_MONTSERRAT_36 0
|
||||
#define LV_FONT_MONTSERRAT_38 0
|
||||
#define LV_FONT_MONTSERRAT_40 0
|
||||
#define LV_FONT_MONTSERRAT_42 0
|
||||
#define LV_FONT_MONTSERRAT_44 0
|
||||
#define LV_FONT_MONTSERRAT_46 0
|
||||
#define LV_FONT_MONTSERRAT_48 0
|
||||
|
||||
/*Demonstrate special features*/
|
||||
#define LV_FONT_MONTSERRAT_12_SUBPX 0
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
|
||||
|
||||
/*Pixel perfect monospace fonts*/
|
||||
#define LV_FONT_UNSCII_8 0
|
||||
#define LV_FONT_UNSCII_16 0
|
||||
|
||||
/*Optionally declare custom fonts here.
|
||||
*You can use these fonts as default font too and they will be available globally.
|
||||
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
|
||||
#define LV_FONT_CUSTOM_DECLARE
|
||||
|
||||
/*Always set a default font*/
|
||||
#define LV_FONT_DEFAULT &lv_font_montserrat_14
|
||||
|
||||
/*Enable handling large font and/or fonts with a lot of characters.
|
||||
*The limit depends on the font size, font face and bpp.
|
||||
*Compiler error will be triggered if a font needs it.*/
|
||||
#define LV_FONT_FMT_TXT_LARGE 0
|
||||
|
||||
/*Enables/disables support for compressed fonts.*/
|
||||
#define LV_USE_FONT_COMPRESSED 0
|
||||
|
||||
/*Enable subpixel rendering*/
|
||||
#define LV_USE_FONT_SUBPX 0
|
||||
#if LV_USE_FONT_SUBPX
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
/*=================
|
||||
* TEXT SETTINGS
|
||||
*=================*/
|
||||
|
||||
/**
|
||||
* Select a character encoding for strings.
|
||||
* Your IDE or editor should have the same character encoding
|
||||
* - LV_TXT_ENC_UTF8
|
||||
* - LV_TXT_ENC_ASCII
|
||||
*/
|
||||
#define LV_TXT_ENC LV_TXT_ENC_UTF8
|
||||
|
||||
/*Can break (wrap) texts on these chars*/
|
||||
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
||||
|
||||
/*If a word is at least this long, will break wherever "prettiest"
|
||||
*To disable, set to a value <= 0*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_LEN 0
|
||||
|
||||
/*Minimum number of characters in a long word to put on a line before a break.
|
||||
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
|
||||
|
||||
/*Minimum number of characters in a long word to put on a line after a break.
|
||||
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
||||
|
||||
/*The control character to use for signalling text recoloring.*/
|
||||
#define LV_TXT_COLOR_CMD "#"
|
||||
|
||||
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
*The direction will be processed according to the Unicode Bidirectional Algorithm:
|
||||
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#define LV_USE_BIDI 0
|
||||
#if LV_USE_BIDI
|
||||
/*Set the default direction. Supported values:
|
||||
*`LV_BASE_DIR_LTR` Left-to-Right
|
||||
*`LV_BASE_DIR_RTL` Right-to-Left
|
||||
*`LV_BASE_DIR_AUTO` detect texts base direction*/
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
|
||||
#endif
|
||||
|
||||
/*Enable Arabic/Persian processing
|
||||
*In these languages characters should be replaced with an other form based on their position in the text*/
|
||||
#define LV_USE_ARABIC_PERSIAN_CHARS 0
|
||||
|
||||
/*==================
|
||||
* WIDGET USAGE
|
||||
*================*/
|
||||
|
||||
/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
|
||||
|
||||
#define LV_USE_ARC 1
|
||||
|
||||
#define LV_USE_ANIMIMG 1
|
||||
|
||||
#define LV_USE_BAR 1
|
||||
|
||||
#define LV_USE_BTN 1
|
||||
|
||||
#define LV_USE_BTNMATRIX 1
|
||||
|
||||
#define LV_USE_CANVAS 1
|
||||
|
||||
#define LV_USE_CHECKBOX 1
|
||||
|
||||
#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
|
||||
|
||||
#define LV_USE_IMG 1 /*Requires: lv_label*/
|
||||
|
||||
#define LV_USE_LABEL 1
|
||||
#if LV_USE_LABEL
|
||||
#define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/
|
||||
#define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_LINE 1
|
||||
|
||||
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
|
||||
#if LV_USE_ROLLER
|
||||
#define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
|
||||
|
||||
#define LV_USE_SWITCH 1
|
||||
|
||||
#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/
|
||||
#if LV_USE_TEXTAREA != 0
|
||||
#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
|
||||
#endif
|
||||
|
||||
#define LV_USE_TABLE 1
|
||||
|
||||
/*==================
|
||||
* EXTRA COMPONENTS
|
||||
*==================*/
|
||||
|
||||
/*-----------
|
||||
* Widgets
|
||||
*----------*/
|
||||
#define LV_USE_CALENDAR 1
|
||||
#if LV_USE_CALENDAR
|
||||
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
|
||||
#else
|
||||
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
|
||||
#endif
|
||||
|
||||
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
|
||||
#define LV_USE_CALENDAR_HEADER_ARROW 1
|
||||
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
|
||||
#endif /*LV_USE_CALENDAR*/
|
||||
|
||||
#define LV_USE_CHART 1
|
||||
|
||||
#define LV_USE_COLORWHEEL 1
|
||||
|
||||
#define LV_USE_IMGBTN 1
|
||||
|
||||
#define LV_USE_KEYBOARD 1
|
||||
|
||||
#define LV_USE_LED 1
|
||||
|
||||
#define LV_USE_LIST 1
|
||||
|
||||
#define LV_USE_MENU 1
|
||||
|
||||
#define LV_USE_METER 1
|
||||
|
||||
#define LV_USE_MSGBOX 1
|
||||
|
||||
#define LV_USE_SPINBOX 1
|
||||
|
||||
#define LV_USE_SPINNER 1
|
||||
|
||||
#define LV_USE_TABVIEW 1
|
||||
|
||||
#define LV_USE_TILEVIEW 1
|
||||
|
||||
#define LV_USE_WIN 1
|
||||
|
||||
#define LV_USE_SPAN 1
|
||||
#if LV_USE_SPAN
|
||||
/*A line text can contain maximum num of span descriptor */
|
||||
#define LV_SPAN_SNIPPET_STACK_SIZE 64
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
* Themes
|
||||
*----------*/
|
||||
|
||||
/*A simple, impressive and very complete theme*/
|
||||
#define LV_USE_THEME_DEFAULT 1
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/*0: Light mode; 1: Dark mode*/
|
||||
#define LV_THEME_DEFAULT_DARK 0
|
||||
|
||||
/*1: Enable grow on press*/
|
||||
#define LV_THEME_DEFAULT_GROW 1
|
||||
|
||||
/*Default transition time in [ms]*/
|
||||
#define LV_THEME_DEFAULT_TRANSITION_TIME 80
|
||||
#endif /*LV_USE_THEME_DEFAULT*/
|
||||
|
||||
/*A very simple theme that is a good starting point for a custom theme*/
|
||||
#define LV_USE_THEME_BASIC 1
|
||||
|
||||
/*A theme designed for monochrome displays*/
|
||||
#define LV_USE_THEME_MONO 1
|
||||
|
||||
/*-----------
|
||||
* Layouts
|
||||
*----------*/
|
||||
|
||||
/*A layout similar to Flexbox in CSS.*/
|
||||
#define LV_USE_FLEX 1
|
||||
|
||||
/*A layout similar to Grid in CSS.*/
|
||||
#define LV_USE_GRID 1
|
||||
|
||||
/*---------------------
|
||||
* 3rd party libraries
|
||||
*--------------------*/
|
||||
|
||||
/*File system interfaces for common APIs */
|
||||
|
||||
/*API for fopen, fread, etc*/
|
||||
#define LV_USE_FS_STDIO 0
|
||||
#if LV_USE_FS_STDIO
|
||||
#define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for open, read, etc*/
|
||||
#define LV_USE_FS_POSIX 0
|
||||
#if LV_USE_FS_POSIX
|
||||
#define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for CreateFile, ReadFile, etc*/
|
||||
#define LV_USE_FS_WIN32 0
|
||||
#if LV_USE_FS_WIN32
|
||||
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
|
||||
#define LV_USE_FS_FATFS 0
|
||||
#if LV_USE_FS_FATFS
|
||||
#define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*PNG decoder library*/
|
||||
#define LV_USE_PNG 0
|
||||
|
||||
/*BMP decoder library*/
|
||||
#define LV_USE_BMP 0
|
||||
|
||||
/* JPG + split JPG decoder library.
|
||||
* Split JPG is a custom format optimized for embedded systems. */
|
||||
#define LV_USE_SJPG 0
|
||||
|
||||
/*GIF decoder library*/
|
||||
#define LV_USE_GIF 0
|
||||
|
||||
/*QR code library*/
|
||||
#define LV_USE_QRCODE 0
|
||||
|
||||
/*FreeType library*/
|
||||
#define LV_USE_FREETYPE 0
|
||||
#if LV_USE_FREETYPE
|
||||
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
|
||||
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
|
||||
#if LV_FREETYPE_CACHE_SIZE >= 0
|
||||
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
|
||||
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
|
||||
/* if font size >= 256, must be configured as image cache */
|
||||
#define LV_FREETYPE_SBIT_CACHE 0
|
||||
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
|
||||
/* (0:use system defaults) */
|
||||
#define LV_FREETYPE_CACHE_FT_FACES 0
|
||||
#define LV_FREETYPE_CACHE_FT_SIZES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Rlottie library*/
|
||||
#define LV_USE_RLOTTIE 0
|
||||
|
||||
/*FFmpeg library for image decoding and playing videos
|
||||
*Supports all major image formats so do not enable other image decoder with it*/
|
||||
#define LV_USE_FFMPEG 0
|
||||
#if LV_USE_FFMPEG
|
||||
/*Dump input information to stderr*/
|
||||
#define LV_FFMPEG_AV_DUMP_FORMAT 0
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
* Others
|
||||
*----------*/
|
||||
|
||||
/*1: Enable API to take snapshot for object*/
|
||||
#define LV_USE_SNAPSHOT 0
|
||||
|
||||
/*1: Enable Monkey test*/
|
||||
#define LV_USE_MONKEY 0
|
||||
|
||||
/*1: Enable grid navigation*/
|
||||
#define LV_USE_GRIDNAV 0
|
||||
|
||||
/*1: Enable lv_obj fragment*/
|
||||
#define LV_USE_FRAGMENT 0
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
*==================*/
|
||||
|
||||
/*Enable the examples to be built with the library*/
|
||||
#define LV_BUILD_EXAMPLES 1
|
||||
|
||||
/*--END OF LV_CONF_H--*/
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
|
||||
#endif /*End of "Content enable"*/
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* @file lv_demo_conf.h
|
||||
* Configuration file for v8.1.1-dev
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* COPY THIS FILE AS lv_demo_conf.h
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
#if 0 /*Set it to "1" to enable the content*/
|
||||
|
||||
#ifndef LV_DEMO_CONF_H
|
||||
#define LV_DEMO_CONF_H
|
||||
|
||||
|
||||
/*******************
|
||||
* GENERAL SETTING
|
||||
*******************/
|
||||
#define LV_EX_PRINTF 0 /*Enable printf-ing data in demoes and examples*/
|
||||
#define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/
|
||||
#define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/
|
||||
|
||||
/*********************
|
||||
* DEMO USAGE
|
||||
*********************/
|
||||
|
||||
/*Show some widget*/
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
/*Printer demo, optimized for 800x480*/
|
||||
#define LV_USE_DEMO_PRINTER 0
|
||||
|
||||
/*Demonstrate the usage of encoder and keyboard*/
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
|
||||
/*Benchmark your system*/
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
|
||||
/*Stress test for LVGL*/
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/*Music player demo*/
|
||||
#define LV_USE_DEMO_MUSIC 1
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
# define LV_DEMO_MUSIC_SQUARE 0
|
||||
# define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
# define LV_DEMO_MUSIC_ROUND 0
|
||||
# define LV_DEMO_MUSIC_LARGE 0
|
||||
# define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#endif
|
||||
|
||||
#endif /*LV_DEMO_CONF_H*/
|
||||
|
||||
#endif /*End of "Content enable"*/
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
#define LGFX_AUTODETECT
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
#include <lv_demo.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
/*Change to your screen resolution*/
|
||||
static const uint16_t screenWidth = 320;
|
||||
static const uint16_t screenHeight = 240;
|
||||
|
||||
static lv_disp_draw_buf_t draw_buf;
|
||||
static lv_color_t buf[2][ screenWidth * 10 ];
|
||||
|
||||
LGFX gfx;
|
||||
|
||||
/* Display flushing */
|
||||
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
|
||||
{
|
||||
if (gfx.getStartCount() == 0)
|
||||
{ // Processing if not yet started
|
||||
gfx.startWrite();
|
||||
}
|
||||
gfx.pushImageDMA( area->x1
|
||||
, area->y1
|
||||
, area->x2 - area->x1 + 1
|
||||
, area->y2 - area->y1 + 1
|
||||
, ( lgfx::swap565_t* )&color_p->full);
|
||||
lv_disp_flush_ready( disp );
|
||||
}
|
||||
|
||||
void sd_access_sample( void )
|
||||
{
|
||||
if (gfx.getStartCount() > 0)
|
||||
{ // Free the bus before accessing the SD card
|
||||
gfx.endWrite();
|
||||
}
|
||||
|
||||
// Something to manipulate the SD card.
|
||||
auto file = SD.open("/file");
|
||||
file.close();
|
||||
}
|
||||
|
||||
/*Read the touchpad*/
|
||||
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
|
||||
{
|
||||
uint16_t touchX, touchY;
|
||||
|
||||
data->state = LV_INDEV_STATE_REL;
|
||||
|
||||
if( gfx.getTouch( &touchX, &touchY ) )
|
||||
{
|
||||
data->state = LV_INDEV_STATE_PR;
|
||||
|
||||
/*Set the coordinates*/
|
||||
data->point.x = touchX;
|
||||
data->point.y = touchY;
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
gfx.begin();
|
||||
|
||||
lv_init();
|
||||
lv_disp_draw_buf_init( &draw_buf, buf[0], buf[1], screenWidth * 10 );
|
||||
|
||||
/*Initialize the display*/
|
||||
static lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init( &disp_drv );
|
||||
/*Change the following line to your display resolution*/
|
||||
disp_drv.hor_res = screenWidth;
|
||||
disp_drv.ver_res = screenHeight;
|
||||
disp_drv.flush_cb = my_disp_flush;
|
||||
disp_drv.draw_buf = &draw_buf;
|
||||
lv_disp_drv_register( &disp_drv );
|
||||
|
||||
/*Initialize the input device driver*/
|
||||
static lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init( &indev_drv );
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = my_touchpad_read;
|
||||
lv_indev_drv_register( &indev_drv );
|
||||
|
||||
|
||||
lv_demo_benchmark();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
lv_timer_handler(); /* let the GUI do its work */
|
||||
delay(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,279 @@
|
|||
#include <LovyanGFX.hpp>
|
||||
|
||||
|
||||
#if defined( LGFX_M5STACK ) || defined( ARDUINO_M5Stack_Core_ESP32 ) || defined( ARDUINO_M5STACK_FIRE ) // M5Stack
|
||||
|
||||
#define BUTTON_A_PIN 39
|
||||
#define BUTTON_B_PIN 38
|
||||
|
||||
static constexpr std::uint32_t draw_cycle = 3;
|
||||
static constexpr float zoom_min = 2;
|
||||
static constexpr float zoom_max = 32;
|
||||
|
||||
#elif defined( LGFX_M5STACK_CORE2 ) || defined( ARDUINO_M5STACK_Core2 )
|
||||
|
||||
#define BUTTON_A_PIN -1
|
||||
#define BUTTON_B_PIN -1
|
||||
|
||||
static constexpr std::uint32_t draw_cycle = 3;
|
||||
static constexpr float zoom_min = 2;
|
||||
static constexpr float zoom_max = 32;
|
||||
|
||||
#elif defined ( LGFX_M5STICKC ) || defined ( ARDUINO_M5Stick_C )
|
||||
|
||||
#define BUTTON_A_PIN 37
|
||||
#define BUTTON_B_PIN 39
|
||||
|
||||
static constexpr std::uint32_t draw_cycle = 1;
|
||||
static constexpr float zoom_min = 1.4;
|
||||
static constexpr float zoom_max = 16;
|
||||
|
||||
#elif defined( LGFX_ODROID_GO ) || defined( ARDUINO_ODROID_ESP32 ) // ODROID-GO
|
||||
|
||||
#define BUTTON_A_PIN 32
|
||||
#define BUTTON_B_PIN 33
|
||||
|
||||
static constexpr std::uint32_t draw_cycle = 3;
|
||||
static constexpr float zoom_min = 2;
|
||||
static constexpr float zoom_max = 32;
|
||||
|
||||
#elif defined( LGFX_TTGO_TWATCH ) || defined( ARDUINO_T ) // TTGO T-Watch
|
||||
|
||||
#define BUTTON_A_PIN 36
|
||||
#define BUTTON_B_PIN -1
|
||||
|
||||
static constexpr std::uint32_t draw_cycle = 2;
|
||||
static constexpr float zoom_min = 2;
|
||||
static constexpr float zoom_max = 32;
|
||||
|
||||
#elif defined( LGFX_WIO_TERMINAL ) || defined (ARDUINO_WIO_TERMINAL) || defined(WIO_TERMINAL)
|
||||
|
||||
#define BUTTON_A_PIN 0x0200|28
|
||||
#define BUTTON_B_PIN 0x0200|27
|
||||
|
||||
static constexpr std::uint32_t draw_cycle = 3;
|
||||
static constexpr float zoom_min = 2;
|
||||
static constexpr float zoom_max = 32;
|
||||
|
||||
#endif
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite sp(&lcd);
|
||||
static std::int32_t px, py;
|
||||
static float ox, oy;
|
||||
static float cx, cy, cr;
|
||||
static float ax, ay;
|
||||
static float zoom;
|
||||
static float angle, rad;
|
||||
static float add_angle = 0;
|
||||
static float add_advance = 0;
|
||||
static std::uint32_t draw_count = 0;
|
||||
static std::uint32_t skip_count = 0;
|
||||
|
||||
static constexpr float deg_to_rad = 0.017453292519943295769236907684886;
|
||||
static constexpr float gravity = -0.005;
|
||||
static constexpr float zoom_speed = 0.02;
|
||||
|
||||
static void create_maze(void)
|
||||
{
|
||||
sp.clear(0);
|
||||
sp.setColor(1);
|
||||
sp.fillRect(0, 0, sp.width(), 16);
|
||||
sp.fillRect(0, sp.height() - 16, sp.width(), 16);
|
||||
sp.fillRect( 0, 0, 16, sp.height()-16);
|
||||
sp.fillRect(sp.width()-16, 0, 16, sp.height()-16);
|
||||
sp.setColor(3);
|
||||
for (int y = 1; y < sp.height(); y += 2)
|
||||
{
|
||||
for (int x = 1; x < sp.width(); x += 2)
|
||||
{
|
||||
sp.writePixel(x, y);
|
||||
int xx = x;
|
||||
int yy = y;
|
||||
do
|
||||
{
|
||||
xx = x;
|
||||
yy = y;
|
||||
switch (random(4)) {
|
||||
case 0: xx = x + 1; break;
|
||||
case 1: xx = x - 1; break;
|
||||
case 2: yy = y + 1; break;
|
||||
case 3: yy = y - 1; break;
|
||||
}
|
||||
} while (3 == sp.readPixelValue(xx, yy));
|
||||
sp.writePixel(xx, yy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
draw_count += draw_cycle;
|
||||
std::uint_fast8_t blink = 127+abs(((int)(draw_count<<1) & 255)-128);
|
||||
sp.setPaletteColor(1, 127, 127, blink);
|
||||
sp.setPaletteColor(2, 127, blink, 127);
|
||||
|
||||
float fx = (cx - ox);
|
||||
float fy = (cy - oy);
|
||||
float len = sqrtf(fx * fx + fy * fy) * zoom;
|
||||
float theta = atan2f(fx, fy) + rad;
|
||||
sp.pushRotateZoom(px - sinf(theta) * len, py - cosf(theta) * len, angle, zoom, zoom);
|
||||
}
|
||||
|
||||
static void game_init(void)
|
||||
{
|
||||
px = lcd.width()>>1;
|
||||
py = lcd.height()/3;
|
||||
|
||||
create_maze();
|
||||
ox = sp.getPivotX();
|
||||
oy = sp.getPivotY();
|
||||
|
||||
cx = (sp.width() >>1);
|
||||
cy = (sp.height()>>1);
|
||||
cr = 0.2;
|
||||
zoom = zoom_min;
|
||||
}
|
||||
|
||||
static bool game_main(void)
|
||||
{
|
||||
std::int32_t tx, ty, tc;
|
||||
tc = lcd.getTouch(&tx, &ty);
|
||||
if ((BUTTON_A_PIN >=0 && BUTTON_B_PIN >=0 && (lgfx::gpio_in(BUTTON_A_PIN) == 0 && lgfx::gpio_in(BUTTON_B_PIN) == 0)) || tc > 1)
|
||||
{
|
||||
zoom *= 1.0 - zoom_speed;
|
||||
if (zoom < zoom_min) { zoom = zoom_min; }
|
||||
}
|
||||
else
|
||||
{
|
||||
zoom *= 1.0 + zoom_speed;
|
||||
if (zoom > zoom_max) { zoom = zoom_max; }
|
||||
|
||||
add_angle -= add_angle / 10;
|
||||
|
||||
if (tc)
|
||||
{
|
||||
add_angle += (tx > lcd.width()>>1) ? 0.6 : -0.6;
|
||||
}
|
||||
else if (BUTTON_A_PIN >= 0 && BUTTON_B_PIN >= 0)
|
||||
{
|
||||
if (BUTTON_A_PIN >=0 && lgfx::gpio_in(BUTTON_A_PIN) == 0) add_angle += 0.6;
|
||||
if (BUTTON_B_PIN >=0 && lgfx::gpio_in(BUTTON_B_PIN) == 0) add_angle -= 0.6;
|
||||
}
|
||||
else
|
||||
{
|
||||
static bool pressed;
|
||||
static bool flow;
|
||||
if (BUTTON_A_PIN >=0 && lgfx::gpio_in(BUTTON_A_PIN) == 0)
|
||||
{
|
||||
if (!pressed)
|
||||
{
|
||||
pressed = true;
|
||||
flow = !flow;
|
||||
}
|
||||
add_angle += flow ? 0.6 : -0.6;
|
||||
}
|
||||
else
|
||||
{
|
||||
pressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
angle += add_angle;
|
||||
add_angle = add_angle * 9 / 10;
|
||||
rad = angle * - deg_to_rad;
|
||||
|
||||
ax += sinf(rad) * gravity;
|
||||
ay -= cosf(rad) * gravity;
|
||||
ax = ax * 9.7 / 10;
|
||||
ay = ay * 9.7 / 10;
|
||||
|
||||
float addy = (ay<0.0) ? -cr:cr;
|
||||
auto tmpy = roundf(cy+ay+addy);
|
||||
|
||||
if ( 3 == sp.readPixelValue(roundf(cx), tmpy))
|
||||
{
|
||||
cy = tmpy - addy + (ay < 0.0 ? 0.5 : -0.5);
|
||||
ay = -ay * 9.0 / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
cy += ay;
|
||||
}
|
||||
|
||||
float addx = (ax<0.0) ? -cr:cr;
|
||||
auto tmpx = roundf(cx+ax+addx);
|
||||
if ( 3 == sp.readPixelValue(tmpx, roundf(cy)))
|
||||
{
|
||||
cx = tmpx - addx + (ax < 0.0 ? 0.5 : -0.5);
|
||||
ax = -ax * 9.0 / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx += ax;
|
||||
}
|
||||
|
||||
std::uint32_t pv = sp.readPixelValue(roundf(cx), roundf(cy));
|
||||
if ( 0 == pv)
|
||||
{
|
||||
sp.drawPixel(roundf(cx), roundf(cy), 2);
|
||||
}
|
||||
else if (1 == pv) return true;
|
||||
|
||||
if (++skip_count == draw_cycle)
|
||||
{
|
||||
skip_count = 0;
|
||||
draw();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lgfx::lgfxPinMode(BUTTON_A_PIN, lgfx::pin_mode_t::input);
|
||||
lgfx::lgfxPinMode(BUTTON_B_PIN, lgfx::pin_mode_t::input);
|
||||
|
||||
lcd.init();
|
||||
lcd.startWrite();
|
||||
lcd.setColorDepth(16);
|
||||
sp.setColorDepth(2);
|
||||
sp.createSprite(257, 257);
|
||||
game_init();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
if (!game_main())
|
||||
{
|
||||
lcd.fillCircle(px, py, roundf(cr*zoom), 0xFFFF00U);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::int32_t py0 = lcd.height() >> 1;
|
||||
float cx0 = (cx + (sp.width() >>1)) / 2;
|
||||
float cy0 = (cy + (sp.height()>>1)) / 2;
|
||||
for (;;)
|
||||
{
|
||||
draw();
|
||||
if (py < py0) ++py;
|
||||
if (cx != cx0) cx += (cx0 - cx) / 256;
|
||||
if (cy != cy0) cy += (cy0 - cy) / 256;
|
||||
|
||||
angle += .5;
|
||||
rad = angle * - deg_to_rad;
|
||||
zoom *= 1 - zoom_speed;
|
||||
if (zoom < zoom_min)
|
||||
{
|
||||
std::int32_t tx, ty;
|
||||
zoom = zoom_min;
|
||||
if ((BUTTON_A_PIN >=0 && lgfx::gpio_in(BUTTON_A_PIN) == 0)
|
||||
|| (BUTTON_B_PIN >=0 && lgfx::gpio_in(BUTTON_B_PIN) == 0)
|
||||
|| lcd.getTouch(&tx, &ty)
|
||||
) break;
|
||||
}
|
||||
}
|
||||
game_init();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,348 @@
|
|||
// 基本的な使い方
|
||||
|
||||
// ※ もし対応機種を ArduinoIDE以外の環境で使用する場合や、
|
||||
// 対応機種がボードマネージャに無い場合 ( TTGO T-Wristband や ESP-WROVER-KIT等 ) は、
|
||||
// LovyanGFX.hppのincludeより前に、define LGFX_~ の定義を記述してください。
|
||||
|
||||
// #define LGFX_M5STACK // M5Stack M5Stack Basic / Gray / Go / Fire
|
||||
// #define LGFX_M5STACK_CORE2 // M5Stack M5Stack Core2
|
||||
// #define LGFX_M5STACK_COREINK // M5Stack M5Stack CoreInk
|
||||
// #define LGFX_M5STICK_C // M5Stack M5Stick C / CPlus
|
||||
// #define LGFX_M5PAPER // M5Stack M5Paper
|
||||
// #define LGFX_M5TOUGH // M5Stack M5Tough
|
||||
// #define LGFX_M5ATOMS3 // M5Stack M5ATOMS3
|
||||
// #define LGFX_ODROID_GO // ODROID-GO
|
||||
// #define LGFX_TTGO_TS // TTGO TS
|
||||
// #define LGFX_TTGO_TWATCH // TTGO T-Watch
|
||||
// #define LGFX_TTGO_TWRISTBAND // TTGO T-Wristband
|
||||
// #define LGFX_TTGO_TDISPLAY // TTGO T-Display
|
||||
// #define LGFX_DDUINO32_XS // DSTIKE D-duino-32 XS
|
||||
// #define LGFX_LOLIN_D32_PRO // LoLin D32 Pro
|
||||
// #define LGFX_LOLIN_S3_PRO // LoLin S3 Pro
|
||||
// #define LGFX_ESP_WROVER_KIT // Espressif ESP-WROVER-KIT
|
||||
// #define LGFX_ESP32_S3_BOX // Espressif ESP32-S3-BOX
|
||||
// #define LGFX_ESP32_S3_BOX_LITE // Espressif ESP32-S3-BOX Lite
|
||||
// #define LGFX_WIFIBOY_PRO // WiFiBoy Pro
|
||||
// #define LGFX_WIFIBOY_MINI // WiFiBoy mini
|
||||
// #define LGFX_MAKERFABS_TOUCHCAMERA // Makerfabs Touch with Camera
|
||||
// #define LGFX_MAKERFABS_MAKEPYTHON // Makerfabs MakePython
|
||||
// #define LGFX_MAKERFABS_TFT_TOUCH_SPI // Makerfabs TFT Touch SPI
|
||||
// #define LGFX_MAKERFABS_TFT_TOUCH_PARALLEL16// Makerfabs TFT Touch Parallel 16
|
||||
// #define LGFX_WT32_SC01 // Seeed WT32-SC01
|
||||
// #define LGFX_WIO_TERMINAL // Seeed Wio Terminal
|
||||
// #define LGFX_PYBADGE // Adafruit PyBadge
|
||||
// #define LGFX_FUNHOUSE // Adafruit FunHouse
|
||||
// #define LGFX_FEATHER_ESP32_S2_TFT // Adafruit Feather ESP32 S2 TFT
|
||||
// #define LGFX_FEATHER_ESP32_S3_TFT // Adafruit Feather ESP32 S3 TFT
|
||||
// #define LGFX_ESPBOY // ESPboy
|
||||
// #define LGFX_WYWY_ESP32S3_HMI_DEVKIT // wywy ESP32S3 HMI DevKit
|
||||
// #define LGFX_ESP32_2432S028 // Sunton ESP32 2432S028
|
||||
|
||||
#define LGFX_AUTODETECT // 自動認識 (D-duino-32 XS, WT32-SC01, PyBadge はパネルID読取りが出来ないため自動認識の対象から外れています)
|
||||
|
||||
// 複数機種の定義を行うか、LGFX_AUTODETECTを定義することで、実行時にボードを自動認識します。
|
||||
|
||||
|
||||
|
||||
|
||||
// ヘッダをincludeします。
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#include <LGFX_AUTODETECT.hpp> // クラス"LGFX"を準備します
|
||||
// #include <lgfx_user/LGFX_ESP32_sample.hpp> // またはユーザ自身が用意したLGFXクラスを準備します
|
||||
|
||||
static LGFX lcd; // LGFXのインスタンスを作成。
|
||||
static LGFX_Sprite sprite(&lcd); // スプライトを使う場合はLGFX_Spriteのインスタンスを作成。
|
||||
|
||||
// もし現在 TFT_eSPI を使用中で、ソースをなるべく変更したくない場合は、こちらのヘッダを利用できます。
|
||||
// #include <LGFX_TFT_eSPI.hpp>
|
||||
// static TFT_eSPI lcd; // TFT_eSPIがLGFXの別名として定義されます。
|
||||
// static TFT_eSprite sprite(&lcd); // TFT_eSpriteがLGFX_Spriteの別名として定義されます。
|
||||
|
||||
|
||||
// 対応機種に無い構成で使う場合は、 examples/HowToUse/2_user_setting.ino を参照してください。
|
||||
// また設定例はsrc/lgfx_userフォルダにもあります。
|
||||
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// 最初に初期化関数を呼び出します。
|
||||
lcd.init();
|
||||
|
||||
|
||||
// 回転方向を 0~3 の4方向から設定します。(4~7を使用すると上下反転になります。)
|
||||
lcd.setRotation(1);
|
||||
|
||||
|
||||
// バックライトの輝度を 0~255 の範囲で設定します。
|
||||
lcd.setBrightness(128);
|
||||
|
||||
|
||||
// 必要に応じてカラーモードを設定します。(初期値は16)
|
||||
// 16の方がSPI通信量が少なく高速に動作しますが、赤と青の諧調が5bitになります。
|
||||
// 24の方がSPI通信量が多くなりますが、諧調表現が綺麗になります。
|
||||
//lcd.setColorDepth(16); // RGB565の16ビットに設定
|
||||
lcd.setColorDepth(24); // RGB888の24ビットに設定(表示される色数はパネル性能によりRGB666の18ビットになります)
|
||||
|
||||
|
||||
// 基本的な図形の描画関数は以下の通りです。
|
||||
/*
|
||||
fillScreen ( color); // 画面全体の塗り潰し
|
||||
drawPixel ( x, y , color); // 点
|
||||
drawFastVLine ( x, y , h , color); // 垂直線
|
||||
drawFastHLine ( x, y, w , color); // 水平線
|
||||
drawRect ( x, y, w, h , color); // 矩形の外周
|
||||
fillRect ( x, y, w, h , color); // 矩形の塗り
|
||||
drawRoundRect ( x, y, w, h, r, color); // 角丸の矩形の外周
|
||||
fillRoundRect ( x, y, w, h, r, color); // 角丸の矩形の塗り
|
||||
drawCircle ( x, y , r, color); // 円の外周
|
||||
fillCircle ( x, y , r, color); // 円の塗り
|
||||
drawEllipse ( x, y, rx, ry , color); // 楕円の外周
|
||||
fillEllipse ( x, y, rx, ry , color); // 楕円の塗り
|
||||
drawLine ( x0, y0, x1, y1 , color); // 2点間の直線
|
||||
drawTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の外周
|
||||
fillTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の塗り
|
||||
drawBezier ( x0, y0, x1, y1, x2, y2, color); // 3点間のベジエ曲線
|
||||
drawBezier ( x0, y0, x1, y1, x2, y2, x3, y3, color); // 4点間のベジエ曲線
|
||||
drawArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の外周
|
||||
fillArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の塗り
|
||||
*/
|
||||
|
||||
|
||||
// 例えばdrawPixelで点を書く場合は、引数は X座標,Y座標,色 の3つ。
|
||||
lcd.drawPixel(0, 0, 0xFFFF); // 座標0:0に白の点を描画
|
||||
|
||||
|
||||
// カラーコードを生成する関数が用意されており、色の指定に使用できます。
|
||||
// 引数は、赤,緑,青をそれぞれ 0~255で指定します。
|
||||
// 色情報の欠落を防ぐため、color888を使う事を推奨します。
|
||||
lcd.drawFastVLine(2, 0, 100, lcd.color888(255, 0, 0)); // 赤で垂直の線を描画
|
||||
lcd.drawFastVLine(4, 0, 100, lcd.color565( 0, 255, 0)); // 緑で垂直の線を描画
|
||||
lcd.drawFastVLine(6, 0, 100, lcd.color332( 0, 0, 255)); // 青で垂直の線を描画
|
||||
|
||||
|
||||
// カラーコード生成関数を使用しない場合は以下のようになります。
|
||||
// RGB888 24ビットで指定 uint32_t型
|
||||
// RGB565 16ビットで指定 uint16_t型、int32_t型
|
||||
// RGB332 8ビットで指定 uint8_t型
|
||||
|
||||
// uint32_t型を使用すると、RGB888の24ビットとして扱われます。
|
||||
// 16進数2桁で赤緑青の順に記述できます。
|
||||
// uint32_t型の変数を使うか、末尾にUを付けるか、uint32_t型にキャストして使用します。
|
||||
uint32_t red = 0xFF0000;
|
||||
lcd.drawFastHLine(0, 2, 100, red); // 赤で水平の線を描画
|
||||
lcd.drawFastHLine(0, 4, 100, 0x00FF00U); // 緑で水平の線を描画
|
||||
lcd.drawFastHLine(0, 6, 100, (uint32_t)0xFF); // 青で水平の線を描画
|
||||
|
||||
|
||||
// uint16_t型およびint32_t型を使用すると、RGB565の16ビットとして扱われます。
|
||||
// 特別な書き方をしない場合はint32_t型として扱われるので、この方式になります。
|
||||
// (AdafruitGFX や TFT_eSPI との互換性のために、このようにしています。)
|
||||
uint16_t green = 0x07E0;
|
||||
lcd.drawRect(10, 10, 50, 50, 0xF800); // 赤で矩形の外周を描画
|
||||
lcd.drawRect(12, 12, 50, 50, green); // 緑で矩形の外周を描画
|
||||
lcd.drawRect(14, 14, 50, 50, (uint16_t)0x1F); // 青で矩形の外周を描画
|
||||
|
||||
|
||||
// int8_t型、uint8_t型を使用すると、RGB332の8ビットとして扱われます。
|
||||
uint8_t blue = 0x03;
|
||||
lcd.fillRect(20, 20, 20, 20, (uint8_t)0xE0); // 赤で矩形の塗りを描画
|
||||
lcd.fillRect(30, 30, 20, 20, (uint8_t)0x1C); // 緑で矩形の塗りを描画
|
||||
lcd.fillRect(40, 40, 20, 20, blue); // 青で矩形の塗りを描画
|
||||
|
||||
|
||||
// 描画関数の引数の色は省略できます。
|
||||
// 省略した場合、setColor関数で設定した色 または最後に使用した色を描画色として使用します。
|
||||
// 同じ色で繰り返し描画する場合は、省略した方がわずかに速く動作します。
|
||||
lcd.setColor(0xFF0000U); // 描画色に赤色を指定
|
||||
lcd.fillCircle ( 40, 80, 20 ); // 赤色で円の塗り
|
||||
lcd.fillEllipse( 80, 40, 10, 20); // 赤色で楕円の塗り
|
||||
lcd.fillArc ( 80, 80, 20, 10, 0, 90); // 赤色で円弧の塗り
|
||||
lcd.fillTriangle(80, 80, 60, 80, 80, 60); // 赤色で三角の塗り
|
||||
lcd.setColor(0x0000FFU); // 描画色に青色を指定
|
||||
lcd.drawCircle ( 40, 80, 20 ); // 青色で円の外周
|
||||
lcd.drawEllipse( 80, 40, 10, 20); // 青色で楕円の外周
|
||||
lcd.drawArc ( 80, 80, 20, 10, 0, 90); // 青色で円弧の外周
|
||||
lcd.drawTriangle(60, 80, 80, 80, 80, 60); // 青色で三角の外周
|
||||
lcd.setColor(0x00FF00U); // 描画色に緑色を指定
|
||||
lcd.drawBezier( 60, 80, 80, 80, 80, 60); // 緑色で二次ベジエ曲線
|
||||
lcd.drawBezier( 60, 80, 80, 20, 20, 80, 80, 60);// 緑色で三次ベジエ曲線
|
||||
|
||||
// グラデーションの線を描画するdrawGradientLine は色の指定を省略できません。
|
||||
lcd.drawGradientLine( 0, 80, 80, 0, 0xFF0000U, 0x0000FFU);// 赤から青へのグラデーション直線
|
||||
|
||||
delay(1000);
|
||||
|
||||
// clearまたはfillScreenで画面全体を塗り潰せます。
|
||||
// fillScreenはfillRectの画面全体を指定したのと同じで、色の指定は描画色の扱いになります。
|
||||
lcd.fillScreen(0xFFFFFFu); // 白で塗り潰し
|
||||
lcd.setColor(0x00FF00u); // 描画色に緑色を指定
|
||||
lcd.fillScreen(); // 緑で塗り潰し
|
||||
|
||||
// clearは描画系の関数とは別で背景色という扱いで色を保持しています。
|
||||
// 背景色は出番が少ないですが、スクロール機能使用時の隙間を塗る色としても使用されます。
|
||||
lcd.clear(0xFFFFFFu); // 背景色に白を指定して塗り潰し
|
||||
lcd.setBaseColor(0x000000u);// 背景色に黒を指定
|
||||
lcd.clear(); // 黒で塗り潰し
|
||||
|
||||
|
||||
// SPIバスの確保と解放は描画関数を呼び出した時に自動的に行われますが、
|
||||
// 描画スピードを重視する場合は、描画処理の前後に startWriteとendWriteを使用します。
|
||||
// SPIバスの確保と解放が抑制され、速度が向上します。
|
||||
// 電子ペーパー(EPD)の場合、startWrite()以降の描画は、endWrite()を呼ぶ事で画面に反映されます。
|
||||
lcd.drawLine(0, 1, 39, 40, red); // SPIバス確保、線を描画、SPIバス解放
|
||||
lcd.drawLine(1, 0, 40, 39, blue); // SPIバス確保、線を描画、SPIバス解放
|
||||
lcd.startWrite(); // SPIバス確保
|
||||
lcd.drawLine(38, 0, 0, 38, 0xFFFF00U); // 線を描画
|
||||
lcd.drawLine(39, 1, 1, 39, 0xFF00FFU); // 線を描画
|
||||
lcd.drawLine(40, 2, 2, 40, 0x00FFFFU); // 線を描画
|
||||
lcd.endWrite(); // SPIバス解放
|
||||
|
||||
|
||||
// startWriteとendWriteは呼出し回数を内部でカウントしており、
|
||||
// 繰り返し呼び出した場合は最初と最後のみ動作します。
|
||||
// startWriteとendWriteは必ず対になるように使用してください。
|
||||
// (SPIバスを占有して構わない場合は、最初にstartWriteを一度呼び、endWriteしない使い方も可能です。)
|
||||
lcd.startWrite(); // カウント+1、SPIバス確保
|
||||
lcd.startWrite(); // カウント+1
|
||||
lcd.startWrite(); // カウント+1
|
||||
lcd.endWrite(); // カウント-1
|
||||
lcd.endWrite(); // カウント-1
|
||||
lcd.endWrite(); // カウント-1、SPIバス解放
|
||||
lcd.endWrite(); // 何もしない
|
||||
// なお過剰にendWriteを呼び出した場合は何も行わず、カウントがマイナスになることもありません。
|
||||
|
||||
|
||||
// startWriteのカウントの状態に依らず、強制的にSPIバスを解放・確保したい場合は、
|
||||
// endTransaction・beginTransactionを使用します。
|
||||
// カウントはクリアされないので、辻褄が合わなくならないよう注意してください。
|
||||
lcd.startWrite(); // カウント+1、SPIバス確保
|
||||
lcd.startWrite(); // カウント+1
|
||||
lcd.drawPixel(0, 0); // 描画
|
||||
lcd.endTransaction(); // SPIバス解放
|
||||
// ここで他のSPIデバイスの使用が可能
|
||||
// 同じSPIバスの別のデバイス(SDカード等)を使う場合、
|
||||
// 必ずSPIバスが解放された状態で行ってください。
|
||||
lcd.beginTransaction(); // SPIバスの確保
|
||||
lcd.drawPixel(0, 0); // 描画
|
||||
lcd.endWrite(); // カウント-1
|
||||
lcd.endWrite(); // カウント-1、SPIバス解放
|
||||
|
||||
|
||||
|
||||
// drawPixelとは別に、writePixelという点を描画する関数があります。
|
||||
// drawPixelは必要に応じてSPIバスの確保を行うのに対し、
|
||||
// writePixelはSPIバスの状態をチェックしません。
|
||||
lcd.startWrite(); // SPIバス確保
|
||||
for (uint32_t x = 0; x < 128; ++x) {
|
||||
for (uint32_t y = 0; y < 128; ++y) {
|
||||
lcd.writePixel(x, y, lcd.color888( x*2, x + y, y*2));
|
||||
}
|
||||
}
|
||||
lcd.endWrite(); // SPIバス解放
|
||||
// 名前が write~ で始まる関数は全て明示的にstartWriteを呼び出しておく必要があります。
|
||||
// writePixel、writeFastVLine、writeFastHLine、writeFillRect が該当します。
|
||||
|
||||
delay(1000);
|
||||
|
||||
// スプライト(オフスクリーン)への描画も同様の描画関数が使えます。
|
||||
// 最初にスプライトの色深度をsetColorDepthで指定します。(省略した場合は16として扱われます。)
|
||||
//sprite.setColorDepth(1); // 1ビット( 2色)パレットモードに設定
|
||||
//sprite.setColorDepth(2); // 2ビット( 4色)パレットモードに設定
|
||||
//sprite.setColorDepth(4); // 4ビット(16色)パレットモードに設定
|
||||
//sprite.setColorDepth(8); // RGB332の8ビットに設定
|
||||
//sprite.setColorDepth(16); // RGB565の16ビットに設定
|
||||
sprite.setColorDepth(24); // RGB888の24ビットに設定
|
||||
|
||||
|
||||
// ※ setColorDepth(8);を設定後に createPalette()を呼ぶ事で、256色パレットモードになります
|
||||
// sprite.createPalette();
|
||||
|
||||
|
||||
// createSpriteで幅と高さを指定してメモリを確保します。
|
||||
// 消費するメモリは色深度と面積に比例します。大きすぎるとメモリ確保に失敗しますので注意してください。
|
||||
sprite.createSprite(65, 65); // 幅65、高さ65でスプライトを作成。
|
||||
|
||||
for (uint32_t x = 0; x < 64; ++x) {
|
||||
for (uint32_t y = 0; y < 64; ++y) {
|
||||
sprite.drawPixel(x, y, lcd.color888(3 + x*4, (x + y)*2, 3 + y*4)); // スプライトに描画
|
||||
}
|
||||
}
|
||||
sprite.drawRect(0, 0, 65, 65, 0xFFFF);
|
||||
|
||||
// 作成したスプライトはpushSpriteで任意の座標に出力できます。
|
||||
// 出力先はインスタンス作成時に引数で渡したLGFXになります。
|
||||
sprite.pushSprite(64, 0); // lcdの座標64,0にスプライトを描画
|
||||
|
||||
// spriteのインスタンス作成時に描画先のポインタを渡していない場合や、
|
||||
// 複数のLGFXがある場合などは、出力先を第一引数に指定してpushSpriteすることもできます。
|
||||
sprite.pushSprite(&lcd, 0, 64); // lcdの座標0,64にスプライトを描画
|
||||
|
||||
delay(1000);
|
||||
|
||||
// pushRotateZoomでスプライトを回転拡大縮小して描画できます。
|
||||
// setPivotで設定した座標が回転中心として扱われ、描画先の座標に回転中心が位置するように描画されます。
|
||||
sprite.setPivot(32, 32); // 座標32,32を中心として扱う
|
||||
int32_t center_x = lcd.width()/2;
|
||||
int32_t center_y = lcd.height()/2;
|
||||
lcd.startWrite();
|
||||
for (int angle = 0; angle <= 360; ++angle) {
|
||||
sprite.pushRotateZoom(center_x, center_y, angle, 2.5, 3); // 画面中心に角度angle、幅2.5倍、高さ3倍で描画
|
||||
|
||||
if ((angle % 36) == 0) lcd.display(); // 電子ペーパーの場合の表示更新を 36回に一度行う
|
||||
}
|
||||
lcd.endWrite();
|
||||
|
||||
delay(1000);
|
||||
|
||||
// 使用しなくなったスプライトのメモリを解放するには deleteSprite を使用します。
|
||||
sprite.deleteSprite();
|
||||
|
||||
// deleteSprite の後でも、同じインスタンスの再利用が可能です。
|
||||
sprite.setColorDepth(4); // 4ビット(16色)パレットモードに設定
|
||||
sprite.createSprite(65, 65);
|
||||
|
||||
// パレットモードのスプライトでは、描画関数の引数の色をパレット番号として扱います。
|
||||
// pushSprite等で描画する際に、パレットを参照して実際の描画色が決まります。
|
||||
|
||||
// 4ビット(16色)パレットモードの場合、パレット番号は0~15が使用可能です。
|
||||
// パレットの初期色は、0が黒,末尾のパレットが白で、0から末尾にかけてグラデーションになっています。
|
||||
// パレットの色を設定するには setPaletteColor を使用します。
|
||||
sprite.setPaletteColor(1, 0x0000FFU); // パレット1番を青に設定
|
||||
sprite.setPaletteColor(2, 0x00FF00U); // パレット2番を緑に設定
|
||||
sprite.setPaletteColor(3, 0xFF0000U); // パレット3番を赤に設定
|
||||
|
||||
sprite.fillRect(10, 10, 45, 45, 1); // パレット1番で矩形の塗り
|
||||
sprite.fillCircle(32, 32, 22, 2); // パレット2番で円の塗り
|
||||
sprite.fillTriangle(32, 12, 15, 43, 49, 43, 3); // パレット3番で三角の塗り
|
||||
|
||||
// pushSpriteの最後の引数で、描画しない色を指定することができます。
|
||||
sprite.pushSprite( 0, 0, 0); // パレット0を透過扱いでスプライトを描画
|
||||
sprite.pushSprite(65, 0, 1); // パレット1を透過扱いでスプライトを描画
|
||||
sprite.pushSprite( 0, 65, 2); // パレット2を透過扱いでスプライトを描画
|
||||
sprite.pushSprite(65, 65, 3); // パレット3を透過扱いでスプライトを描画
|
||||
|
||||
delay(5000);
|
||||
|
||||
lcd.startWrite(); // ここでstartWrite()することで、SPIバスを占有したままにする。
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static int count = 0;
|
||||
static int a = 0;
|
||||
static int x = 0;
|
||||
static int y = 0;
|
||||
static float zoom = 3;
|
||||
++count;
|
||||
if ((a += 1) >= 360) a -= 360;
|
||||
if ((x += 2) >= lcd.width()) x -= lcd.width();
|
||||
if ((y += 1) >= lcd.height()) y -= lcd.height();
|
||||
sprite.setPaletteColor(1, lcd.color888( 0, 0, count & 0xFF));
|
||||
sprite.setPaletteColor(2, lcd.color888( 0,~count & 0xFF, 0));
|
||||
sprite.setPaletteColor(3, lcd.color888( count & 0xFF, 0, 0));
|
||||
|
||||
sprite.pushRotateZoom(x, y, a, zoom, zoom, 0);
|
||||
|
||||
if ((count % 100) == 0) lcd.display(); // 電子ペーパーの場合の表示更新を 100回に一度行う
|
||||
}
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
// ESP32でLovyanGFXを独自設定で利用する場合の設定例
|
||||
|
||||
/// 独自の設定を行うクラスを、LGFX_Deviceから派生して作成します。
|
||||
class LGFX : public lgfx::LGFX_Device
|
||||
{
|
||||
/*
|
||||
クラス名は"LGFX"から別の名前に変更しても構いません。
|
||||
AUTODETECTと併用する場合は"LGFX"は使用されているため、LGFX以外の名前に変更してください。
|
||||
また、複数枚のパネルを同時使用する場合もそれぞれに異なる名前を付けてください。
|
||||
※ クラス名を変更する場合はコンストラクタの名前も併せて同じ名前に変更が必要です。
|
||||
|
||||
名前の付け方は自由に決めて構いませんが、設定が増えた場合を想定し、
|
||||
例えばESP32 DevKit-CでSPI接続のILI9341の設定を行った場合、
|
||||
LGFX_DevKitC_SPI_ILI9341
|
||||
のような名前にし、ファイル名とクラス名を一致させておくことで、利用時に迷いにくくなります。
|
||||
//*/
|
||||
|
||||
|
||||
// 接続するパネルの型にあったインスタンスを用意します。
|
||||
//lgfx::Panel_GC9A01 _panel_instance;
|
||||
//lgfx::Panel_GDEW0154M09 _panel_instance;
|
||||
//lgfx::Panel_HX8357B _panel_instance;
|
||||
//lgfx::Panel_HX8357D _panel_instance;
|
||||
//lgfx::Panel_ILI9163 _panel_instance;
|
||||
lgfx::Panel_ILI9341 _panel_instance;
|
||||
//lgfx::Panel_ILI9342 _panel_instance;
|
||||
//lgfx::Panel_ILI9481 _panel_instance;
|
||||
//lgfx::Panel_ILI9486 _panel_instance;
|
||||
//lgfx::Panel_ILI9488 _panel_instance;
|
||||
//lgfx::Panel_IT8951 _panel_instance;
|
||||
//lgfx::Panel_RA8875 _panel_instance;
|
||||
//lgfx::Panel_SH110x _panel_instance; // SH1106, SH1107
|
||||
//lgfx::Panel_SSD1306 _panel_instance;
|
||||
//lgfx::Panel_SSD1327 _panel_instance;
|
||||
//lgfx::Panel_SSD1331 _panel_instance;
|
||||
//lgfx::Panel_SSD1351 _panel_instance; // SSD1351, SSD1357
|
||||
//lgfx::Panel_SSD1963 _panel_instance;
|
||||
//lgfx::Panel_ST7735 _panel_instance;
|
||||
//lgfx::Panel_ST7735S _panel_instance;
|
||||
//lgfx::Panel_ST7789 _panel_instance;
|
||||
//lgfx::Panel_ST7796 _panel_instance;
|
||||
|
||||
|
||||
// パネルを接続するバスの種類にあったインスタンスを用意します。
|
||||
lgfx::Bus_SPI _bus_instance; // SPIバスのインスタンス
|
||||
//lgfx::Bus_I2C _bus_instance; // I2Cバスのインスタンス
|
||||
//lgfx::Bus_Parallel8 _bus_instance; // 8ビットパラレルバスのインスタンス
|
||||
|
||||
// バックライト制御が可能な場合はインスタンスを用意します。(必要なければ削除)
|
||||
lgfx::Light_PWM _light_instance;
|
||||
|
||||
// タッチスクリーンの型にあったインスタンスを用意します。(必要なければ削除)
|
||||
lgfx::Touch_FT5x06 _touch_instance; // FT5206, FT5306, FT5406, FT6206, FT6236, FT6336, FT6436
|
||||
//lgfx::Touch_GSL1680E_800x480 _touch_instance; // GSL_1680E, 1688E, 2681B, 2682B
|
||||
//lgfx::Touch_GSL1680F_800x480 _touch_instance;
|
||||
//lgfx::Touch_GSL1680F_480x272 _touch_instance;
|
||||
//lgfx::Touch_GSLx680_320x320 _touch_instance;
|
||||
//lgfx::Touch_GT911 _touch_instance;
|
||||
//lgfx::Touch_STMPE610 _touch_instance;
|
||||
//lgfx::Touch_TT21xxx _touch_instance; // TT21100
|
||||
//lgfx::Touch_XPT2046 _touch_instance;
|
||||
|
||||
public:
|
||||
|
||||
// コンストラクタを作成し、ここで各種設定を行います。
|
||||
// クラス名を変更した場合はコンストラクタも同じ名前を指定してください。
|
||||
LGFX(void)
|
||||
{
|
||||
{ // バス制御の設定を行います。
|
||||
auto cfg = _bus_instance.config(); // バス設定用の構造体を取得します。
|
||||
|
||||
// SPIバスの設定
|
||||
cfg.spi_host = VSPI_HOST; // 使用するSPIを選択 ESP32-S2,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
|
||||
// ※ ESP-IDFバージョンアップに伴い、VSPI_HOST , HSPI_HOSTの記述は非推奨になるため、エラーが出る場合は代わりにSPI2_HOST , SPI3_HOSTを使用してください。
|
||||
cfg.spi_mode = 0; // SPI通信モードを設定 (0 ~ 3)
|
||||
cfg.freq_write = 40000000; // 送信時のSPIクロック (最大80MHz, 80MHzを整数で割った値に丸められます)
|
||||
cfg.freq_read = 16000000; // 受信時のSPIクロック
|
||||
cfg.spi_3wire = true; // 受信をMOSIピンで行う場合はtrueを設定
|
||||
cfg.use_lock = true; // トランザクションロックを使用する場合はtrueを設定
|
||||
cfg.dma_channel = SPI_DMA_CH_AUTO; // 使用するDMAチャンネルを設定 (0=DMA不使用 / 1=1ch / 2=ch / SPI_DMA_CH_AUTO=自動設定)
|
||||
// ※ ESP-IDFバージョンアップに伴い、DMAチャンネルはSPI_DMA_CH_AUTO(自動設定)が推奨になりました。1ch,2chの指定は非推奨になります。
|
||||
cfg.pin_sclk = 18; // SPIのSCLKピン番号を設定
|
||||
cfg.pin_mosi = 23; // SPIのMOSIピン番号を設定
|
||||
cfg.pin_miso = 19; // SPIのMISOピン番号を設定 (-1 = disable)
|
||||
cfg.pin_dc = 27; // SPIのD/Cピン番号を設定 (-1 = disable)
|
||||
// SDカードと共通のSPIバスを使う場合、MISOは省略せず必ず設定してください。
|
||||
//*/
|
||||
/*
|
||||
// I2Cバスの設定
|
||||
cfg.i2c_port = 0; // 使用するI2Cポートを選択 (0 or 1)
|
||||
cfg.freq_write = 400000; // 送信時のクロック
|
||||
cfg.freq_read = 400000; // 受信時のクロック
|
||||
cfg.pin_sda = 21; // SDAを接続しているピン番号
|
||||
cfg.pin_scl = 22; // SCLを接続しているピン番号
|
||||
cfg.i2c_addr = 0x3C; // I2Cデバイスのアドレス
|
||||
//*/
|
||||
/*
|
||||
// 8ビットパラレルバスの設定
|
||||
cfg.i2s_port = I2S_NUM_0; // 使用するI2Sポートを選択 (I2S_NUM_0 or I2S_NUM_1) (ESP32のI2S LCDモードを使用します)
|
||||
cfg.freq_write = 20000000; // 送信クロック (最大20MHz, 80MHzを整数で割った値に丸められます)
|
||||
cfg.pin_wr = 4; // WR を接続しているピン番号
|
||||
cfg.pin_rd = 2; // RD を接続しているピン番号
|
||||
cfg.pin_rs = 15; // RS(D/C)を接続しているピン番号
|
||||
cfg.pin_d0 = 12; // D0を接続しているピン番号
|
||||
cfg.pin_d1 = 13; // D1を接続しているピン番号
|
||||
cfg.pin_d2 = 26; // D2を接続しているピン番号
|
||||
cfg.pin_d3 = 25; // D3を接続しているピン番号
|
||||
cfg.pin_d4 = 17; // D4を接続しているピン番号
|
||||
cfg.pin_d5 = 16; // D5を接続しているピン番号
|
||||
cfg.pin_d6 = 27; // D6を接続しているピン番号
|
||||
cfg.pin_d7 = 14; // D7を接続しているピン番号
|
||||
//*/
|
||||
|
||||
_bus_instance.config(cfg); // 設定値をバスに反映します。
|
||||
_panel_instance.setBus(&_bus_instance); // バスをパネルにセットします。
|
||||
}
|
||||
|
||||
{ // 表示パネル制御の設定を行います。
|
||||
auto cfg = _panel_instance.config(); // 表示パネル設定用の構造体を取得します。
|
||||
|
||||
cfg.pin_cs = 14; // CSが接続されているピン番号 (-1 = disable)
|
||||
cfg.pin_rst = 33; // RSTが接続されているピン番号 (-1 = disable)
|
||||
cfg.pin_busy = -1; // BUSYが接続されているピン番号 (-1 = disable)
|
||||
|
||||
// ※ 以下の設定値はパネル毎に一般的な初期値が設定されていますので、不明な項目はコメントアウトして試してみてください。
|
||||
|
||||
cfg.panel_width = 240; // 実際に表示可能な幅
|
||||
cfg.panel_height = 320; // 実際に表示可能な高さ
|
||||
cfg.offset_x = 0; // パネルのX方向オフセット量
|
||||
cfg.offset_y = 0; // パネルのY方向オフセット量
|
||||
cfg.offset_rotation = 0; // 回転方向の値のオフセット 0~7 (4~7は上下反転)
|
||||
cfg.dummy_read_pixel = 8; // ピクセル読出し前のダミーリードのビット数
|
||||
cfg.dummy_read_bits = 1; // ピクセル以外のデータ読出し前のダミーリードのビット数
|
||||
cfg.readable = true; // データ読出しが可能な場合 trueに設定
|
||||
cfg.invert = false; // パネルの明暗が反転してしまう場合 trueに設定
|
||||
cfg.rgb_order = false; // パネルの赤と青が入れ替わってしまう場合 trueに設定
|
||||
cfg.dlen_16bit = false; // 16bitパラレルやSPIでデータ長を16bit単位で送信するパネルの場合 trueに設定
|
||||
cfg.bus_shared = true; // SDカードとバスを共有している場合 trueに設定(drawJpgFile等でバス制御を行います)
|
||||
|
||||
// 以下はST7735やILI9163のようにピクセル数が可変のドライバで表示がずれる場合にのみ設定してください。
|
||||
// cfg.memory_width = 240; // ドライバICがサポートしている最大の幅
|
||||
// cfg.memory_height = 320; // ドライバICがサポートしている最大の高さ
|
||||
|
||||
_panel_instance.config(cfg);
|
||||
}
|
||||
|
||||
//*
|
||||
{ // バックライト制御の設定を行います。(必要なければ削除)
|
||||
auto cfg = _light_instance.config(); // バックライト設定用の構造体を取得します。
|
||||
|
||||
cfg.pin_bl = 32; // バックライトが接続されているピン番号
|
||||
cfg.invert = false; // バックライトの輝度を反転させる場合 true
|
||||
cfg.freq = 44100; // バックライトのPWM周波数
|
||||
cfg.pwm_channel = 7; // 使用するPWMのチャンネル番号
|
||||
|
||||
_light_instance.config(cfg);
|
||||
_panel_instance.setLight(&_light_instance); // バックライトをパネルにセットします。
|
||||
}
|
||||
//*/
|
||||
|
||||
//*
|
||||
{ // タッチスクリーン制御の設定を行います。(必要なければ削除)
|
||||
auto cfg = _touch_instance.config();
|
||||
|
||||
cfg.x_min = 0; // タッチスクリーンから得られる最小のX値(生の値)
|
||||
cfg.x_max = 239; // タッチスクリーンから得られる最大のX値(生の値)
|
||||
cfg.y_min = 0; // タッチスクリーンから得られる最小のY値(生の値)
|
||||
cfg.y_max = 319; // タッチスクリーンから得られる最大のY値(生の値)
|
||||
cfg.pin_int = 38; // INTが接続されているピン番号
|
||||
cfg.bus_shared = true; // 画面と共通のバスを使用している場合 trueを設定
|
||||
cfg.offset_rotation = 0;// 表示とタッチの向きのが一致しない場合の調整 0~7の値で設定
|
||||
|
||||
// SPI接続の場合
|
||||
cfg.spi_host = VSPI_HOST;// 使用するSPIを選択 (HSPI_HOST or VSPI_HOST)
|
||||
cfg.freq = 1000000; // SPIクロックを設定
|
||||
cfg.pin_sclk = 18; // SCLKが接続されているピン番号
|
||||
cfg.pin_mosi = 23; // MOSIが接続されているピン番号
|
||||
cfg.pin_miso = 19; // MISOが接続されているピン番号
|
||||
cfg.pin_cs = 5; // CSが接続されているピン番号
|
||||
|
||||
// I2C接続の場合
|
||||
cfg.i2c_port = 1; // 使用するI2Cを選択 (0 or 1)
|
||||
cfg.i2c_addr = 0x38; // I2Cデバイスアドレス番号
|
||||
cfg.pin_sda = 23; // SDAが接続されているピン番号
|
||||
cfg.pin_scl = 32; // SCLが接続されているピン番号
|
||||
cfg.freq = 400000; // I2Cクロックを設定
|
||||
|
||||
_touch_instance.config(cfg);
|
||||
_panel_instance.setTouch(&_touch_instance); // タッチスクリーンをパネルにセットします。
|
||||
}
|
||||
//*/
|
||||
|
||||
setPanel(&_panel_instance); // 使用するパネルをセットします。
|
||||
}
|
||||
};
|
||||
|
||||
// 準備したクラスのインスタンスを作成します。
|
||||
LGFX display;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// SPIバスとパネルの初期化を実行すると使用可能になります。
|
||||
display.init();
|
||||
|
||||
display.setTextSize((std::max(display.width(), display.height()) + 255) >> 8);
|
||||
|
||||
// タッチが使用可能な場合のキャリブレーションを行います。(省略可)
|
||||
if (display.touch())
|
||||
{
|
||||
if (display.width() < display.height()) display.setRotation(display.getRotation() ^ 1);
|
||||
|
||||
// 画面に案内文章を描画します。
|
||||
display.setTextDatum(textdatum_t::middle_center);
|
||||
display.drawString("touch the arrow marker.", display.width()>>1, display.height() >> 1);
|
||||
display.setTextDatum(textdatum_t::top_left);
|
||||
|
||||
// タッチを使用する場合、キャリブレーションを行います。画面の四隅に表示される矢印の先端を順にタッチしてください。
|
||||
std::uint16_t fg = TFT_WHITE;
|
||||
std::uint16_t bg = TFT_BLACK;
|
||||
if (display.isEPD()) std::swap(fg, bg);
|
||||
display.calibrateTouch(nullptr, fg, bg, std::max(display.width(), display.height()) >> 3);
|
||||
}
|
||||
|
||||
display.fillScreen(TFT_BLACK);
|
||||
}
|
||||
|
||||
uint32_t count = ~0;
|
||||
void loop(void)
|
||||
{
|
||||
display.startWrite();
|
||||
display.setRotation(++count & 7);
|
||||
display.setColorDepth((count & 8) ? 16 : 24);
|
||||
|
||||
display.setTextColor(TFT_WHITE);
|
||||
display.drawNumber(display.getRotation(), 16, 0);
|
||||
|
||||
display.setTextColor(0xFF0000U);
|
||||
display.drawString("R", 30, 16);
|
||||
display.setTextColor(0x00FF00U);
|
||||
display.drawString("G", 40, 16);
|
||||
display.setTextColor(0x0000FFU);
|
||||
display.drawString("B", 50, 16);
|
||||
|
||||
display.drawRect(30,30,display.width()-60,display.height()-60,count*7);
|
||||
display.drawFastHLine(0, 0, 10);
|
||||
|
||||
display.endWrite();
|
||||
|
||||
int32_t x, y;
|
||||
if (display.getTouch(&x, &y)) {
|
||||
display.fillRect(x-2, y-2, 5, 5, count*7);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,313 @@
|
|||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
void drawGradation(void)
|
||||
{
|
||||
// 背景にグラデーションを描画する
|
||||
lcd.startWrite();
|
||||
lcd.setAddrWindow(0, 0, lcd.width(), lcd.height());
|
||||
for (int y = 0; y < lcd.height(); ++y) {
|
||||
for (int x = 0; x < lcd.width(); ++x) {
|
||||
lcd.writeColor(lcd.color888(x>>1, (x + y) >> 2, y>>1), 1);
|
||||
}
|
||||
}
|
||||
lcd.endWrite();
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
drawGradation();
|
||||
|
||||
// 文字の描画方法には大きく分けて2通り、print 系の関数と drawString 系の関数があります。
|
||||
|
||||
// drawString 関数では、第1引数で文字列を指定し、第2引数でX座標、第3引数でY座標を指定します。
|
||||
lcd.drawString("string!", 10, 10);
|
||||
|
||||
// drawNumber 関数では、第1引数が数値になります。
|
||||
lcd.drawNumber(123, 100, 10);
|
||||
|
||||
// drawFloat 関数では、第1引数が数値、第2引数が小数点以下の桁数になり、第3引数がX座標、第4引数がY座標になります。
|
||||
lcd.drawFloat(3.14, 2, 150, 10);
|
||||
|
||||
// print 関数では、setCursor関数で指定した座標 (またはprint関数で最後に描画した文字の続き)に描画します。
|
||||
lcd.setCursor(10, 20);
|
||||
lcd.print("print!");
|
||||
|
||||
// printf関数で、第2引数以降の内容を描画できます。(C言語のprintf準拠ですので文字列や浮動小数も描画できます)
|
||||
int value = 123;
|
||||
lcd.printf("test %d", value);
|
||||
|
||||
// println関数で、文字列を描画後に改行できます。print("\n");と同じ効果です。
|
||||
lcd.println("println");
|
||||
|
||||
// フォントを変更するには、setFont関数を使用します。
|
||||
// TFT_eSPIのsetTextFont関数と同じフォントは Font0 ~ Font8 になります。
|
||||
// ※ エディタの入力支援が使える場合、引数に&fonts::まで入力する事でフォント一覧が表示されます
|
||||
lcd.setFont(&fonts::Font4);
|
||||
lcd.println("TestFont4");
|
||||
|
||||
// TFT_eSPIとの互換性のためにsetTextFont関数による番号でのフォント変更にも対応しています。
|
||||
// 引数に指定できる数字は 0, 2, 4, 6, 7, 8 です。(TFT_eSPI準拠です)
|
||||
// ※ ただし この方法は、他の番号のフォントも強制的にバイナリに含まれサイズが膨らむため、非推奨です。
|
||||
lcd.setTextFont(2);
|
||||
lcd.println("TestFont2");
|
||||
|
||||
|
||||
// setTextColorで色を変更できます。
|
||||
// 1つ目の引数が文字色、2つ目の引数が背景色になります。
|
||||
lcd.setTextColor(0x00FFFFU, 0xFF0000U);
|
||||
lcd.print("CyanText RedBack");
|
||||
// ※ 同じ場所に文字を繰り返し描画し直したい場合、背景色を指定して重ね書きすることを推奨します。
|
||||
// fillRect等で消去してから書き直すと、ちらつきが発生する可能性があります。
|
||||
|
||||
|
||||
// setTextColorで第1引数のみを指定し第2引数を省略した場合は、
|
||||
// 背景を塗り潰さず文字だけを描画します。
|
||||
lcd.setTextColor(0xFFFF00U);
|
||||
lcd.print("YellowText ClearBack");
|
||||
|
||||
|
||||
// Font6は時計用の文字のみが収録されています。
|
||||
lcd.setFont(&fonts::Font6);
|
||||
lcd.print("apm.:-0369");
|
||||
|
||||
// Font7は7セグメント液晶風のフォントが収録されています。
|
||||
lcd.setFont(&fonts::Font7);
|
||||
lcd.print(".:-147");
|
||||
|
||||
// Font8は数字のみが収録されています。
|
||||
lcd.setFont(&fonts::Font8);
|
||||
lcd.print(".:-258");
|
||||
|
||||
|
||||
delay(3000);
|
||||
drawGradation();
|
||||
|
||||
// IPAフォントをコンバートした日本語フォントが4種類x9サイズ = 36通りプリセットされています。
|
||||
// 末尾の数字がサイズを表しており、8, 12, 16, 20, 24, 28, 32, 36, 40 が用意されています。
|
||||
// fonts::lgfxJapanMincho_12 // 明朝体 サイズ12 固定幅フォント
|
||||
// fonts::lgfxJapanMinchoP_16 // 明朝体 サイズ16 プロポーショナルフォント
|
||||
// fonts::lgfxJapanGothic_20 // ゴシック体 サイズ20 固定幅フォント
|
||||
// fonts::lgfxJapanGothicP_24 // ゴシック体 サイズ24 プロポーショナルフォント
|
||||
|
||||
// efontをコンバートした日本語・韓国語・中国語(簡体字・繁体字)フォントが各4種類x5サイズ=20通りプリセットされています。
|
||||
// 数字がサイズを表しており、10, 12, 14, 16, 24 が用意されています。
|
||||
// 末尾の文字は b= ボールド(太字) / i= イタリック(斜体) を表しています。
|
||||
// fonts::efontJA_10 // 日本語 サイズ10
|
||||
// fonts::efontCN_12_b // 簡体字 サイズ12 ボールド
|
||||
// fonts::efontTW_14_bi // 繁体字 サイズ14 ボールドイタリック
|
||||
// fonts::efontKR_16_i // 韓国語 サイズ16 イタリック
|
||||
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.setFont(&fonts::lgfxJapanMincho_16); lcd.print("明朝体 16 Hello World\nこんにちは世界\n");
|
||||
//lcd.setFont(&fonts::lgfxJapanMinchoP_16); lcd.print("明朝 P 16 Hello World\nこんにちは世界\n");
|
||||
lcd.setFont(&fonts::lgfxJapanGothic_16); lcd.print("ゴシック体 16 Hello World\nこんにちは世界\n");
|
||||
//lcd.setFont(&fonts::lgfxJapanGothicP_16); lcd.print("ゴシック P 16 Hello World\nこんにちは世界\n");
|
||||
|
||||
// ※ やまねこ氏の [日本語フォントサブセットジェネレーター](https://github.com/yamamaya/lgfxFontSubsetGenerator)
|
||||
// を使用することで、必要な文字だけを含む小サイズのフォントデータを作成できます。
|
||||
|
||||
|
||||
delay(3000);
|
||||
drawGradation();
|
||||
|
||||
|
||||
// LovyanGFXでは AdafruitGFX フォントも setFont 関数で使用できます。
|
||||
// (TFT_eSPIとの互換性のために setFreeFont関数も用意しています)
|
||||
lcd.setFont(&fonts::FreeSerif9pt7b);
|
||||
|
||||
|
||||
// 右揃え や 中央揃え で描画したい場合は、setTextDatum 関数で基準位置を指定します。
|
||||
// 縦方向が top、middle、baseline、bottomの4通り、横方向が left、center、rightの3通りです。
|
||||
// 縦と横の指定を組み合わせた12通りの中から指定します。
|
||||
lcd.setTextDatum( textdatum_t::top_left );
|
||||
lcd.setTextDatum( textdatum_t::top_center );
|
||||
lcd.setTextDatum( textdatum_t::top_right );
|
||||
lcd.setTextDatum( textdatum_t::middle_left );
|
||||
lcd.setTextDatum( textdatum_t::middle_center );
|
||||
lcd.setTextDatum( textdatum_t::middle_right );
|
||||
lcd.setTextDatum( textdatum_t::baseline_left );
|
||||
lcd.setTextDatum( textdatum_t::baseline_center );
|
||||
lcd.setTextDatum( textdatum_t::baseline_right );
|
||||
lcd.setTextDatum( textdatum_t::bottom_left );
|
||||
lcd.setTextDatum( textdatum_t::bottom_center );
|
||||
lcd.setTextDatum( textdatum_t::bottom_right );
|
||||
// ※ "textdatum_t::" は省略可能です
|
||||
// ※ print系関数には縦方向の指定のみ効果があり、横方向の指定は効果がありません。
|
||||
|
||||
// 右下揃え
|
||||
lcd.setTextDatum( bottom_right );
|
||||
lcd.drawString("bottom_right", lcd.width() / 2, lcd.height() / 2);
|
||||
|
||||
// 左下揃え
|
||||
lcd.setTextDatum( bottom_left );
|
||||
lcd.drawString("bottom_left", lcd.width() / 2, lcd.height() / 2);
|
||||
|
||||
// 右上揃え
|
||||
lcd.setTextDatum( top_right );
|
||||
lcd.drawString("top_right", lcd.width() / 2, lcd.height() / 2);
|
||||
|
||||
// 左上揃え
|
||||
lcd.setTextDatum( top_left );
|
||||
lcd.drawString("top_left", lcd.width() / 2, lcd.height() / 2);
|
||||
|
||||
|
||||
// 基準座標に中心線を描画
|
||||
lcd.drawFastVLine(lcd.width() / 2, 0, lcd.height(), 0xFFFFFFU);
|
||||
lcd.drawFastHLine(0, lcd.height() / 2, lcd.width(), 0xFFFFFFU);
|
||||
|
||||
|
||||
delay(3000);
|
||||
drawGradation();
|
||||
|
||||
lcd.setFont(&Font2);
|
||||
lcd.setCursor(0, 0);
|
||||
|
||||
|
||||
lcd.drawRect(8, 8, lcd.width() - 16, lcd.height() - 16, 0xFFFFFFU);
|
||||
|
||||
// setClipRect関数で描画する範囲を限定できます。指定した範囲外には描画されなくなります。
|
||||
// ※ テキスト系のみならず、すべての描画関数に影響します。
|
||||
lcd.setClipRect(10, 10, lcd.width() - 20, lcd.height() - 20);
|
||||
|
||||
|
||||
// setTextSize 関数で 文字の拡大率を指定します。
|
||||
// 第1引数で横方向の倍率、第2引数で縦方向の倍率を指定します。
|
||||
// 第2引数を省略した場合は、第1引数の倍率が縦と横の両方に反映されます。
|
||||
lcd.setTextSize(2.7, 4);
|
||||
lcd.println("Size 2.7 x 4");
|
||||
|
||||
lcd.setTextSize(2.5);
|
||||
lcd.println("Size 2.5 x 2.5");
|
||||
|
||||
lcd.setTextSize(1.5, 2);
|
||||
lcd.println("Size 1.5 x 2");
|
||||
|
||||
delay(1000);
|
||||
|
||||
lcd.setTextColor(0xFFFFFFU, 0);
|
||||
for (float i = 0; i < 30; i += 0.01) {
|
||||
lcd.setTextSize(sin(i)+1.1, cos(i)+1.1);
|
||||
lcd.drawString("size test", 10, 10);
|
||||
}
|
||||
|
||||
lcd.setTextSize(1);
|
||||
|
||||
// setTextWrap 関数で、print 関数が画面端(描画範囲端)に到達した時の折り返し動作を指定します。
|
||||
// 第1引数をtrueにすると、右端到達後に左端へ移動します。
|
||||
// 第2引数をtrueにすると、下端到達後に上端へ移動します。(省略時:false)
|
||||
lcd.setTextWrap(false);
|
||||
lcd.println("setTextWrap(false) testing... long long long long string wrap test string ");
|
||||
// false指定時は位置調整されず、描画範囲外にはみ出した部分は描画されません。
|
||||
|
||||
lcd.setTextWrap(true);
|
||||
lcd.setTextColor(0xFFFF00U, 0);
|
||||
lcd.println("setTextWrap(true) testing... long long long long string wrap test string ");
|
||||
// true指定時は描画範囲内に収まるよう座標を自動調整します。
|
||||
|
||||
delay(1000);
|
||||
|
||||
// 第2引数にtrue指定時は、画面下端に到達すると続きを上端から描画します。
|
||||
lcd.setTextColor(0xFFFFFFU, 0);
|
||||
lcd.setTextWrap(true, true);
|
||||
lcd.println("setTextWrap(true, true) testing...");
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
lcd.printf("wrap test %03d ", i);
|
||||
delay(50);
|
||||
}
|
||||
|
||||
|
||||
drawGradation();
|
||||
|
||||
// setTextScroll 関数で、画面下端に到達した時のスクロール動作を指定します。
|
||||
// setScrollRect 関数でスクロールする矩形範囲を指定します。(未指定時は画面全体がスクロールします)
|
||||
// ※ スクロール機能は、LCDが画素読出しに対応している必要があります。
|
||||
lcd.setTextScroll(true);
|
||||
|
||||
// 第1~第4引数で X Y Width Height の矩形範囲を指定し、第5引数でスクロール後の色を指定します。第5引数は省略可(省略時は変更なし)
|
||||
lcd.setScrollRect(10, 10, lcd.width() - 20, lcd.height() - 20, 0x00001FU);
|
||||
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
lcd.printf("scroll test %d \n", i);
|
||||
}
|
||||
|
||||
|
||||
// setClipRectの範囲指定を解除します。
|
||||
lcd.clearClipRect();
|
||||
|
||||
// setScrollRectの範囲指定を解除します。
|
||||
lcd.clearScrollRect();
|
||||
|
||||
|
||||
lcd.setTextSize(1);
|
||||
lcd.setTextColor(0xFFFFFFU, 0);
|
||||
|
||||
|
||||
// setTextPadding 関数で、drawString 系関数で背景塗り潰し時の最小幅を指定できます。
|
||||
lcd.setTextPadding(100);
|
||||
|
||||
|
||||
drawGradation();
|
||||
}
|
||||
|
||||
void drawNumberTest(const lgfx::IFont* font)
|
||||
{
|
||||
lcd.setFont(font);
|
||||
|
||||
lcd.fillScreen(0x0000FF);
|
||||
|
||||
lcd.setColor(0xFFFF00U);
|
||||
lcd.drawFastVLine( 80, 0, 240);
|
||||
lcd.drawFastVLine(160, 0, 240);
|
||||
lcd.drawFastVLine(240, 0, 240);
|
||||
lcd.drawFastHLine(0, 45, 320);
|
||||
lcd.drawFastHLine(0, 95, 320);
|
||||
lcd.drawFastHLine(0, 145, 320);
|
||||
lcd.drawFastHLine(0, 195, 320);
|
||||
|
||||
for (int i = 0; i < 200; ++i) {
|
||||
lcd.setTextDatum( textdatum_t::bottom_right ); lcd.drawNumber(i, 80, 45);
|
||||
lcd.setTextDatum( textdatum_t::bottom_center ); lcd.drawNumber(i, 160, 45);
|
||||
lcd.setTextDatum( textdatum_t::bottom_left ); lcd.drawNumber(i, 240, 45);
|
||||
lcd.setTextDatum( textdatum_t::baseline_right ); lcd.drawNumber(i, 80, 95);
|
||||
lcd.setTextDatum( textdatum_t::baseline_center ); lcd.drawNumber(i, 160, 95);
|
||||
lcd.setTextDatum( textdatum_t::baseline_left ); lcd.drawNumber(i, 240, 95);
|
||||
lcd.setTextDatum( textdatum_t::middle_right ); lcd.drawNumber(i, 80, 145);
|
||||
lcd.setTextDatum( textdatum_t::middle_center ); lcd.drawNumber(i, 160, 145);
|
||||
lcd.setTextDatum( textdatum_t::middle_left ); lcd.drawNumber(i, 240, 145);
|
||||
lcd.setTextDatum( textdatum_t::top_right ); lcd.drawNumber(i, 80, 195);
|
||||
lcd.setTextDatum( textdatum_t::top_center ); lcd.drawNumber(i, 160, 195);
|
||||
lcd.setTextDatum( textdatum_t::top_left ); lcd.drawNumber(i, 240, 195);
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
// ※ 名前が"Free"で始まるフォントは 9pt 12pt 18pt 24ptの4種類があります。
|
||||
drawNumberTest( &fonts::Font0 );
|
||||
drawNumberTest( &fonts::Font2 );
|
||||
drawNumberTest( &fonts::Font4 );
|
||||
drawNumberTest( &fonts::Font6 );
|
||||
drawNumberTest( &fonts::Font7 );
|
||||
drawNumberTest( &fonts::Font8 );
|
||||
drawNumberTest( &fonts::TomThumb );
|
||||
drawNumberTest( &fonts::FreeMono9pt7b );
|
||||
drawNumberTest( &fonts::FreeMonoBold9pt7b );
|
||||
drawNumberTest( &fonts::FreeMonoOblique9pt7b );
|
||||
drawNumberTest( &fonts::FreeMonoBoldOblique9pt7b);
|
||||
drawNumberTest( &fonts::FreeSans9pt7b );
|
||||
drawNumberTest( &fonts::FreeSansBold9pt7b );
|
||||
drawNumberTest( &fonts::FreeSansOblique9pt7b );
|
||||
drawNumberTest( &fonts::FreeSansBoldOblique9pt7b);
|
||||
drawNumberTest( &fonts::FreeSerif9pt7b );
|
||||
drawNumberTest( &fonts::FreeSerifBold9pt7b );
|
||||
drawNumberTest( &fonts::FreeSerifItalic9pt7b );
|
||||
drawNumberTest( &fonts::FreeSerifBoldItalic9pt7b);
|
||||
drawNumberTest( &fonts::Orbitron_Light_24 );
|
||||
drawNumberTest( &fonts::Roboto_Thin_24 );
|
||||
drawNumberTest( &fonts::Satisfy_24 );
|
||||
drawNumberTest( &fonts::Yellowtail_32 );
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
// このサンプルの実行にはArduino-misakiUTF16が必要です。
|
||||
// need misakifont to run this example.
|
||||
//
|
||||
// URL : https://github.com/Tamakichi/Arduino-misakiUTF16
|
||||
//
|
||||
|
||||
// Arduino-misakiUTF16のフォントデータをincludeします。
|
||||
// Include the font data of Arduino-misakiUTF16.
|
||||
#include "misakiUTF16FontData.h"
|
||||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
// lgfx::BDFfontクラスを使って、Arduino-misakiUTF16を使用できるように設定します。
|
||||
static constexpr lgfx::BDFfont misaki_font =
|
||||
{ fdata // 第1引数 フォントのビットマップデータ
|
||||
, ftable // 第2引数 unicodeフォントテーブル
|
||||
, sizeof(ftable)>>1 // 第3引数 フォントテーブルのサイズ
|
||||
, 8 // 第4引数 フォント幅
|
||||
, 4 // 第5引数 フォント幅 (半角)
|
||||
, 7 // 第6引数 フォント高さ
|
||||
, 6 // 第7引数 ベースライン高さ
|
||||
, 8 // 第8引数 改行時の縦方向カーソル移動量
|
||||
};
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
// 先ほど作成した misaki_font を setFont 関数の引数に指定することで、print や drawString 等で使用できます。
|
||||
lcd.setFont(&misaki_font);
|
||||
|
||||
lcd.setTextWrap(true, true);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
lcd.setTextColor(0x808080U|random(0xFFFFFF), 0x7F7F7FU&random(0x10000));
|
||||
|
||||
lcd.print("美さきフォントは8x8のコンパクトなフォントです。");
|
||||
lcd.print("Arduino-misakiUTF16は、教育漢字1,006字(小学校で習う漢字)+ひらがな・カタカナ・記号・半角等の1,710字にしぼって収録されています。");
|
||||
lcd.print("Hello");
|
||||
lcd.print("HELLO");
|
||||
lcd.print("こんにちは");
|
||||
delay(1000);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
// このサンプルの実行にはefontが必要です。
|
||||
// need efont to run this example.
|
||||
//
|
||||
// URL : https://github.com/tanakamasayuki/efont
|
||||
//
|
||||
|
||||
// 使用する文字セットに応じたヘッダをincludeします。
|
||||
// Include a header corresponding to the character set used.
|
||||
//#include <efontEnableAll.h>
|
||||
//#include <efontEnableAscii.h>
|
||||
//#include <efontEnableCJK.h>
|
||||
//#include <efontEnableCn.h>
|
||||
#include <efontEnableJa.h>
|
||||
//#include <efontEnableJaMini.h>
|
||||
//#include <efontEnableKr.h>
|
||||
//#include <efontEnableTw.h>
|
||||
|
||||
// efontのフォントデータをincludeします。
|
||||
// Include the font data of efont.
|
||||
#include <efontFontData.h>
|
||||
|
||||
// LovyanGFXより先に efontのincludeが必要です。
|
||||
// need to include efont before LovyanGFX.
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
// setFont関数に引数efontを指定すると、printやdrawString等でefontを使用できます。
|
||||
lcd.setFont(&fonts::efont);
|
||||
|
||||
lcd.setTextWrap(true, true);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
lcd.setTextColor(random(0x10000), random(0x10000));
|
||||
lcd.setTextSize(random(1,3), random(1,3));
|
||||
|
||||
lcd.print("Hello");
|
||||
lcd.print("こんにちは");
|
||||
lcd.print("你好");
|
||||
lcd.print("안녕하세요");
|
||||
lcd.print("Доброе утро");
|
||||
lcd.print("Päivää");
|
||||
lcd.print("Здравствуйте");
|
||||
delay(1000);
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
|
||||
Copyright 1984-1989, 1994 Adobe Systems Incorporated. Copyright 1988, 1994 Digital Equipment Corporation.
|
||||
|
||||
Adobe is a trademark of Adobe Systems Incorporated which may be registered in certain jurisdictions.
|
||||
Permission to use these trademarks is hereby granted only in association with the images described in this file.
|
||||
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notices appear in all copies and that both those copyright notices
|
||||
and this permission notice appear in supporting documentation, and that the names of Adobe Systems
|
||||
and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.
|
||||
|
||||
Adobe Systems and Digital Equipment Corporation make no representations about the suitability of this software for any purpose.
|
||||
It is provided "as is" without express or implied warranty.
|
||||
|
||||
Font Copyright Statement:
|
||||
"Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved.
|
||||
Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved."
|
||||
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t u8g2_font_courB08_tr[];
|
||||
extern const uint8_t u8g2_font_courB10_tr[];
|
||||
extern const uint8_t u8g2_font_courB12_tr[];
|
||||
extern const uint8_t u8g2_font_courB14_tr[];
|
||||
extern const uint8_t u8g2_font_courB18_tr[];
|
||||
extern const uint8_t u8g2_font_courB24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_courR08_tr[];
|
||||
extern const uint8_t u8g2_font_courR10_tr[];
|
||||
extern const uint8_t u8g2_font_courR12_tr[];
|
||||
extern const uint8_t u8g2_font_courR14_tr[];
|
||||
extern const uint8_t u8g2_font_courR18_tr[];
|
||||
extern const uint8_t u8g2_font_courR24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_helvB08_tr[];
|
||||
extern const uint8_t u8g2_font_helvB10_tr[];
|
||||
extern const uint8_t u8g2_font_helvB12_tr[];
|
||||
extern const uint8_t u8g2_font_helvB14_tr[];
|
||||
extern const uint8_t u8g2_font_helvB18_tr[];
|
||||
extern const uint8_t u8g2_font_helvB24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_helvR08_tr[];
|
||||
extern const uint8_t u8g2_font_helvR10_tr[];
|
||||
extern const uint8_t u8g2_font_helvR12_tr[];
|
||||
extern const uint8_t u8g2_font_helvR14_tr[];
|
||||
extern const uint8_t u8g2_font_helvR18_tr[];
|
||||
extern const uint8_t u8g2_font_helvR24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_ncenB08_tr[];
|
||||
extern const uint8_t u8g2_font_ncenB10_tr[];
|
||||
extern const uint8_t u8g2_font_ncenB12_tr[];
|
||||
extern const uint8_t u8g2_font_ncenB14_tr[];
|
||||
extern const uint8_t u8g2_font_ncenB18_tr[];
|
||||
extern const uint8_t u8g2_font_ncenB24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_ncenR08_tr[];
|
||||
extern const uint8_t u8g2_font_ncenR10_tr[];
|
||||
extern const uint8_t u8g2_font_ncenR12_tr[];
|
||||
extern const uint8_t u8g2_font_ncenR14_tr[];
|
||||
extern const uint8_t u8g2_font_ncenR18_tr[];
|
||||
extern const uint8_t u8g2_font_ncenR24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_timB08_tr[];
|
||||
extern const uint8_t u8g2_font_timB10_tr[];
|
||||
extern const uint8_t u8g2_font_timB12_tr[];
|
||||
extern const uint8_t u8g2_font_timB14_tr[];
|
||||
extern const uint8_t u8g2_font_timB18_tr[];
|
||||
extern const uint8_t u8g2_font_timB24_tr[];
|
||||
|
||||
extern const uint8_t u8g2_font_timR08_tr[];
|
||||
extern const uint8_t u8g2_font_timR10_tr[];
|
||||
extern const uint8_t u8g2_font_timR12_tr[];
|
||||
extern const uint8_t u8g2_font_timR14_tr[];
|
||||
extern const uint8_t u8g2_font_timR18_tr[];
|
||||
extern const uint8_t u8g2_font_timR24_tr[];
|
||||
|
|
@ -0,0 +1,365 @@
|
|||
/*
|
||||
|
||||
ProFont
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014 Carl Osterwald, Stephen C. Gilardi, Andrew Welch
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#include "profont.h"
|
||||
|
||||
/*
|
||||
Fontname: ProFont10
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont10_tr[886] =
|
||||
"`\0\2\2\3\4\3\4\4\5\11\0\376\6\376\7\377\1\42\2J\3Y \5\0b\3!\7\61c"
|
||||
"\63R\0\42\7\223v\223T\0#\12-fW\15U\15U\1$\16E^\233\301P\31l\220T\265"
|
||||
"A\4%\13\65b\67T\62\225J\62\1&\13\64b\27S\314 \251\230\2'\5\21s#(\11\303"
|
||||
"^\233\312\66\310 )\12C^\223A\6\261U\2*\11,f\27+\25+\0+\7\33f\227V\2"
|
||||
",\7\32Z\227\24\0-\5\212j#.\5\11c\23/\15DZ\17\62\210\31\304\14b\6\31\60\12"
|
||||
"\64b\247\242\32I&\5\61\7\263b\227dk\62\12\64b\247b\6\261\34\1\63\12\64b\247b\215"
|
||||
"dR\0\64\11\64b\33U\65b\34\65\12\64b\63\64\330H&\5\66\12\64b\247\62XQ&\5"
|
||||
"\67\13\64b\63\62\210\65\310 \2\70\12\64b\247bRQ&\5\71\12\64b\247\242L\33$\5:"
|
||||
"\6!c\23\3;\10\62Z\227aR\0<\11\253b\233j\220A\0=\10\34f\63\62\32\1>\11"
|
||||
"\253b\223A\6\251\4\77\11\64b\247b\233\212\0@\11\64b\247\242\272\321\0A\11\64b\247\242\34"
|
||||
"S\6B\12\64b\263\342HQ\216\4C\13\64b\247\242\6\31\304\244\0D\11\64b\263\242s$\0"
|
||||
"E\13\64b\63\64X\31d\60\2F\13\64b\63\64X\31d\220\1G\12\64b\247\242\6i&\5"
|
||||
"H\11\64b\23\345\230f\0I\7\263b\263bkJ\14\64b\17\62\310 \3\231\24\0K\12\64b"
|
||||
"\23U\222\62\225\1L\14\64b\223A\6\31d\220\301\10M\11\64b\23\307\21\315\0N\11\64b\23"
|
||||
"\227\232f\0O\11\64b\247\242\63)\0P\12\64b\263\242\34)\203\14Q\11<^\247\242\313F\1"
|
||||
"R\12\64b\263\242\34)\312\0S\12\64b\247b\322H&\5T\10\263b\263b\27\0U\10\64b"
|
||||
"\23=\223\2V\10\64b\23\275b\4W\11\64b\23\315q\304\0X\12\64b\23e\222*\312\0Y"
|
||||
"\12\64b\23\255\230A\6\21Z\12\64b\63\62\210m\60\2[\7B_\263z\11\134\16\304Z\223A"
|
||||
"F\31d\224AF\31\4]\7\302^\243z\15^\6\223r\327\0_\6\15Z\63\4`\6\222v\23"
|
||||
"\3a\10$b\67\242R\5b\13\64b\223A\6+\312\221\0c\10$b\247\242F\3d\12\64b"
|
||||
"\17\62H#\312\64e\10$b\247\206F\3f\11\263b\233\322\212\25\0g\12\64Z\67\242L\33$"
|
||||
"\5h\12\64b\223A\6+\232\1i\10\263b\227\221\254\6j\10\302Z\27UK\1k\13\64b\223"
|
||||
"A\6)\311T\6l\7\263b#\273\6m\11%b\63R\245\222*n\10$b\223\222)\3o\10"
|
||||
"$b\247\242L\12p\12\64Z\263\242\34)\203\14q\12\64Z\67\242L\33d\20r\11$b\223\222"
|
||||
"\15\62\0s\10$b\67\66\32\11t\11\263b\27\323\212\31\4u\7$b\23-Uv\10$b\23"
|
||||
"\255\30\1w\11%b\223\222J\252\13x\10$b\23\223T\61y\12\64Z\23\315\264AR\0z\10"
|
||||
"$b\63b\71\2{\13\313Z\233b\225A\254A\0|\6A_s\10}\13\313Z\223A\254A\212"
|
||||
"U\4~\7\24j\227T\2\177\5\0b\3\0\0\0\4\377\377\0";
|
||||
/*
|
||||
Fontname: ProFont11
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont11_tr[967] =
|
||||
"`\0\3\2\3\4\3\4\4\6\13\0\376\7\376\10\377\1>\2\201\3\252 \5\0\242\3!\7\71\243"
|
||||
"cP\2\42\7\233\266#\261\4#\13-\252\247\62(\225A\251\0$\16M\236+[*J\266%J"
|
||||
"e\213\0%\16=\242gP\22S\22)J\42%\0&\14=\242G\252\324*\211\24)\1'\5\31"
|
||||
"\267c(\10\313\236+)u+)\11\313\236#+u)\1*\12-\252\253RY\232\42\0+\12-"
|
||||
"\246+\214\6)\214\0,\10\242\232cH\24\0-\5\213\256c.\6\22\243c\10/\14U\232\263\26"
|
||||
"fa\26fa\10\60\14=\242g\311\244%\231\264d\1\61\11=\242+\32;\15\2\62\12=\242g"
|
||||
"\311\302\254m\20\63\13=\242g\311\302H\325\222\5\64\14=\242/\223\222R\62h\331\0\65\13=\242"
|
||||
"\343\70\244\241\226,\0\66\14=\242g\11\207$\263%\13\0\67\12=\242c\20k\305\22\0\70\14="
|
||||
"\242g\311\264d\311\264d\1\71\14=\242g\311l\311\20&\13\0:\10*\243c\210\206\0;\11\272"
|
||||
"\232c\210\206D\1<\7\274\242/jl=\10\35\252cP\7\1>\10\274\242#lj\3\77\13="
|
||||
"\242g\311\302\254\16E\0@\15=\242g\311\224!I\224!\35\2A\14=\242+K\242\244\66\14\231"
|
||||
"\26B\15=\242cH\62mP\62mP\0C\12=\242g\311\304\266d\1D\12=\242cH\62o"
|
||||
"\203\2E\13=\242\343\30\16I\30\16\2F\12=\242\343\30\16IX\4G\13=\242g\311\304h\323"
|
||||
"\222\5H\12=\242#\263\15Cf\13I\12=\242c\220\302N\203\0J\11=\242\263Q\323\222\5K"
|
||||
"\14=\242#\223\222\222\226D\225,L\10=\242#\354q\20M\14=\242#[\226DI\64[\0N"
|
||||
"\13=\242#\233\224D\332l\1O\12=\242g\311\274%\13\0P\14=\242cH\62mP\302\42\0"
|
||||
"Q\12E\236g\311\274T\326\0R\14=\242cH\62mP\62[\0S\13=\242g\311\324UK\26"
|
||||
"\0T\11=\242c\220\302\236\0U\11=\242#\363-Y\0V\14=\242#\263%\245$\13#\0W"
|
||||
"\12=\242#sI\224\344\26X\13=\242#\323\222Z\245\246\5Y\12=\242#\263%\265\260\4Z\12"
|
||||
"=\242c\20\263\216\203\0[\10J\237c\351\213\0\134\14\325\232#L\303\64L\303\64\14]\10\312\236"
|
||||
"C\351\313\0^\10\35\262+Kj\1_\6\16\232\343\0`\6\222\272#\12a\11-\242g\320L\212"
|
||||
"\22b\14=\242#\14\207$\263\15\12\0c\11-\242g\311\304t\10d\12=\242\263\62h\266d\10"
|
||||
"e\12-\242g\311\206!\35\2f\11\274\242K\211\246\254\11g\14=\232g\320l\311\20&\13\0h"
|
||||
"\12=\242#\14\207$s\13i\10\273\242'\224Z\6j\11K\232+\224:-\0k\13=\242#,"
|
||||
"%\245\251\222\5l\7\273\242C\352em\14-\242cH*J\242$J\1n\11-\242#\61i\266"
|
||||
"\0o\11-\242g\311l\311\2p\14=\232cH\62\333\240\204!\0q\12=\232g\320l\311\20\26"
|
||||
"r\11-\242#\61\211E\0s\11-\242gP\17\12\0t\11\274\242'\213\246\254(u\11-\242#"
|
||||
"sR\224\0v\13-\242#\323\222R\222E\0w\14-\242#I\224DI\224.\0x\12-\242#"
|
||||
"Kj\225Z\0y\13=\232#sK\206\60Y\0z\11-\242c\320\332\6\1{\12\333\232+\211Z"
|
||||
"\262\250-|\6I\237\343\1}\13\333\232#\213\332\222\250%\2~\6\25\256\307\5\177\5\0\242\3\0"
|
||||
"\0\0\4\377\377\0";
|
||||
/*
|
||||
Fontname: ProFont12
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont12_tr[980] =
|
||||
"`\0\3\2\3\4\3\4\4\6\13\0\376\10\376\11\377\1C\2\212\3\267 \5\0\242\3!\6A\243"
|
||||
"\343\22\42\7\233\272#\261\4#\13-\256\247\62(\225A\251\0$\17U\236+[*J\266%Q\242"
|
||||
"T\266\10%\16E\242gP\22\245\233\244(\211\224\0&\15E\242G\252\324*Q\222H\221\22'\5"
|
||||
"\31\273c(\10\323\236+)\365V)\11\323\236#+\365R\2*\12-\256\253RY\232\42\0+\12"
|
||||
"-\246+\214\6)\214\0,\10\242\232cH\24\0-\5\213\256c.\6\22\243c\10/\14U\232\263"
|
||||
"\26fa\26fa\10\60\15E\242g\311\244%\231\64-Y\0\61\11E\242+\32{\32\4\62\12E"
|
||||
"\242g\311\302\254\343 \63\14E\242g\311\302H\15\265d\1\64\14E\242/\223\222R\62ha\66\65"
|
||||
"\14E\242\343\30\16i\250%\13\0\66\14E\242g\11\303!\311l\311\2\67\12E\242c\20k\305&"
|
||||
"\0\70\14E\242g\311\264d\311l\311\2\71\14E\242g\311l\311\20V\26\0:\10\62\243c\10\207"
|
||||
"\0;\11\302\232c\10\207D\1<\7\274\246/jl=\10\35\256cP\7\1>\10\274\246#lj"
|
||||
"\3\77\13E\242g\311\302Z\35\212\0@\16E\242g\311\224!I\224!L\207\0A\15E\242+K"
|
||||
"\242\244\246\15C\246\5B\15E\242cH\62mP\62\333\240\0C\12E\242g\311\304n\311\2D\12"
|
||||
"E\242cH\62\337\6\5E\13E\242\343\30\16IX\34\4F\12E\242\343\30\16I\330\10G\14E"
|
||||
"\242g\311\304\322\246%\13\0H\12E\242#\263\15C\346\26I\12E\242c\220\302\236\6\1J\12E"
|
||||
"\242\263\243\246%\13\0K\15E\242#\223\222\222\246%Q%\13L\10E\242#\354\343 M\14E\242"
|
||||
"#[\226DI\64\267\0N\13E\242#\233\224D\332\334\2O\12E\242g\311|K\26\0P\14E"
|
||||
"\242cH\62mP\302F\0Q\12M\236g\311|\251\254\1R\14E\242cH\62mP\62\267\0S"
|
||||
"\13E\242g\311\324\65\324\222\5T\11E\242c\220\302>\1U\11E\242#\363[\262\0V\14E\242"
|
||||
"#sKJI\26F\0W\12E\242#\363\222(\311-X\13E\242#\263%\265JM\13Y\12E"
|
||||
"\242#sKja\11Z\12E\242c\20\263\216\341 [\10R\237c\351\27\1\134\14\325\232#L\303"
|
||||
"\64L\303\64\14]\10\322\236C\351\227\1^\10\35\266+Kj\1_\6\16\232\343\0`\6\222\276#"
|
||||
"\12a\11-\242g\320L\212\22b\14E\242#,\16If\33\24\0c\11-\242g\311\304t\10d"
|
||||
"\12E\242\263e\320l\311\20e\12-\242g\311\206!\35\2f\12\304\242K\211\246\254\23\0g\14="
|
||||
"\232g\320l\311\20&\13\0h\12E\242#,\16I\346\26i\11\303\242'\7\244\226\1j\12S\232"
|
||||
"+\7\244N\13\0k\13E\242#lJJS%\13l\10\303\242C\352\313\0m\14-\242cH*"
|
||||
"J\242$J\1n\11-\242#\61i\266\0o\11-\242g\311l\311\2p\14=\232cH\62\333\240"
|
||||
"\204!\0q\12=\232g\320l\311\20\26r\11-\242#\61\211E\0s\11-\242gP\17\12\0t"
|
||||
"\11\304\242'+MYQu\11-\242#sR\224\0v\13-\242#\323\222R\222E\0w\14-\242"
|
||||
"#I\224DI\224.\0x\12-\242#Kj\225Z\0y\13=\232#sK\206\60Y\0z\11-"
|
||||
"\242c\320\332\6\1{\12\333\232+\211Z\262\250-|\6Q\237\343!}\13\333\232#\213\332\222\250%"
|
||||
"\2~\6\25\262\307\5\177\5\0\242\3\0\0\0\4\377\377\0";
|
||||
/*
|
||||
Fontname: ProFont15
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont15_tr[1093] =
|
||||
"`\0\3\2\3\4\3\5\4\7\17\0\375\11\375\13\376\1n\2\336\4( \5\0\302\7!\7\311\303"
|
||||
"\307!\11\42\7\244\336G\344\24#\15\66\316O\224\14K\324\62,Q\2$\23m\272W\230-\25%"
|
||||
"J\262-\211\22\245\262\205\21\0%\23O\302\317\60$\231\22%mI-iJ\264DL\0&\20N"
|
||||
"\302\317\224%Q%\254dQ\242EK\0'\6\241\337\307\20(\11\354\272_\324\326\307\6)\12\354\272"
|
||||
"G\330\326\247\66\0*\13\65\316W\245\62-M\21\0+\12-\306W\30\15R\30\1,\10\253\266\217"
|
||||
"))\1-\6\214\316\307\20.\6\22\303\307\20/\16f\272o\61\15\323\60\15\323\60M\1\60\20N"
|
||||
"\302\317\220\204\332\224(\321&\212\311\220\0\61\12O\302_\70\367m\30\2\62\13N\302\317\220\204i\261"
|
||||
"\343\60\63\16N\302\317\220\204iiN\305dH\0\64\16N\302g\250%Q%K\206\61\15\7\65\16"
|
||||
"N\302\307!M\7\71M\305dH\0\66\16N\302\317\220\244\351\240\204\216\311\220\0\67\11N\302\307\265"
|
||||
"\330\332\6\70\17N\302\317\220\204\306dHBc\62$\0\71\15N\302\317\220\204\216\311\240V\206\4:"
|
||||
"\10:\303\307\20\17\1;\12\323\266\217\35S\244\244\4<\10\315\302g\326\265\3=\10&\316\307\35\35"
|
||||
"\6>\11\315\302G\332\255#\0\77\14N\302\317\220\204i\261\35\314\0@\17N\302\317\220\204\322\220D"
|
||||
"JdI\343AA\15N\302\227\250E-\341\60\210\306\0B\15N\302\307\240\204\306a\11\215\303\2C"
|
||||
"\14N\302\317\220\204j\217\311\220\0D\13N\302\307\240\204~\34\26\0E\14N\302\307!\255\16JZ"
|
||||
"\35\6F\13N\302\307!\255\16J\332\12G\15N\302\317\220\204jm\64&C\2H\13N\302G\350"
|
||||
"\70\14\242c\0I\13O\302\307!\213\373\66\14\1J\13N\302oW\321\230\14\11\0K\20N\302G"
|
||||
"\250%Q%\23\223,\252%a\0L\11N\302G\332\257\303\0M\15O\302G\272-\25)\222\42\325"
|
||||
"\65N\15N\302G\270)\221\224h\243c\0O\13N\302\317\220\204~L\206\4P\14N\302\307\240\204"
|
||||
"\306aI[\1Q\16V\276\317\220\204\276DR\222\14q\0R\14N\302\307\240\204\306a\11\35\3S"
|
||||
"\17N\302\317\220\204j<\304\251\230\14\11\0T\11O\302\307!\213\373\15U\12N\302G\350\217\311\220"
|
||||
"\0V\17O\302GjM\262(\253\204I\32g\0W\15O\302G\352)\222\42\245\262\255\1X\16N"
|
||||
"\302GhL\242L\324\242$\24\3Y\14O\302GjM\262J\32\267\1Z\12N\302\307\65\354\65\35"
|
||||
"\6[\11c\277\307\20\365O\3\134\16\346\272G\32\247q\32\247q\32\247\1]\11\343\276\307\324\77\15"
|
||||
"\1^\10\235\332W\226\324\2_\6\17\272\307!`\6\233\342GVa\13\66\302\317\60\332\246$\221\2"
|
||||
"b\14N\302GZ\35\224\320qX\0c\12\66\302\317\220\204jy\20d\13N\302o\313\60:&\203"
|
||||
"\0e\14\66\302\317\220\204\303\240\306\203\0f\12\314\302\227\222ES\326\11g\15N\266\317\60:&\203"
|
||||
"Z\31\22\0h\13N\302GZ\35\224\320c\0i\11K\303O\16H]\6j\12\343\266W\16H}"
|
||||
"Z\0k\16N\302G\332\226D\225L\211\262$\14l\10K\303\207\324/\3m\15\67\302\307%\212\244"
|
||||
"H\212\244H*n\12\66\302G\244\224\66\321\30o\13\66\302\317\220\204\216\311\220\0p\14N\266\307\240"
|
||||
"\204\216\303\222V\1q\13N\266\317\60:&\203\332\0r\12\66\302G\244\224\306\264\12s\13\66\302\317"
|
||||
"\60\17q:,\0t\12\314\302OV\232\262F\1u\12\66\302G\350\66%\211\24v\13\66\302G("
|
||||
"&Q\233(\1w\16\67\302G\24I\221\24I\221T\261\0x\14\66\302G\230D\231\250EI\30y"
|
||||
"\14N\266G\350\61\31\324\312\220\0z\10\66\302\307\261\343\60{\13\374\266\227\222\365\24f=\12|\7"
|
||||
"\351\273\307\207\0}\14\374\266\207\230\365\30e\275H\0~\7\26\322\217d\1\177\5\0\302\7\0\0\0"
|
||||
"\4\377\377\0";
|
||||
/*
|
||||
Fontname: ProFont17
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont17_tr[1308] =
|
||||
"`\0\3\3\4\5\3\5\5\11\21\0\375\13\375\15\376\1\260\3p\4\377 \5\0\10\63!\10\262\16"
|
||||
"\63\36D\4\42\10U\212\63$\274\10#\15w:sT\16\27\225\303E\5\0$\24\370\350\362\304R"
|
||||
"\232E\205\42l\274H(*\66\252X\6%\23\270\10\263,\7\211\204\251H,Q(\22\322D\26\2"
|
||||
"&\22\270\10\263\244\64\221.\302!\211B\21\211N\24\1'\7R\216\63\16\3(\12\366\352\62e:"
|
||||
"\352\253\16)\13\366\352\62\244:\352\233\216\0*\17\210\70\363T$\207\21\221t\230\250\311\0+\14\210"
|
||||
"\30\363\304j\207\203L\254\6,\11d\332r\66I\224\0-\7%J\63\16\3.\7\63\14\63\16\2"
|
||||
"/\34\11\331\362\1r\200X\16\20\313\1b\71@,\7\210\345\0\261\34 \226\3\344\0\60\21\270\10"
|
||||
"\263h\26!\255d\221\230jD\211\215\4\61\13\270\10\363\204\314\372v\70\10\62\16\270\10\263h\26!"
|
||||
"Q\252\327\303A\0\63\22\270\10\263h\26!QF\234\3$B\242\304F\2\64\22\270\10s\245C\232"
|
||||
"D\244\42\223\34\16R)\221\0\65\20\270\10\63\36\310\246;@,&Jl$\0\66\17\270\10\263J"
|
||||
"\26\261\351\42\344(\261\221\0\67\13\270\10\63\36\304\252\232u\3\70\21\270\10\263h\26!Qb\243Y"
|
||||
"\204D\211\215\4\71\17\270\10\263h\26!G\311\311,\61\225\0:\11\203\14\63\16\342\203\0;\14\264"
|
||||
"\332r\266\203&K\22%\0<\11\267\12s\205z\326\3=\13X\70\63\36\344\220\303A\0>\12\267"
|
||||
"\12\63\304z\324+\0\77\17\270\10\263h\26!Q\252\71\216\42\226\1@\21\270\10\263h\26!\311r"
|
||||
"\221PN\23\71\340dA\17\270\10\363\244D\232H\213\360p\60\62\12B\22\270\10\63L\27!\361 "
|
||||
"\61\311$B\342Ab\2C\16\270\10\263h\26!\263F\242\304F\2D\15\270\10\63L\27!\77\36"
|
||||
"$&\0E\16\270\10\63\36\310b\223I\254|\70\10F\15\270\10\63\36\310b\223I\254\63\0G\17"
|
||||
"\270\10\263h\26!\263\310\221(\261\221\0H\14\270\10\63\204\34\17\7#\217\2I\14\270\10\63\36d"
|
||||
"b};\34\4J\14\270\10\263\365Ld\224\330H\0K\23\270\10\63\204\64\211HEF\234\22%\62"
|
||||
"\221\232D(L\12\270\10\63\304\372\363\341 M\20\270\10\63\204\245\303\213\204\42\241H\210\34\5N\16"
|
||||
"\270\10\63\204\65\23EB\262\25y\24O\15\270\10\263h\26!\77Jl$\0P\16\270\10\63L\27"
|
||||
"!\361 \61\211u\6Q\20\330\350\262h\26!_$$\212\255,\7\10R\20\270\10\63L\27!\361"
|
||||
" \61\311$B\216\2S\21\270\10\263h\26!\35P,\27\211\22\33\11\0T\13\270\10\63\36db"
|
||||
"\375\15\0U\13\270\10\63\204\374\243\304F\2V\17\270\10\63\204<JD\332\210T\261\14\0W\17\270"
|
||||
"\10\63\204\274H(\22\212\344\360T\24X\21\270\10\63\204\214\22\221\214*\245\211$BF\1Y\16\270"
|
||||
"\10\63\204\34K\23\33U\254\15\0Z\14\270\10\63\36\304R}>\34\4[\13\364\356\62\16#\375\247"
|
||||
"C\0\134 \11\331\62\344\0\71D\16\220C\344\0\71D\16\220C\344\0\71D\16\220C\344\0\71D"
|
||||
"\16\20]\13\364\352\62\16!\375\247\303\0^\13Wj\363\242\63\211\332\64\0_\7)\330\62\36\10`"
|
||||
"\10C\232\63BJ\1a\15\210\10\263,\7![\211B\21)b\16\270\10\63\304\312\246\213\220\343A"
|
||||
"b\2c\14\210\10\263h\26!\263\34p\62d\15\270\10\263\65Y\16B\216\222\223\1e\15\210\10\263"
|
||||
"h\26\341\341`\7\234\14f\15\266\14\363F\24\31\211&\324\33\0g\17\270\330\262,\7!G\311\311"
|
||||
",\252\221\0h\14\270\10\63\304\312\246\213\220\217\2i\15\266\12\263\204r\10\211\250\323\241\0j\14\345"
|
||||
"\330\362\224)\64}\263\214\0k\21\270\10\63\304\332$\42\25\31\261&R\223\10\5l\12\266\12\63H"
|
||||
"D\375t(m\21\210\10\63L\27\25\212\204\42\241H(\22\212\2n\14\210\10\63D*L\65\42G"
|
||||
"\1o\14\210\10\263h\26!G\211\215\4p\16\270\330\62L\27!\307\203\304$V\6q\15\270\330\262"
|
||||
",\7!G\311\311\254\1r\14\210\10\63D*L\65\262f\0s\15\210\10\263\16\7\261\321|\70\210"
|
||||
"\0t\15\266\14s\204j$\232P+m\0u\14\210\10\63\204\274\225(\24\221\2v\15\210\10\63\204"
|
||||
"\214\22\221\66\42U\6w\24\210\10\63$\22\212\204\42\241H(\22\212\344\60\21I\0x\20\210\10\63"
|
||||
"\204\22\221\214*\226\322D\22\241\0y\16\270\330\62\204|\224\234\314\242\32\11\0z\11\207\10\63\36u"
|
||||
"<\34{\16\25\333\362D#\231N\212j\272\315\4|\7\362\356\62~\20}\16\25\335\62d\63=*"
|
||||
"\251\351\64\222\1~\12\70Xsf\23\311l\2\177\5\0\10\63\0\0\0\4\377\377\0";
|
||||
/*
|
||||
Fontname: ProFont22
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont22_tr[1704] =
|
||||
"`\0\4\4\4\5\4\5\5\14\26\0\374\16\374\20\376\2N\4\177\6\213 \5\0\20r!\11\342\30"
|
||||
"rxP\210\0\42\11fTs\20BO\4#\25\252\220r\221H\210\220\7E$\22\42\344A\21\211"
|
||||
"\204\10\1$$*\321q\22(\314\14\212\21\42\212\10!\42h\204\250C\247D\14\22BDH\11\21"
|
||||
"#\320\30\23(\10\0%\37\352\20rA\261D\10\21\21EJ\10!s\350\14\21\21EJ\10!\42"
|
||||
"\204\14\11AB\0&\34\352\20r)td\214\20\61C\204\214\61E\214\224\21\42hH\14!\222\204"
|
||||
"\210\0'\6bXs`(\17&\325q\22\63d\66\202\344Gs$\0)\17&\325q\20\64G\362"
|
||||
"\67Cf#\10\0*\23\252\220r\22(H\210\20&\206\214\60\221H\240 \0+\16\252Pr\22("
|
||||
"\243\7\205\4\312\10\0,\20\225\224q\21B\202\310\30!#\246\11\3\0-\6&\324r`.\12D"
|
||||
"\66\362\20\201B\4\0/\34K\221\361\224P\244@\221\2E\12\24)P\244@\221\2E\12\24)P"
|
||||
"\244H\0\60\32\352\20r\61\203bP\251Bf\216\214 \61\344\214\241R\205F\240\61\2\0\61\15\352"
|
||||
"\20r\22(\252B\371\243\7\5\62\21\352\20r\61\203bP\61\201\342\206\315g\17\12\63\27\352\20r"
|
||||
"\61\203bP\61\201\342D\21+\70\220X\241\21h\214\0\64\32\352\20r\23\67\214T\241\21b\206\10"
|
||||
"\31#D\220\220\7\305\4\12\63d\0\65\24\352\20rxpP \222\204\3%$Vh\4\32#\0"
|
||||
"\66\25\352\20r\61sd\234@$)D\25\243Y\241\21h\214\0\67\17\352\20rxPPv\303f"
|
||||
"'P\216\0\70\32\352\20r\61\203bP\61b\42\4\211\61\203bP\61b\205F\240\61\2\0\71\25"
|
||||
"\352\20r\61\203bP\61\232\225\22\221\4\241\270!g\214\0:\15\244\66\362\20\201B\250\10\24\42\0"
|
||||
";\24\365\224q\21B\202\210h!$\210\214\21\62b\232\60\0<\15\350\24r\23\65h^\15\233g"
|
||||
"\2=\13j\220rxP\36\324\203\2>\15\350\24r\20\66_\15\232W\302\0\77\24\352\20r\61\203"
|
||||
"bP\61\201\342\206\315N<h\201\202\0@\30\352\20r\61\203bP\61\62G\220\10!\42\204\10\32"
|
||||
"\22\2\7&AA\30\352\20r\22G\214\224\20AB\304\10\22\42H\204\260\7\311h&\0B\25\352"
|
||||
"\20r@\222BT\61\252D I!\252\30U,\220\0C\22\352\20r\61\203bP\61\202\362Y\241"
|
||||
"\21h\214\0D\17\352\20r@\222BT\61\372+\26H\0E\20\352\20rxpP\206H\220\10\224"
|
||||
"\341\203\2F\17\352\20rxpP\206H\220\10\224\207\0G\24\352\20r\61\203bP\61\202\22YF"
|
||||
"Y\241\21h\214\0H\15\352\20r\20F\317\36$\243g\2I\15\352\20rxPH\240\374\243\7\5"
|
||||
"J\17\352\20r\224\37\22\243\254\320\10\64F\0K\37\352\20r\20Uh\204\230!B\306\210\30T\212"
|
||||
"X)\21\203\204\214\21\63D\320\10Q\305\4L\13\352\20r\20(\377\303\7\5M\26\352\20r\20V"
|
||||
"\350\310\203\20\224\10!\42\204\210\20b\364L\0N\25\352\20r\20V\312\320\31\22C\210\214 s\310"
|
||||
"T\61:\23O\21\352\20r\61\203bP\61\372Y\241\21h\214\0P\21\352\20r@\222BT\61\252"
|
||||
"X \21(\17\1Q\24\12\321q\61\203bP\61\372\211\220\22&\320\34\34(\0R\23\352\20r@"
|
||||
"\222BT\61\252D I!\252\30\235\11S\26\352\20r\61\203bP\61\202\3\17\35\34H\254\320\10"
|
||||
"\64F\0T\14\352\20rxPH\240\374\217\0U\16\352\20r\20F\377Y\241\21h\214\0V\30\352"
|
||||
"\20r\20F\317D\10\22\42H\214\20ABD\21#'P\20\0W\26\352\20r\20F\237\10!\42"
|
||||
"\204\210\20\22$\36\4\71TL\0X\30\352\20r\20FY\241\21C\306\230\42F\312\314\220\21\203\212"
|
||||
"Q&\0Y\22\352\20r\20Fg\205F\14\31c\212\234@\71\2Z\17\352\20rxPP\334\260\371"
|
||||
"\235\300\7\5[\12$\331qP\42\377O\20\134\34K\223q\20)T\244P\221BE\12\25)T\244"
|
||||
"P\221BE\12\25)T\244\0]\12$\325q@\42\377O\24^\21j\20s\22G\312\314\220\21\203"
|
||||
"F\4\13\1\0_\10,\220qx\220\0`\11D\224s\20\62\211\0a\22\252\20rA\301\212\30U"
|
||||
"\205\216\224\60!\204\210\0b\21\352\20r\20(C$)D\25\243+\26H\0c\20\252\20r\61\203"
|
||||
"bP\61\202\22\16L\202\0d\20\352\20r\224\23\24\254\210\321\254\224\210$\10e\17\252\20r\61\203"
|
||||
"bP\261\7\11\7&Af\20\350\24r\42Sd\224 #\206\204\311\217\0g\24\352\220qA\301\212"
|
||||
"\30\315J\211H\202P\334\220\63F\0h\17\352\20r\20(C$)D\25\243\317\4i\15\346\24r"
|
||||
"\21$\234\10!\371\204\1j\16&\221q\222\234\10!\371\67(\210\0k\32\352\20r\20(G#\304"
|
||||
"\14\21\62F\304 Cg\206\14\21\64BT\61\1l\13\346\24r BH\376\23\6m\32\252\20r"
|
||||
"@\222B\210\210\42B\210\10!\42\204\210\20\42B\210\10!\42\1n\21\252\20r\20BD\204\211\42"
|
||||
"\207J\21\243\63\1o\21\252\20r\61\203bP\61\232\25\32\201\306\10\0p\21\352\220q@\222BT"
|
||||
"\61\272b\201D\240\14\1q\20\352\220qA\301\212\30\315J\211H\202P\16r\21\252\20r\20BD"
|
||||
"\204\211\42\207\312\11\224C\0s\17\252\20rA\261P\344\241\223\2W \1t\20\350\24r\21&#"
|
||||
"#\206\204\311\331\260B\4u\20\252\20r\20F\257\12\35)aB\10\21\1v\26\252\20r\20F\231"
|
||||
"\10AB\4\211\21\62F\210(b\344\4\1w\34\252\20r\20\42\204\210\20\42B\210\10!\42\204\210"
|
||||
"\20\42B\210H\201F\210\20\0x\25\252\20r\20Vh\304\220\61\246\210\221\62\63d\304\240b\2y"
|
||||
"\22\352\220q\20F\237\225\22\221\4\241\270!g\214\0z\14\252\20rxPl>{P\0{\24f"
|
||||
"\225q\22\63d\214 y\63d\314\240A\362\321D\2|\10\42\331q\370\300\0}\24f\225q\20\64"
|
||||
"\221|\64\315\220\61\202\344\315\220\61\202\0~\16J\320r\21$\242\10\221\22\202\204\0\177\5\0\20r"
|
||||
"\0\0\0\4\377\377\0";
|
||||
/*
|
||||
Fontname: ProFont29
|
||||
Copyright: ProFont Distribution 2.2 <EFBFBD> Generated by Fontographer 4.1.5
|
||||
Glyphs: 96/256
|
||||
BBX Build Mode: 0
|
||||
*/
|
||||
const uint8_t u8g2_font_profont29_tr[2108] =
|
||||
"`\0\4\4\5\5\4\5\6\20\35\0\373\23\373\26\375\2\332\5\216\10\37 \6\0 \204\1!\11c"
|
||||
"\66\204\341\3f\11\42\12)i\207a\214\375\315\0#\35\357a\205g\262\61\303\306\214y\360\315dc"
|
||||
"\206\215\31\363\340\233\311\306\14\33\63\6\0$)-c\203k\350\224\305\322,\31\61\223!F\206\30\31"
|
||||
"\66b\30\262d\310F\14\33bd\210\221)f\262&Y\311\241S\1%.n\42\204g\11\213\26B"
|
||||
"\4\31\31rd\4\211!g\204\30R\205.U\21AF\206\34\31Ab\310\210\61B\204\214\61\62\210"
|
||||
"\314(A\0&'n\42\204\211 *E\323\14\42\63\206\320\20b\347L\222\64\25\344\214\21\22gN"
|
||||
"\14*\63\246\14\233\23\204\6\211\0'\10#u\207\341\1\3(\21)o\203M\30!z\65l\376\63"
|
||||
"\372L\4\0)\20)k\203C\30}\66\377+B\364L\30\0*\32\255a\205k\350\60!CD\220"
|
||||
"@\261\350\330\241\25-\204\14\21\66t*\0+\17\255\341\204k\350\134=x\220j\350\134\1,\20f"
|
||||
"\355\202eH\211J\310LB\202\32\61\0-\10h,\206\341A\2.\12\245p\204c\304\213\21\0/"
|
||||
"#O\343\202y\332\301c\7\217\35<v\360\330\301c\7\217\35<v\360\330\301c\7\217\35<v\360"
|
||||
"`\0\60#n\42\204\311\230\32&\303F\214;\206*\221\32\22F\210\230 \243(\25\262s#\206\15"
|
||||
"a\243\314\20\0\61\20m\42\204k\350Hb\67\235\377\352\301\203\4\62\27n\42\204\311\230\32&\303F"
|
||||
"\14\64\70v\350P\222\364\313\7\17\26\63\37n\42\204\311\230\32&\303F\14\64\70v$\71\203%\315"
|
||||
"\22\66hp\304\260!l\224\31\2\64\37n\42\204q(\311\202\346\216\221\30Ed\20\231\61\204\306\214"
|
||||
"\32\363\340\1\303\261\23\246\312\0\65\31n\42\204\341\267c\25\61i;x\354\264\6\15\216\30\66\204\215"
|
||||
"\62C\0\66\33n\42\204\351T\42EC\307*b\322b\334\210\201\366p\304\260!l\224\31\2\67\20"
|
||||
"n\42\204\341\3\266\63%IO\307\316g\0\70!n\42\204\311\230\32&\303F\14\264p\4!\62\252"
|
||||
"P\251!Db\240\205#\206\15a\243\314\20\0\71\33n\42\204\311\230\32&\303F\14\264\207#\306\215"
|
||||
"h\302H\355\320A\212R\35\2:\17\245q\204c\304\213\361@F\274\30\1\0;\26f\356\202eH"
|
||||
"\211J\306\3\33R\242\22\62\223\220\240F\14\0<\16l*\204S$\71\372K\372K\21\0=\15."
|
||||
"a\205\341\3\366\20\77x\300\0>\15l*\204C$\375;\372K\221\0\77\30n\42\204\311\230\32&"
|
||||
"\303F\14\64\70v(Iz:\36\312\261\223\1@\42n\42\204\311\230\32&\303F\14\64\244f\11\223"
|
||||
"\61F\306\30\31c\204\315\211AE\6\217m\302H\1A\35n\42\204\213(I\203\346\206\14\33\62j"
|
||||
"\320l\206\15\31\66b\340\203\17\6\332\341\0B\35n\42\204A\21\223\26\343F\14\264\31\11&k\230"
|
||||
"\14#\61\320v#Z\60Q\4\0C\30n\42\204\311\230\32&\303F\14\264v~hp\304\260!l"
|
||||
"\224\31\2D\24n\42\204A\21\223\26\343F\14\264\377\335\210\26L\24\1E\21n\42\204\341\267s\273"
|
||||
"f\233\261s\373\340\1\3F\17n\42\204\341\267s\273f\233\261\363[\0G\31n\42\204\311\230\32&"
|
||||
"\303F\14\264v\252\34\332p\304\260!l\224\31\2H\17n\42\204a\240\375\360\301\7\3\355\207\3I"
|
||||
"\17m\42\204\341\203TC\347\377\352\301\203\4J\22n\42\204w\376[\203\66\34\61l\10\33e\206\0"
|
||||
"K'm\42\204a\234\261S$\6\21\31Cf\10\241\21\244\216\231+h\356\330\10RC\10\215!\63"
|
||||
"\210\310(\22\303\316\15L\15n\42\204a\354\374\377\366\301\3\6M\35o\42\204a\344\271TkZ\250"
|
||||
"\70a\244\210\231\61f\306\230\31cf\214I\373\345\0N\32n\42\204a\340\71d\251\24\231 c\204"
|
||||
"\210\31\22\206T%Cw\320>\34O\26n\42\204\311\230\32&\303F\14\264\377p\304\260!l\224\31"
|
||||
"\2P\26n\42\204A\21\223\26\343F\14\264\335\210\26L\24\215\235\337\2Q\34\316b\203\311\230\32&"
|
||||
"\303F\14\264\177\42\310\4\231\21#\220\260Q\206\226Z\21\0R\30n\42\204A\21\223\26\343F\14\264"
|
||||
"\31\11&k\230\14#\61\320>\34S\35n\42\204\311\230\32&\303F\14\264xl\62ei\7\33\64"
|
||||
"\70b\330\20\66\312\14\1T\15m\42\204\341\203TC\347\377W\0U\21n\42\204a\240\375\177\70b"
|
||||
"\330\20\66\312\14\1V\35n\42\204a\240}\70b\330\220ac\6\315j\310\260!\343\14\232$JV"
|
||||
"\260\60\0W\34o\42\204a\244\375\315\30\63c\314\214\61\63\306H\21\23\17F\264Y\225\356\344\0X"
|
||||
"\36n\42\204a\240\15\217\221 D\206\10)t&I\232CE\204\14!\22\304\16\332p\0Y\24m"
|
||||
"\42\204a\234}w\212\4\31*H\235+\71t\276\2Z\21n\42\204\341\3\266CI\322\177:\366\301"
|
||||
"\3\6[\15&w\203\341\201\231\371\377o\36\14\134#O\347\202a\360\350\301\243\7\217\36<z\360\350"
|
||||
"\301\243\7\217\36<z\360\350\301\243\7\217\36<z\360\0]\15&k\203\341\301\230\371\377o\36\30^"
|
||||
"\24\16\341\206M,Is\250\210\220!D\202\30\11\201\42\0_\10p\340\202\341\7\3`\12\307\350\207"
|
||||
"C\20\35\211\0a\27\316!\204I\11\213\26\343\14\332\335\261\22cN\244\30rd\320\4b\26n\42"
|
||||
"\204a\354\334*b\322b\334\210\201\366\335\210\26L\24\1c\23\316!\204\311\230\32&\303F\14\264v"
|
||||
"\306c\233\60Rd\25n\42\204w\36)a\321b\234A{\70b\334\210&\214\24e\25\316!\204\311"
|
||||
"\230\32&\303F\14\64\370\340\203\301c\233\60Rf\22k*\204\217\224\241C\343F%\311j\340\374W"
|
||||
"\0g\32n\342\202I\11\213\26\343\14\332\303\21\343F\64a\244v\350 E\251\16\1h\22n\42\204"
|
||||
"a\354\334*b\322b\334\210\201\366\17\7i\20i*\204g\330\364\300\314X\66\177\363\200\1j\23\10"
|
||||
"\343\202k\366`\214X\65\377G#N\30!\4\0k#n\42\204a\354<#\61\212\310 \62c\10"
|
||||
"\15!\65\202\30\262T%\10\221!\63\212\310\60\22\343\16\16l\15i*\204\301\214e\363\377\346\1\3"
|
||||
"m#\317!\204aQ\23\27c\206\214\30\63\306\314\30\63c\314\214\61\63\306\314\30\63c\314\214\61\63"
|
||||
"\306\314\4n\24\316!\204a\320$GF\244\70\63\242\330\71\203\366\303\1o\26\316!\204\311\230\32&"
|
||||
"\303F\14\264\207#\206\15a\243\314\20\0p\26n\342\202A\21\223\26\343F\14\264\357F\264`\242h"
|
||||
"\354\334\2q\25n\342\202I\11\213\26\343\14\332\303\21\343F\64a\244v\36r\24\316!\204a\320$"
|
||||
"GF\244\70\63\242\330\71\263\363[\0s\26\316!\204I\11\213\7B\307\252Z\245\226\354\320\7\42\230"
|
||||
"(\2t\22k*\204g\340\134%\311j\340|\71\360\224\71\2u\23\316!\204a\240\375\335\261\22c"
|
||||
"N\244\30rd\320\4v\31\316!\204a\240\35\216\30\66d\330\230A\263\32\62l\310\70\203&I\1"
|
||||
"w&\317!\204a\314\30\63c\314\214\61\63\306\314\30\63c\314\214\61\63\306\314\30\63cN\224 \321"
|
||||
"\304\204\241\61c\0x\34\316!\204a\240\301c$\10\221!B\12\235As\250\210\220!D\202\330A"
|
||||
"\203\3y\26n\342\202a\240\375\303\21\343F\64a\244v\350 E\251\16\1z\15\315!\204\341\203\204"
|
||||
"\364\207\17\36${\30\251\357\202mP\65\244\206\315\257\310\24\32V\214\330\374\31\261B\305\6|\7#"
|
||||
"w\203\341\37}\32\251\353\202aX\241b\304\346\317\210\25\33T\206\324\260\371\25\231B\205\206\1~\20"
|
||||
"\255 \206\205\320\210#\17\210\234\30D\4\0\177\6\0 \204\1\0\0\0\4\377\377\0";
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t u8g2_font_profont10_tr[];
|
||||
extern const uint8_t u8g2_font_profont11_tr[];
|
||||
extern const uint8_t u8g2_font_profont12_tr[];
|
||||
extern const uint8_t u8g2_font_profont15_tr[];
|
||||
extern const uint8_t u8g2_font_profont17_tr[];
|
||||
extern const uint8_t u8g2_font_profont22_tr[];
|
||||
extern const uint8_t u8g2_font_profont29_tr[];
|
||||
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#include "profont.h"
|
||||
#include "adobex11font.h"
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
static const lgfx::U8g2font profont10( u8g2_font_profont10_tr );
|
||||
static const lgfx::U8g2font profont11( u8g2_font_profont11_tr );
|
||||
static const lgfx::U8g2font profont12( u8g2_font_profont12_tr );
|
||||
static const lgfx::U8g2font profont15( u8g2_font_profont15_tr );
|
||||
static const lgfx::U8g2font profont17( u8g2_font_profont17_tr );
|
||||
static const lgfx::U8g2font profont22( u8g2_font_profont22_tr );
|
||||
static const lgfx::U8g2font profont29( u8g2_font_profont29_tr );
|
||||
|
||||
static const lgfx::U8g2font courB08 ( u8g2_font_courB08_tr );
|
||||
static const lgfx::U8g2font courB10 ( u8g2_font_courB10_tr );
|
||||
static const lgfx::U8g2font courB12 ( u8g2_font_courB12_tr );
|
||||
static const lgfx::U8g2font courB14 ( u8g2_font_courB14_tr );
|
||||
static const lgfx::U8g2font courB18 ( u8g2_font_courB18_tr );
|
||||
static const lgfx::U8g2font courB24 ( u8g2_font_courB24_tr );
|
||||
|
||||
static const lgfx::U8g2font courR08 ( u8g2_font_courR08_tr );
|
||||
static const lgfx::U8g2font courR10 ( u8g2_font_courR10_tr );
|
||||
static const lgfx::U8g2font courR12 ( u8g2_font_courR12_tr );
|
||||
static const lgfx::U8g2font courR14 ( u8g2_font_courR14_tr );
|
||||
static const lgfx::U8g2font courR18 ( u8g2_font_courR18_tr );
|
||||
static const lgfx::U8g2font courR24 ( u8g2_font_courR24_tr );
|
||||
|
||||
static const lgfx::U8g2font helvB08 ( u8g2_font_helvB08_tr );
|
||||
static const lgfx::U8g2font helvB10 ( u8g2_font_helvB10_tr );
|
||||
static const lgfx::U8g2font helvB12 ( u8g2_font_helvB12_tr );
|
||||
static const lgfx::U8g2font helvB14 ( u8g2_font_helvB14_tr );
|
||||
static const lgfx::U8g2font helvB18 ( u8g2_font_helvB18_tr );
|
||||
static const lgfx::U8g2font helvB24 ( u8g2_font_helvB24_tr );
|
||||
|
||||
static const lgfx::U8g2font helvR08 ( u8g2_font_helvR08_tr );
|
||||
static const lgfx::U8g2font helvR10 ( u8g2_font_helvR10_tr );
|
||||
static const lgfx::U8g2font helvR12 ( u8g2_font_helvR12_tr );
|
||||
static const lgfx::U8g2font helvR14 ( u8g2_font_helvR14_tr );
|
||||
static const lgfx::U8g2font helvR18 ( u8g2_font_helvR18_tr );
|
||||
static const lgfx::U8g2font helvR24 ( u8g2_font_helvR24_tr );
|
||||
|
||||
static const lgfx::U8g2font ncenB08 ( u8g2_font_ncenB08_tr );
|
||||
static const lgfx::U8g2font ncenB10 ( u8g2_font_ncenB10_tr );
|
||||
static const lgfx::U8g2font ncenB12 ( u8g2_font_ncenB12_tr );
|
||||
static const lgfx::U8g2font ncenB14 ( u8g2_font_ncenB14_tr );
|
||||
static const lgfx::U8g2font ncenB18 ( u8g2_font_ncenB18_tr );
|
||||
static const lgfx::U8g2font ncenB24 ( u8g2_font_ncenB24_tr );
|
||||
|
||||
static const lgfx::U8g2font ncenR08 ( u8g2_font_ncenR08_tr );
|
||||
static const lgfx::U8g2font ncenR10 ( u8g2_font_ncenR10_tr );
|
||||
static const lgfx::U8g2font ncenR12 ( u8g2_font_ncenR12_tr );
|
||||
static const lgfx::U8g2font ncenR14 ( u8g2_font_ncenR14_tr );
|
||||
static const lgfx::U8g2font ncenR18 ( u8g2_font_ncenR18_tr );
|
||||
static const lgfx::U8g2font ncenR24 ( u8g2_font_ncenR24_tr );
|
||||
|
||||
static const lgfx::U8g2font timB08 ( u8g2_font_timB08_tr );
|
||||
static const lgfx::U8g2font timB10 ( u8g2_font_timB10_tr );
|
||||
static const lgfx::U8g2font timB12 ( u8g2_font_timB12_tr );
|
||||
static const lgfx::U8g2font timB14 ( u8g2_font_timB14_tr );
|
||||
static const lgfx::U8g2font timB18 ( u8g2_font_timB18_tr );
|
||||
static const lgfx::U8g2font timB24 ( u8g2_font_timB24_tr );
|
||||
|
||||
static const lgfx::U8g2font timR08 ( u8g2_font_timR08_tr );
|
||||
static const lgfx::U8g2font timR10 ( u8g2_font_timR10_tr );
|
||||
static const lgfx::U8g2font timR12 ( u8g2_font_timR12_tr );
|
||||
static const lgfx::U8g2font timR14 ( u8g2_font_timR14_tr );
|
||||
static const lgfx::U8g2font timR18 ( u8g2_font_timR18_tr );
|
||||
static const lgfx::U8g2font timR24 ( u8g2_font_timR24_tr );
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
lcd.setTextColor(random(0x10000)| 0x8410, random(0x10000)&0x7BEF);
|
||||
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&profont10); lcd.print("profont10\n");
|
||||
lcd.setFont(&profont11); lcd.print("profont11\n");
|
||||
lcd.setFont(&profont12); lcd.print("profont12\n");
|
||||
lcd.setFont(&profont15); lcd.print("profont15\n");
|
||||
lcd.setFont(&profont17); lcd.print("profont17\n");
|
||||
lcd.setFont(&profont22); lcd.print("profont22\n");
|
||||
lcd.setFont(&profont29); lcd.print("profont29\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&courB08); lcd.print("courB08\n");
|
||||
lcd.setFont(&courB10); lcd.print("courB10\n");
|
||||
lcd.setFont(&courB12); lcd.print("courB12\n");
|
||||
lcd.setFont(&courB14); lcd.print("courB14\n");
|
||||
lcd.setFont(&courB18); lcd.print("courB18\n");
|
||||
lcd.setFont(&courB24); lcd.print("courB24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&courR08); lcd.print("courR08\n");
|
||||
lcd.setFont(&courR10); lcd.print("courR10\n");
|
||||
lcd.setFont(&courR12); lcd.print("courR12\n");
|
||||
lcd.setFont(&courR14); lcd.print("courR14\n");
|
||||
lcd.setFont(&courR18); lcd.print("courR18\n");
|
||||
lcd.setFont(&courR24); lcd.print("courR24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&helvB08); lcd.print("helvB08\n");
|
||||
lcd.setFont(&helvB10); lcd.print("helvB10\n");
|
||||
lcd.setFont(&helvB12); lcd.print("helvB12\n");
|
||||
lcd.setFont(&helvB14); lcd.print("helvB14\n");
|
||||
lcd.setFont(&helvB18); lcd.print("helvB18\n");
|
||||
lcd.setFont(&helvB24); lcd.print("helvB24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&helvR08); lcd.print("helvR08\n");
|
||||
lcd.setFont(&helvR10); lcd.print("helvR10\n");
|
||||
lcd.setFont(&helvR12); lcd.print("helvR12\n");
|
||||
lcd.setFont(&helvR14); lcd.print("helvR14\n");
|
||||
lcd.setFont(&helvR18); lcd.print("helvR18\n");
|
||||
lcd.setFont(&helvR24); lcd.print("helvR24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&ncenB08); lcd.print("ncenB08\n");
|
||||
lcd.setFont(&ncenB10); lcd.print("ncenB10\n");
|
||||
lcd.setFont(&ncenB12); lcd.print("ncenB12\n");
|
||||
lcd.setFont(&ncenB14); lcd.print("ncenB14\n");
|
||||
lcd.setFont(&ncenB18); lcd.print("ncenB18\n");
|
||||
lcd.setFont(&ncenB24); lcd.print("ncenB24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&ncenR08); lcd.print("ncenR08\n");
|
||||
lcd.setFont(&ncenR10); lcd.print("ncenR10\n");
|
||||
lcd.setFont(&ncenR12); lcd.print("ncenR12\n");
|
||||
lcd.setFont(&ncenR14); lcd.print("ncenR14\n");
|
||||
lcd.setFont(&ncenR18); lcd.print("ncenR18\n");
|
||||
lcd.setFont(&ncenR24); lcd.print("ncenR24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&timB08 ); lcd.print("timB08\n");
|
||||
lcd.setFont(&timB10 ); lcd.print("timB10\n");
|
||||
lcd.setFont(&timB12 ); lcd.print("timB12\n");
|
||||
lcd.setFont(&timB14 ); lcd.print("timB14\n");
|
||||
lcd.setFont(&timB18 ); lcd.print("timB18\n");
|
||||
lcd.setFont(&timB24 ); lcd.print("timB24\n");
|
||||
delay(2000);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
lcd.setFont(&timR08 ); lcd.print("timR08\n");
|
||||
lcd.setFont(&timR10 ); lcd.print("timR10\n");
|
||||
lcd.setFont(&timR12 ); lcd.print("timR12\n");
|
||||
lcd.setFont(&timR14 ); lcd.print("timR14\n");
|
||||
lcd.setFont(&timR18 ); lcd.print("timR18\n");
|
||||
lcd.setFont(&timR24 ); lcd.print("timR24\n");
|
||||
delay(2000);
|
||||
}
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
#include <LovyanGFX.hpp>
|
||||
|
||||
extern const uint8_t rgb888[];
|
||||
extern const uint8_t bgr888[];
|
||||
extern const uint16_t swap565[];
|
||||
extern const uint16_t rgb565[];
|
||||
extern const uint8_t rgb332[];
|
||||
|
||||
static constexpr int image_width = 33;
|
||||
static constexpr int image_height = 31;
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
lcd.startWrite();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
|
||||
/*
|
||||
画像データを描画する関数は幾つか種類があります。
|
||||
|
||||
方法1.事前に描画範囲を設定しておき、次にデータの長さを指定して描画する方法
|
||||
方法2.描画する座標と幅・高さを指定してデータを描画する方法
|
||||
|
||||
|
||||
|
||||
方法1.事前に描画範囲を設定しておき、次にデータの長さを指定して描画する方法
|
||||
|
||||
この方法では、setWindow/setAddrWindow関数で描画範囲を設定したあと、
|
||||
writePixels/pushPixels関数で画像データの長さを指定して描画します。
|
||||
|
||||
setWindow( x0, y0, x1, y1 ); // 描画範囲の指定。左上座標と右下座標を指定します。
|
||||
setAddrWindow( x, y, w, h ); // 描画範囲の指定。左上座標と幅と高さを指定します。
|
||||
|
||||
setWindow は画面外の座標を指定した場合の動作は保証されません。
|
||||
setAddrWindow は描画範囲外が指定された場合は範囲内に調整されます。
|
||||
※ ただし自動調整された結果、実際に設定される幅や高さが指定した値より小さくなる可能性があるので注意が必要です。
|
||||
|
||||
writePixels ( *data, len, swap ); // 画像を描画する。(事前にstartWrite、事後にendWriteが必要)
|
||||
pushPixels ( *data, len, swap ); // 画像を描画する。(startWrite・endWriteは不要)
|
||||
|
||||
※ writePixelsはAdafruitGFX由来の関数で、pushPixelsはTFT_eSPI由来の関数です。
|
||||
描画内容は同等ですが、startWrite/endWriteが自動で行われるか否かが違います。
|
||||
|
||||
第1引数:画像データのポインタ(データ型に応じて色の形式を判断して変換が行われます。)
|
||||
第2引数:画像データのピクセル数(バイト数でない点に注意。)
|
||||
第3引数:バイト順変換フラグ(省略時は事前にsetSwapBytes関数で設定した値が使用されます。)
|
||||
|
||||
第1引数のdataの型に基づいて色の形式変換が行われます。
|
||||
uint8_t* の場合、 8bitカラー RGB332として扱います。
|
||||
uint16_t* の場合、16bitカラー RGB565として扱います。
|
||||
void* の場合、24bitカラー RGB888として扱います。
|
||||
※ (3バイトのプリミティブ型が無いため、void*型を24bitカラー扱いとしています)
|
||||
|
||||
※ LCDに描画する際に、LCDの色数モードに応じて色形式の変換が自動的に行われます。
|
||||
*/
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
lcd.setColorDepth(16); // LCDを16bitカラーモードに設定する。
|
||||
lcd.setSwapBytes(true); // バイト順変換を有効にする。
|
||||
int len = image_width * image_height;
|
||||
|
||||
// 画像の幅と高さをsetAddrWindowで事前に設定し、writePixelsで描画します。
|
||||
lcd.setAddrWindow(0, 0, image_width, image_height); // 描画範囲を設定。
|
||||
lcd.writePixels((uint16_t*)rgb565, len); // RGB565の16bit画像データを描画。
|
||||
|
||||
// データとバイト順変換の指定が一致していない場合、色化けします。
|
||||
lcd.setAddrWindow(0, 40, image_width, image_height);
|
||||
// 第3引数でfalseを指定することでバイト順変換の有無を指定できます。
|
||||
lcd.writePixels((uint16_t*)rgb565, len, false); // RGB565の画像をバイト順変換無しで描画すると色が化ける。
|
||||
|
||||
// 描画範囲が画面外にはみ出すなどして画像の幅や高さと合わなくなった場合、描画結果が崩れます。
|
||||
lcd.setAddrWindow(-1, 80, image_width, image_height); // X座標が-1(画面外)のため、正しく設定できない。
|
||||
lcd.writePixels((uint16_t*)rgb565, len); // 描画先の幅と画像の幅が不一致のため描画内容が崩れる。
|
||||
|
||||
// データと型が一致していない場合も、描画結果が崩れます。
|
||||
lcd.setAddrWindow(0, 120, image_width, image_height);
|
||||
// RGB565のデータをわざとuint8_tにキャストし、RGB332の8bitカラーとして扱わせる。
|
||||
lcd.writePixels((uint8_t*)rgb565, len); // 画像の形式と型が一致していないため描画が乱れる。
|
||||
|
||||
// データと型が一致していれば、描画先の色数に合わせて適切な形式変換が行われます。
|
||||
lcd.setAddrWindow(0, 160, image_width, image_height);
|
||||
lcd.writePixels((uint8_t*)rgb332, len); // RGB332のデータでも16bitカラーのLCDに正しく描画できる。
|
||||
|
||||
|
||||
// ※ LCDへの画像データの送信は、メモリの若いアドレスにあるデータから順に1Byte単位で送信されます。
|
||||
// このため、例えばRGB565の16bit型のデータを素直にuint16_tの配列で用意すると、送信の都合としてはバイト順が入れ替わった状態になります。
|
||||
// この場合は事前にsetSwapBytes(true)を使用したり、第3引数にtrueを指定する事で、バイト順の変換が行われて正常に描画できます。
|
||||
// なお用意する画像データを予め上位下位バイトを入れ替えた状態で作成すれば、この変換は不要になり速度面で有利になります。
|
||||
|
||||
lcd.setAddrWindow(40, 0, image_width, image_height);
|
||||
lcd.writePixels((uint16_t*)swap565, len, false); // 予め上位下位が入れ替わった16bitデータの場合はバイト順変換を無効にする。
|
||||
|
||||
lcd.setAddrWindow(40, 40, image_width, image_height);
|
||||
lcd.writePixels((uint16_t*)swap565, len, true); // 逆に、予め上位下位が入れ替わったデータにバイト順変換を行うと色が化ける。
|
||||
|
||||
lcd.setAddrWindow(40, 80, image_width, image_height);
|
||||
lcd.writePixels((void*)rgb888, len, true); // 24bitのデータも同様に、RGB888の青が下位側にあるデータはバイト順変換が必要。
|
||||
|
||||
lcd.setAddrWindow(40, 120, image_width, image_height);
|
||||
lcd.writePixels((void*)bgr888, len, false); // 同様に、BGR888の赤が下位側にあるデータはバイト順変換は不要。
|
||||
|
||||
lcd.setAddrWindow(40, 160, image_width, image_height);
|
||||
lcd.writePixels((void*)bgr888, len, true); // 設定を誤ると、色が化ける。(赤と青が入れ替わる)
|
||||
|
||||
lcd.display();
|
||||
delay(4000);
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
/*
|
||||
方法2.描画する座標と幅・高さを指定してデータを描画する方法
|
||||
|
||||
この方法では、pushImage関数を用いて描画範囲と描画データを指定して描画します。
|
||||
|
||||
pushImage( x, y, w, h, *data); // 指定された座標に画像を描画する。
|
||||
|
||||
方法1と違い、画面外にはみ出す座標を指定しても描画が乱れることはありません。(はみ出した部分は描画されません。)
|
||||
方法1と違い、バイト順の変換を指定する引数が無いため、事前にsetSwapBytesによる設定が必要です。
|
||||
なお方法1と同様に、dataの型に応じて色変換が行われます。
|
||||
*/
|
||||
|
||||
lcd.setSwapBytes(true); // バイト順変換を有効にする。
|
||||
|
||||
// 描画先の座標と画像の幅・高さを指定して画像データを描画します。
|
||||
lcd.pushImage( 0, 0, image_width, image_height, (uint16_t*)rgb565); // RGB565の16bit画像データを描画。
|
||||
|
||||
// データとバイト順変換の指定が一致していない場合、色化けします。
|
||||
lcd.pushImage( 0, 40, image_width, image_height, (uint16_t*)swap565); // NG. バイト順変換済みデータにバイト順変換を行うと色化けする。
|
||||
|
||||
// 描画範囲が画面外にはみ出すなどした場合でも、描画結果が崩れることはありません。
|
||||
lcd.pushImage(-1, 80, image_width, image_height, (uint16_t*)rgb565); // X座標-1(画面外)を指定しても描画は乱れない。
|
||||
|
||||
// データと型が一致していない場合は、描画結果が崩れます。
|
||||
lcd.pushImage(0, 120, image_width, image_height, (uint8_t*)rgb565); // RGB565のデータをuint8_tにキャストし、RGB332として扱わせると描画が乱れる。
|
||||
|
||||
// データと型が一致していれば、適切に形式変換が行われます。
|
||||
lcd.pushImage(0, 160, image_width, image_height, (uint8_t*)rgb332); // RGB332のデータでも正しく描画できる。
|
||||
|
||||
|
||||
lcd.setSwapBytes(false); // バイト順の変換を無効にする。
|
||||
lcd.pushImage( 40, 0, image_width, image_height, (uint8_t* )rgb332); // good. RGB332のデータはバイト順変換の影響を受けない。
|
||||
lcd.pushImage( 40, 40, image_width, image_height, (uint16_t*)rgb565); // NG. RGB565のデータはバイト順変換が必要。
|
||||
lcd.pushImage( 40, 80, image_width, image_height, (void* )rgb888); // NG. RGB888のデータはバイト順変換が必要。
|
||||
lcd.pushImage( 40, 120, image_width, image_height, (uint16_t*)swap565); // good. バイト順変換済みRGB565のデータは色化けしない。
|
||||
lcd.pushImage( 40, 160, image_width, image_height, (void* )bgr888); // good. バイト順変換済みRGB888のデータは色化けしない。
|
||||
|
||||
lcd.setSwapBytes(true); // バイト順の変換を有効にする。
|
||||
lcd.pushImage( 80, 0, image_width, image_height, (uint8_t* )rgb332); // good. RGB332のデータはバイト順変換の影響を受けない。
|
||||
lcd.pushImage( 80, 40, image_width, image_height, (uint16_t*)rgb565); // good. バイト順変換が有効ならRGB565のデータは色化けしない。
|
||||
lcd.pushImage( 80, 80, image_width, image_height, (void* )rgb888); // good. バイト順変換が有効ならRGB888のデータは色化けしない。
|
||||
lcd.pushImage( 80, 120, image_width, image_height, (uint16_t*)swap565); // NG. バイト順変換済みデータにバイト順変換を行うと色化けする。
|
||||
lcd.pushImage( 80, 160, image_width, image_height, (void* )bgr888); // NG. バイト順変換済みデータにバイト順変換を行うと色化けする。
|
||||
|
||||
// データの型として、lgfx::名前空間に定義されている型を利用する事もできます。
|
||||
// これらの型にキャストする場合はsetSwapBytesの設定は無視されます。
|
||||
lcd.pushImage(120, 0, image_width, image_height, (lgfx:: rgb332_t*) rgb332); // good 8bitデータ
|
||||
lcd.pushImage(120, 40, image_width, image_height, (lgfx:: rgb565_t*) rgb565); // good 16bitデータ
|
||||
lcd.pushImage(120, 80, image_width, image_height, (lgfx:: rgb888_t*) rgb888); // good 24bitデータ
|
||||
lcd.pushImage(120, 120, image_width, image_height, (lgfx::swap565_t*)swap565); // good バイト順変換済み16bitデータ
|
||||
lcd.pushImage(120, 160, image_width, image_height, (lgfx:: bgr888_t*) bgr888); // good バイト順変換済み24bitデータ
|
||||
|
||||
// 第6引数で透過色を指定できます。透過指定された色のある部分は描画されません。
|
||||
lcd.pushImage(160, 0, image_width, image_height, (lgfx:: rgb332_t*) rgb332, 0); // 黒を透過指定
|
||||
lcd.pushImage(160, 40, image_width, image_height, (lgfx:: rgb565_t*) rgb565, (uint8_t)0xE0); // 赤を透過指定
|
||||
lcd.pushImage(160, 80, image_width, image_height, (lgfx:: rgb888_t*) rgb888, (uint16_t)0x07E0); // 緑を透過指定
|
||||
lcd.pushImage(160, 120, image_width, image_height, (lgfx::swap565_t*)swap565, (uint32_t)0x0000FFU); // 青を透過指定
|
||||
lcd.pushImage(160, 160, image_width, image_height, (lgfx:: bgr888_t*) bgr888, TFT_WHITE); // 白を透過指定
|
||||
|
||||
lcd.display();
|
||||
delay(4000);
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
// pushImageRotateZoom関数を使うと、画像を回転拡大縮小させて描画できます。
|
||||
for (int angle = 0; angle <= 360; ++angle) {
|
||||
lcd.pushImageRotateZoom
|
||||
( lcd.width() >> 2 // 描画先の中心座標X
|
||||
, lcd.height() >> 1 // 描画先の中心座標Y
|
||||
, image_width >> 1 // 画像の中心座標X
|
||||
, image_height >> 1 // 画像の中心座標Y
|
||||
, angle // 回転角度
|
||||
, 3.0 // X方向の描画倍率 (マイナス指定で反転可能)
|
||||
, 3.0 // Y方向の描画倍率 (マイナス指定で反転可能)
|
||||
, image_width // 画像データの幅
|
||||
, image_height // 画像データの高さ
|
||||
, rgb332 // 画像データのポインタ
|
||||
);
|
||||
|
||||
// pushImageRotateZoomWithAA関数を使うと、アンチエイリアスが有効になります。
|
||||
lcd.pushImageRotateZoomWithAA
|
||||
( lcd.width()*3>> 2
|
||||
, lcd.height() >> 1
|
||||
, image_width >> 1
|
||||
, image_height >> 1
|
||||
, angle
|
||||
, 3.0
|
||||
, 3.0
|
||||
, image_width
|
||||
, image_height
|
||||
, rgb332
|
||||
);
|
||||
|
||||
if ((angle % 36) == 0) { lcd.display(); }
|
||||
}
|
||||
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
// pushImageAffine関数を使うと、画像をアフィン変換で変形させて描画できます。
|
||||
// アフィン変換のパラメータはfloat型の配列で指定します。
|
||||
{
|
||||
float matrix[6] = // 等倍表示
|
||||
{ 1.0, 0.0, (float)lcd.width() / 2
|
||||
, 0.0, 1.0, (float)lcd.height() / 2 };
|
||||
lcd.pushImageAffine(matrix, image_width, image_height, rgb332);
|
||||
}
|
||||
|
||||
lcd.display();
|
||||
delay(1000);
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
{
|
||||
float matrix[6] = // 横2倍表示
|
||||
{ 2.0, 0.0, (float)lcd.width() / 2
|
||||
, 0.0, 1.0, (float)lcd.height() / 2 };
|
||||
lcd.pushImageAffine(matrix, image_width, image_height, rgb332);
|
||||
}
|
||||
|
||||
lcd.display();
|
||||
delay(1000);
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
{
|
||||
float matrix[6] = // 縦2倍表示
|
||||
{ 1.0, 0.0, (float)lcd.width() / 2
|
||||
, 0.0, 2.0, (float)lcd.height() / 2 };
|
||||
lcd.pushImageAffine(matrix, image_width, image_height, rgb332);
|
||||
}
|
||||
|
||||
lcd.display();
|
||||
delay(1000);
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
{
|
||||
float matrix[6] = // 斜め変形
|
||||
{ 1.0, -0.4, (float)lcd.width() / 2
|
||||
, 0.0, 1.0, (float)lcd.height() / 2 };
|
||||
lcd.pushImageAffine(matrix, image_width, image_height, rgb332);
|
||||
}
|
||||
|
||||
lcd.display();
|
||||
delay(1000);
|
||||
lcd.clear(TFT_DARKGREY);
|
||||
|
||||
// pushImageAffineWithAA関数を使用するとアンチエイリアスが有効になります。
|
||||
{
|
||||
float matrix[6] =
|
||||
{ 1.0, 0.0, (float)lcd.width() / 2
|
||||
, 0.0, 1.0, (float)lcd.height() / 2 };
|
||||
for (int i = -300; i < 300; i++) {
|
||||
float f = (float)i / 100;
|
||||
matrix[1] = f;
|
||||
matrix[3] = f;
|
||||
lcd.pushImageAffineWithAA(matrix, image_width, image_height, rgb332);
|
||||
|
||||
if ((i % 30) == 0) { lcd.display(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#define R 0x00,0x00,0xFF,
|
||||
#define G 0x00,0xFF,0x00,
|
||||
#define B 0xFF,0x00,0x00,
|
||||
#define C 0xFF,0xFF,0x00,
|
||||
#define M 0xFF,0x00,0xFF,
|
||||
#define Y 0x00,0xFF,0xFF,
|
||||
#define W 0xFF,0xFF,0xFF,
|
||||
#define _ 0x00,0x00,0x00,
|
||||
constexpr uint8_t rgb888[] = {
|
||||
#include "image.h"
|
||||
};
|
||||
#undef R
|
||||
#undef G
|
||||
#undef B
|
||||
#undef C
|
||||
#undef M
|
||||
#undef Y
|
||||
#undef W
|
||||
#undef _
|
||||
//----------------------------------------------------------------------------
|
||||
#define R 0xFF,0x00,0x00,
|
||||
#define G 0x00,0xFF,0x00,
|
||||
#define B 0x00,0x00,0xFF,
|
||||
#define C 0x00,0xFF,0xFF,
|
||||
#define M 0xFF,0x00,0xFF,
|
||||
#define Y 0xFF,0xFF,0x00,
|
||||
#define W 0xFF,0xFF,0xFF,
|
||||
#define _ 0x00,0x00,0x00,
|
||||
constexpr uint8_t bgr888[] = {
|
||||
#include "image.h"
|
||||
};
|
||||
#undef R
|
||||
#undef G
|
||||
#undef B
|
||||
#undef C
|
||||
#undef M
|
||||
#undef Y
|
||||
#undef W
|
||||
#undef _
|
||||
//----------------------------------------------------------------------------
|
||||
#define R 0x00F8,
|
||||
#define G 0xE007,
|
||||
#define B 0x1F00,
|
||||
#define C 0xFF07,
|
||||
#define M 0x1FF8,
|
||||
#define Y 0xE0FF,
|
||||
#define W 0xFFFF,
|
||||
#define _ 0x0000,
|
||||
constexpr uint16_t swap565[] = {
|
||||
#include "image.h"
|
||||
};
|
||||
#undef R
|
||||
#undef G
|
||||
#undef B
|
||||
#undef C
|
||||
#undef M
|
||||
#undef Y
|
||||
#undef W
|
||||
#undef _
|
||||
//----------------------------------------------------------------------------
|
||||
#define R 0xF800,
|
||||
#define G 0x07E0,
|
||||
#define B 0x001F,
|
||||
#define C 0x07FF,
|
||||
#define M 0xF81F,
|
||||
#define Y 0xFFE0,
|
||||
#define W 0xFFFF,
|
||||
#define _ 0x0000,
|
||||
constexpr uint16_t rgb565[] = {
|
||||
#include "image.h"
|
||||
};
|
||||
#undef R
|
||||
#undef G
|
||||
#undef B
|
||||
#undef C
|
||||
#undef M
|
||||
#undef Y
|
||||
#undef W
|
||||
#undef _
|
||||
//----------------------------------------------------------------------------
|
||||
#define R 0xE0,
|
||||
#define G 0x1C,
|
||||
#define B 0x03,
|
||||
#define C 0x1F,
|
||||
#define M 0xE3,
|
||||
#define Y 0xFC,
|
||||
#define W 0xFF,
|
||||
#define _ 0x00,
|
||||
constexpr uint8_t rgb332[] = {
|
||||
#include "image.h"
|
||||
};
|
||||
#undef R
|
||||
#undef G
|
||||
#undef B
|
||||
#undef C
|
||||
#undef M
|
||||
#undef Y
|
||||
#undef W
|
||||
#undef _
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
_ _ _ _ _ _ _ _ _ _ _ _ _ R R R R R R R _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ _ _ _ R R R R R R R R R R R _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ _ _ R R R R R R R R R R R R R _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ _ R R R R _ _ _ _ _ _ R R R R R _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ R R R R R _ _ R R R _ _ R R R R R _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ R R R R R _ _ R R R _ _ R R R R R _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ R R R R R R _ _ _ _ _ _ R R R R R R R _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ R R R R R R _ _ R R _ _ R R R R R R R _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ R R R R R R _ _ R R R _ _ R R R R R R _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ R R R R R R _ _ R R R _ _ R R R R R R _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ R R R R R R _ _ R R R _ _ R R R R R R _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ R R R R R R R R R R R R R R R R R R R _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ G Y Y Y Y Y Y R R R R R R R M M M M M M B _ _ _ _ _ _
|
||||
_ _ _ _ G G G G Y Y Y Y Y Y Y R R R M M M M M M M B B B B _ _ _ _
|
||||
_ _ _ G G G G G Y Y Y Y Y Y Y Y R M M M M M M M M B B B B B _ _ _
|
||||
_ _ G G G G G G G Y Y Y Y Y Y Y W M M M M M M M B B B B B B B _ _
|
||||
_ G G G G G G G G G Y Y Y Y Y W W W M M M M M B B B B B B B B B _
|
||||
_ G G G G G G G G G G Y Y Y Y W W W M M M M B B B B B B B B B B _
|
||||
G G G G G G G G G G G G G Y W W W W W M B B B B B B B B B B B B B
|
||||
G G G G G _ _ _ _ G G G G G C C C C C B B B B _ _ _ _ _ B B B B B
|
||||
G G G G _ _ G G _ _ G G G G C C C C C B B B B _ _ B B _ _ B B B B
|
||||
G G G G _ _ G G G G G G G G C C C C C B B B B _ _ B B _ _ B B B B
|
||||
G G G G _ _ G G G G G G G G C C C C C B B B B _ _ _ _ _ B B B B B
|
||||
G G G G _ _ G _ _ _ G G G G C C C C C B B B B _ _ B B _ _ B B B B
|
||||
G G G G _ _ G G _ _ G G G G C C C C C B B B B _ _ B B _ _ B B B B
|
||||
_ G G G _ _ G G _ _ G G G G G C C C B B B B B _ _ B B _ _ B B B _
|
||||
_ G G G G _ _ _ _ G G G G G G C C C B B B B B _ _ _ _ _ B B B B _
|
||||
_ _ G G G G G G G G G G G G G G C B B B B B B B B B B B B B B _ _
|
||||
_ _ _ G G G G G G G G G G G G G _ B B B B B B B B B B B B B _ _ _
|
||||
_ _ _ _ G G G G G G G G G G G _ _ _ B B B B B B B B B B B _ _ _ _
|
||||
_ _ _ _ _ _ G G G G G G G _ _ _ _ _ _ _ B B B B B B B _ _ _ _ _ _
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite canvas(&lcd); // オフスクリーン描画用バッファ
|
||||
static LGFX_Sprite clockbase(&canvas); // 時計の文字盤パーツ
|
||||
static LGFX_Sprite needle1(&canvas); // 長針・短針パーツ
|
||||
static LGFX_Sprite shadow1(&canvas); // 長針・短針の影パーツ
|
||||
static LGFX_Sprite needle2(&canvas); // 秒針パーツ
|
||||
static LGFX_Sprite shadow2(&canvas); // 秒針の影パーツ
|
||||
|
||||
static constexpr uint64_t oneday = 86400000; // 1日 = 1000msec x 60sec x 60min x 24hour = 86400000
|
||||
static uint64_t count = rand() % oneday; // 現在時刻 (ミリ秒カウンタ)
|
||||
static int32_t width = 239; // 時計の縦横画像サイズ
|
||||
static int32_t halfwidth = width >> 1; // 時計盤の中心座標
|
||||
static auto transpalette = 0; // 透過色パレット番号
|
||||
static float zoom; // 表示倍率
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
zoom = (float)(std::min(lcd.width(), lcd.height())) / width; // 表示が画面にフィットするよう倍率を調整
|
||||
|
||||
lcd.setPivot(lcd.width() >> 1, lcd.height() >> 1); // 時計描画時の中心を画面中心に合わせる
|
||||
|
||||
canvas.setColorDepth(lgfx::palette_4bit); // 各部品を4ビットパレットモードで準備する
|
||||
clockbase.setColorDepth(lgfx::palette_4bit);
|
||||
needle1.setColorDepth(lgfx::palette_4bit);
|
||||
shadow1.setColorDepth(lgfx::palette_4bit);
|
||||
needle2.setColorDepth(lgfx::palette_4bit);
|
||||
shadow2.setColorDepth(lgfx::palette_4bit);
|
||||
// パレットの初期色はグレースケールのグラデーションとなっており、
|
||||
// 0番が黒(0,0,0)、15番が白(255,255,255)
|
||||
// 1番~14番は黒から白へ段階的に明るさが変化している
|
||||
//
|
||||
// パレットを使う場合、描画関数は色の代わりに0~15のパレット番号を指定する
|
||||
|
||||
canvas.createSprite(width, width); // メモリ確保
|
||||
clockbase.createSprite(width, width);
|
||||
needle1.createSprite(9, 119);
|
||||
shadow1.createSprite(9, 119);
|
||||
needle2.createSprite(3, 119);
|
||||
shadow2.createSprite(3, 119);
|
||||
|
||||
canvas.fillScreen(transpalette); // 透過色で背景を塗り潰す (create直後は0埋めされているので省略可能)
|
||||
clockbase.fillScreen(transpalette);
|
||||
needle1.fillScreen(transpalette);
|
||||
shadow1.fillScreen(transpalette);
|
||||
|
||||
clockbase.setTextFont(4); // フォント種類を変更(時計盤の文字用)
|
||||
clockbase.setTextDatum(lgfx::middle_center);
|
||||
clockbase.fillCircle(halfwidth, halfwidth, halfwidth , 6); // 時計盤の背景の円を塗る
|
||||
clockbase.drawCircle(halfwidth, halfwidth, halfwidth - 1, 15);
|
||||
for (int i = 1; i <= 60; ++i) {
|
||||
float rad = i * 6 * - 0.0174532925; // 時計盤外周の目盛り座標を求める
|
||||
float cosy = - cos(rad) * (halfwidth * 10 / 11);
|
||||
float sinx = - sin(rad) * (halfwidth * 10 / 11);
|
||||
bool flg = 0 == (i % 5); // 5目盛り毎フラグ
|
||||
clockbase.fillCircle(halfwidth + sinx + 1, halfwidth + cosy + 1, flg * 3 + 1, 4); // 目盛りを描画
|
||||
clockbase.fillCircle(halfwidth + sinx , halfwidth + cosy , flg * 3 + 1, 12);
|
||||
if (flg) { // 文字描画
|
||||
cosy = - cos(rad) * (halfwidth * 10 / 13);
|
||||
sinx = - sin(rad) * (halfwidth * 10 / 13);
|
||||
clockbase.setTextColor(1);
|
||||
clockbase.drawNumber(i/5, halfwidth + sinx + 1, halfwidth + cosy + 4);
|
||||
clockbase.setTextColor(15);
|
||||
clockbase.drawNumber(i/5, halfwidth + sinx , halfwidth + cosy + 3);
|
||||
}
|
||||
}
|
||||
clockbase.setTextFont(7);
|
||||
|
||||
needle1.setPivot(4, 100); // 針パーツの回転中心座標を設定する
|
||||
shadow1.setPivot(4, 100);
|
||||
needle2.setPivot(1, 100);
|
||||
shadow2.setPivot(1, 100);
|
||||
|
||||
for (int i = 6; i >= 0; --i) { // 針パーツの画像を作成する
|
||||
needle1.fillTriangle(4, - 16 - (i<<1), 8, needle1.height() - (i<<1), 0, needle1.height() - (i<<1), 15 - i);
|
||||
shadow1.fillTriangle(4, - 16 - (i<<1), 8, shadow1.height() - (i<<1), 0, shadow1.height() - (i<<1), 1 + i);
|
||||
}
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
needle1.fillTriangle(4, 16 + (i<<1), 8, needle1.height() + 32 + (i<<1), 0, needle1.height() + 32 + (i<<1), 15 - i);
|
||||
shadow1.fillTriangle(4, 16 + (i<<1), 8, shadow1.height() + 32 + (i<<1), 0, shadow1.height() + 32 + (i<<1), 1 + i);
|
||||
}
|
||||
needle1.fillTriangle(4, 32, 8, needle1.height() + 64, 0, needle1.height() + 64, 0);
|
||||
shadow1.fillTriangle(4, 32, 8, shadow1.height() + 64, 0, shadow1.height() + 64, 0);
|
||||
needle1.fillRect(0, 117, 9, 2, 15);
|
||||
shadow1.fillRect(0, 117, 9, 2, 1);
|
||||
needle1.drawFastHLine(1, 117, 7, 12);
|
||||
shadow1.drawFastHLine(1, 117, 7, 4);
|
||||
|
||||
needle1.fillCircle(4, 100, 4, 15);
|
||||
shadow1.fillCircle(4, 100, 4, 1);
|
||||
needle1.drawCircle(4, 100, 4, 14);
|
||||
|
||||
needle2.fillScreen(9);
|
||||
shadow2.fillScreen(3);
|
||||
needle2.drawFastVLine(1, 0, 119, 8);
|
||||
shadow2.drawFastVLine(1, 0, 119, 1);
|
||||
needle2.fillRect(0, 99, 3, 3, 8);
|
||||
|
||||
lcd.startWrite();
|
||||
|
||||
// shadow1.pushSprite(&lcd, 0, 0); // デバッグ用、パーツを直接LCDに描画する
|
||||
// needle1.pushSprite(&lcd, 10, 0);
|
||||
// shadow2.pushSprite(&lcd, 20, 0);
|
||||
// needle2.pushSprite(&lcd, 25, 0);
|
||||
}
|
||||
|
||||
void update7Seg(int32_t hour, int32_t min)
|
||||
{ // 時計盤のデジタル表示部の描画
|
||||
int x = clockbase.getPivotX() - 69;
|
||||
int y = clockbase.getPivotY();
|
||||
clockbase.setCursor(x, y);
|
||||
clockbase.setTextColor(5); // 消去色で 88:88 を描画する
|
||||
clockbase.print("88:88");
|
||||
clockbase.setCursor(x, y);
|
||||
clockbase.setTextColor(12); // 表示色で時:分を描画する
|
||||
clockbase.printf("%02d:%02d", hour, min);
|
||||
}
|
||||
|
||||
void drawDot(int pos, int palette)
|
||||
{
|
||||
bool flg = 0 == (pos % 5); // 5目盛り毎フラグ
|
||||
float rad = pos * 6 * - 0.0174532925; // 時計盤外周の目盛り座標を求める
|
||||
float cosy = - cos(rad) * (halfwidth * 10 / 11);
|
||||
float sinx = - sin(rad) * (halfwidth * 10 / 11);
|
||||
canvas.fillCircle(halfwidth + sinx, halfwidth + cosy, flg * 3 + 1, palette);
|
||||
}
|
||||
|
||||
void drawClock(uint64_t time)
|
||||
{ // 時計の描画
|
||||
static int32_t p_min = -1;
|
||||
int32_t sec = time / 1000;
|
||||
int32_t min = sec / 60;
|
||||
if (p_min != min) { // 分の値が変化していれば時計盤のデジタル表示部分を更新
|
||||
p_min = min;
|
||||
update7Seg(min / 60, min % 60);
|
||||
}
|
||||
clockbase.pushSprite(0, 0); // 描画用バッファに時計盤の画像を上書き
|
||||
|
||||
drawDot(sec % 60, 14);
|
||||
drawDot(min % 60, 15);
|
||||
drawDot(((min/60)*5)%60, 15);
|
||||
|
||||
float fhour = (float)time / 120000; // 短針の角度
|
||||
float fmin = (float)time / 10000; // 長針の角度
|
||||
float fsec = (float)time*6 / 1000; // 秒針の角度
|
||||
int px = canvas.getPivotX();
|
||||
int py = canvas.getPivotY();
|
||||
shadow1.pushRotateZoom(px+2, py+2, fhour, 1.0, 0.7, transpalette); // 針の影を右下方向にずらして描画する
|
||||
shadow1.pushRotateZoom(px+3, py+3, fmin , 1.0, 1.0, transpalette);
|
||||
shadow2.pushRotateZoom(px+4, py+4, fsec , 1.0, 1.0, transpalette);
|
||||
needle1.pushRotateZoom( fhour, 1.0, 0.7, transpalette); // 針を描画する
|
||||
needle1.pushRotateZoom( fmin , 1.0, 1.0, transpalette);
|
||||
needle2.pushRotateZoom( fsec , 1.0, 1.0, transpalette);
|
||||
|
||||
canvas.pushRotateZoom(0, zoom, zoom, transpalette); // 完了した時計盤をLCDに描画する
|
||||
lcd.display();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static uint32_t p_milli = 0;
|
||||
uint32_t milli = lgfx::millis() % 1000;
|
||||
if (p_milli > milli) count += 1000 + (milli - p_milli);
|
||||
else count += (milli - p_milli);
|
||||
p_milli = milli;
|
||||
|
||||
int32_t tmp = (count % 1000) >> 3;
|
||||
canvas.setPaletteColor(8, 255 - (tmp>>1), 255 - (tmp>>1), 200 - tmp); // 秒針の描画色を変化させる
|
||||
//count += 60000;
|
||||
if ( count > oneday ) { count -= oneday; }
|
||||
drawClock(count);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite _sprites[2];
|
||||
|
||||
struct ball_info_t {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t dx;
|
||||
int32_t dy;
|
||||
int32_t r;
|
||||
int32_t m;
|
||||
uint32_t color;
|
||||
};
|
||||
|
||||
static constexpr std::uint32_t SHIFTSIZE = 8;
|
||||
static constexpr std::uint32_t BALL_MAX = 256;
|
||||
|
||||
static ball_info_t _balls[2][BALL_MAX];
|
||||
static std::uint32_t _ball_count = 0, _fps = 0;
|
||||
static std::uint32_t ball_count = 0;
|
||||
static std::uint32_t sec, psec;
|
||||
static std::uint32_t fps = 0, frame_count = 0;
|
||||
|
||||
static std::uint32_t _width;
|
||||
static std::uint32_t _height;
|
||||
|
||||
volatile bool _is_running;
|
||||
volatile std::uint32_t _draw_count;
|
||||
volatile std::uint32_t _loop_count;
|
||||
|
||||
static void diffDraw(LGFX_Sprite* sp0, LGFX_Sprite* sp1)
|
||||
{
|
||||
union
|
||||
{
|
||||
std::uint32_t* s32;
|
||||
std::uint8_t* s;
|
||||
};
|
||||
union
|
||||
{
|
||||
std::uint32_t* p32;
|
||||
std::uint8_t* p;
|
||||
};
|
||||
s32 = (std::uint32_t*)sp0->getBuffer();
|
||||
p32 = (std::uint32_t*)sp1->getBuffer();
|
||||
|
||||
auto width = sp0->width();
|
||||
auto height = sp0->height();
|
||||
|
||||
auto w32 = (width+3) >> 2;
|
||||
std::int32_t y = 0;
|
||||
do
|
||||
{
|
||||
std::int32_t x32 = 0;
|
||||
do
|
||||
{
|
||||
while (s32[x32] == p32[x32] && ++x32 < w32);
|
||||
if (x32 == w32) break;
|
||||
|
||||
std::int32_t xs = x32 << 2;
|
||||
while (s[xs] == p[xs]) ++xs;
|
||||
|
||||
while (++x32 < w32 && s32[x32] != p32[x32]);
|
||||
|
||||
std::int32_t xe = (x32 << 2) - 1;
|
||||
if (xe >= width) xe = width - 1;
|
||||
while (s[xe] == p[xe]) --xe;
|
||||
|
||||
lcd.pushImage(xs, y, xe - xs + 1, 1, &s[xs]);
|
||||
} while (x32 < w32);
|
||||
s32 += w32;
|
||||
p32 += w32;
|
||||
} while (++y < height);
|
||||
lcd.display();
|
||||
}
|
||||
|
||||
static void drawfunc(void)
|
||||
{
|
||||
ball_info_t *balls;
|
||||
ball_info_t *a;
|
||||
LGFX_Sprite *sprite;
|
||||
|
||||
auto width = _sprites[0].width();
|
||||
auto height = _sprites[0].height();
|
||||
|
||||
std::size_t flip = _draw_count & 1;
|
||||
balls = &_balls[flip][0];
|
||||
|
||||
sprite = &(_sprites[flip]);
|
||||
sprite->clear();
|
||||
|
||||
for (int32_t i = 8; i < width; i += 16) {
|
||||
sprite->drawFastVLine(i, 0, height, 0x1F);
|
||||
}
|
||||
for (int32_t i = 8; i < height; i += 16) {
|
||||
sprite->drawFastHLine(0, i, width, 0x1F);
|
||||
}
|
||||
for (std::uint32_t i = 0; i < _ball_count; i++) {
|
||||
a = &balls[i];
|
||||
sprite->fillCircle( a->x >> SHIFTSIZE
|
||||
, a->y >> SHIFTSIZE
|
||||
, a->r >> SHIFTSIZE
|
||||
, a->color);
|
||||
}
|
||||
|
||||
sprite->setCursor(1,1);
|
||||
sprite->setTextColor(TFT_BLACK);
|
||||
sprite->printf("obj:%d fps:%d", _ball_count, _fps);
|
||||
sprite->setCursor(0,0);
|
||||
sprite->setTextColor(TFT_WHITE);
|
||||
sprite->printf("obj:%d fps:%d", _ball_count, _fps);
|
||||
diffDraw(&_sprites[flip], &_sprites[!flip]);
|
||||
++_draw_count;
|
||||
}
|
||||
|
||||
static void mainfunc(void)
|
||||
{
|
||||
static constexpr float e = 0.999; // Coefficient of friction
|
||||
|
||||
sec = lgfx::millis() / 1000;
|
||||
if (psec != sec) {
|
||||
psec = sec;
|
||||
fps = frame_count;
|
||||
frame_count = 0;
|
||||
|
||||
if (++ball_count >= BALL_MAX) { ball_count = 1; }
|
||||
auto a = &_balls[_loop_count & 1][ball_count - 1];
|
||||
a->color = lgfx::color888(100+(rand()%155), 100+(rand()%155), 100+(rand()%155));
|
||||
a->x = 0;
|
||||
a->y = 0;
|
||||
a->dx = (rand() & (3 << SHIFTSIZE)) + 1;
|
||||
a->dy = (rand() & (3 << SHIFTSIZE)) + 1;
|
||||
a->r = (4 + (ball_count & 0x07)) << SHIFTSIZE;
|
||||
a->m = 4 + (ball_count & 0x07);
|
||||
#if defined (ESP32) || defined (CONFIG_IDF_TARGET_ESP32) || defined (ESP_PLATFORM)
|
||||
vTaskDelay(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
frame_count++;
|
||||
_loop_count++;
|
||||
|
||||
ball_info_t *a, *b, *balls;
|
||||
int32_t rr, len, vx2vy2;
|
||||
float vx, vy, distance, t;
|
||||
|
||||
size_t f = _loop_count & 1;
|
||||
balls = a = &_balls[f][0];
|
||||
b = &_balls[!f][0];
|
||||
memcpy(a, b, sizeof(ball_info_t) * ball_count);
|
||||
|
||||
for (int i = 0; i != ball_count; i++) {
|
||||
a = &balls[i];
|
||||
// a->dy += 4; // gravity
|
||||
|
||||
a->x += a->dx;
|
||||
if (a->x < a->r) {
|
||||
a->x = a->r;
|
||||
if (a->dx < 0) a->dx = - a->dx*e;
|
||||
} else if (a->x >= _width - a->r) {
|
||||
a->x = _width - a->r -1;
|
||||
if (a->dx > 0) a->dx = - a->dx*e;
|
||||
}
|
||||
a->y += a->dy;
|
||||
if (a->y < a->r) {
|
||||
a->y = a->r;
|
||||
if (a->dy < 0) a->dy = - a->dy*e;
|
||||
} else if (a->y >= _height - a->r) {
|
||||
a->y = _height - a->r -1;
|
||||
if (a->dy > 0) a->dy = - a->dy*e;
|
||||
}
|
||||
for (int j = i + 1; j != ball_count; j++) {
|
||||
b = &balls[j];
|
||||
|
||||
rr = a->r + b->r;
|
||||
vx = a->x - b->x;
|
||||
if (abs(vx) > rr) continue;
|
||||
vy = a->y - b->y;
|
||||
if (abs(vy) > rr) continue;
|
||||
|
||||
len = sqrt(vx * vx + vy * vy);
|
||||
if (len >= rr) continue;
|
||||
if (len == 0.0) continue;
|
||||
distance = (rr - len) >> 1;
|
||||
vx *= distance / len;
|
||||
vy *= distance / len;
|
||||
|
||||
a->x += vx;
|
||||
b->x -= vx;
|
||||
vx = b->x - a->x;
|
||||
|
||||
a->y += vy;
|
||||
b->y -= vy;
|
||||
vy = b->y - a->y;
|
||||
|
||||
vx2vy2 = vx * vx + vy * vy;
|
||||
|
||||
t = -(vx * a->dx + vy * a->dy) / vx2vy2;
|
||||
float arx = a->dx + vx * t;
|
||||
float ary = a->dy + vy * t;
|
||||
|
||||
t = -(-vy * a->dx + vx * a->dy) / vx2vy2;
|
||||
float amx = a->dx - vy * t;
|
||||
float amy = a->dy + vx * t;
|
||||
|
||||
t = -(vx * b->dx + vy * b->dy) / vx2vy2;
|
||||
float brx = b->dx + vx * t;
|
||||
float bry = b->dy + vy * t;
|
||||
|
||||
t = -(-vy * b->dx + vx * b->dy) / vx2vy2;
|
||||
float bmx = b->dx - vy * t;
|
||||
float bmy = b->dy + vx * t;
|
||||
|
||||
float adx = (a->m * amx + b->m * bmx + bmx * e * b->m - amx * e * b->m) / (a->m + b->m);
|
||||
float bdx = - e * (bmx - amx) + adx;
|
||||
float ady = (a->m * amy + b->m * bmy + bmy * e * b->m - amy * e * b->m) / (a->m + b->m);
|
||||
float bdy = - e * (bmy - amy) + ady;
|
||||
|
||||
a->dx = roundf(adx + arx);
|
||||
a->dy = roundf(ady + ary);
|
||||
b->dx = roundf(bdx + brx);
|
||||
b->dy = roundf(bdy + bry);
|
||||
}
|
||||
}
|
||||
|
||||
_fps = fps;
|
||||
_ball_count = ball_count;
|
||||
}
|
||||
|
||||
#if defined (ESP32) || defined (CONFIG_IDF_TARGET_ESP32) || defined (ESP_PLATFORM)
|
||||
static void taskDraw(void*)
|
||||
{
|
||||
while ( _is_running )
|
||||
{
|
||||
while (_loop_count == _draw_count) { taskYIELD(); }
|
||||
drawfunc();
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.begin();
|
||||
lcd.startWrite();
|
||||
lcd.setColorDepth(8);
|
||||
if (lcd.width() < lcd.height()) lcd.setRotation(lcd.getRotation() ^ 1);
|
||||
|
||||
auto lcd_width = lcd.width();
|
||||
auto lcd_height = lcd.height();
|
||||
|
||||
for (std::uint32_t i = 0; i < 2; ++i)
|
||||
{
|
||||
_sprites[i].setTextSize(2);
|
||||
_sprites[i].setColorDepth(8);
|
||||
}
|
||||
|
||||
bool fail = false;
|
||||
for (std::uint32_t i = 0; !fail && i < 2; ++i)
|
||||
{
|
||||
fail = !_sprites[i].createSprite(lcd_width, lcd_height);
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
fail = false;
|
||||
for (std::uint32_t i = 0; !fail && i < 2; ++i)
|
||||
{
|
||||
_sprites[i].setPsram(true);
|
||||
fail = !_sprites[i].createSprite(lcd_width, lcd_height);
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
fail = false;
|
||||
if (lcd_width > 320) lcd_width = 320;
|
||||
if (lcd_height > 240) lcd_height = 240;
|
||||
|
||||
for (std::uint32_t i = 0; !fail && i < 2; ++i)
|
||||
{
|
||||
_sprites[i].setPsram(true);
|
||||
fail = !_sprites[i].createSprite(lcd_width, lcd_height);
|
||||
}
|
||||
if (fail)
|
||||
{
|
||||
lcd.print("createSprite fail...");
|
||||
lgfx::delay(3000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_width = lcd_width << SHIFTSIZE;
|
||||
_height = lcd_height << SHIFTSIZE;
|
||||
|
||||
for (std::uint32_t i = 0; i < ball_count; ++i)
|
||||
{
|
||||
auto a = &_balls[_loop_count & 1][i];
|
||||
a->color = lgfx::color888(100+(rand()%155), 100+(rand()%155), 100+(rand()%155));
|
||||
a->x = 0;
|
||||
a->y = 0;
|
||||
a->dx = (rand() & (3 << SHIFTSIZE)) + 1;
|
||||
a->dy = (rand() & (3 << SHIFTSIZE)) + 1;
|
||||
a->r = (4 + (i & 0x07)) << SHIFTSIZE;
|
||||
a->m = 4 + (i & 0x07);
|
||||
}
|
||||
|
||||
_is_running = true;
|
||||
_draw_count = 0;
|
||||
_loop_count = 0;
|
||||
|
||||
#if defined (CONFIG_IDF_TARGET_ESP32)
|
||||
xTaskCreate(taskDraw, "taskDraw", 2048, NULL, 0, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
mainfunc();
|
||||
#if defined (CONFIG_IDF_TARGET_ESP32)
|
||||
while (_loop_count != _draw_count) { taskYIELD(); }
|
||||
#else
|
||||
drawfunc();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#include "image320x240x16.h"
|
||||
#include "image480x320x8.h"
|
||||
#include "image640x480x4.h"
|
||||
#include "image1280x960x1.h"
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite sprite;
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
if (lcd.width() < lcd.height()) { lcd.setRotation(lcd.getRotation() ^ 1); }
|
||||
|
||||
// setBufferを使用することで、予め用意されたデータを用いてスプライトを使用できるようにする。
|
||||
sprite.setBuffer(const_cast<std::uint8_t*>(image320x240x16), 320, 240, 16);
|
||||
// sprite.setBuffer(const_cast<std::uint8_t*>(image480x320x8), 480, 320, 8);
|
||||
// sprite.setBuffer(const_cast<std::uint8_t*>(image640x480x4), 640, 480, 4);
|
||||
// sprite.setBuffer(const_cast<std::uint8_t*>(image1280x960x1), 1280, 960, 1);
|
||||
// sprite.createPalette();
|
||||
|
||||
// ※ 本来const(書換不可能)なデータをconst_castにより非constと偽って使用しています。
|
||||
// このため、このスプライトに対して描画を行うとプログラムはクラッシュします。
|
||||
// LCDや他のスプライトに描画する関数など、読出しを行う関数のみが使用できます。
|
||||
// OK) sprite.pushSprite
|
||||
// OK) sprite.pushRotated
|
||||
// OK) sprite.pushRotateZoom
|
||||
// OK) sprite.readRect
|
||||
// NG) sprite.drawPixel
|
||||
// NG) sprite.fillRect
|
||||
// NG) sprite.scroll
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static std::uint32_t count;
|
||||
if (++count == 360) count = 0;
|
||||
float zoom = (((float)count) / 200) + 0.1;
|
||||
sprite.pushRotateZoom(&lcd, lcd.width() >> 1, lcd.height() >> 1, count, zoom, zoom);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite canvas(&lcd); // オフスクリーン描画用バッファ
|
||||
static LGFX_Sprite base(&canvas); // 文字盤パーツ
|
||||
static LGFX_Sprite needle(&canvas); // 針パーツ
|
||||
|
||||
static int32_t width = 239; // 画像サイズ
|
||||
static int32_t halfwidth = width >> 1; // 中心座標
|
||||
static auto transpalette = 0; // 透過色パレット番号
|
||||
static float zoom; // 表示倍率
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
int lw = std::min(lcd.width(), lcd.height());
|
||||
|
||||
zoom = (float)lw / width; // 表示が画面にフィットするよう倍率を調整
|
||||
|
||||
int px = lcd.width() >> 1;
|
||||
int py = lcd.height() >> 1;
|
||||
lcd.setPivot(px, py); // 描画時の中心を画面中心に合わせる
|
||||
|
||||
lcd.setColorDepth(24);
|
||||
for (int i = 0; i < 180; i+=2) { // 外周を描画する
|
||||
lcd.setColor(lcd.color888(i*1.4,i*1.4+2,i*1.4+4));
|
||||
lcd.fillArc(px, py, (lw>>1) , (lw>>1)-zoom*3, 90+i, 92+i);
|
||||
lcd.fillArc(px, py, (lw>>1) , (lw>>1)-zoom*3, 88-i, 90-i);
|
||||
}
|
||||
for (int i = 0; i < 180; i+=2) { // 外周を描画する
|
||||
lcd.setColor(lcd.color888(i*1.4,i*1.4+2,i*1.4+4));
|
||||
lcd.fillArc(px, py, (lw>>1)-zoom*4, (lw>>1)-zoom*7, 270+i, 272+i);
|
||||
lcd.fillArc(px, py, (lw>>1)-zoom*4, (lw>>1)-zoom*7, 268-i, 270-i);
|
||||
}
|
||||
lcd.setColorDepth(16);
|
||||
|
||||
canvas.setColorDepth(lgfx::palette_2bit); // 各部品を2ビットパレットモードで準備する
|
||||
base .setColorDepth(lgfx::palette_2bit);
|
||||
needle.setColorDepth(lgfx::palette_2bit);
|
||||
|
||||
canvas.createSprite(width, width); // メモリ確保
|
||||
base .createSprite(width, width);
|
||||
needle.createSprite(3, 11);
|
||||
|
||||
base.setFont(&fonts::Orbitron_Light_24); // フォント種類を変更(盤の文字用)
|
||||
//base.setFont(&fonts::Roboto_Thin_24); // フォント種類を変更(盤の文字用)
|
||||
|
||||
base.setTextDatum(lgfx::middle_center);
|
||||
|
||||
base.fillCircle(halfwidth, halfwidth, halfwidth - 8, 1);
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 10, halfwidth - 11, 135, 45, 3);
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 20, halfwidth - 23, 2, 43, 2);
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 20, halfwidth - 23, 317, 358, 2);
|
||||
base.setTextColor(3);
|
||||
|
||||
for (int i = -5; i <= 25; ++i) {
|
||||
bool flg = 0 == (i % 5); // 5目盛り毎フラグ
|
||||
if (flg) {
|
||||
// 大きい目盛り描画
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 10, halfwidth - 24, 179.8 + i*9, 180.2 + i*9, 3);
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 10, halfwidth - 20, 179.4 + i*9, 180.6 + i*9, 3);
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 10, halfwidth - 14, 179 + i*9, 181 + i*9, 3);
|
||||
float rad = i * 9 * 0.0174532925;
|
||||
float ty = - sin(rad) * (halfwidth * 10 / 15);
|
||||
float tx = - cos(rad) * (halfwidth * 10 / 17);
|
||||
base.drawFloat((float)i/10, 1, halfwidth + tx, halfwidth + ty); // 数値描画
|
||||
} else {
|
||||
// 小さい目盛り描画
|
||||
base.fillArc(halfwidth, halfwidth, halfwidth - 10, halfwidth - 17, 179.5 + i*9, 180.5 + i*9, 3);
|
||||
}
|
||||
}
|
||||
|
||||
needle.setPivot(1, 9); // 針パーツの回転中心座標を設定する
|
||||
needle.drawRect(0, 0, 3, 11, 2);
|
||||
|
||||
canvas.setPaletteColor(1, 0, 0, 15);
|
||||
canvas.setPaletteColor(2, 255, 31, 31);
|
||||
canvas.setPaletteColor(3, 255, 255, 191);
|
||||
|
||||
lcd.startWrite();
|
||||
}
|
||||
|
||||
|
||||
void draw(float value)
|
||||
{
|
||||
base.pushSprite(0, 0); // 描画用バッファに盤の画像を上書き
|
||||
|
||||
float angle = 270 + value * 90.0;
|
||||
needle.pushRotateZoom( angle, 3.0, 10.0, transpalette); // 針をバッファに描画する
|
||||
canvas.fillCircle(halfwidth, halfwidth, 7, 3);
|
||||
canvas.pushRotateZoom(0, zoom, zoom, transpalette); // 完了した盤をLCDに描画する
|
||||
if (value >= 1.5)
|
||||
lcd.fillCircle(lcd.width()>>1, (lcd.height()>>1) + width * 4/10, 5, 0x007FFFU);
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
float value = 0;
|
||||
do {
|
||||
draw(value);
|
||||
} while (1.9 > (value += 0.005 + value * 0.05));
|
||||
do {
|
||||
draw(value);
|
||||
} while (-0.5 < (value -= 0.1));
|
||||
do {
|
||||
draw(value);
|
||||
} while (0.0 > (value += 0.05));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#define LGFX_AUTODETECT
|
||||
#include <LGFX_AUTODETECT.hpp> // クラス"LGFX"を準備します
|
||||
// #include <lgfx_user/LGFX_ESP32_sample.hpp> // またはユーザ自身が用意したLGFXクラスを準備します
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
static std::uint32_t sec, psec;
|
||||
static std::uint32_t fps = 0, frame_count = 0;
|
||||
static std::int32_t lcd_width ;
|
||||
static std::int32_t lcd_height;
|
||||
|
||||
struct obj_info_t {
|
||||
std::int32_t x;
|
||||
std::int32_t y;
|
||||
std::int32_t r;
|
||||
std::int32_t dx;
|
||||
std::int32_t dy;
|
||||
std::uint32_t color;
|
||||
|
||||
void move()
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
if (x < 0) {
|
||||
x = 0;
|
||||
if (dx < 0) dx = - dx;
|
||||
} else if (x >= lcd_width) {
|
||||
x = lcd_width -1;
|
||||
if (dx > 0) dx = - dx;
|
||||
}
|
||||
if (y < 0) {
|
||||
y = 0;
|
||||
if (dy < 0) dy = - dy;
|
||||
} else if (y >= lcd_height) {
|
||||
y = lcd_height - 1;
|
||||
if (dy > 0) dy = - dy;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr std::uint32_t obj_count = 200;
|
||||
static obj_info_t objects[obj_count];
|
||||
|
||||
static LGFX_Sprite sprites[2];
|
||||
static int_fast16_t sprite_height;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
if (lcd.width() < lcd.height())
|
||||
{
|
||||
lcd.setRotation(lcd.getRotation() ^ 1);
|
||||
}
|
||||
lcd_width = lcd.width();
|
||||
lcd_height = lcd.height();
|
||||
obj_info_t *a;
|
||||
for (std::uint32_t i = 0; i < obj_count; ++i) {
|
||||
a = &objects[i];
|
||||
a->color = (uint32_t)rand() | 0x808080U;
|
||||
a->x = rand() % lcd_width;
|
||||
a->y = rand() % lcd_height;
|
||||
a->dx = ((rand() & 3) + 1) * (i & 1 ? 1 : -1);
|
||||
a->dy = ((rand() & 3) + 1) * (i & 2 ? 1 : -1);
|
||||
a->r = 8 + (i & 0x07);
|
||||
}
|
||||
|
||||
uint32_t div = 2;
|
||||
for (;;) {
|
||||
sprite_height = (lcd_height + div - 1) / div;
|
||||
bool fail = false;
|
||||
for (std::uint32_t i = 0; !fail && i < 2; ++i)
|
||||
{
|
||||
sprites[i].setColorDepth(lcd.getColorDepth());
|
||||
sprites[i].setFont(&fonts::Font2);
|
||||
fail = !sprites[i].createSprite(lcd_width, sprite_height);
|
||||
}
|
||||
if (!fail) break;
|
||||
for (std::uint32_t i = 0; i < 2; ++i)
|
||||
{
|
||||
sprites[i].deleteSprite();
|
||||
}
|
||||
++div;
|
||||
}
|
||||
lcd.startWrite();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static std::uint_fast8_t flip = 0;
|
||||
|
||||
obj_info_t *a;
|
||||
for (std::uint32_t i = 0; i != obj_count; i++) {
|
||||
objects[i].move();
|
||||
}
|
||||
for (std::int32_t y = 0; y < lcd_height; y += sprite_height) {
|
||||
flip = flip ? 0 : 1;
|
||||
sprites[flip].clear();
|
||||
for (std::uint32_t i = 0; i != obj_count; i++) {
|
||||
a = &objects[i];
|
||||
if (( a->y + a->r >= y ) && ( a->y - a->r <= y + sprite_height ))
|
||||
sprites[flip].drawCircle(a->x, a->y - y, a->r, a->color);
|
||||
}
|
||||
|
||||
if (y == 0) {
|
||||
sprites[flip].setCursor(1,1);
|
||||
sprites[flip].setTextColor(TFT_BLACK);
|
||||
sprites[flip].printf("obj:%d fps:%d", obj_count, fps);
|
||||
sprites[flip].setCursor(0,0);
|
||||
sprites[flip].setTextColor(TFT_WHITE);
|
||||
sprites[flip].printf("obj:%d fps:%d", obj_count, fps);
|
||||
}
|
||||
sprites[flip].pushSprite(&lcd, 0, y);
|
||||
}
|
||||
lcd.display();
|
||||
|
||||
++frame_count;
|
||||
sec = lgfx::millis() / 1000;
|
||||
if (psec != sec) {
|
||||
psec = sec;
|
||||
fps = frame_count;
|
||||
frame_count = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#define LGFX_AUTODETECT
|
||||
#include <LGFX_AUTODETECT.hpp> // クラス"LGFX"を準備します
|
||||
// #include <lgfx_user/LGFX_ESP32_sample.hpp> // またはユーザ自身が用意したLGFXクラスを準備します
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
extern const unsigned short info[];
|
||||
extern const unsigned short alert[];
|
||||
extern const unsigned short closeX[];
|
||||
|
||||
static constexpr unsigned short infoWidth = 32;
|
||||
static constexpr unsigned short infoHeight = 32;
|
||||
|
||||
static constexpr unsigned short alertWidth = 32;
|
||||
static constexpr unsigned short alertHeight = 32;
|
||||
|
||||
static constexpr unsigned short closeWidth = 32;
|
||||
static constexpr unsigned short closeHeight = 32;
|
||||
|
||||
|
||||
static uint32_t sec, psec;
|
||||
static size_t fps = 0, frame_count = 0;
|
||||
static uint32_t lcd_width ;
|
||||
static uint32_t lcd_height;
|
||||
|
||||
struct obj_info_t {
|
||||
int_fast16_t x;
|
||||
int_fast16_t y;
|
||||
int_fast16_t dx;
|
||||
int_fast16_t dy;
|
||||
int_fast8_t img;
|
||||
float r;
|
||||
float z;
|
||||
float dr;
|
||||
float dz;
|
||||
|
||||
void move()
|
||||
{
|
||||
r += dr;
|
||||
x += dx;
|
||||
if (x < 0) {
|
||||
x = 0;
|
||||
if (dx < 0) dx = - dx;
|
||||
} else if (x >= lcd_width) {
|
||||
x = lcd_width -1;
|
||||
if (dx > 0) dx = - dx;
|
||||
}
|
||||
y += dy;
|
||||
if (y < 0) {
|
||||
y = 0;
|
||||
if (dy < 0) dy = - dy;
|
||||
} else if (y >= lcd_height) {
|
||||
y = lcd_height - 1;
|
||||
if (dy > 0) dy = - dy;
|
||||
}
|
||||
z += dz;
|
||||
if (z < .5) {
|
||||
z = .5;
|
||||
if (dz < .0) dz = - dz;
|
||||
} else if (z >= 2.0) {
|
||||
z = 2.0;
|
||||
if (dz > .0) dz = - dz;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr size_t obj_count = 50;
|
||||
static obj_info_t objects[obj_count];
|
||||
|
||||
static LGFX_Sprite sprites[2];
|
||||
static LGFX_Sprite icons[3];
|
||||
static int_fast16_t sprite_height;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
if (lcd.width() < lcd.height())
|
||||
{
|
||||
lcd.setRotation(lcd.getRotation() ^ 1);
|
||||
}
|
||||
lcd_width = lcd.width();
|
||||
lcd_height = lcd.height();
|
||||
obj_info_t *a;
|
||||
for (size_t i = 0; i < obj_count; ++i) {
|
||||
a = &objects[i];
|
||||
a->img = i % 3;
|
||||
a->x = rand() % lcd_width;
|
||||
a->y = rand() % lcd_height;
|
||||
a->dx = ((rand() & 3) + 1) * (i & 1 ? 1 : -1);
|
||||
a->dy = ((rand() & 3) + 1) * (i & 2 ? 1 : -1);
|
||||
a->dr = ((rand() & 3) + 1) * (i & 2 ? 1 : -1);
|
||||
a->r = 0;
|
||||
a->z = (float)((rand() % 10)+10) / 10;
|
||||
a->dz = (float)((rand() % 10)+1) / 100;
|
||||
}
|
||||
|
||||
uint32_t div = 2;
|
||||
for (;;) {
|
||||
sprite_height = (lcd_height + div - 1) / div;
|
||||
bool fail = false;
|
||||
for (std::uint32_t i = 0; !fail && i < 2; ++i)
|
||||
{
|
||||
sprites[i].setColorDepth(lcd.getColorDepth());
|
||||
sprites[i].setFont(&fonts::Font2);
|
||||
fail = !sprites[i].createSprite(lcd_width, sprite_height);
|
||||
}
|
||||
if (!fail) break;
|
||||
for (std::uint32_t i = 0; i < 2; ++i)
|
||||
{
|
||||
sprites[i].deleteSprite();
|
||||
}
|
||||
++div;
|
||||
}
|
||||
|
||||
icons[0].createSprite(infoWidth, infoHeight);
|
||||
icons[1].createSprite(alertWidth, alertHeight);
|
||||
icons[2].createSprite(closeWidth, closeHeight);
|
||||
|
||||
icons[0].setSwapBytes(true);
|
||||
icons[1].setSwapBytes(true);
|
||||
icons[2].setSwapBytes(true);
|
||||
|
||||
icons[0].pushImage(0, 0, infoWidth, infoHeight, info);
|
||||
icons[1].pushImage(0, 0, alertWidth, alertHeight, alert);
|
||||
icons[2].pushImage(0, 0, closeWidth, closeHeight, closeX);
|
||||
|
||||
lcd.startWrite();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static uint8_t flip = 0;
|
||||
|
||||
obj_info_t *a;
|
||||
for (int i = 0; i != obj_count; i++) {
|
||||
objects[i].move();
|
||||
}
|
||||
for (int_fast16_t y = 0; y < lcd_height; y += sprite_height) {
|
||||
flip = flip ? 0 : 1;
|
||||
sprites[flip].clear();
|
||||
for (size_t i = 0; i != obj_count; i++) {
|
||||
a = &objects[i];
|
||||
icons[a->img].pushRotateZoom(&sprites[flip], a->x, a->y - y, a->r, a->z, a->z, 0);
|
||||
}
|
||||
|
||||
if (y == 0) {
|
||||
sprites[flip].setCursor(0,0);
|
||||
sprites[flip].setFont(&fonts::Font4);
|
||||
sprites[flip].setTextColor(0xFFFFFFU);
|
||||
sprites[flip].printf("obj:%d fps:%d", obj_count, fps);
|
||||
}
|
||||
sprites[flip].pushSprite(&lcd, 0, y);
|
||||
}
|
||||
lcd.display();
|
||||
|
||||
++frame_count;
|
||||
sec = lgfx::millis() / 1000;
|
||||
if (psec != sec) {
|
||||
psec = sec;
|
||||
fps = frame_count;
|
||||
frame_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr unsigned short info[1024] ={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0861,0x4A69,0x8C71,0xA514,0xBDF7,0xBDF7,0xA514,0x8C71,0x4A69,0x0861,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x39E7,0x9CF3,0xEF7D,0xF79E,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xFFDF,0xF79E,0xEF7D,0x9CF3,0x39E7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2965,0x9492,0xF79E,0xFFDF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFDF,0xF79E,0x9492,0x2965,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x630C,0xEF7D,0xFFDF,0xFFFF,0xFFFF,0xFFFF,0xD75F,0xB6BF,0x9E5F,0x963F,0x963F,0x9E5F,0xB6BF,0xD75F,0xFFFF,0xFFFF,0xFFFF,0xFFDF,0xEF7D,0x630C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x73AE,0xEF7D,0xFFDF,0xFFFF,0xFFDF,0xBEDF,0x7DBF,0x7DBF,0x7DDF,0x7DDF,0x7DDF,0x7DDF,0x7DDF,0x7DBF,0x759F,0x7DBE,0xBEBF,0xFFDF,0xFFFF,0xFFDF,0xEF7D,0x73AE,0x0000,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x630C,0xEF7D,0xFFFF,0xFFFF,0xE77F,0x7DBE,0x759E,0x759F,0x7DBF,0x7DDF,0x7DDF,0x85FF,0x7DDF,0x7DDF,0x7DBF,0x759F,0x759E,0x6D7E,0x7DBE,0xDF7F,0xFFFF,0xFFFF,0xEF7D,0x630C,0x0000,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x31A6,0xEF5D,0xFFDF,0xFFFF,0xCF1E,0x6D7E,0x6D7E,0x759E,0x759F,0x7DBF,0x7DDF,0x8E1F,0xBEDF,0xC6FF,0x8DFF,0x75BF,0x759F,0x759E,0x6D7E,0x655E,0x655D,0xCF1E,0xFFFF,0xFFDF,0xEF5D,0x31A6,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x0000,0x94B2,0xF7BE,0xFFFF,0xDF5E,0x655D,0x655D,0x6D7E,0x6D7E,0x759E,0x75BF,0x759F,0xEFBF,0xFFFF,0xFFFF,0xEFBF,0x759F,0x759E,0x6D7E,0x6D7E,0x655D,0x653D,0x653D,0xDF5E,0xFFFF,0xF7BE,0x94B2,0x0000,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x4228,0xEF7D,0xFFFF,0xF7BF,0x6D5D,0x653D,0x655D,0x6D5E,0x6D7E,0x759E,0x759E,0x85DF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8DFE,0x6D7E,0x6D7E,0x6D5E,0x655D,0x653D,0x5D1D,0x6D5D,0xF7BF,0xFFFF,0xEF7D,0x4228,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x0000,0xA534,0xFFDF,0xFFDF,0xA65D,0x5D1D,0x5D1D,0x653D,0x655E,0x6D7E,0x6D7E,0x6D7E,0x651E,0xE77F,0xFFFF,0xFFFF,0xF7BF,0x5CFE,0x6D7E,0x6D7E,0x655E,0x653D,0x5D1D,0x5D1D,0x54FC,0xA65D,0xFFDF,0xFFDF,0xA534,0x0000,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x18E3,0xEF5D,0xFFFF,0xEF9E,0x5CFC,0x54FC,0x5D1D,0x5D3D,0x653D,0x655E,0x6D7E,0x6D7E,0x653E,0x6D3E,0xB67E,0xBEBE,0x755E,0x5D1E,0x6D5E,0x655E,0x653D,0x5D3D,0x5D1D,0x54FC,0x54DC,0x54FC,0xEF9E,0xFFFF,0xEF5D,0x18E3,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x630C,0xEF7D,0xFFDF,0xB69D,0x54DC,0x54FC,0x5CFC,0x5D1D,0x653D,0x653D,0x655E,0x6D5E,0x655E,0x5CFE,0x4C9D,0x4C7D,0x54DD,0x653E,0x655E,0x653D,0x653D,0x5D1D,0x5CFC,0x54FC,0x54DC,0x4CBC,0xB69D,0xFFDF,0xEF7D,0x630C,0x0000, // row 12, 416 pixels
|
||||
0x0000,0x94B2,0xF7BE,0xFFDF,0x85BC,0x4CBC,0x54DC,0x54FC,0x5CFD,0x5D1D,0x5D3D,0x653D,0x655D,0x653D,0x85DE,0xC6FE,0xC6FE,0x85BE,0x653D,0x653D,0x5D3D,0x5D1D,0x5CFD,0x54FC,0x54DC,0x4CBC,0x4CBB,0x85BC,0xFFDF,0xF7BE,0x94B2,0x0000, // row 13, 448 pixels
|
||||
0x0000,0xB5B6,0xFFDF,0xF7BE,0x651C,0x4CBB,0x4CBC,0x54DC,0x54FC,0x5CFC,0x5D1D,0x5D1D,0x653D,0x5D1D,0xE77E,0xFFDF,0xFFDF,0xEF9E,0x5CFD,0x5D1D,0x5D1D,0x5CFC,0x54FC,0x54DC,0x4CBC,0x4CBB,0x449B,0x651B,0xF7BE,0xFFDF,0xB5B6,0x0000, // row 14, 480 pixels
|
||||
0x0000,0xC638,0xFFDF,0xF7BE,0x54DB,0x449B,0x4CBB,0x4CBC,0x54DC,0x54FC,0x54FC,0x5D1D,0x5D1D,0x7D7D,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x7D7D,0x5CFD,0x54FC,0x54FC,0x54DC,0x4CBC,0x4CBB,0x449B,0x447B,0x54BB,0xF7BE,0xFFDF,0xC638,0x0000, // row 15, 512 pixels
|
||||
0x0000,0xC638,0xFFDF,0xF79E,0x4CBB,0x449B,0x449B,0x4CBB,0x4CBC,0x54DC,0x54DC,0x54FC,0x54DC,0x753C,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x753C,0x54DC,0x54DC,0x54DC,0x4CBC,0x4CBB,0x449B,0x449B,0x3C7B,0x4C9B,0xF79E,0xFFDF,0xC638,0x0000, // row 16, 544 pixels
|
||||
0x0000,0xB5B6,0xFFDF,0xF7BE,0x5CFB,0x3C7B,0x447B,0x449B,0x4CBB,0x4CBC,0x4CBC,0x4CDC,0x4CBC,0x6D1C,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0x6CFC,0x4CBC,0x4CBC,0x4CBC,0x4CBB,0x449B,0x447B,0x3C7B,0x3C5A,0x54DB,0xF7BE,0xFFDF,0xB5B6,0x0000, // row 17, 576 pixels
|
||||
0x0000,0x94B2,0xF7BE,0xF7BE,0x755B,0x3C5A,0x3C7B,0x447B,0x449B,0x449B,0x4CBB,0x4CBB,0x4C9B,0x6CFB,0xF79E,0xF79E,0xF79E,0xF79E,0x64FB,0x449B,0x4CBB,0x449B,0x449B,0x447B,0x3C7B,0x3C5A,0x3C5A,0x753B,0xF7BE,0xF7BE,0x9CD3,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x6B4D,0xEF7D,0xF7BE,0xA61C,0x3C5A,0x3C5A,0x3C7B,0x447B,0x447B,0x449B,0x449B,0x447B,0x64DB,0xF79E,0xF79E,0xF79E,0xF79E,0x64DB,0x447B,0x449B,0x447B,0x447B,0x3C7B,0x3C5A,0x3C5A,0x343A,0xA61C,0xF7BE,0xEF7D,0x6B4D,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x2124,0xE71C,0xFFDF,0xDF3D,0x3C5A,0x343A,0x3C5A,0x3C5A,0x3C7B,0x3C7B,0x447B,0x3C5B,0x64BA,0xF79E,0xF79E,0xF79E,0xF79E,0x64BA,0x3C5B,0x3C7B,0x3C7B,0x3C5A,0x3C5A,0x343A,0x343A,0x343A,0xDF3D,0xFFDF,0xE71C,0x2124,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x0000,0xAD75,0xF7BE,0xF79E,0x859B,0x343A,0x343A,0x345A,0x3C5A,0x3C5A,0x3C5A,0x3C5A,0x5C9A,0xEF7D,0xEF7D,0xEF7D,0xEF7D,0x5C9A,0x3C3A,0x3C5A,0x3C5A,0x345A,0x343A,0x343A,0x341A,0x859B,0xF79E,0xF7BE,0xAD75,0x0000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x0000,0x528A,0xE71C,0xFFDF,0xDF3D,0x3C5A,0x343A,0x343A,0x343A,0x343A,0x3C5A,0x343A,0x4C5A,0xEF7D,0xEF7D,0xEF7D,0xEF7D,0x4C59,0x343A,0x343A,0x343A,0x343A,0x343A,0x341A,0x3C5A,0xDF3D,0xFFDF,0xE71C,0x528A,0x0000,0x0000, // row 22, 736 pixels
|
||||
0x0000,0x0000,0x0000,0x9CD3,0xF79E,0xF7BE,0xBE7C,0x3419,0x341A,0x341A,0x343A,0x343A,0x341A,0x2B99,0xC69C,0xEF7D,0xEF7D,0xD6DC,0x2398,0x341A,0x343A,0x341A,0x341A,0x2C19,0x2C19,0xBE7C,0xF7BE,0xF79E,0x9CD3,0x0000,0x0000,0x0000, // row 23, 768 pixels
|
||||
0x0000,0x0000,0x0000,0x39E7,0xDEDB,0xFFDF,0xF79E,0x9DFB,0x2C19,0x2C19,0x2C1A,0x341A,0x341A,0x2BB9,0x2B57,0x6459,0x74B9,0x2337,0x2BB9,0x341A,0x2C1A,0x2C19,0x2C19,0x2C19,0x9DFB,0xF79E,0xFFDF,0xDEDB,0x39E7,0x0000,0x0000,0x0000, // row 24, 800 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x632C,0xDEFB,0xFFDF,0xEF7D,0xB65C,0x3C39,0x2BF9,0x2C19,0x2C19,0x2BF9,0x2398,0x1B58,0x1B37,0x2398,0x2BF9,0x2C19,0x2BF9,0x2BF9,0x3439,0xB65C,0xEF7D,0xFFDF,0xDEFB,0x632C,0x0000,0x0000,0x0000,0x0000, // row 25, 832 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x73AE,0xDEFB,0xF7BE,0xF79E,0xDF1C,0x7D5A,0x2BF9,0x2BF9,0x2BF9,0x2BF9,0x23D9,0x23D9,0x2BF9,0x2BF9,0x2BF9,0x2BF9,0x7D5A,0xDF1C,0xF79E,0xF7BE,0xDEFB,0x73AE,0x0000,0x0000,0x0000,0x0000,0x0000, // row 26, 864 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x632C,0xDEDB,0xF79E,0xFFDF,0xEF7D,0xD6FC,0x9DFB,0x5CDA,0x4C9A,0x3419,0x3419,0x4C9A,0x5CDA,0x9DFB,0xD6FC,0xEF7D,0xFFDF,0xF79E,0xDEDB,0x632C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 27, 896 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4208,0x94B2,0xDEFB,0xF7BE,0xFFDF,0xF7BE,0xF79E,0xEF7D,0xEF5D,0xEF5D,0xEF7D,0xF79E,0xF7BE,0xFFDF,0xF7BE,0xDEFB,0x94B2,0x4208,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 28, 928 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x528A,0xA534,0xDEDB,0xE73C,0xF79E,0xF7BE,0xF7BE,0xF7BE,0xF7BE,0xF79E,0xE73C,0xDEDB,0xA534,0x528A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 29, 960 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x18C3,0x5AEB,0x8C71,0xAD55,0xBDD7,0xBDD7,0xAD55,0x8C71,0x5AEB,0x18C3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 30, 992 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; // row 31, 1024 pixels
|
||||
|
||||
constexpr unsigned short alert[1024] ={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0840,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1080,0xAC66,0xEDE8,0xFE69,0xC4C6,0x2901,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBCC6,0xFE68,0xFE68,0xFE6A,0xFE68,0xEDE8,0x18A1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8344,0xFE48,0xFE8C,0xFFDD,0xFFFF,0xFEF0,0xFE48,0xB466,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1880,0xEDC7,0xFE48,0xFF99,0xFFBC,0xFF9B,0xFFBD,0xFE6A,0xFE48,0x5A23,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9BE5,0xFE28,0xFED0,0xFFBC,0xFF7A,0xFF9A,0xFF9B,0xFF35,0xFE28,0xBCA6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3962,0xFE28,0xFE28,0xFF9A,0xFF79,0xFF9A,0xFF9B,0xFF9A,0xFFBD,0xFE6B,0xFE28,0x72E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB465,0xFE28,0xFEF2,0xFF7A,0xFF79,0xFF7A,0xFF9A,0xFF7A,0xFF7A,0xFF78,0xFE28,0xDD67,0x0860,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5A22,0xFE07,0xFE29,0xFF9B,0xFF37,0xFF58,0xFF79,0xFF79,0xFF79,0xFF58,0xFF9B,0xFEAE,0xFE07,0x93A4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC4A5,0xFE07,0xFF15,0xFF37,0xFF36,0xAD11,0x2965,0x2965,0xCDF4,0xFF37,0xFF37,0xFF79,0xFE07,0xFE07,0x2901,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7B03,0xFDE7,0xFE4B,0xFF79,0xFEF4,0xFF15,0xB552,0x2945,0x2945,0xDE55,0xFF16,0xFF15,0xFF58,0xFED1,0xFDE7,0xAC25,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0840,0xDD26,0xFDE7,0xFF57,0xFED3,0xFED2,0xFEF4,0xBD93,0x2124,0x2124,0xDE75,0xFF14,0xFED3,0xFED3,0xFF7A,0xFE08,0xFDE7,0x49A2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x9BA4,0xFDC6,0xFE6E,0xFF36,0xFE90,0xFEB1,0xFED3,0xC592,0x2124,0x2124,0xE675,0xFED3,0xFEB2,0xFEB1,0xFEF3,0xFEF3,0xFDC6,0xBC45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 12, 416 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3141,0xF5C6,0xF5C7,0xFF58,0xFE90,0xFE6F,0xFE8F,0xFEB1,0xCDB2,0x2104,0x2104,0xF6B4,0xFEB1,0xFE90,0xFE8F,0xFE90,0xFF58,0xFE0A,0xF5C6,0x72A3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 13, 448 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xABE4,0xF5A6,0xFEB1,0xFED3,0xFE4E,0xFE6E,0xFE6F,0xFE90,0xD5F2,0x18E3,0x18E3,0xFED4,0xFE90,0xFE6F,0xFE6F,0xFE6E,0xFE91,0xFF36,0xF5A6,0xCCA5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 14, 480 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x5202,0xF5A6,0xF5C7,0xFF58,0xFE4D,0xFE4D,0xFE4D,0xFE4E,0xFE6F,0xDE11,0x18C3,0x18C3,0xFED3,0xFE6F,0xFE6E,0xFE4E,0xFE4D,0xFE4D,0xFF16,0xFE2C,0xF5A6,0x9363,0x0000,0x0000,0x0000,0x0000,0x0000, // row 15, 512 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0xBC44,0xF585,0xFED3,0xFE6F,0xFE2C,0xFE2C,0xFE2D,0xFE4D,0xFE4E,0xE630,0x10A2,0x2104,0xFED1,0xFE4E,0xFE4D,0xFE4D,0xFE2D,0xFE2C,0xFE4D,0xFF37,0xF586,0xF585,0x28E1,0x0000,0x0000,0x0000,0x0000, // row 16, 544 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x7282,0xF565,0xF5EA,0xFF16,0xFE0B,0xFE0B,0xFE0B,0xFE2C,0xFE2C,0xFE4D,0xF670,0x1082,0x2924,0xFEB0,0xFE2D,0xFE2C,0xFE2C,0xFE2C,0xFE0B,0xFE0B,0xFEB2,0xFE6F,0xF565,0xA383,0x0000,0x0000,0x0000,0x0000, // row 17, 576 pixels
|
||||
0x0000,0x0000,0x0000,0x0840,0xD4C4,0xF565,0xFEF5,0xFE0C,0xFDE9,0xFDEA,0xFE0A,0xFE0B,0xFE0B,0xFE2C,0xFE8F,0x0861,0x2964,0xFE8F,0xFE2C,0xFE0B,0xFE0B,0xFE0B,0xFE0A,0xFDEA,0xFE0B,0xFF37,0xF586,0xF565,0x4181,0x0000,0x0000,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x0000,0x0000,0x9343,0xF545,0xF60C,0xFED3,0xFDC8,0xFDC8,0xFDC9,0xFDE9,0xFDEA,0xFDEA,0xFE0B,0xFE8E,0x0861,0x3184,0xFE6D,0xFE0B,0xFE0A,0xFDEA,0xFDEA,0xFDE9,0xFDC9,0xFDC9,0xFE4E,0xFEB2,0xF545,0xB3E3,0x0000,0x0000,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x0000,0x28E0,0xF544,0xF545,0xFF17,0xFDC8,0xFDA7,0xFDA7,0xFDC8,0xFDC8,0xFDC9,0xFDC9,0xFDE9,0xFE6C,0x10A2,0x39C4,0xFE4C,0xFDEA,0xFDE9,0xFDC9,0xFDC9,0xFDC8,0xFDC8,0xFDA7,0xFDA8,0xFF16,0xF588,0xF544,0x6222,0x0000,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x0000,0xA383,0xF524,0xF64E,0xFE4E,0xFD86,0xFD86,0xFD87,0xFDA7,0xFDA7,0xFDA8,0xFDC8,0xFDC8,0xFE2A,0xA469,0xB4EA,0xFE2A,0xFDC9,0xFDC8,0xFDC8,0xFDA8,0xFDA7,0xFDA7,0xFD87,0xFD86,0xFDEA,0xFED3,0xF524,0xC443,0x0000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x51C1,0xF504,0xF546,0xFF16,0xF565,0xFD65,0xFD65,0xFD86,0xFD86,0xFD86,0xFDA7,0xFDA7,0xFDA7,0xFDE8,0xFE6A,0xFE4A,0xFDE8,0xFDA7,0xFDA7,0xFDA7,0xFDA7,0xFD86,0xFD86,0xFD86,0xFD65,0xFD65,0xFEB2,0xF5CA,0xF504,0x8AE2,0x0000, // row 22, 736 pixels
|
||||
0x0000,0xB3A2,0xED03,0xFE92,0xFDC9,0xF543,0xF544,0xFD44,0xFD65,0xFD65,0xFD65,0xFD86,0xFD86,0xFD86,0xFDA7,0xFDC7,0xFDC7,0xFDA7,0xFD86,0xFD86,0xFD86,0xFD86,0xFD65,0xFD65,0xFD65,0xFD44,0xF544,0xFD86,0xFEF5,0xED03,0xE4C3,0x1880, // row 23, 768 pixels
|
||||
0x7241,0xECE3,0xF567,0xFED3,0xF523,0xF523,0xF523,0xF543,0xF544,0xF544,0xFD65,0xFD65,0xFD65,0xFD65,0xD4E6,0x39C5,0x39A5,0xD4E6,0xFD86,0xFD65,0xFD65,0xFD65,0xFD65,0xF544,0xF544,0xF543,0xF523,0xF523,0xFE2E,0xF5EC,0xECE3,0x9B42, // row 24, 800 pixels
|
||||
0xD443,0xECE3,0xFED4,0xF565,0xF502,0xF502,0xF522,0xF523,0xF523,0xF543,0xF544,0xF544,0xF544,0xFD65,0x8B64,0x18C3,0x18C3,0x8344,0xFD85,0xFD44,0xF544,0xF544,0xF544,0xF543,0xF523,0xF523,0xF522,0xF502,0xF523,0xFEF5,0xED04,0xECE3, // row 25, 832 pixels
|
||||
0xECC3,0xF5AB,0xFE6F,0xF501,0xF4E1,0xF501,0xF502,0xF502,0xF522,0xF522,0xF523,0xF523,0xF523,0xFD84,0xC504,0x20E1,0x18E1,0xC4E4,0xFD84,0xF543,0xF523,0xF523,0xF523,0xF522,0xF522,0xF502,0xF502,0xF501,0xF501,0xFDC9,0xF62F,0xECC3, // row 26, 864 pixels
|
||||
0xECC2,0xFE92,0xF523,0xF4E0,0xF4E0,0xF4E1,0xF4E1,0xF501,0xF501,0xF502,0xF502,0xF522,0xF522,0xF543,0xFDE3,0xFEA5,0xF6A4,0xFE04,0xF543,0xF522,0xF522,0xF522,0xF502,0xF502,0xF501,0xF501,0xF4E1,0xF4E1,0xF4E0,0xF4E1,0xFED4,0xECC2, // row 27, 896 pixels
|
||||
0xECA2,0xF5EC,0xF4E0,0xF4C0,0xF4E0,0xF4E0,0xF4E0,0xF4E1,0xF4E1,0xF501,0xF501,0xF501,0xF502,0xF502,0xF542,0xFDA2,0xFDA2,0xF542,0xF502,0xF502,0xF502,0xF501,0xF501,0xF501,0xF4E1,0xF4E1,0xF4E0,0xF4E0,0xF4E0,0xF4C0,0xF5A9,0xECA2, // row 28, 928 pixels
|
||||
0xECA2,0xECA2,0xECC2,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4E1,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E2,0xF4E1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xF4C1,0xECC2,0xECC3,0xECA2, // row 29, 960 pixels
|
||||
0x8AC1,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0xEC82,0x9B01, // row 30, 992 pixels
|
||||
0x0000,0x1880,0x51A0,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x8AA1,0x61E0,0x28E0,0x0000}; // row 31, 1024 pixels
|
||||
|
||||
constexpr unsigned short closeX[1024] ={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x30C3,0x4124,0x61C7,0x61C7,0x4124,0x30E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 0, 32 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x48E3,0xA249,0xEB8E,0xFCB2,0xFD14,0xFD75,0xFD96,0xFD34,0xFCF3,0xEBEF,0xA28A,0x4904,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 1, 64 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x58E3,0xC228,0xFC10,0xFD34,0xFE18,0xFE59,0xFE79,0xFE9A,0xFE9A,0xFE9A,0xFE9A,0xFE59,0xFD75,0xFC51,0xC28A,0x5904,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 2, 96 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2041,0x8945,0xF34D,0xFD34,0xFDB6,0xFD75,0xFD55,0xFD55,0xFD96,0xFDD7,0xFDF7,0xFDF7,0xFDB6,0xFDB6,0xFDD7,0xFDF7,0xFD75,0xF38E,0x8965,0x2041,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 3, 128 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x4082,0xE208,0xF410,0xFD34,0xFC92,0xFBEF,0xFBAE,0xFBEF,0xFC71,0xFD14,0xFD75,0xFDB6,0xFD75,0xFD14,0xFC92,0xFC51,0xFC71,0xFCF3,0xFD75,0xFC30,0xEA28,0x40A2,0x0000,0x0000,0x0000,0x0000,0x0000, // row 4, 160 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x3861,0xE1E7,0xF451,0xFC92,0xFB4D,0xFA49,0xFA49,0xFAEB,0xFBAE,0xFC71,0xFD34,0xFDB6,0xFE18,0xFDB6,0xFD34,0xFC71,0xFBAE,0xFB0C,0xFAEB,0xFBAE,0xFCD3,0xFC71,0xE208,0x4082,0x0000,0x0000,0x0000,0x0000, // row 5, 192 pixels
|
||||
0x0000,0x0000,0x0000,0x1020,0xD986,0xF430,0xFC30,0xFA28,0xF924,0xF965,0xFA8A,0xFB0C,0xFBAE,0xFC51,0xFD14,0xFD75,0xFDB6,0xFD75,0xFD14,0xFC51,0xFC71,0xFBEF,0xFA28,0xF9C7,0xFA8A,0xFC51,0xF430,0xD9A6,0x1020,0x0000,0x0000,0x0000, // row 6, 224 pixels
|
||||
0x0000,0x0000,0x0000,0x78A2,0xEB6D,0xFC30,0xF9C7,0xF861,0xF8A2,0xFA08,0xFEDB,0xFD55,0xFB4D,0xFC10,0xFC92,0xFD14,0xFD34,0xFD14,0xFC92,0xFCB2,0xFF7D,0xFF7D,0xFB2C,0xF945,0xF8E3,0xF9E7,0xFC30,0xEB8E,0x78C3,0x0000,0x0000,0x0000, // row 7, 256 pixels
|
||||
0x0000,0x0000,0x3841,0xD9E7,0xF492,0xF208,0xF041,0xF800,0xF945,0xFE9A,0xFFFF,0xFFFF,0xFD75,0xFB8E,0xFC10,0xFC51,0xFC71,0xFC51,0xFCB2,0xFF7D,0xFFFF,0xFFFF,0xFF3C,0xFA8A,0xF882,0xF841,0xFA08,0xFC92,0xDA08,0x3841,0x0000,0x0000, // row 8, 288 pixels
|
||||
0x0000,0x0000,0x88A2,0xEBCF,0xF2EB,0xF061,0xF000,0xF8E3,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD75,0xFB4D,0xFBAE,0xFBAE,0xFC71,0xFF7D,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFEFB,0xFA28,0xF800,0xF061,0xF2EB,0xEBEF,0x90C3,0x0000,0x0000, // row 9, 320 pixels
|
||||
0x0000,0x2820,0xD1C7,0xF410,0xE945,0xE800,0xF000,0xFE9A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD34,0xFAEB,0xFBCF,0xFF5D,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF1C,0xF986,0xF000,0xF145,0xF410,0xD1E7,0x2820,0x0000, // row 10, 352 pixels
|
||||
0x0000,0x6841,0xDB2C,0xEACB,0xE041,0xE800,0xF000,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFD14,0xFF1C,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFBCF,0xF082,0xF000,0xE841,0xEACB,0xE34D,0x7061,0x0000, // row 11, 384 pixels
|
||||
0x0000,0x9861,0xE3CF,0xE186,0xE000,0xE800,0xE800,0xF145,0xFEDB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE986,0xEBCF,0xA082,0x0000, // row 12, 416 pixels
|
||||
0x0800,0xB8A2,0xE3AE,0xD8A2,0xD800,0xE000,0xE800,0xE800,0xF145,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE000,0xE0A2,0xEBAE,0xC0C3,0x0800, // row 13, 448 pixels
|
||||
0x1800,0xC124,0xE30C,0xD020,0xD800,0xE000,0xE000,0xE800,0xE800,0xF145,0xFEDB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB8E,0xF000,0xF000,0xE800,0xE800,0xE000,0xE000,0xD820,0xE30C,0xC124,0x1800, // row 14, 480 pixels
|
||||
0x2800,0xC165,0xDAAA,0xC800,0xD000,0xD800,0xE000,0xE000,0xE800,0xE800,0xF124,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFB6D,0xF000,0xF000,0xE800,0xE800,0xE000,0xE000,0xD800,0xD000,0xDAAA,0xC165,0x2800, // row 15, 512 pixels
|
||||
0x2000,0xB924,0xD269,0xC800,0xD000,0xD000,0xD800,0xE000,0xE000,0xE800,0xE924,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF36D,0xE800,0xE800,0xE800,0xE000,0xE000,0xD800,0xD000,0xD000,0xDA69,0xC145,0x2800, // row 16, 544 pixels
|
||||
0x1000,0xB0A2,0xD28A,0xC000,0xC800,0xD000,0xD000,0xD800,0xD800,0xE165,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF3AE,0xE000,0xE000,0xD800,0xD800,0xD000,0xD000,0xC800,0xD28A,0xB8C3,0x1000, // row 17, 576 pixels
|
||||
0x0000,0xA800,0xD2AA,0xB800,0xC000,0xC800,0xC800,0xD000,0xD965,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBAE,0xD800,0xD800,0xD000,0xC800,0xC800,0xC000,0xD2AA,0xB020,0x0000, // row 18, 608 pixels
|
||||
0x0000,0x8000,0xCA69,0xB841,0xB800,0xC000,0xC800,0xD186,0xFEFB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBCF,0xD000,0xC800,0xC800,0xC000,0xC041,0xCA69,0x8000,0x0000, // row 19, 640 pixels
|
||||
0x0000,0x4800,0xC1C7,0xB8E3,0xB800,0xB800,0xC000,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEBEF,0xFE79,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xE410,0xC841,0xC000,0xB800,0xC0E3,0xC1C7,0x4800,0x0000, // row 20, 672 pixels
|
||||
0x0000,0x1000,0xB061,0xC1E7,0xB000,0xB000,0xB800,0xD269,0xFFBE,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xE38E,0xD000,0xD965,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xDB0C,0xC020,0xB800,0xB000,0xC1E7,0xB061,0x1000,0x0000, // row 21, 704 pixels
|
||||
0x0000,0x0000,0x6000,0xB9C7,0xB061,0xB000,0xB000,0xB800,0xCA49,0xFF9E,0xFFFF,0xFFFF,0xFFFF,0xE38E,0xC800,0xC800,0xC800,0xD186,0xF69A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xDB0C,0xB800,0xB800,0xB000,0xB061,0xC1C7,0x6000,0x0000,0x0000, // row 22, 736 pixels
|
||||
0x0000,0x0000,0x1800,0xB041,0xB986,0xA800,0xA800,0xB000,0xB000,0xCA49,0xFF7D,0xFFFF,0xDB8E,0xC000,0xC000,0xC000,0xC000,0xC000,0xC986,0xF6DB,0xFFFF,0xFFFF,0xD30C,0xB800,0xB000,0xB000,0xA800,0xB986,0xB041,0x1800,0x0000,0x0000, // row 23, 768 pixels
|
||||
0x0000,0x0000,0x0000,0x5800,0xB0E3,0xA8C3,0xA800,0xA800,0xA800,0xB000,0xCACB,0xD38E,0xB000,0xB800,0xB800,0xB800,0xB800,0xB800,0xB800,0xC145,0xF6DB,0xD34D,0xB000,0xB000,0xA800,0xA800,0xB0C3,0xB0E3,0x5800,0x0000,0x0000,0x0000, // row 24, 800 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x6000,0xB124,0xA882,0xA000,0xA800,0xA800,0xA800,0xA800,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xB000,0xA800,0xA800,0xA800,0xA800,0xA882,0xB124,0x6000,0x0000,0x0000,0x0000,0x0000, // row 25, 832 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x6000,0xB104,0xA882,0xA000,0xA000,0xA000,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA800,0xA000,0xA000,0xA882,0xB104,0x6000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 26, 864 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6000,0xB0A2,0xA8C3,0xA020,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA000,0xA020,0xA8C3,0xB0A2,0x6000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 27, 896 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4800,0xA800,0xB0C3,0xA0A2,0x9800,0x9800,0x9800,0x9800,0xA000,0xA000,0xA000,0x9800,0x9800,0x9800,0xA082,0xB0E3,0xA800,0x4800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 28, 928 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x5800,0xA800,0xB0A2,0xA8E3,0xA0A2,0xA041,0x9800,0x9800,0xA041,0xA0A2,0xA8E3,0xB0A2,0xA800,0x5800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 29, 960 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3000,0x6000,0x8800,0xA000,0xA800,0xA800,0xA000,0x8800,0x6000,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // row 30, 992 pixels
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; // row 31, 1024 pixels
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite sprite(&lcd);
|
||||
|
||||
struct meter_t
|
||||
{
|
||||
int32_t pivot_x;
|
||||
int32_t pivot_y;
|
||||
|
||||
float angle = 0;
|
||||
float add = 0;
|
||||
|
||||
void advance(void)
|
||||
{
|
||||
if ((angle >= 256 && add > 0.0)
|
||||
|| (angle <= 0 && add < 0.0))
|
||||
{
|
||||
add = -add;
|
||||
}
|
||||
angle += add;
|
||||
}
|
||||
|
||||
void drawGauge(uint32_t color)
|
||||
{
|
||||
lcd.setPivot(pivot_x, pivot_y);
|
||||
sprite.setPaletteColor(1, color);
|
||||
sprite.pushRotated(angle - 127);
|
||||
advance();
|
||||
}
|
||||
};
|
||||
|
||||
struct meter_t meter1, meter2, meter3;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
if (lcd.width() < lcd.height()) {
|
||||
lcd.setRotation(lcd.getRotation() ^ 1);
|
||||
}
|
||||
|
||||
sprite.setColorDepth(2);
|
||||
|
||||
sprite.createSprite(3,lcd.height() / 8);
|
||||
sprite.setPivot(1, lcd.height() / 4);
|
||||
|
||||
sprite.drawFastVLine(1, 0, sprite.height() , 3);
|
||||
sprite.drawFastVLine(0, 2, sprite.height() - 4, 1);
|
||||
|
||||
meter1.pivot_x = lcd.width() >> 1;
|
||||
meter1.pivot_y = (lcd.height() >> 2) + 2;
|
||||
meter1.add = 0.01;
|
||||
|
||||
meter2.pivot_x = lcd.width() >> 2;
|
||||
meter2.pivot_y = (lcd.height() * 3) >>2;
|
||||
meter2.add = 0.11;
|
||||
|
||||
meter3.pivot_x = (lcd.width() * 3) >> 2;
|
||||
meter3.pivot_y = (lcd.height() * 3) >> 2;
|
||||
meter3.add = 0.57;
|
||||
|
||||
lcd.fillScreen(lcd.color565(0,0,127));
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
lcd.drawFastHLine(0, (i*2+1) * lcd.height() / 40, lcd.width(), 0xFFFF);
|
||||
lcd.drawFastVLine((i*2+1) * lcd.width() / 40, 0, lcd.height() , 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
meter1.drawGauge(sprite.color888(255, meter1.angle, 127));
|
||||
meter2.drawGauge(sprite.color888(255 - meter2.angle, meter2.angle, 127));
|
||||
meter3.drawGauge(sprite.color888(0, 127, meter3.angle));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite sp;
|
||||
static LGFX_Sprite sprites[2];
|
||||
static bool flip;
|
||||
static int sprite_height;
|
||||
|
||||
inline uint16_t getBackColor(int x, int y)
|
||||
{
|
||||
return lcd.swap565(abs((x&31)-16)<<3, 0, abs((y&31)-16)<<3);
|
||||
//return lcd.swap565(x, 0, y);
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
if (lcd.width() < lcd.height()) { lcd.setRotation(lcd.getRotation()^1); }
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
sprites[i].setColorDepth(lcd.getColorDepth());
|
||||
sprites[i].setFont(&fonts::Font2);
|
||||
sprites[i].setTextColor(TFT_WHITE);
|
||||
sprites[i].setTextDatum(textdatum_t::top_right);
|
||||
}
|
||||
|
||||
int div = 1;
|
||||
for (;;)
|
||||
{
|
||||
sprite_height = (lcd.height() + div - 1) / div;
|
||||
bool fail = false;
|
||||
for (int i = 0; !fail && i < 2; ++i)
|
||||
{
|
||||
fail = !sprites[i].createSprite(lcd.width(), sprite_height);
|
||||
}
|
||||
if (!fail) break;
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
sprites[i].deleteSprite();
|
||||
}
|
||||
div++;
|
||||
}
|
||||
|
||||
sp.setColorDepth(8);
|
||||
sp.setFont(&fonts::Font2);
|
||||
sp.setTextDatum(textdatum_t::middle_center);
|
||||
|
||||
lcd.startWrite();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static int count;
|
||||
static int prev_sec;
|
||||
static int prev_fps;
|
||||
static int fps;
|
||||
++fps;
|
||||
int sec = millis() / 1000;
|
||||
if (prev_sec != sec)
|
||||
{
|
||||
prev_sec = sec;
|
||||
prev_fps = fps;
|
||||
fps = 0;
|
||||
}
|
||||
count++;
|
||||
|
||||
float y_center = (std::max(lcd.width(), lcd.height()));
|
||||
float distance;
|
||||
float zoom_x, zoom_y;
|
||||
|
||||
for (int div_y = 0; div_y < lcd.height(); div_y += sprite_height)
|
||||
{
|
||||
float angle = (float)(count * 36) / 100;
|
||||
// sprites[flip].clear();
|
||||
//* // draw background
|
||||
if (lcd.getColorDepth() == 16)
|
||||
{
|
||||
std::uint16_t* rawbuf = (std::uint16_t*)sprites[flip].getBuffer();
|
||||
for (int y = 0; y < sprite_height; y++)
|
||||
{
|
||||
std::uint16_t* rawline = &rawbuf[y * lcd.width()];
|
||||
for (int x = 0; x < lcd.width(); x++)
|
||||
{
|
||||
rawline[x] = lcd.swap565(abs((x&31)-16)<<3, 0, abs(((div_y + y)&31)-16)<<3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (lcd.getColorDepth() > 16)
|
||||
{
|
||||
lgfx::bgr888_t* rawbuf = (lgfx::bgr888_t*)sprites[flip].getBuffer();
|
||||
for (int y = 0; y < sprite_height; y++)
|
||||
{
|
||||
lgfx::bgr888_t* rawline = &rawbuf[y * lcd.width()];
|
||||
for (int x = 0; x < lcd.width(); x++)
|
||||
{
|
||||
rawline[x] = lcd.swap888(abs((x&31)-16)<<3, 0, abs(((div_y + y)&31)-16)<<3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (div_y == 0)
|
||||
{
|
||||
// draw fps and counter
|
||||
sprites[flip].setCursor(0,0);
|
||||
sprites[flip].printf("fps:%03d", prev_fps);
|
||||
sprites[flip].drawNumber(count, lcd.width(), 0);
|
||||
|
||||
distance = y_center;
|
||||
zoom_x = distance / 512.0f;
|
||||
zoom_y = distance / 256.0f;
|
||||
sp.createSprite(21, 11);
|
||||
sp.fillTriangle(0, 0, 20, 0, 10, 10, TFT_WHITE);
|
||||
sp.setPivot(10, distance / zoom_y - 0.5);
|
||||
sp.pushRotateZoomWithAA(&sprites[flip], lcd.width() / 2, y_center - div_y, 0, zoom_x, zoom_y, 0);
|
||||
}
|
||||
|
||||
|
||||
// draw outer dial
|
||||
distance = y_center * 0.95;
|
||||
zoom_y = distance / 30;
|
||||
sp.createSprite(1, 1);
|
||||
sp.clear(TFT_WHITE);
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
float a = fmodf(360.0f + angle - i * 3.6f, 360.0f);
|
||||
if (a > 40 && a < 320) continue;
|
||||
|
||||
zoom_x = distance / (i%5 ? 50 : 30);
|
||||
zoom_y = distance / (i%5 ? 30 : ((i % 10) ? 20 : 15));
|
||||
sp.setPivot(0, distance / zoom_y - 0.5);
|
||||
sp.pushRotateZoomWithAA(&sprites[flip], lcd.width() / 2, y_center - div_y, a, zoom_x, zoom_y, 0);
|
||||
}
|
||||
|
||||
// draw outer number
|
||||
distance *= 0.92;
|
||||
zoom_x = distance / 128.0f;
|
||||
zoom_y = distance / 128.0f;
|
||||
sp.createSprite(18, 14);
|
||||
sp.setPivot((float)sp.width() / 2, distance / zoom_y);
|
||||
sp.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
for (int i = 0; i < 100; i += 10)
|
||||
{
|
||||
float a = fmodf(360.0f + angle - i * 3.6f, 360.0f);
|
||||
if (a > 50 && a < 310) continue;
|
||||
sp.drawNumber(i, sp.width()>>1, sp.height()>>1);
|
||||
sp.pushRotateZoomWithAA(&sprites[flip], lcd.width() / 2, y_center - div_y, a, zoom_x, zoom_y, 0);
|
||||
}
|
||||
|
||||
|
||||
// draw inner dial
|
||||
angle /= 10;
|
||||
distance *= 0.85;
|
||||
sp.createSprite(1, 1);
|
||||
sp.clear(TFT_YELLOW);
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
float a = fmodf(360.0f + angle - i * 3.6f, 360.0f);
|
||||
if (a > 60 && a < 300) continue;
|
||||
|
||||
zoom_x = distance / (i%5 ? 50 : 30);
|
||||
zoom_y = distance / (i%5 ? 30 : ((i % 10) ? 20 : 15));
|
||||
sp.setPivot(0, distance / zoom_y - 0.5);
|
||||
sp.pushRotateZoomWithAA(&sprites[flip], lcd.width() / 2, y_center - div_y, a, zoom_x, zoom_y, 0);
|
||||
}
|
||||
|
||||
// draw inner number
|
||||
distance *= 0.9;
|
||||
zoom_x = distance / 128.0f;
|
||||
zoom_y = distance / 128.0f;
|
||||
sp.createSprite(21, 14);
|
||||
sp.setPivot((float)sp.width() / 2, distance / zoom_y);
|
||||
sp.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
for (int i = 0; i < 100; i += 10)
|
||||
{
|
||||
float a = fmodf(360.0f + angle - i * 3.6f, 360.0f);
|
||||
if (a > 70 && a < 290) continue;
|
||||
sp.drawFloat(float(i)/100, 1, sp.width()>>1, sp.height()>>1);
|
||||
sp.pushRotateZoomWithAA(&sprites[flip], lcd.width() / 2, y_center - div_y, a, zoom_x, zoom_y, 0);
|
||||
}
|
||||
|
||||
sprites[flip].pushSprite(&lcd, 0, div_y);
|
||||
flip = !flip;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
static LGFX_Sprite sprite1(&lcd);
|
||||
static LGFX_Sprite sprite2(&lcd);
|
||||
static LGFX_Sprite* sprites[2] = {&sprite1, &sprite2};
|
||||
static int32_t width = 280;
|
||||
static size_t count = 0;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
lcd.setPivot(lcd.width()>>1, lcd.height()>>1);
|
||||
width = std::min(width, (std::max(lcd.width(), lcd.height())+10)) | 1;
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
sprites[i]->setColorDepth(8);
|
||||
sprites[i]->createSprite(width, width);
|
||||
sprites[i]->createPalette();
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
++count;
|
||||
bool flip = count & 1;
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
sprites[flip]->setPaletteColor(i, ((i-count-1) & 0x7F)<<1, ((i-count-1) & 0xFF), ((i-count-1) & 0x3F)<<2);
|
||||
}
|
||||
sprites[!flip]->clearClipRect();
|
||||
sprites[!flip]->setColor(count);
|
||||
sprites[!flip]->fillRect(0,0,width,3);
|
||||
sprites[!flip]->fillRect(0,0,3,width);
|
||||
sprites[!flip]->fillRect(width-3,0,3,width);
|
||||
sprites[!flip]->fillRect(0,width-3,width,3);
|
||||
sprites[!flip]->setClipRect(3,3,width-6,width-6);
|
||||
sprites[!flip]->pushRotateZoom(sprites[flip], width>>1, (width>>1)+10, ((float)count)*.5, 0.9, 0.95);
|
||||
sprites[flip]->pushSprite((lcd.width() - width) >> 1, (lcd.height() - width) >> 1);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,440 @@
|
|||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
/*\
|
||||
*
|
||||
* Push your LGFX sprites with style!
|
||||
*
|
||||
* LGFX_SpriteFX: A LGFX Layer brought to you by @tobozo, copyleft (c+) 2023
|
||||
*
|
||||
\*/
|
||||
|
||||
|
||||
namespace lgfx
|
||||
{
|
||||
|
||||
namespace easing
|
||||
{
|
||||
/*\
|
||||
* Easing Functions - inspired from :
|
||||
* - http://gizma.com/easing
|
||||
* - https://easings.net/
|
||||
* Only considering the t value for the range [0, 1] => [0, 1]
|
||||
\*/
|
||||
typedef float (*easing_fn_t)(float in);
|
||||
// for trigo
|
||||
const float c1 = 1.70158f;
|
||||
const float c2 = c1 * 1.525f;
|
||||
const float c3 = c1 + 1.0f;
|
||||
const float c4 = (2.0f * PI) / 3.0f;
|
||||
const float c5 = (2.0f * PI) / 4.5f;
|
||||
// for bounce
|
||||
const float n1 = 7.5625f;
|
||||
const float d1 = 2.75f;
|
||||
|
||||
float linear(float t) { return t; }
|
||||
float easeInQuad(float t) { return powf(t,2.0f); }
|
||||
float easeOutQuad(float t) { return t*(2.0f-t); }
|
||||
float easeInOutQuad(float t) { return t<.5f ? 2.0f*powf(t,2) : -1.0f+(4.0f-2.0f*t)*t; }
|
||||
float easeInCubic(float t) { return powf(t,3.0f); }
|
||||
float easeOutCubic(float t) { return 1.0f - powf(1.0f - t, 3.0f); }
|
||||
float easeInOutCubic(float t) { return t<.5f ? 4.0f*powf(t,3) : (t-1.0f)*(2.0f*t-2.0f)*(2.0f*t-2.0f)+1.0f; }
|
||||
float easeInQuart(float t) { return powf(t,4.0f); }
|
||||
float easeOutQuart(float t) { return 1.0f - powf(1.0f - t, 4.0f); }
|
||||
float easeInOutQuart(float t) { return t < 0.5 ? 8.0f * t * t * t * t : 1.0f - powf(-2.0f * t + 2.0f, 4.0f) / 2.0f; }
|
||||
float easeInQuint(float t) { return powf(t,5.0f); }
|
||||
float easeOutQuint(float t) { return 1.0f - powf(1.0f - t, 5.0f); }
|
||||
float easeInOutQuint(float t) { return t < 0.5 ? 16.0f * t * t * t * t * t : 1.0f - powf(-2.0f * t + 2.0f, 5.0f) / 2.0f;/*t<.5f ? 16.0f*powf(t,5) : 1.0f+16.0f*(--t)*powf(t,4);*/ }
|
||||
float easeInSine(float t) { return 1.0f - cosf((t * PI) / 2.0f); }
|
||||
float easeOutSine(float t) { return sinf((t * PI) / 2.0f); }
|
||||
float easeInOutSine(float t) { return -(cosf(PI * t) - 1.0f) / 2.0f; }
|
||||
float easeInExpo(float t) { return t==0 ? 0 : powf(2, 10.0f * t - 10.0f); }
|
||||
float easeOutExpo(float t) { return t==1.0f ? 1.0f : 1.0f - powf(2, -10.0f * t); }
|
||||
float easeInOutExpo(float t) { return t==0 ? 0 : t==1.0f ? 1.0f : t < 0.5f ? powf(2, 20.0f * t - 10.0f) / 2.0f : (2.0f - powf(2, -20.0f * t + 10.0f)) / 2.0f; }
|
||||
float easeInCirc(float t) { return 1.0f - sqrtf(1.0f - powf(t, 2.0f)); }
|
||||
float easeOutCirc(float t) { return sqrtf(1.0f - powf(t - 1, 2.0f)); }
|
||||
float easeInOutCirc(float t) { return t < 0.5f ? (1.0f - sqrtf(1.0f - powf(2.0f * t, 2.0f))) / 2.0f : (sqrtf(1 - powf(-2.0f * t + 2.0f, 2.0f)) + 1.0f) / 2.0f; }
|
||||
float easeInBack(float t) { return c3 * t * t * t - c1 * t * t; }
|
||||
float easeOutBack(float t) { return 1.0f + c3 * powf(t - 1.0f, 3.0f) + c1 * powf(t - 1.0f, 2.0f); }
|
||||
float easeInOutBack(float t) { return t < 0.5f ? (powf(2.0*t, 2.0f) * ((c2 + 1.0f) * 2.0f * t - c2)) / 2.0f : (powf(2.0*t-2, 2.0f) * ((c2 + 1.0f) * (t * 2.0f - 2.0f) + c2) + 2.0f) / 2.0f; }
|
||||
float easeInElastic(float t) { return t==0 ? 0 : t==1.0f ? 1.0f : -powf(2, 10.0f * t - 10.0f) * sinf((t * 10.0f - 10.75f) * c4); }
|
||||
float easeOutElastic(float t) { return t==0 ? 0 : t==1.0f ? 1.0f : powf(2, -10.0f * t) * sinf((t * 10.0f - 0.75f) * c4) + 1; }
|
||||
float easeInOutElastic(float t) { return t==0 ? 0 : t==1 ? 1 : t<0.5 ? -(powf(2, 20.0f*t-10.0f)*sinf((20.0f*t-11.125f)*c5))/2.0f : (powf(2,-20.0f*t+10.0f)*sinf((20.0f*t-11.125f)*c5))/2.0f+1.0f; }
|
||||
float easeOutBounce(float t) { return t<1.0f/d1 ? n1*t*t : t<2.0f/d1 ? n1*(t-=1.5f/d1)*t+0.75f : t<2.5f/d1 ? n1*(t-=2.25f/d1)*t+0.9375f : n1*(t-=2.625f/d1)*t+0.984375f; }
|
||||
|
||||
}; // end namespace easing
|
||||
|
||||
|
||||
namespace transition_fx
|
||||
{
|
||||
|
||||
enum trans_type_t // all transitions effects supported by this addon are listed here
|
||||
{
|
||||
PIXEL_STRETCH, // pixel stretch animation, vertical/horizontal both directions
|
||||
PIXEL_SLICE, // scrolled portions
|
||||
PIXEL_SPIN,
|
||||
};
|
||||
|
||||
struct anim_param_t // abstract item to hold transition pointer, used by pushAnimated()
|
||||
{
|
||||
const trans_type_t type;
|
||||
const void *ptr;
|
||||
};
|
||||
|
||||
|
||||
enum trans_spindir_t
|
||||
{
|
||||
SPIN_RIGHT,
|
||||
SPIN_LEFT
|
||||
};
|
||||
|
||||
struct spin_params_t
|
||||
{
|
||||
const int32_t x;
|
||||
const int32_t y;
|
||||
const trans_spindir_t dir; // spin direction
|
||||
const uint32_t duration_ms; // easing duration
|
||||
const easing::easing_fn_t easingFunc;
|
||||
};
|
||||
|
||||
|
||||
enum trans_axis_t // transition orientation for PIXEL_SLICE
|
||||
{
|
||||
AXIS_H,
|
||||
AXIS_V
|
||||
};
|
||||
|
||||
struct slice_params_t // transition parameters for PIXEL_SLICE
|
||||
{
|
||||
const int32_t x;
|
||||
const int32_t y;
|
||||
const trans_axis_t dir; // slicing direction
|
||||
const uint32_t slices; // slices amount
|
||||
const uint32_t duration_ms; // easing duration
|
||||
const easing::easing_fn_t easingFunc;
|
||||
};
|
||||
|
||||
struct sliceRect_t // grouped properties for PIXEL_SLICE
|
||||
{
|
||||
sliceRect_t() {};
|
||||
sliceRect_t(int32_t x_, int32_t y_, int32_t clipx_, int32_t clipy_, int32_t clipw_, int32_t cliph_ ) :
|
||||
x(x_), y(y_), clipx(clipx_), clipy(clipy_), clipw(clipw_), cliph(cliph_) { }
|
||||
int32_t x{0};
|
||||
int32_t y{0};
|
||||
int32_t clipx{0};
|
||||
int32_t clipy{0};
|
||||
int32_t clipw{0};
|
||||
int32_t cliph{0};
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum trans_datum_t // transition direction for PIXEL_STRETCH
|
||||
{
|
||||
LTR_DATUM, // left to righ
|
||||
RTL_DATUM, // right to left
|
||||
TTB_DATUM, // top to bottom
|
||||
BTT_DATUM // bottom to top
|
||||
};
|
||||
|
||||
struct stretch_params_t // transition parameters for PIXEL_STRETCH
|
||||
{
|
||||
const int32_t x;
|
||||
const int32_t y;
|
||||
const trans_datum_t dir; // stretch direction
|
||||
const uint32_t delay_ms; // mininal delay per frame
|
||||
};
|
||||
|
||||
struct coords_float_t // x/y coords as float for PIXEL_STRETCH
|
||||
{
|
||||
template <typename T> coords_float_t(T x_, T y_ ) : x(x_+0.0f), y(y_+0.0f) { }
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
struct pixel_stretch_fx_t // direction and loop controls for PIXEL_STRETCH
|
||||
{
|
||||
public:
|
||||
pixel_stretch_fx_t( coords_float_t pos_, uint32_t w_, uint32_t h_, trans_datum_t direction_=LTR_DATUM, uint32_t delay_ms_=1 )
|
||||
: pos(pos_), clipWidth(w_), clipHeight(h_), direction(direction_), delay_ms(delay_ms_)
|
||||
{
|
||||
swapx = (direction==RTL_DATUM||direction==BTT_DATUM);
|
||||
swapy = (direction==TTB_DATUM||direction==BTT_DATUM);
|
||||
|
||||
auto clip1 = !swapy ? clipHeight : clipWidth;
|
||||
auto clip2 = !swapy ? clipWidth : clipHeight;
|
||||
auto &_pos = !swapy ? pos.y : pos.x;
|
||||
auto &_middle = !swapy ? middle.y : middle.x;
|
||||
auto &_topleft = !swapy ? topleft.y : topleft.x;
|
||||
auto &_scan = !swapy ? scanheight : scanwidth;
|
||||
|
||||
_middle = _pos + clip1/2.0f;
|
||||
_topleft = _pos;
|
||||
_scan = clip1;
|
||||
|
||||
loopstart = swapx ? clip2+1.0f : 0;
|
||||
loopend = swapx ? -1.0f : clip2;
|
||||
loopdir = swapx ?-1.0f : 1.0f;
|
||||
tick();
|
||||
last_ms = anim_start = millis();
|
||||
};
|
||||
|
||||
void tick()
|
||||
{
|
||||
auto &_scan = !swapy ? scanpos.x : scanpos.y;
|
||||
auto &_zoom = !swapy ? zoom.x : zoom.y;
|
||||
auto &_middle = !swapy ? middle.x : middle.y;
|
||||
auto &_topleft = !swapy ? topleft.x : topleft.y;
|
||||
auto &_pos = !swapy ? pos.x : pos.y;
|
||||
auto _clip = !swapx ? !swapy ? clipWidth : clipHeight : 0;
|
||||
|
||||
_scan = -loopstart;
|
||||
_zoom = (!swapx ? _clip-loopstart : loopstart) - 0.5f;
|
||||
_middle = ((!swapx ? _pos+loopstart : _pos) + _zoom/2.0f) - 0.5f;
|
||||
_topleft = _pos + loopstart;
|
||||
}
|
||||
|
||||
bool next()
|
||||
{
|
||||
loopstart += loopdir;
|
||||
handleTimer();
|
||||
tick();
|
||||
return loopstart!=loopend;
|
||||
}
|
||||
|
||||
void handleTimer()
|
||||
{
|
||||
uint32_t render_ms_tmp = millis() - last_ms;
|
||||
if( delay_ms > 1 ) {
|
||||
if( render_ms_tmp < delay_ms ) {
|
||||
vTaskDelay( delay_ms - render_ms_tmp );
|
||||
}
|
||||
}
|
||||
last_ms = millis();
|
||||
}
|
||||
|
||||
// scanline
|
||||
coords_float_t scanpos = { 0, 0 };
|
||||
float scanwidth = 1;
|
||||
float scanheight = 1;
|
||||
|
||||
// projection zone
|
||||
coords_float_t middle = { 0, 0 };
|
||||
coords_float_t zoom = { 1, 1 };
|
||||
coords_float_t topleft = { 0, 0 };
|
||||
|
||||
// timer helpers
|
||||
uint32_t anim_start = 0;
|
||||
uint32_t last_ms = 0;
|
||||
const float rotate = 0;
|
||||
|
||||
private:
|
||||
|
||||
const coords_float_t pos;
|
||||
const float clipWidth;
|
||||
const float clipHeight;
|
||||
const trans_datum_t direction;
|
||||
const uint32_t delay_ms;// 15=66fps
|
||||
|
||||
float loopstart = 0;
|
||||
float loopend = 0;
|
||||
float loopdir = 1;
|
||||
|
||||
bool swapx = false;
|
||||
bool swapy = false;
|
||||
};
|
||||
|
||||
}; // end namespace transition_fx
|
||||
|
||||
|
||||
using namespace transition_fx;
|
||||
using namespace easing;
|
||||
|
||||
|
||||
class LGFX_SpriteFx : public LGFX_Sprite
|
||||
{
|
||||
public:
|
||||
|
||||
LGFX_SpriteFx(LovyanGFX* parent) : LGFX_Sprite(parent) { };
|
||||
|
||||
void spin( int32_t x=0, int32_t y=0, trans_spindir_t dir=SPIN_RIGHT, uint32_t duration=255, easing_fn_t easing=linear ) { spin_impl({x,y,dir,duration,easing}); }
|
||||
void spinC( int32_t x=0, int32_t y=0, uint32_t duration=255, easing_fn_t easing=linear ) { spin_impl({x,y,SPIN_RIGHT,duration,easing}); }
|
||||
void spinA( int32_t x=0, int32_t y=0, uint32_t duration=255, easing_fn_t easing=linear ) { spin_impl({x,y,SPIN_LEFT,duration,easing}); }
|
||||
|
||||
void slice( int32_t x=0, int32_t y=0, trans_axis_t axis=AXIS_V, uint32_t slices=8,
|
||||
uint32_t duration=255, easing_fn_t easing=linear ) { slice_impl({x,y,axis,slices,duration,easing}); }
|
||||
void sliceH( int32_t x=0, int32_t y=0, uint8_t slices=8,
|
||||
uint32_t duration=255, easing_fn_t easing=linear ) { slice_impl({x,y,AXIS_H,slices,duration,easing}); }
|
||||
void sliceV( int32_t x=0, int32_t y=0, uint8_t slices=8,
|
||||
uint32_t duration=255, easing_fn_t easing=linear ) { slice_impl({x,y,AXIS_V,slices,duration,easing}); }
|
||||
|
||||
void stretch( int32_t x=0, int32_t y=0, trans_datum_t dir=LTR_DATUM, uint32_t delay_ms=0 ) { stretch_impl({x,y,dir,delay_ms}); }
|
||||
void stretchLTR( int32_t x=0, int32_t y=0, uint32_t delay_ms=0 ) { stretch_impl({x,y,LTR_DATUM,delay_ms}); }
|
||||
void stretchRTL( int32_t x=0, int32_t y=0, uint32_t delay_ms=0 ) { stretch_impl({x,y,RTL_DATUM,delay_ms}); }
|
||||
void stretchTTB( int32_t x=0, int32_t y=0, uint32_t delay_ms=0 ) { stretch_impl({x,y,TTB_DATUM,delay_ms}); }
|
||||
void stretchBTT( int32_t x=0, int32_t y=0, uint32_t delay_ms=0 ) { stretch_impl({x,y,BTT_DATUM,delay_ms}); }
|
||||
|
||||
void pushAnimated( anim_param_t* params )
|
||||
{
|
||||
assert( params );
|
||||
assert( params->ptr );
|
||||
switch( params->type ) {
|
||||
case PIXEL_STRETCH: {
|
||||
auto pixel_stretch = (stretch_params_t*) params->ptr;
|
||||
stretch_impl( {pixel_stretch->x, pixel_stretch->y, pixel_stretch->dir, pixel_stretch->delay_ms} );
|
||||
}
|
||||
break;
|
||||
case PIXEL_SLICE: {
|
||||
auto pixel_slice = (slice_params_t*) params->ptr;
|
||||
slice_impl( {pixel_slice->x, pixel_slice->y, pixel_slice->dir, pixel_slice->slices, pixel_slice->duration_ms, pixel_slice->easingFunc} );
|
||||
}
|
||||
break;
|
||||
case PIXEL_SPIN: {
|
||||
auto pixel_spin = (spin_params_t*) params->ptr;
|
||||
spin_impl( {pixel_spin->x, pixel_spin->y, pixel_spin->dir, pixel_spin->duration_ms, pixel_spin->easingFunc} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void spin_impl( spin_params_t params )
|
||||
{
|
||||
if( _parent == nullptr ) {
|
||||
log_e("Sprite has no parent, can't guess display");
|
||||
return;
|
||||
}
|
||||
|
||||
auto x = params.x;
|
||||
auto y = params.y;
|
||||
auto dir = params.dir;
|
||||
auto duration = params.duration_ms;
|
||||
auto easingFunc = params.easingFunc;
|
||||
|
||||
const uint32_t timer_start = millis();
|
||||
const uint32_t timer_end = timer_start + duration;
|
||||
const uint32_t max_steps = 1000;
|
||||
|
||||
const float middlex = float(x) + float(this->width()/2.0f);// - float(x/2.0f);
|
||||
const float middley = float(y) + float(this->height()/2.0f);// - float(y/2.0f);
|
||||
const int anglestart = dir==SPIN_RIGHT ? -360:360;
|
||||
const int angleend = -anglestart;
|
||||
|
||||
uint32_t timer_pos = 0;
|
||||
uint32_t timer_now = 0;
|
||||
|
||||
_parent->setClipRect( x, y, this->width(), this->height() );
|
||||
do {
|
||||
timer_now = millis();
|
||||
if( timer_now>timer_end ) timer_now=timer_end;
|
||||
timer_pos = map( timer_now, timer_start, timer_end, 0, max_steps );
|
||||
float ifloat = float(timer_pos)/float(max_steps);
|
||||
float zoom = easingFunc( ifloat );
|
||||
int angle = map( int(zoom*max_steps), 0, max_steps, anglestart, angleend );
|
||||
this->pushRotateZoom( _parent, middlex, middley, angle, zoom, zoom );
|
||||
} while( timer_now<timer_end );
|
||||
_parent->clearClipRect();
|
||||
}
|
||||
|
||||
|
||||
void slice_impl( slice_params_t params )
|
||||
{
|
||||
if( _parent == nullptr ) {
|
||||
log_e("Sprite has no parent, can't guess display");
|
||||
return;
|
||||
}
|
||||
|
||||
auto x = params.x;
|
||||
auto y = params.y;
|
||||
auto slices = params.slices;
|
||||
auto axis = params.dir;
|
||||
auto duration = params.duration_ms;
|
||||
auto easingFunc = params.easingFunc;
|
||||
|
||||
const uint32_t timer_start = millis();
|
||||
const uint32_t timer_end = timer_start + duration;
|
||||
const uint32_t max_steps = 1000;
|
||||
|
||||
const bool is_vertical = axis==AXIS_V;
|
||||
const int32_t scroll_pan_max = is_vertical ? this->width() : this->height();
|
||||
const int32_t scroll_pos_max = is_vertical ? this->height() : this->width();
|
||||
|
||||
if( slices < 2 ) slices = 2;
|
||||
if( slices > scroll_pan_max/2 ) slices = scroll_pan_max/2;
|
||||
|
||||
const int32_t slice_pad = scroll_pan_max/slices; // slice width or slice height depending axis
|
||||
|
||||
int32_t scroll_pos = 0;
|
||||
uint32_t steps = 1000;
|
||||
|
||||
uint32_t timer_pos = 0;
|
||||
uint32_t timer_now = 0;
|
||||
|
||||
do {
|
||||
timer_now = millis();
|
||||
if( timer_now>timer_end ) timer_now=timer_end;
|
||||
timer_pos = map( timer_now, timer_start, timer_end, 0, max_steps );
|
||||
float ifloat = float(timer_pos)/float(steps);
|
||||
float eased = easingFunc( ifloat );
|
||||
scroll_pos = map( int(eased*steps), 0, steps, 0, scroll_pos_max );
|
||||
const int32_t slice1 = is_vertical ? (y-this->height())+scroll_pos : (x-this->width())+scroll_pos;
|
||||
const int32_t slice2 = is_vertical ? (y+this->height())-scroll_pos : (x+this->width())-scroll_pos;
|
||||
int32_t slice_num = 0;
|
||||
do { // secondary axis (opposite slicing)
|
||||
const int32_t offset = slice_num*slice_pad;
|
||||
const auto rect = (is_vertical)
|
||||
? sliceRect_t( x, slice_num%2==0 ? slice2 : slice1, x+offset, y, slice_pad, this->height() )
|
||||
: sliceRect_t( slice_num%2==0 ? slice2 : slice1, y, x, y+offset, this->width(), slice_pad )
|
||||
;
|
||||
_parent->setClipRect( rect.clipx, rect.clipy, rect.clipw, rect.cliph );
|
||||
this->pushSprite( _parent, rect.x, rect.y );
|
||||
slice_num++;
|
||||
} while( slice_num <= slices );
|
||||
} while( timer_now<timer_end );
|
||||
_parent->clearClipRect();
|
||||
}
|
||||
|
||||
|
||||
void stretch_impl( stretch_params_t params )
|
||||
{
|
||||
if( _parent == nullptr ) {
|
||||
log_e("Sprite has no parent, can't guess display");
|
||||
return;
|
||||
}
|
||||
|
||||
auto x = params.x;
|
||||
auto y = params.y;
|
||||
auto direction = params.dir;
|
||||
auto delay_ms = params.delay_ms;
|
||||
|
||||
pixel_stretch_fx_t fx( {x, y}, this->width(), this->height(), direction, delay_ms );
|
||||
|
||||
LGFX_Sprite *scanline = new LGFX_Sprite();
|
||||
scanline->setColorDepth( this->getColorDepth() );
|
||||
scanline->setPsram( false ); // use heap for faster frame rate
|
||||
|
||||
if( !scanline->createSprite( fx.scanwidth, fx.scanheight ) ) {
|
||||
log_e("Not enough ram to create stretch effect");
|
||||
this->pushSprite( _parent, x, y );
|
||||
delete scanline;
|
||||
return;
|
||||
}
|
||||
|
||||
_parent->setClipRect( x, y, this->width(), this->height() );
|
||||
do {
|
||||
this->pushSprite( scanline, fx.scanpos.x, fx.scanpos.y );
|
||||
scanline->pushRotateZoom( _parent, fx.middle.x, fx.middle.y, fx.rotate, fx.zoom.x, fx.zoom.y );
|
||||
} while( fx.next() );
|
||||
_parent->clearClipRect();
|
||||
|
||||
scanline->deleteSprite();
|
||||
delete scanline;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
using lgfx::LGFX_SpriteFx;
|
||||
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
/*\
|
||||
*
|
||||
* Push your LGFX sprites with style!
|
||||
*
|
||||
* LGFX_SpriteFX: A LGFX Layer brought to you by @tobozo, copyleft (c+) 2023
|
||||
*
|
||||
* This demo demonstrates the different ways a sprite can
|
||||
* be printed to the display using transitions.
|
||||
*
|
||||
* Transition effects:
|
||||
* - Spin: appears in a zommed spin
|
||||
* - Slice: sliced and merged
|
||||
* - Stretch: spread from one edge
|
||||
*
|
||||
* Easing function: plenty!
|
||||
*
|
||||
* Note: "Strech" transition does not support easing, only min delay between frames.
|
||||
*
|
||||
* Simple usage:
|
||||
*
|
||||
* // create a sprite using "LGFX_SpriteFx" instead of "LGFX_Sprite" constructor.
|
||||
*
|
||||
* auto sprite = new LGFX_SpriteFx(&tft);
|
||||
*
|
||||
* // draw some stuff in the sprite...
|
||||
*
|
||||
* // when the sprite is ready to be pushed, instead of sprite->pushSprite( x, y ), use one of these these:
|
||||
*
|
||||
* sprite->spin( x, y );
|
||||
* sprite->slice( x, y );
|
||||
* sprite->stretch( x, y );
|
||||
*
|
||||
*
|
||||
* Advanced usage:
|
||||
*
|
||||
* See LGFX_SpriteFX.hpp and this sketch for more advanced examples.
|
||||
*
|
||||
\*/
|
||||
|
||||
#define LGFX_AUTODETECT
|
||||
|
||||
#include "LGFX_SpriteFX.hpp"
|
||||
#include "assets.h" // some example images for this demo
|
||||
|
||||
|
||||
struct easingFuncDesc_t
|
||||
{
|
||||
const char* name;
|
||||
lgfx::easing::easing_fn_t func;
|
||||
};
|
||||
|
||||
|
||||
struct img_t
|
||||
{
|
||||
const unsigned char* data;
|
||||
const unsigned int len;
|
||||
const uint32_t w;
|
||||
const uint32_t h;
|
||||
};
|
||||
|
||||
|
||||
static LGFX tft;
|
||||
static LGFX_SpriteFx *sptr;
|
||||
|
||||
const img_t dog = img_t { dog_200_200_jpg, dog_200_200_jpg_len, 200, 200 };
|
||||
const img_t logo = img_t { lgfx_logo_201x197_jpg, lgfx_logo_201x197_jpg_len, 201, 197 };
|
||||
const img_t palette1 = img_t { palette_300x128_jpg, palette_300x128_jpg_len, 300, 128 };
|
||||
const img_t palette2 = img_t { palette_128x200_jpg, palette_128x200_jpg_len, 128, 200 };
|
||||
|
||||
|
||||
const img_t *images[] = { &palette1, &palette2, &dog, &logo };
|
||||
|
||||
const easingFuncDesc_t easingFunctions[] =
|
||||
{
|
||||
{ "easeOutBounce", lgfx::easing::easeOutBounce },
|
||||
{ "easeOutElastic", lgfx::easing::easeOutElastic },
|
||||
// { "easeInElastic", lgfx::easing::easeInElastic },
|
||||
// { "easeInOutElastic", lgfx::easing::easeInOutElastic },
|
||||
// { "easeInQuad", lgfx::easing::easeInQuad },
|
||||
// { "easeOutQuad", lgfx::easing::easeOutQuad },
|
||||
// { "easeInOutQuad", lgfx::easing::easeInOutQuad },
|
||||
// { "easeInCubic", lgfx::easing::easeInCubic },
|
||||
// { "easeOutCubic", lgfx::easing::easeOutCubic },
|
||||
// { "easeInOutCubic", lgfx::easing::easeInOutCubic },
|
||||
// { "easeInQuart", lgfx::easing::easeInQuart },
|
||||
// { "easeOutQuart", lgfx::easing::easeOutQuart },
|
||||
// { "easeInOutQuart", lgfx::easing::easeInOutQuart },
|
||||
// { "easeInQuint", lgfx::easing::easeInQuint },
|
||||
// { "easeOutQuint", lgfx::easing::easeOutQuint },
|
||||
// { "easeInOutQuint", lgfx::easing::easeInOutQuint },
|
||||
// { "easeInSine", lgfx::easing::easeInSine },
|
||||
// { "easeOutSine", lgfx::easing::easeOutSine },
|
||||
// { "easeInOutSine", lgfx::easing::easeInOutSine },
|
||||
// { "easeInExpo", lgfx::easing::easeInExpo },
|
||||
// { "easeOutExpo", lgfx::easing::easeOutExpo },
|
||||
// { "easeInOutExpo", lgfx::easing::easeInOutExpo },
|
||||
// { "easeInCirc", lgfx::easing::easeInCirc },
|
||||
// { "easeOutCirc", lgfx::easing::easeOutCirc },
|
||||
// { "easeInOutCirc", lgfx::easing::easeInOutCirc },
|
||||
// { "easeInBack", lgfx::easing::easeInBack },
|
||||
// { "easeOutBack", lgfx::easing::easeOutBack },
|
||||
// { "easeInOutBack", lgfx::easing::easeInOutBack },
|
||||
// { "linear", lgfx::easing::linear },
|
||||
};
|
||||
|
||||
|
||||
void clearZone( int x, int y, int w, int h, uint32_t delay_ms )
|
||||
{
|
||||
delay( delay_ms );
|
||||
tft.fillRect( x, y, w, h, TFT_WHITE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin( 115200 );
|
||||
tft.init();
|
||||
|
||||
tft.setTextDatum( TL_DATUM );
|
||||
tft.setTextPadding( tft.width() );
|
||||
tft.setTextColor( TFT_WHITE, TFT_BLACK );
|
||||
tft.setTextSize(2);
|
||||
tft.setTextWrap( false );
|
||||
|
||||
sptr = new LGFX_SpriteFx(&tft);
|
||||
sptr->setPsram( false );
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
static uint32_t imgidx = 0;
|
||||
static uint32_t imgcount = sizeof(images)/sizeof(img_t*);
|
||||
static uint32_t min_delay_ms = 8;
|
||||
|
||||
auto imgmod = imgidx%imgcount;
|
||||
min_delay_ms = (imgmod==0) ? 8-min_delay_ms : min_delay_ms;
|
||||
|
||||
auto img = images[imgmod];
|
||||
auto posx = tft.width()/2 - img->w/2;
|
||||
auto posy = tft.height()/2 - img->h/2;
|
||||
|
||||
if( ! sptr->createSprite( img->w, img->h ) ) return;
|
||||
|
||||
// highlight zone
|
||||
tft.fillRect( posx, posy, sptr->width(), sptr->height(), TFT_WHITE );
|
||||
tft.drawRect( posx-1, posy-1, sptr->width()+2, sptr->height()+2, TFT_RED );
|
||||
|
||||
// fill sprite with image
|
||||
sptr->drawJpg( img->data, img->len, 0, 0, img->w, img->h );
|
||||
|
||||
sptr->stretchRTL( posx, posy, min_delay_ms ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->stretchBTT( posx, posy, min_delay_ms ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->stretchLTR( posx, posy, min_delay_ms ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->stretchTTB( posx, posy, min_delay_ms ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
size_t easing_functions_count = sizeof(easingFunctions)/sizeof(easingFuncDesc_t);
|
||||
|
||||
for( int i=0;i<easing_functions_count;i++ ) {
|
||||
|
||||
auto easingFunc = easingFunctions[i].func;
|
||||
auto funcName = easingFunctions[i].name;
|
||||
|
||||
Serial.printf("Easing: %s\n", funcName );
|
||||
tft.setCursor( 0, 0 );
|
||||
tft.printf("Easing: %-32s", funcName );
|
||||
|
||||
|
||||
sptr->spinC( posx, posy, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->spinA( posx, posy, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
sptr->sliceH( posx, posy, 0, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->sliceV( posx, posy, 0, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
sptr->sliceH( posx, posy, 4, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->sliceV( posx, posy, 4, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
sptr->sliceH( posx, posy, 8, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->sliceV( posx, posy, 8, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
sptr->sliceH( posx, posy, 16, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->sliceV( posx, posy, 16, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
sptr->sliceH( posx, posy, 255, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
sptr->sliceV( posx, posy, 255, 1000, easingFunc ); // clearZone( posx, posy, img->w, img->h, 500 );
|
||||
|
||||
}
|
||||
|
||||
tft.setCursor( 0, 0 );
|
||||
tft.printf("%64s", "" );
|
||||
|
||||
// clear zone
|
||||
tft.fillRect( posx-1, posy-1, img->w+2, img->h+2, TFT_BLACK );
|
||||
|
||||
imgidx++;
|
||||
}
|
||||
3088
libraries/LovyanGFX/LovyanGFX/examples/Sprite/TransitionFX/assets.h
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
#include <LovyanGFX.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define LINE_COUNT 6
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
static std::vector<int> points[LINE_COUNT];
|
||||
static int colors[] = { TFT_RED, TFT_GREEN, TFT_BLUE, TFT_CYAN, TFT_MAGENTA, TFT_YELLOW };
|
||||
static int xoffset, yoffset, point_count;
|
||||
|
||||
int getBaseColor(int x, int y)
|
||||
{
|
||||
return ((x^y)&3 || ((x-xoffset)&31 && y&31) ? TFT_BLACK : ((!y || x == xoffset) ? TFT_WHITE : TFT_DARKGREEN));
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
if (lcd.width() < lcd.height()) lcd.setRotation(lcd.getRotation() ^ 1);
|
||||
|
||||
yoffset = lcd.height() >> 1;
|
||||
xoffset = lcd.width() >> 1;
|
||||
point_count = lcd.width() + 1;
|
||||
|
||||
for (int i = 0; i < LINE_COUNT; i++)
|
||||
{
|
||||
points[i].resize(point_count);
|
||||
}
|
||||
|
||||
lcd.startWrite();
|
||||
lcd.setAddrWindow(0, 0, lcd.width(), lcd.height());
|
||||
for (int y = 0; y < lcd.height(); y++)
|
||||
{
|
||||
for (int x = 0; x < lcd.width(); x++)
|
||||
{
|
||||
lcd.writeColor(getBaseColor(x, y - yoffset), 1);
|
||||
}
|
||||
}
|
||||
lcd.endWrite();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static int prev_sec;
|
||||
static int fps;
|
||||
++fps;
|
||||
int sec = millis() / 1000;
|
||||
if (prev_sec != sec)
|
||||
{
|
||||
prev_sec = sec;
|
||||
lcd.setCursor(0,0);
|
||||
lcd.printf("fps:%03d", fps);
|
||||
fps = 0;
|
||||
}
|
||||
|
||||
static int count;
|
||||
|
||||
for (int i = 0; i < LINE_COUNT; i++)
|
||||
{
|
||||
points[i][count % point_count] = (sinf((float)count / (10 + 30 * i))+sinf((float)count / (13 + 37 * i))) * (lcd.height() >> 2);
|
||||
}
|
||||
|
||||
++count;
|
||||
|
||||
lcd.startWrite();
|
||||
int index1 = count % point_count;
|
||||
for (int x = 0; x < point_count-1; x++)
|
||||
{
|
||||
int index0 = index1;
|
||||
index1 = (index0 +1) % point_count;
|
||||
for (int i = 0; i < LINE_COUNT; i++)
|
||||
{
|
||||
int y = points[i][index0];
|
||||
if (y != points[i][index1])
|
||||
{
|
||||
lcd.writePixel(x, y + yoffset, getBaseColor(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < LINE_COUNT; i++)
|
||||
{
|
||||
int y = points[i][index1];
|
||||
lcd.writePixel(x, y + yoffset, colors[i]);
|
||||
}
|
||||
}
|
||||
lcd.endWrite();
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#define LGFX_AUTODETECT
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
LGFX lcd;
|
||||
LGFX_Sprite canvas;
|
||||
|
||||
static constexpr char text[] = "Hello world ! こんにちは世界! this is long long string sample. 寿限無、寿限無、五劫の擦り切れ、海砂利水魚の、水行末・雲来末・風来末、喰う寝る処に住む処、藪ら柑子の藪柑子、パイポ・パイポ・パイポのシューリンガン、シューリンガンのグーリンダイ、グーリンダイのポンポコピーのポンポコナの、長久命の長助";
|
||||
static constexpr size_t textlen = sizeof(text) / sizeof(text[0]);
|
||||
size_t textpos = 0;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
// 画面が横長になるように回転
|
||||
if (lcd.width() < lcd.height()) lcd.setRotation(lcd.getRotation() ^ 1);
|
||||
|
||||
canvas.setColorDepth(8);
|
||||
canvas.setFont(&fonts::lgfxJapanMinchoP_32);
|
||||
canvas.setTextWrap(false); // 右端到達時のカーソル折り返しを禁止
|
||||
canvas.createSprite(lcd.width() + 36, 36); // 画面幅+1文字分の横幅を用意
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
int32_t cursor_x = canvas.getCursorX() - 1; // 現在のカーソル位置を取得し、1ドット左に移動
|
||||
if (cursor_x <= 0) // カーソル位置が左端に到達している場合は一周したと判断
|
||||
{
|
||||
textpos = 0; // 文字列の読取り位置をリセット
|
||||
cursor_x = lcd.width(); // 新たな文字が画面右端に描画されるようにカーソル位置を変更
|
||||
}
|
||||
|
||||
canvas.setCursor(cursor_x, 0); // カーソル位置を更新
|
||||
canvas.scroll(-1, 0); // キャンバスの内容を1ドット左にスクロール
|
||||
while (textpos < textlen && cursor_x <= lcd.width()) // 画面右端に文字が書けるか判定
|
||||
{
|
||||
canvas.print(text[textpos++]); // 1バイトずつ出力 (マルチバイト文字でもこの処理で動作します)
|
||||
cursor_x = canvas.getCursorX(); // 出力後のカーソル位置を取得
|
||||
}
|
||||
|
||||
canvas.pushSprite(&lcd, 0, 0);
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
#if defined (ARDUINO_WIO_TERMINAL)
|
||||
#include <Seeed_FS.h>
|
||||
#include <SD/Seeed_SD.h>
|
||||
#else
|
||||
#include <SD.h>
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
static constexpr char filename[] = "/lovyangfx_test.bmp";
|
||||
|
||||
#ifndef SDCARD_SS_PIN
|
||||
#define SDCARD_SS_PIN 4
|
||||
#endif
|
||||
|
||||
#ifndef SDCARD_SPI
|
||||
#define SDCARD_SPI SPI
|
||||
#endif
|
||||
|
||||
|
||||
bool saveToSD_16bit(void)
|
||||
{
|
||||
bool result = false;
|
||||
File file = SD.open(filename, "w");
|
||||
if (file)
|
||||
{
|
||||
int width = lcd.width();
|
||||
int height = lcd.height();
|
||||
|
||||
int rowSize = (2 * width + 3) & ~ 3;
|
||||
|
||||
lgfx::bitmap_header_t bmpheader;
|
||||
bmpheader.bfType = 0x4D42;
|
||||
bmpheader.bfSize = rowSize * height + sizeof(bmpheader);
|
||||
bmpheader.bfOffBits = sizeof(bmpheader);
|
||||
|
||||
bmpheader.biSize = 40;
|
||||
bmpheader.biWidth = width;
|
||||
bmpheader.biHeight = height;
|
||||
bmpheader.biPlanes = 1;
|
||||
bmpheader.biBitCount = 16;
|
||||
bmpheader.biCompression = 3;
|
||||
|
||||
file.write((std::uint8_t*)&bmpheader, sizeof(bmpheader));
|
||||
std::uint8_t buffer[rowSize];
|
||||
memset(&buffer[rowSize - 4], 0, 4);
|
||||
for (int y = lcd.height() - 1; y >= 0; y--)
|
||||
{
|
||||
lcd.readRect(0, y, lcd.width(), 1, (lgfx::rgb565_t*)buffer);
|
||||
file.write(buffer, rowSize);
|
||||
}
|
||||
file.close();
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.print("error:file open failure\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool saveToSD_24bit(void)
|
||||
{
|
||||
bool result = false;
|
||||
File file = SD.open(filename, "w");
|
||||
if (file)
|
||||
{
|
||||
int width = lcd.width();
|
||||
int height = lcd.height();
|
||||
|
||||
int rowSize = (3 * width + 3) & ~ 3;
|
||||
|
||||
lgfx::bitmap_header_t bmpheader;
|
||||
bmpheader.bfType = 0x4D42;
|
||||
bmpheader.bfSize = rowSize * height + sizeof(bmpheader);
|
||||
bmpheader.bfOffBits = sizeof(bmpheader);
|
||||
|
||||
bmpheader.biSize = 40;
|
||||
bmpheader.biWidth = width;
|
||||
bmpheader.biHeight = height;
|
||||
bmpheader.biPlanes = 1;
|
||||
bmpheader.biBitCount = 24;
|
||||
bmpheader.biCompression = 0;
|
||||
|
||||
file.write((std::uint8_t*)&bmpheader, sizeof(bmpheader));
|
||||
std::uint8_t buffer[rowSize];
|
||||
memset(&buffer[rowSize - 4], 0, 4);
|
||||
for (int y = lcd.height() - 1; y >= 0; y--)
|
||||
{
|
||||
lcd.readRect(0, y, lcd.width(), 1, (lgfx::rgb888_t*)buffer);
|
||||
file.write(buffer, rowSize);
|
||||
}
|
||||
file.close();
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.print("error:file open failure\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
lcd.setColorDepth(16);
|
||||
|
||||
lcd.setColor(TFT_WHITE);
|
||||
lcd.startWrite();
|
||||
lcd.setAddrWindow(0, 0, lcd.width(), lcd.height());
|
||||
for (int y = 0; y < lcd.height(); ++y)
|
||||
{
|
||||
for (int x = 0; x < lcd.width(); ++x)
|
||||
{
|
||||
lcd.writeColor( lcd.color888(x << 1, x + y, y << 1), 1);
|
||||
}
|
||||
}
|
||||
lcd.print("BMP save test\n");
|
||||
lcd.endWrite();
|
||||
|
||||
do {
|
||||
SD.end();
|
||||
delay(1000);
|
||||
|
||||
SD.begin(SDCARD_SS_PIN, SDCARD_SPI, 25000000);
|
||||
|
||||
} while (!saveToSD_16bit());
|
||||
|
||||
|
||||
lcd.print("BMP save success.");
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
lcd.drawBmpFile(SD, filename, random(-20,20), random(-20, 20));
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
#if defined (ARDUINO_WIO_TERMINAL)
|
||||
#include <Seeed_FS.h>
|
||||
#include <SD/Seeed_SD.h>
|
||||
#else
|
||||
#include <SD.h>
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
static constexpr char filename[] = "/lovyangfx_test.png";
|
||||
|
||||
#ifndef SDCARD_SS_PIN
|
||||
#define SDCARD_SS_PIN 4
|
||||
#endif
|
||||
|
||||
#ifndef SDCARD_SPI
|
||||
#define SDCARD_SPI SPI
|
||||
#endif
|
||||
|
||||
|
||||
bool saveToSD(void)
|
||||
{
|
||||
// createPng関数で指定範囲の画像からPNG形式のデータを生成します。
|
||||
// SAMD51の場合 172x172程度が上限です。
|
||||
// ESP32の場合 192x192程度が上限です。
|
||||
// メモリ使用状況によってさらに縮みます。
|
||||
// ESP32でPSRAMが有効な場合は大きなサイズでも保存できる可能性があります。
|
||||
std::size_t dlen;
|
||||
std::uint8_t* png = (std::uint8_t*)lcd.createPng(&dlen, 0, 0, 128, 128);
|
||||
if (!png)
|
||||
{
|
||||
Serial.print("error:createPng\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
Serial.print("success:createPng\n");
|
||||
|
||||
bool result = false;
|
||||
File file = SD.open(filename, "w");
|
||||
if (file)
|
||||
{
|
||||
file.write((std::uint8_t*)png, dlen);
|
||||
file.close();
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.print("error:file open failure\n");
|
||||
}
|
||||
|
||||
free(png);
|
||||
return result;
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
lcd.setColorDepth(24);
|
||||
|
||||
lcd.setColor(TFT_WHITE);
|
||||
lcd.startWrite();
|
||||
lcd.setAddrWindow(0, 0, lcd.width(), lcd.height());
|
||||
for (int y = 0; y < lcd.height(); ++y)
|
||||
{
|
||||
for (int x = 0; x < lcd.width(); ++x)
|
||||
{
|
||||
lcd.writeColor( lcd.color888(x << 1, x + y, y << 1), 1);
|
||||
}
|
||||
}
|
||||
lcd.print("PNG save test\n");
|
||||
lcd.endWrite();
|
||||
|
||||
do {
|
||||
SD.end();
|
||||
delay(1000);
|
||||
|
||||
SD.begin(SDCARD_SS_PIN, SDCARD_SPI, 25000000);
|
||||
|
||||
} while (!saveToSD());
|
||||
|
||||
|
||||
lcd.print("PNG save success.");
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
lcd.drawPngFile(SD, filename, random(-20,20), random(-20, 20));
|
||||
}
|
||||
|
|
@ -0,0 +1,756 @@
|
|||
/*
|
||||
Adapted from the Adafruit and Xark's PDQ graphicstest sketch.
|
||||
|
||||
See end of file for original header text and MIT license info.
|
||||
|
||||
This sketch uses the GLCD font only.
|
||||
|
||||
*/
|
||||
|
||||
#include <LGFX_TFT_eSPI.hpp>
|
||||
//#include <TFT_eSPI.h>
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#include <algorithm>
|
||||
|
||||
static TFT_eSPI tft;
|
||||
|
||||
unsigned long total = 0;
|
||||
unsigned long tn = 0;
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println(""); Serial.println("");
|
||||
Serial.println("Lovyan's LovyanGFX library Test!");
|
||||
|
||||
tft.init();
|
||||
tft.setRotation(0);
|
||||
tft.startWrite();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
|
||||
Serial.println(F("Benchmark Time (microseconds)"));
|
||||
|
||||
uint32_t usecHaD = testHaD();
|
||||
Serial.print(F("HaD pushColor "));
|
||||
Serial.println(usecHaD);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecFillScreen = testFillScreen();
|
||||
Serial.print(F("Screen fill "));
|
||||
Serial.println(usecFillScreen);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecText = testText();
|
||||
Serial.print(F("Text "));
|
||||
Serial.println(usecText);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecPixels = testPixels();
|
||||
Serial.print(F("Pixels "));
|
||||
Serial.println(usecPixels);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecLines = testLines(TFT_BLUE);
|
||||
Serial.print(F("Lines "));
|
||||
Serial.println(usecLines);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecFastLines = testFastLines(TFT_RED, TFT_BLUE);
|
||||
Serial.print(F("Horiz/Vert Lines "));
|
||||
Serial.println(usecFastLines);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecRects = testRects(TFT_GREEN);
|
||||
Serial.print(F("Rectangles (outline) "));
|
||||
Serial.println(usecRects);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecFilledRects = testFilledRects(TFT_YELLOW, TFT_MAGENTA);
|
||||
Serial.print(F("Rectangles (filled) "));
|
||||
Serial.println(usecFilledRects);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecFilledCircles = testFilledCircles(10, TFT_MAGENTA);
|
||||
Serial.print(F("Circles (filled) "));
|
||||
Serial.println(usecFilledCircles);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecCircles = testCircles(10, TFT_WHITE);
|
||||
Serial.print(F("Circles (outline) "));
|
||||
Serial.println(usecCircles);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecTriangles = testTriangles();
|
||||
Serial.print(F("Triangles (outline) "));
|
||||
Serial.println(usecTriangles);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecFilledTrangles = testFilledTriangles();
|
||||
Serial.print(F("Triangles (filled) "));
|
||||
Serial.println(usecFilledTrangles);
|
||||
delay(100);
|
||||
|
||||
uint32_t usecRoundRects = testRoundRects();
|
||||
Serial.print(F("Rounded rects (outline) "));
|
||||
Serial.println(usecRoundRects);
|
||||
delay(100);
|
||||
|
||||
uint32_t usedFilledRoundRects = testFilledRoundRects();
|
||||
Serial.print(F("Rounded rects (filled) "));
|
||||
Serial.println(usedFilledRoundRects);
|
||||
delay(100);
|
||||
|
||||
Serial.println(F("Done!"));
|
||||
|
||||
uint16_t c = 4;
|
||||
int8_t d = 1;
|
||||
for (int32_t i = 0; i < tft.height(); i++)
|
||||
{
|
||||
tft.drawFastHLine(0, i, tft.width(), c);
|
||||
c += d;
|
||||
if (c <= 4 || c >= 11)
|
||||
d = -d;
|
||||
}
|
||||
|
||||
tft.setCursor(0, 0);
|
||||
tft.setTextColor(TFT_MAGENTA);
|
||||
tft.setTextSize(2);
|
||||
|
||||
tft.println(F(" LovyanGFX test"));
|
||||
|
||||
tft.setTextSize(1);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.println(F(""));
|
||||
tft.setTextSize(1);
|
||||
tft.println(F(""));
|
||||
tft.setTextColor(tft.color565(0x80, 0x80, 0x80));
|
||||
|
||||
tft.println(F(""));
|
||||
|
||||
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.println(F(" Benchmark microseconds"));
|
||||
tft.println(F(""));
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("HaD pushColor "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecHaD);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Screen fill "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecFillScreen);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Text "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecText);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Pixels "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecPixels);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Lines "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecLines);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Horiz/Vert Lines "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecFastLines);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Rectangles "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecRects);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Rectangles-filled "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecFilledRects);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Circles "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecCircles);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Circles-filled "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecFilledCircles);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Triangles "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecTriangles);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Triangles-filled "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecFilledTrangles);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Rounded rects "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usecRoundRects);
|
||||
|
||||
tft.setTextColor(TFT_CYAN); tft.setTextSize(1);
|
||||
tft.print(F("Rounded rects-fill "));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
printnice(usedFilledRoundRects);
|
||||
|
||||
tft.setTextSize(1);
|
||||
tft.println(F(""));
|
||||
tft.setTextColor(TFT_GREEN); tft.setTextSize(2);
|
||||
tft.print(F("Benchmark Complete!"));
|
||||
|
||||
delay(60 * 1000L);
|
||||
}
|
||||
|
||||
void printnice(int32_t v)
|
||||
{
|
||||
char str[32] = { 0 };
|
||||
sprintf(str, "%d", v);
|
||||
for (char *p = (str+strlen(str))-3; p > str; p -= 3)
|
||||
{
|
||||
memmove(p+1, p, strlen(p)+1);
|
||||
*p = ',';
|
||||
|
||||
}
|
||||
while (strlen(str) < 10)
|
||||
{
|
||||
memmove(str+1, str, strlen(str)+1);
|
||||
*str = ' ';
|
||||
}
|
||||
tft.println(str);
|
||||
}
|
||||
|
||||
static inline uint32_t micros_start() __attribute__ ((always_inline));
|
||||
static inline uint32_t micros_start()
|
||||
{
|
||||
uint8_t oms = millis();
|
||||
while ((uint8_t)millis() == oms)
|
||||
;
|
||||
return micros();
|
||||
}
|
||||
|
||||
uint32_t testHaD()
|
||||
{
|
||||
// pseudo-code for cheesy RLE
|
||||
// start with color1
|
||||
// while more input data remaining
|
||||
// count = 0nnnnnnn = 1 byte or 1nnnnnnn nnnnnnnn 2 bytes (0 - 32767)
|
||||
// repeat color count times
|
||||
// toggle color1/color2
|
||||
static const uint8_t HaD_240x320[] PROGMEM =
|
||||
{
|
||||
0xb9, 0x50, 0x0e, 0x80, 0x93, 0x0e, 0x41, 0x11, 0x80, 0x8d, 0x11, 0x42, 0x12, 0x80, 0x89, 0x12,
|
||||
0x45, 0x12, 0x80, 0x85, 0x12, 0x48, 0x12, 0x80, 0x83, 0x12, 0x4a, 0x13, 0x7f, 0x13, 0x4c, 0x13,
|
||||
0x7d, 0x13, 0x4e, 0x13, 0x7b, 0x13, 0x50, 0x13, 0x79, 0x13, 0x52, 0x13, 0x77, 0x13, 0x54, 0x13,
|
||||
0x75, 0x13, 0x57, 0x11, 0x75, 0x11, 0x5a, 0x11, 0x73, 0x11, 0x5c, 0x11, 0x71, 0x11, 0x5e, 0x10,
|
||||
0x71, 0x10, 0x60, 0x10, 0x6f, 0x10, 0x61, 0x10, 0x6f, 0x10, 0x60, 0x11, 0x6f, 0x11, 0x5e, 0x13,
|
||||
0x6d, 0x13, 0x5c, 0x14, 0x6d, 0x14, 0x5a, 0x15, 0x6d, 0x15, 0x58, 0x17, 0x6b, 0x17, 0x37, 0x01,
|
||||
0x1f, 0x17, 0x6b, 0x17, 0x1f, 0x01, 0x17, 0x02, 0x1d, 0x18, 0x6b, 0x18, 0x1d, 0x02, 0x17, 0x03,
|
||||
0x1b, 0x19, 0x6b, 0x19, 0x1b, 0x03, 0x17, 0x05, 0x18, 0x1a, 0x6b, 0x1a, 0x18, 0x05, 0x17, 0x06,
|
||||
0x16, 0x1b, 0x6b, 0x1b, 0x16, 0x06, 0x17, 0x07, 0x14, 0x1c, 0x6b, 0x1c, 0x14, 0x07, 0x17, 0x08,
|
||||
0x12, 0x1d, 0x6b, 0x1d, 0x12, 0x08, 0x17, 0x09, 0x10, 0x1e, 0x6b, 0x1e, 0x10, 0x09, 0x17, 0x0a,
|
||||
0x0e, 0x1f, 0x6b, 0x1f, 0x0e, 0x0a, 0x17, 0x0b, 0x0c, 0x20, 0x6b, 0x20, 0x0c, 0x0b, 0x17, 0x0c,
|
||||
0x0b, 0x21, 0x69, 0x21, 0x0b, 0x0c, 0x18, 0x0d, 0x08, 0x23, 0x67, 0x23, 0x08, 0x0d, 0x19, 0x0e,
|
||||
0x06, 0x26, 0x63, 0x26, 0x06, 0x0e, 0x19, 0x0f, 0x04, 0x28, 0x61, 0x28, 0x04, 0x0f, 0x19, 0x10,
|
||||
0x02, 0x2a, 0x5f, 0x2a, 0x02, 0x10, 0x1a, 0x3c, 0x5d, 0x3c, 0x1b, 0x3d, 0x5b, 0x3d, 0x1c, 0x3d,
|
||||
0x59, 0x3d, 0x1d, 0x3e, 0x57, 0x3e, 0x1e, 0x3e, 0x55, 0x3e, 0x1f, 0x40, 0x51, 0x40, 0x20, 0x40,
|
||||
0x4f, 0x40, 0x22, 0x40, 0x22, 0x09, 0x22, 0x40, 0x24, 0x40, 0x1a, 0x17, 0x1a, 0x40, 0x26, 0x40,
|
||||
0x16, 0x1d, 0x16, 0x40, 0x28, 0x40, 0x12, 0x23, 0x12, 0x40, 0x2a, 0x40, 0x0f, 0x27, 0x0f, 0x40,
|
||||
0x2c, 0x41, 0x0b, 0x2b, 0x0b, 0x41, 0x2f, 0x3f, 0x09, 0x2f, 0x09, 0x3f, 0x32, 0x3d, 0x08, 0x33,
|
||||
0x08, 0x3d, 0x35, 0x3a, 0x08, 0x35, 0x08, 0x3a, 0x3a, 0x36, 0x07, 0x39, 0x07, 0x36, 0x41, 0x09,
|
||||
0x05, 0x23, 0x07, 0x3b, 0x07, 0x23, 0x05, 0x09, 0x54, 0x21, 0x07, 0x3d, 0x07, 0x21, 0x64, 0x1f,
|
||||
0x06, 0x41, 0x06, 0x1f, 0x66, 0x1d, 0x06, 0x43, 0x06, 0x1d, 0x68, 0x1b, 0x06, 0x45, 0x06, 0x1b,
|
||||
0x6b, 0x18, 0x06, 0x47, 0x06, 0x18, 0x6e, 0x16, 0x06, 0x49, 0x06, 0x16, 0x70, 0x14, 0x06, 0x4b,
|
||||
0x06, 0x14, 0x72, 0x13, 0x06, 0x4b, 0x06, 0x13, 0x74, 0x11, 0x06, 0x4d, 0x06, 0x11, 0x76, 0x0f,
|
||||
0x06, 0x4f, 0x06, 0x0f, 0x78, 0x0e, 0x05, 0x51, 0x05, 0x0e, 0x7a, 0x0c, 0x06, 0x51, 0x06, 0x0c,
|
||||
0x7d, 0x09, 0x06, 0x53, 0x06, 0x09, 0x80, 0x80, 0x08, 0x05, 0x55, 0x05, 0x08, 0x80, 0x82, 0x06,
|
||||
0x05, 0x57, 0x05, 0x06, 0x80, 0x84, 0x05, 0x05, 0x57, 0x05, 0x05, 0x80, 0x86, 0x03, 0x05, 0x59,
|
||||
0x05, 0x03, 0x80, 0x88, 0x02, 0x05, 0x59, 0x05, 0x02, 0x80, 0x8f, 0x5b, 0x80, 0x95, 0x5b, 0x80,
|
||||
0x94, 0x5d, 0x80, 0x93, 0x5d, 0x80, 0x92, 0x5e, 0x80, 0x92, 0x5f, 0x80, 0x91, 0x5f, 0x80, 0x90,
|
||||
0x61, 0x80, 0x8f, 0x61, 0x80, 0x8f, 0x61, 0x80, 0x8e, 0x63, 0x80, 0x8d, 0x63, 0x80, 0x8d, 0x63,
|
||||
0x80, 0x8d, 0x63, 0x80, 0x8c, 0x19, 0x07, 0x25, 0x07, 0x19, 0x80, 0x8b, 0x16, 0x0d, 0x1f, 0x0d,
|
||||
0x16, 0x80, 0x8b, 0x14, 0x11, 0x1b, 0x11, 0x14, 0x80, 0x8b, 0x13, 0x13, 0x19, 0x13, 0x13, 0x80,
|
||||
0x8b, 0x12, 0x15, 0x17, 0x15, 0x12, 0x80, 0x8a, 0x12, 0x17, 0x15, 0x17, 0x12, 0x80, 0x89, 0x11,
|
||||
0x19, 0x13, 0x19, 0x11, 0x80, 0x89, 0x11, 0x19, 0x13, 0x19, 0x11, 0x80, 0x89, 0x10, 0x1b, 0x11,
|
||||
0x1b, 0x10, 0x80, 0x89, 0x0f, 0x1c, 0x11, 0x1c, 0x0f, 0x80, 0x89, 0x0f, 0x1c, 0x11, 0x1c, 0x0f,
|
||||
0x80, 0x89, 0x0f, 0x1c, 0x11, 0x1c, 0x0f, 0x80, 0x89, 0x0e, 0x1d, 0x11, 0x1d, 0x0e, 0x80, 0x89,
|
||||
0x0e, 0x1c, 0x13, 0x1c, 0x0e, 0x80, 0x89, 0x0e, 0x1b, 0x15, 0x1b, 0x0e, 0x80, 0x89, 0x0e, 0x1b,
|
||||
0x15, 0x1b, 0x0e, 0x80, 0x89, 0x0e, 0x1a, 0x17, 0x1a, 0x0e, 0x80, 0x89, 0x0e, 0x18, 0x1b, 0x18,
|
||||
0x0e, 0x80, 0x89, 0x0e, 0x16, 0x1f, 0x16, 0x0e, 0x80, 0x89, 0x0e, 0x14, 0x23, 0x14, 0x0e, 0x80,
|
||||
0x89, 0x0f, 0x11, 0x27, 0x11, 0x0f, 0x80, 0x89, 0x0f, 0x0e, 0x2d, 0x0e, 0x0f, 0x80, 0x89, 0x0f,
|
||||
0x0c, 0x31, 0x0c, 0x0f, 0x80, 0x89, 0x0f, 0x0b, 0x33, 0x0b, 0x0f, 0x80, 0x8a, 0x0f, 0x09, 0x35,
|
||||
0x09, 0x0f, 0x80, 0x8b, 0x10, 0x08, 0x35, 0x08, 0x10, 0x80, 0x8b, 0x10, 0x07, 0x37, 0x07, 0x10,
|
||||
0x80, 0x8b, 0x11, 0x06, 0x37, 0x06, 0x11, 0x80, 0x8b, 0x12, 0x05, 0x37, 0x05, 0x12, 0x80, 0x8c,
|
||||
0x13, 0x03, 0x1b, 0x01, 0x1b, 0x03, 0x13, 0x80, 0x8d, 0x30, 0x03, 0x30, 0x80, 0x8d, 0x30, 0x04,
|
||||
0x2f, 0x80, 0x8d, 0x2f, 0x05, 0x2f, 0x80, 0x8e, 0x2e, 0x06, 0x2d, 0x80, 0x8f, 0x2d, 0x07, 0x2d,
|
||||
0x80, 0x8f, 0x2d, 0x07, 0x2d, 0x80, 0x90, 0x2c, 0x08, 0x2b, 0x80, 0x91, 0x2b, 0x09, 0x2b, 0x80,
|
||||
0x8c, 0x01, 0x05, 0x2a, 0x09, 0x2a, 0x05, 0x01, 0x80, 0x85, 0x03, 0x05, 0x2a, 0x09, 0x2a, 0x05,
|
||||
0x03, 0x80, 0x82, 0x04, 0x05, 0x2a, 0x09, 0x2a, 0x04, 0x05, 0x80, 0x80, 0x06, 0x05, 0x29, 0x04,
|
||||
0x02, 0x03, 0x29, 0x05, 0x06, 0x7e, 0x07, 0x05, 0x29, 0x03, 0x03, 0x03, 0x29, 0x05, 0x07, 0x7c,
|
||||
0x09, 0x05, 0x28, 0x02, 0x05, 0x02, 0x28, 0x05, 0x09, 0x7a, 0x0a, 0x05, 0x28, 0x02, 0x05, 0x02,
|
||||
0x28, 0x05, 0x0a, 0x78, 0x0c, 0x05, 0x27, 0x02, 0x05, 0x02, 0x27, 0x05, 0x0c, 0x76, 0x0d, 0x06,
|
||||
0x26, 0x01, 0x07, 0x01, 0x26, 0x06, 0x0d, 0x73, 0x10, 0x05, 0x55, 0x05, 0x10, 0x70, 0x12, 0x05,
|
||||
0x53, 0x05, 0x12, 0x6e, 0x13, 0x06, 0x51, 0x06, 0x13, 0x6c, 0x15, 0x05, 0x51, 0x05, 0x15, 0x6a,
|
||||
0x16, 0x06, 0x4f, 0x06, 0x16, 0x68, 0x18, 0x06, 0x4d, 0x06, 0x18, 0x66, 0x1a, 0x06, 0x4b, 0x06,
|
||||
0x1a, 0x64, 0x1c, 0x06, 0x49, 0x06, 0x1c, 0x55, 0x07, 0x05, 0x1e, 0x06, 0x49, 0x06, 0x1e, 0x05,
|
||||
0x07, 0x42, 0x30, 0x06, 0x47, 0x06, 0x30, 0x3a, 0x34, 0x06, 0x45, 0x06, 0x34, 0x35, 0x37, 0x06,
|
||||
0x43, 0x06, 0x37, 0x32, 0x39, 0x07, 0x3f, 0x07, 0x39, 0x2f, 0x3c, 0x07, 0x3d, 0x07, 0x3c, 0x2c,
|
||||
0x3e, 0x07, 0x3b, 0x07, 0x3e, 0x2a, 0x40, 0x06, 0x3b, 0x06, 0x40, 0x28, 0x40, 0x06, 0x3c, 0x07,
|
||||
0x40, 0x26, 0x3f, 0x08, 0x3d, 0x08, 0x3f, 0x24, 0x3f, 0x09, 0x3d, 0x09, 0x3f, 0x22, 0x3f, 0x0a,
|
||||
0x14, 0x01, 0x13, 0x02, 0x13, 0x0a, 0x3f, 0x20, 0x3f, 0x0b, 0x14, 0x01, 0x13, 0x02, 0x13, 0x0b,
|
||||
0x3f, 0x1f, 0x3e, 0x0c, 0x14, 0x01, 0x13, 0x02, 0x13, 0x0c, 0x3e, 0x1e, 0x3e, 0x0d, 0x13, 0x02,
|
||||
0x13, 0x02, 0x13, 0x0d, 0x3e, 0x1d, 0x3d, 0x0e, 0x13, 0x02, 0x13, 0x02, 0x13, 0x0e, 0x3d, 0x1c,
|
||||
0x3c, 0x11, 0x11, 0x04, 0x11, 0x04, 0x11, 0x11, 0x3c, 0x1b, 0x10, 0x01, 0x2a, 0x12, 0x11, 0x04,
|
||||
0x11, 0x04, 0x11, 0x12, 0x2a, 0x01, 0x10, 0x1a, 0x0f, 0x04, 0x28, 0x14, 0x0f, 0x06, 0x0f, 0x06,
|
||||
0x0f, 0x14, 0x28, 0x04, 0x0f, 0x19, 0x0e, 0x06, 0x26, 0x16, 0x0d, 0x08, 0x0d, 0x08, 0x0d, 0x16,
|
||||
0x26, 0x06, 0x0e, 0x19, 0x0d, 0x07, 0x25, 0x18, 0x0b, 0x0a, 0x0b, 0x0a, 0x0b, 0x18, 0x25, 0x07,
|
||||
0x0d, 0x19, 0x0c, 0x09, 0x23, 0x1c, 0x06, 0x0f, 0x05, 0x10, 0x05, 0x1c, 0x23, 0x09, 0x0c, 0x18,
|
||||
0x0c, 0x0b, 0x21, 0x69, 0x21, 0x0b, 0x0c, 0x17, 0x0b, 0x0d, 0x1f, 0x6b, 0x1f, 0x0d, 0x0b, 0x17,
|
||||
0x0a, 0x0f, 0x1e, 0x6b, 0x1e, 0x0f, 0x0a, 0x17, 0x09, 0x11, 0x1d, 0x6b, 0x1d, 0x11, 0x09, 0x17,
|
||||
0x07, 0x14, 0x1c, 0x6b, 0x1c, 0x14, 0x07, 0x17, 0x06, 0x16, 0x1b, 0x6b, 0x1b, 0x16, 0x06, 0x17,
|
||||
0x05, 0x18, 0x1a, 0x6b, 0x1a, 0x18, 0x05, 0x17, 0x04, 0x1a, 0x19, 0x6b, 0x19, 0x1a, 0x04, 0x17,
|
||||
0x03, 0x1b, 0x19, 0x6b, 0x19, 0x1b, 0x03, 0x17, 0x02, 0x1d, 0x18, 0x6b, 0x18, 0x1d, 0x02, 0x37,
|
||||
0x17, 0x6b, 0x17, 0x58, 0x16, 0x6b, 0x16, 0x5a, 0x14, 0x6d, 0x14, 0x5c, 0x13, 0x6d, 0x13, 0x5e,
|
||||
0x12, 0x6d, 0x12, 0x60, 0x10, 0x6f, 0x10, 0x61, 0x10, 0x6f, 0x10, 0x60, 0x11, 0x6f, 0x11, 0x5e,
|
||||
0x11, 0x71, 0x11, 0x5c, 0x12, 0x71, 0x12, 0x5a, 0x12, 0x73, 0x12, 0x58, 0x12, 0x75, 0x12, 0x56,
|
||||
0x13, 0x75, 0x13, 0x54, 0x13, 0x77, 0x13, 0x51, 0x14, 0x79, 0x14, 0x4e, 0x14, 0x7b, 0x14, 0x4c,
|
||||
0x14, 0x7d, 0x14, 0x4a, 0x14, 0x7f, 0x14, 0x48, 0x13, 0x80, 0x83, 0x13, 0x46, 0x13, 0x80, 0x85,
|
||||
0x13, 0x44, 0x12, 0x80, 0x89, 0x12, 0x42, 0x11, 0x80, 0x8d, 0x11, 0x40, 0x0f, 0x80, 0x93, 0x0f,
|
||||
0x45, 0x04, 0x80, 0x9d, 0x04, 0xb9, 0x56,
|
||||
};
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
uint32_t start = micros_start();
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
tft.setAddrWindow(0, 0, 240, 320);
|
||||
|
||||
uint16_t cnt = 0;
|
||||
uint16_t color = tft.color565((i << 4) | i, (i << 4) | i, (i << 4) | i);
|
||||
uint16_t curcolor = 0;
|
||||
|
||||
const uint8_t *cmp = &HaD_240x320[0];
|
||||
|
||||
tft.startWrite();
|
||||
while (cmp < &HaD_240x320[sizeof(HaD_240x320)])
|
||||
{
|
||||
cnt = pgm_read_byte(cmp++);
|
||||
if (cnt & 0x80) cnt = ((cnt & 0x7f) << 8) | pgm_read_byte(cmp++);
|
||||
tft.pushColor(curcolor, cnt); // PDQ_GFX has count
|
||||
curcolor ^= color;
|
||||
}
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
uint32_t t = micros() - start;
|
||||
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
tft.setTextSize(2);
|
||||
tft.setCursor(8, 285);
|
||||
tft.print(F("http://hackaday.io/"));
|
||||
tft.setCursor(96, 302);
|
||||
tft.print(F("Xark"));
|
||||
|
||||
delay(3 * 1000L);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t testFillScreen()
|
||||
{
|
||||
uint32_t start = micros_start();
|
||||
// Shortened this tedious test!
|
||||
tft.fillScreen(TFT_WHITE);
|
||||
tft.fillScreen(TFT_RED);
|
||||
tft.fillScreen(TFT_GREEN);
|
||||
tft.fillScreen(TFT_BLUE);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
return (micros() - start)/5;
|
||||
}
|
||||
|
||||
uint32_t testText()
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
uint32_t start = micros_start();
|
||||
tft.setCursor(0, 0);
|
||||
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
|
||||
tft.println(F("Hello World!"));
|
||||
tft.setTextSize(2);
|
||||
tft.setTextColor(tft.color565(0xff, 0x00, 0x00));
|
||||
tft.print(F("RED "));
|
||||
tft.setTextColor(tft.color565(0x00, 0xff, 0x00));
|
||||
tft.print(F("GREEN "));
|
||||
tft.setTextColor(tft.color565(0x00, 0x00, 0xff));
|
||||
tft.println(F("BLUE"));
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
tft.println(1234.56);
|
||||
tft.setTextColor(TFT_RED); tft.setTextSize(3);
|
||||
tft.println(0xDEADBEEF, HEX);
|
||||
tft.println();
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.setTextSize(5);
|
||||
tft.println(F("Groop"));
|
||||
tft.setTextSize(2);
|
||||
tft.println(F("I implore thee,"));
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.setTextSize(1);
|
||||
tft.println(F("my foonting turlingdromes."));
|
||||
tft.println(F("And hooptiously drangle me"));
|
||||
tft.println(F("with crinkly bindlewurdles,"));
|
||||
tft.println(F("Or I will rend thee"));
|
||||
tft.println(F("in the gobberwarts"));
|
||||
tft.println(F("with my blurglecruncheon,"));
|
||||
tft.println(F("see if I don't!"));
|
||||
tft.println(F(""));
|
||||
tft.println(F(""));
|
||||
tft.setTextColor(TFT_MAGENTA);
|
||||
tft.setTextSize(6);
|
||||
tft.println(F("Woot!"));
|
||||
uint32_t t = micros() - start;
|
||||
delay(1000);
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t testPixels()
|
||||
{
|
||||
int32_t w = tft.width();
|
||||
int32_t h = tft.height();
|
||||
|
||||
uint32_t start = micros_start();
|
||||
tft.startWrite();
|
||||
for (uint16_t y = 0; y < h; y++)
|
||||
{
|
||||
for (uint16_t x = 0; x < w; x++)
|
||||
{
|
||||
tft.drawPixel(x, y, tft.color565(x<<3, y<<3, x*y));
|
||||
}
|
||||
}
|
||||
tft.endWrite();
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
|
||||
uint32_t testLines(uint16_t color)
|
||||
{
|
||||
uint32_t start, t;
|
||||
int32_t x1, y1, x2, y2;
|
||||
int32_t w = tft.width();
|
||||
int32_t h = tft.height();
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
x1 = y1 = 0;
|
||||
y2 = h - 1;
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (x2 = 0; x2 < w; x2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
x2 = w - 1;
|
||||
|
||||
for (y2 = 0; y2 < h; y2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
t = micros() - start; // fillScreen doesn't count against timing
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
x1 = w - 1;
|
||||
y1 = 0;
|
||||
y2 = h - 1;
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (x2 = 0; x2 < w; x2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
x2 = 0;
|
||||
for (y2 = 0; y2 < h; y2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
t += micros() - start;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
x1 = 0;
|
||||
y1 = h - 1;
|
||||
y2 = 0;
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (x2 = 0; x2 < w; x2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
x2 = w - 1;
|
||||
for (y2 = 0; y2 < h; y2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
t += micros() - start;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
x1 = w - 1;
|
||||
y1 = h - 1;
|
||||
y2 = 0;
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (x2 = 0; x2 < w; x2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
x2 = 0;
|
||||
for (y2 = 0; y2 < h; y2 += 6)
|
||||
{
|
||||
tft.drawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
t += micros() - start;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t testFastLines(uint16_t color1, uint16_t color2)
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t x, y;
|
||||
int32_t w = tft.width();
|
||||
int32_t h = tft.height();
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (y = 0; y < h; y += 5)
|
||||
tft.drawFastHLine(0, y, w, color1);
|
||||
for (x = 0; x < w; x += 5)
|
||||
tft.drawFastVLine(x, 0, h, color2);
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
uint32_t testRects(uint16_t color)
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t n, i, i2;
|
||||
int32_t cx = tft.width() / 2;
|
||||
int32_t cy = tft.height() / 2;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
n = std::min(tft.width(), tft.height());
|
||||
start = micros_start();
|
||||
for (i = 2; i < n; i += 6)
|
||||
{
|
||||
i2 = i / 2;
|
||||
tft.drawRect(cx-i2, cy-i2, i, i, color);
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
uint32_t testFilledRects(uint16_t color1, uint16_t color2)
|
||||
{
|
||||
uint32_t start, t = 0;
|
||||
int32_t n, i, i2;
|
||||
int32_t cx = tft.width() / 2 - 1;
|
||||
int32_t cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
n = std::min(tft.width(), tft.height());
|
||||
for (i = n; i > 0; i -= 6)
|
||||
{
|
||||
i2 = i / 2;
|
||||
|
||||
start = micros_start();
|
||||
|
||||
tft.fillRect(cx-i2, cy-i2, i, i, color1);
|
||||
|
||||
t += micros() - start;
|
||||
|
||||
// Outlines are not included in timing results
|
||||
tft.drawRect(cx-i2, cy-i2, i, i, color2);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t testFilledCircles(uint8_t radius, uint16_t color)
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (x = radius; x < w; x += r2)
|
||||
{
|
||||
for (y = radius; y < h; y += r2)
|
||||
{
|
||||
tft.fillCircle(x, y, radius, color);
|
||||
}
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
uint32_t testCircles(uint8_t radius, uint16_t color)
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t x, y, r2 = radius * 2;
|
||||
int32_t w = tft.width() + radius;
|
||||
int32_t h = tft.height() + radius;
|
||||
|
||||
// Screen is not cleared for this one -- this is
|
||||
// intentional and does not affect the reported time.
|
||||
start = micros_start();
|
||||
|
||||
for (x = 0; x < w; x += r2)
|
||||
{
|
||||
for (y = 0; y < h; y += r2)
|
||||
{
|
||||
tft.drawCircle(x, y, radius, color);
|
||||
}
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
uint32_t testTriangles()
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t n, i;
|
||||
int32_t cx = tft.width()/ 2 - 1;
|
||||
int32_t cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
n = std::min(cx, cy);
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (i = 0; i < n; i += 5)
|
||||
{
|
||||
tft.drawTriangle(
|
||||
cx , cy - i, // peak
|
||||
cx - i, cy + i, // bottom left
|
||||
cx + i, cy + i, // bottom right
|
||||
tft.color565(0, 0, i));
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
uint32_t testFilledTriangles()
|
||||
{
|
||||
uint32_t start, t = 0;
|
||||
int32_t i;
|
||||
int32_t cx = tft.width() / 2 - 1;
|
||||
int32_t cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (i = std::min(cx,cy); i > 10; i -= 5) {
|
||||
start = micros_start();
|
||||
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
|
||||
tft.color565(0, i, i));
|
||||
t += micros() - start;
|
||||
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
|
||||
tft.color565(i, i, 0));
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t testRoundRects()
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t w, i, i2;
|
||||
int32_t cx = tft.width() / 2 - 1;
|
||||
int32_t cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
w = std::min(tft.width(), tft.height());
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (i = 0; i < w; i += 6)
|
||||
{
|
||||
i2 = i / 2;
|
||||
tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
uint32_t testFilledRoundRects()
|
||||
{
|
||||
uint32_t start;
|
||||
int32_t i, i2;
|
||||
int32_t cx = tft.width() / 2 - 1;
|
||||
int32_t cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
start = micros_start();
|
||||
|
||||
for (i = std::min(tft.width(), tft.height()); i > 20; i -= 6)
|
||||
{
|
||||
i2 = i / 2;
|
||||
tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
Original sketch text:
|
||||
|
||||
This is an example sketch for the Adafruit 2.2" SPI display.
|
||||
This library works with the Adafruit 2.2" TFT Breakout w/SD card
|
||||
----> http://www.adafruit.com/products/1480
|
||||
|
||||
Check out the links above for our tutorials and wiring diagrams
|
||||
These displays use SPI to communicate, 4 or 5 pins are required to
|
||||
interface (RST is optional)
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
MIT license, all text above must be included in any redistribution
|
||||
****************************************************/
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.16.0)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS "$(PROJECT_PATH)/../../../../../LovyanGFX")
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(LovyanGFX-build-test)
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "main/main.cpp"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
idf_component_register(
|
||||
SRCS "main.cpp"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES LovyanGFX)
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
#if !defined LGFX_AUTODETECT
|
||||
#define LGFX_AUTODETECT
|
||||
#endif
|
||||
|
||||
#if !defined LGFX_USE_V1
|
||||
#define LGFX_USE_V1
|
||||
#endif
|
||||
|
||||
#if defined ( ARDUINO ) && defined ( ESP32 )
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
#if defined SKIP_I2C_TEST
|
||||
#define DUMMY_DISPLAY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined DUMMY_DISPLAY
|
||||
// AUTODETECT will fail, so let's build a dummy object
|
||||
// with arbitraty display for the sakes of testing
|
||||
class LGFX : public lgfx::LGFX_Device
|
||||
{
|
||||
lgfx::Panel_ST7735S _panel_instance;
|
||||
lgfx::Bus_SPI _bus_instance;
|
||||
|
||||
public:
|
||||
LGFX(void)
|
||||
{
|
||||
{
|
||||
auto cfg = _bus_instance.config();
|
||||
_bus_instance.config(cfg);
|
||||
_panel_instance.setBus(&_bus_instance);
|
||||
}
|
||||
{
|
||||
auto cfg = _panel_instance.config();
|
||||
_panel_instance.config(cfg);
|
||||
}
|
||||
setPanel(&_panel_instance);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined SKIP_I2C_TEST
|
||||
|
||||
class LGFX_I2C : public lgfx::LGFX_Device
|
||||
{
|
||||
lgfx::Bus_I2C _bus_instance;
|
||||
lgfx::Panel_SSD1306 _panel_instance;
|
||||
lgfx::Touch_FT5x06 _touch_instance;
|
||||
|
||||
public:
|
||||
LGFX_I2C(void)
|
||||
{
|
||||
{
|
||||
auto cfg = _bus_instance.config();
|
||||
_bus_instance.config(cfg);
|
||||
_panel_instance.setBus(&_bus_instance);
|
||||
}
|
||||
{
|
||||
auto cfg = _panel_instance.config();
|
||||
_panel_instance.config(cfg);
|
||||
}
|
||||
{
|
||||
auto cfg = _touch_instance.config();
|
||||
_touch_instance.config(cfg);
|
||||
_panel_instance.setTouch(&_touch_instance);
|
||||
}
|
||||
setPanel(&_panel_instance);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static LGFX display1;
|
||||
|
||||
#if !defined SKIP_I2C_TEST
|
||||
static LGFX_I2C display2;
|
||||
#endif
|
||||
|
||||
static LGFX_Sprite sprite(&display1);
|
||||
|
||||
void test(LGFX_Device &lcd)
|
||||
{
|
||||
lcd.init();
|
||||
lcd.setRotation(1);
|
||||
lcd.setBrightness(128);
|
||||
lcd.setColorDepth(24);
|
||||
lcd.drawPixel(0, 0, 0xFFFF);
|
||||
lcd.drawFastVLine(2, 0, 100, lcd.color888(255, 0, 0));
|
||||
lcd.drawFastVLine(4, 0, 100, lcd.color565( 0, 255, 0));
|
||||
lcd.drawFastVLine(6, 0, 100, lcd.color332( 0, 0, 255));
|
||||
uint32_t red = 0xFF0000;
|
||||
lcd.drawFastHLine(0, 2, 100, red);
|
||||
lcd.drawFastHLine(0, 4, 100, 0x00FF00U);
|
||||
lcd.drawFastHLine(0, 6, 100, (uint32_t)0xFF);
|
||||
uint16_t green = 0x07E0;
|
||||
lcd.drawRect(10, 10, 50, 50, 0xF800);
|
||||
lcd.drawRect(12, 12, 50, 50, green);
|
||||
lcd.drawRect(14, 14, 50, 50, (uint16_t)0x1F);
|
||||
uint8_t blue = 0x03;
|
||||
lcd.fillRect(20, 20, 20, 20, (uint8_t)0xE0);
|
||||
lcd.fillRect(30, 30, 20, 20, (uint8_t)0x1C);
|
||||
lcd.fillRect(40, 40, 20, 20, blue);
|
||||
lcd.setColor(0xFF0000U);
|
||||
lcd.fillCircle ( 40, 80, 20 );
|
||||
lcd.fillEllipse( 80, 40, 10, 20);
|
||||
lcd.fillArc ( 80, 80, 20, 10, 0, 90);
|
||||
lcd.fillTriangle(80, 80, 60, 80, 80, 60);
|
||||
lcd.setColor(0x0000FFU);
|
||||
lcd.drawCircle ( 40, 80, 20 );
|
||||
lcd.drawEllipse( 80, 40, 10, 20);
|
||||
lcd.drawArc ( 80, 80, 20, 10, 0, 90);
|
||||
lcd.drawTriangle(60, 80, 80, 80, 80, 60);
|
||||
lcd.setColor(0x00FF00U);
|
||||
lcd.drawBezier( 60, 80, 80, 80, 80, 60);
|
||||
lcd.drawBezier( 60, 80, 80, 20, 20, 80, 80, 60);
|
||||
lcd.drawGradientLine( 0, 80, 80, 0, 0xFF0000U, 0x0000FFU);
|
||||
|
||||
lcd.fillScreen(0xFFFFFFu);
|
||||
lcd.setColor(0x00FF00u);
|
||||
lcd.fillScreen();
|
||||
lcd.clear(0xFFFFFFu);
|
||||
lcd.setBaseColor(0x000000u);
|
||||
lcd.clear();
|
||||
lcd.drawLine(0, 1, 39, 40, red);
|
||||
lcd.drawLine(1, 0, 40, 39, blue);
|
||||
lcd.startWrite();
|
||||
lcd.drawLine(38, 0, 0, 38, 0xFFFF00U);
|
||||
lcd.drawLine(39, 1, 1, 39, 0xFF00FFU);
|
||||
lcd.drawLine(40, 2, 2, 40, 0x00FFFFU);
|
||||
lcd.endWrite();
|
||||
lcd.startWrite();
|
||||
lcd.startWrite();
|
||||
lcd.startWrite();
|
||||
lcd.endWrite();
|
||||
lcd.endWrite();
|
||||
lcd.endWrite();
|
||||
lcd.endWrite();
|
||||
lcd.startWrite();
|
||||
lcd.startWrite();
|
||||
lcd.drawPixel(0, 0);
|
||||
lcd.endTransaction();
|
||||
lcd.beginTransaction();
|
||||
lcd.drawPixel(0, 0);
|
||||
lcd.endWrite();
|
||||
lcd.endWrite();
|
||||
lcd.startWrite();
|
||||
for (uint32_t x = 0; x < 128; ++x) {
|
||||
for (uint32_t y = 0; y < 128; ++y) {
|
||||
lcd.writePixel(x, y, lcd.color888( x*2, x + y, y*2));
|
||||
}
|
||||
}
|
||||
lcd.endWrite();
|
||||
|
||||
sprite.setColorDepth(24);
|
||||
sprite.createSprite(65, 65);
|
||||
|
||||
for (uint32_t x = 0; x < 64; ++x) {
|
||||
for (uint32_t y = 0; y < 64; ++y) {
|
||||
sprite.drawPixel(x, y, lcd.color888(3 + x*4, (x + y)*2, 3 + y*4));
|
||||
}
|
||||
}
|
||||
sprite.drawRect(0, 0, 65, 65, 0xFFFF);
|
||||
sprite.pushSprite(64, 0);
|
||||
sprite.pushSprite(&lcd, 0, 64);
|
||||
|
||||
|
||||
sprite.setPivot(32, 32);
|
||||
int32_t center_x = lcd.width()/2;
|
||||
int32_t center_y = lcd.height()/2;
|
||||
lcd.startWrite();
|
||||
for (int angle = 0; angle <= 360; ++angle) {
|
||||
sprite.pushRotateZoom(center_x, center_y, angle, 2.5, 3);
|
||||
if ((angle % 36) == 0) lcd.display();
|
||||
}
|
||||
lcd.endWrite();
|
||||
|
||||
sprite.deleteSprite();
|
||||
|
||||
sprite.setColorDepth(4);
|
||||
sprite.createSprite(65, 65);
|
||||
sprite.setPaletteColor(1, 0x0000FFU);
|
||||
sprite.setPaletteColor(2, 0x00FF00U);
|
||||
sprite.setPaletteColor(3, 0xFF0000U);
|
||||
|
||||
sprite.fillRect(10, 10, 45, 45, 1);
|
||||
sprite.fillCircle(32, 32, 22, 2);
|
||||
sprite.fillTriangle(32, 12, 15, 43, 49, 43, 3);
|
||||
|
||||
sprite.pushSprite(&lcd, 0, 0, 0);
|
||||
|
||||
lcd.drawBmp((uint8_t*)nullptr, 0, 0, 0);
|
||||
lcd.drawPng((uint8_t*)nullptr, 0, 0, 0);
|
||||
lcd.drawJpg((uint8_t*)nullptr, 0, 0, 0);
|
||||
lcd.drawQoi((uint8_t*)nullptr, 0, 0, 0);
|
||||
|
||||
#if defined ( ARDUINO ) && defined ( ESP32 )
|
||||
lcd.drawBmpFile(SPIFFS, "/test.bmp");
|
||||
lcd.drawPngFile(SPIFFS, "/test.png");
|
||||
lcd.drawJpgFile(SPIFFS, "/test.jpg");
|
||||
lcd.drawQoiFile(SPIFFS, "/test.qoi");
|
||||
#endif
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
test(display1);
|
||||
#if !defined SKIP_I2C_TEST
|
||||
test(display2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
lgfx::delay(1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if !defined ARDUINO
|
||||
extern "C" {
|
||||
void loopTask(void*)
|
||||
{
|
||||
setup();
|
||||
for(;;) {
|
||||
loop();
|
||||
}
|
||||
}
|
||||
void app_main()
|
||||
{
|
||||
xTaskCreatePinnedToCore( loopTask, "loopTask", 8192, NULL, 1, NULL, 1 );
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
; Inspired from https://github.com/Jason2866/Tasmota-build
|
||||
[platformio]
|
||||
description = LGFX Build test suite for platformio
|
||||
default_envs = esp8266
|
||||
; lib_extra_dirs = ../../../../LovyanGFX
|
||||
|
||||
src_dir = main
|
||||
extra_configs = platformio_esp8266.ini
|
||||
platformio_esp32.ini
|
||||
platformio_atmelsam.ini
|
||||
platformio_rpipico.ini
|
||||
|
||||
[env]
|
||||
framework = arduino
|
||||
lib_deps = LovyanGFX
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
[atmelsam_default]
|
||||
platform = atmelsam
|
||||
|
||||
[env:seeed_wio_terminal]
|
||||
[env:adafruit_pybadge_m4]
|
||||
|
||||
[env:seeed_wio_terminal-default]
|
||||
platform = ${atmelsam_default.platform}
|
||||
board = seeed_wio_terminal
|
||||
|
||||
[env:adafruit_pybadge_m4-default]
|
||||
platform = ${atmelsam_default.platform}
|
||||
board = adafruit_pybadge_m4
|
||||
build_src_flags =
|
||||
${env.src_build_flags}
|
||||
-DLED_PIN=13
|
||||
-O3 -flto
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
|
||||
[coding_standards]
|
||||
build_flags =
|
||||
-Wno-unused-variable
|
||||
-Wno-unused-but-set-variable
|
||||
-Wno-sign-compare
|
||||
-Wunreachable-code
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wshadow
|
||||
-Wdouble-promotion
|
||||
-Wformat
|
||||
-Wnonnull
|
||||
|
||||
|
||||
[esp32_1_0_6]
|
||||
platform = espressif32 @ ^3
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_0]
|
||||
platform = espressif32 @ ^4
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_1]
|
||||
platform = espressif32 @ ^4
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_2]
|
||||
platform = espressif32 @ ^4
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.2
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_3]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.3/esp32-2.0.3.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
|
||||
|
||||
[esp32_2_0_4]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esp32-2.0.4.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_5]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.5/esp32-2.0.5.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_6]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.6/esp32-2.0.6.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_7]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.7/esp32-2.0.7.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
[esp32_2_0_8]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.8/esp32-2.0.8.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
|
||||
|
||||
|
||||
[esp32_default]
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
;platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.3/esp32-2.0.3.zip
|
||||
build_flags = ${coding_standards.build_flags}
|
||||
|
||||
|
||||
[esp32]
|
||||
board = esp32dev
|
||||
[M5StickC]
|
||||
board = m5stick-c
|
||||
[M5Stack]
|
||||
board = m5stack-core-esp32
|
||||
[M5Core2]
|
||||
board = m5stack-core2
|
||||
[M5CoreS3]
|
||||
board = esp32-s3-devkitc-1
|
||||
board_upload.flash_size = 16MB
|
||||
board_upload.maximum_size = 16777216
|
||||
board_build.partitions = default_16MB.csv
|
||||
board_build.arduino.memory_type = qio_qspi
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DARDUINO_M5STACK_CORES3
|
||||
-DBOARD_HAS_PSRAM
|
||||
-DARDUINO_UDB_MODE=1
|
||||
|
||||
[esp32c3]
|
||||
board = esp32dev
|
||||
board_build.mcu = esp32c3
|
||||
build_flags =
|
||||
-DDUMMY_DISPLAY
|
||||
${coding_standards.build_flags}
|
||||
[esp32s2]
|
||||
board = esp32dev
|
||||
board_build.mcu = esp32s2
|
||||
[esp32s3]
|
||||
board = esp32dev
|
||||
board_build.mcu = esp32s3
|
||||
|
||||
|
||||
; for some reason platformio 5.0 wants this
|
||||
[env:esp32]
|
||||
[env:m5stick-c]
|
||||
[env:m5stack-core-esp32]
|
||||
[env:m5stack-core2]
|
||||
[env:m5stack-cores3]
|
||||
[env:esp32-s2]
|
||||
[env:esp32-s3]
|
||||
[env:esp32-c3]
|
||||
|
||||
|
||||
[env:m5stack-cores3-2_0_5]
|
||||
extends = M5CoreS3, esp32_2_0_5
|
||||
[env:m5stack-cores3-2_0_6]
|
||||
extends = M5CoreS3, esp32_2_0_6
|
||||
[env:m5stack-cores3-2_0_7]
|
||||
extends = M5CoreS3, esp32_2_0_7
|
||||
[env:m5stack-cores3-2_0_8]
|
||||
extends = M5CoreS3, esp32_2_0_8
|
||||
[env:m5stack-cores3-default]
|
||||
extends = M5CoreS3, esp32_2_0_8
|
||||
|
||||
|
||||
[env:esp32-1_0_6]
|
||||
extends = esp32, esp32_1_0_6
|
||||
board = esp32dev
|
||||
[env:esp32-2_0_0]
|
||||
extends = esp32, esp32_2_0_0
|
||||
[env:esp32-2_0_1]
|
||||
extends = esp32, esp32_2_0_1
|
||||
[env:esp32-2_0_2]
|
||||
extends = esp32, esp32_2_0_2
|
||||
[env:esp32-2_0_3]
|
||||
extends = esp32, esp32_2_0_3
|
||||
[env:esp32-2_0_4]
|
||||
extends = esp32, esp32_2_0_4
|
||||
[env:esp32-2_0_5]
|
||||
extends = esp32, esp32_2_0_5
|
||||
[env:esp32-2_0_6]
|
||||
extends = esp32, esp32_2_0_6
|
||||
[env:esp32-2_0_7]
|
||||
extends = esp32, esp32_2_0_7
|
||||
[env:esp32-2_0_8]
|
||||
extends = esp32, esp32_2_0_8
|
||||
[env:esp32-default]
|
||||
extends = esp32, esp32_default
|
||||
|
||||
[env:m5stick-c-1_0_6]
|
||||
extends = M5StickC, esp32_1_0_6
|
||||
[env:m5stick-c-2_0_0]
|
||||
extends = M5StickC, esp32_2_0_0
|
||||
[env:m5stick-c-2_0_1]
|
||||
extends = M5StickC, esp32_2_0_1
|
||||
[env:m5stick-c-2_0_2]
|
||||
extends = M5StickC, esp32_2_0_2
|
||||
[env:m5stick-c-2_0_3]
|
||||
extends = M5StickC, esp32_2_0_3
|
||||
[env:m5stick-c-2_0_4]
|
||||
extends = esp32, esp32_2_0_4
|
||||
[env:m5stick-c-2_0_5]
|
||||
extends = esp32, esp32_2_0_5
|
||||
[env:m5stick-c-2_0_6]
|
||||
extends = esp32, esp32_2_0_6
|
||||
[env:m5stick-c-2_0_7]
|
||||
extends = esp32, esp32_2_0_7
|
||||
[env:m5stick-c-2_0_8]
|
||||
extends = esp32, esp32_2_0_8
|
||||
[env:m5stick-c-default]
|
||||
extends = M5StickC, esp32_default
|
||||
|
||||
|
||||
[env:m5stack-core-esp32-1_0_6]
|
||||
extends = M5Stack, esp32_1_0_6
|
||||
[env:m5stack-core-esp32-2_0_0]
|
||||
extends = M5Stack, esp32_2_0_0
|
||||
[env:m5stack-core-esp32-2_0_1]
|
||||
extends = M5Stack, esp32_2_0_1
|
||||
[env:m5stack-core-esp32-2_0_2]
|
||||
extends = M5Stack, esp32_2_0_2
|
||||
[env:m5stack-core-esp32-2_0_3]
|
||||
extends = M5Stack, esp32_2_0_3
|
||||
[env:m5stack-core-esp32-2_0_4]
|
||||
extends = esp32, esp32_2_0_4
|
||||
[env:m5stack-core-esp32-2_0_5]
|
||||
extends = esp32, esp32_2_0_5
|
||||
[env:m5stack-core-esp32-2_0_6]
|
||||
extends = esp32, esp32_2_0_6
|
||||
[env:m5stack-core-esp32-2_0_7]
|
||||
extends = esp32, esp32_2_0_7
|
||||
[env:m5stack-core-esp32-2_0_8]
|
||||
extends = esp32, esp32_2_0_8
|
||||
[env:m5stack-core-esp32-default]
|
||||
extends = M5Stack, esp32_default
|
||||
|
||||
[env:m5stack-core2-1_0_6]
|
||||
extends = M5Core2, esp32_1_0_6
|
||||
[env:m5stack-core2-2_0_0]
|
||||
extends = M5Core2, esp32_2_0_0
|
||||
[env:m5stack-core2-2_0_1]
|
||||
extends = M5Core2, esp32_2_0_1
|
||||
[env:m5stack-core2-2_0_2]
|
||||
extends = M5Core2, esp32_2_0_2
|
||||
[env:m5stack-core2-2_0_3]
|
||||
extends = M5Core2, esp32_2_0_3
|
||||
[env:m5stack-core2-2_0_4]
|
||||
extends = esp32, esp32_2_0_4
|
||||
[env:m5stack-core2-2_0_5]
|
||||
extends = esp32, esp32_2_0_5
|
||||
[env:m5stack-core2-2_0_6]
|
||||
extends = esp32, esp32_2_0_6
|
||||
[env:m5stack-core2-2_0_7]
|
||||
extends = esp32, esp32_2_0_7
|
||||
[env:m5stack-core2-2_0_8]
|
||||
extends = esp32, esp32_2_0_8
|
||||
[env:m5stack-core2-default]
|
||||
extends = M5Core2, esp32_default
|
||||
|
||||
[env:esp32-c3-2_0_1]
|
||||
extends = esp32c3, esp32_2_0_1
|
||||
[env:esp32-c3-2_0_2]
|
||||
extends = esp32c3, esp32_2_0_2
|
||||
[env:esp32-c3-2_0_3]
|
||||
extends = esp32c3, esp32_2_0_3
|
||||
[env:esp32-c3-2_0_4]
|
||||
extends = esp32c3, esp32_2_0_4
|
||||
[env:esp32-c3-2_0_5]
|
||||
extends = esp32c3, esp32_2_0_5
|
||||
[env:esp32-c3-2_0_6]
|
||||
extends = esp32c3, esp32_2_0_6
|
||||
[env:esp32-c3-2_0_7]
|
||||
extends = esp32c3, esp32_2_0_7
|
||||
[env:esp32-c3-2_0_8]
|
||||
extends = esp32c3, esp32_2_0_8
|
||||
[env:esp32-c3-default]
|
||||
extends = esp32c3, esp32_default
|
||||
|
||||
[env:esp32-s2-2_0_1]
|
||||
extends = esp32s2, esp32_2_0_1
|
||||
[env:esp32-s2-2_0_2]
|
||||
extends = esp32s2, esp32_2_0_2
|
||||
[env:esp32-s2-2_0_3]
|
||||
extends = esp32s2, esp32_2_0_3
|
||||
[env:esp32-s2-2_0_4]
|
||||
extends = esp32, esp32_2_0_4
|
||||
[env:esp32-s2-2_0_5]
|
||||
extends = esp32, esp32_2_0_5
|
||||
[env:esp32-s2-2_0_6]
|
||||
extends = esp32, esp32_2_0_6
|
||||
[env:esp32-s2-2_0_7]
|
||||
extends = esp32, esp32_2_0_7
|
||||
[env:esp32-s2-2_0_8]
|
||||
extends = esp32, esp32_2_0_8
|
||||
[env:esp32-s2-default]
|
||||
extends = esp32s2, esp32_default
|
||||
|
||||
[env:esp32-s3-2_0_3]
|
||||
extends = esp32s3, esp32_2_0_3
|
||||
[env:esp32-s3-2_0_4]
|
||||
extends = esp32, esp32_2_0_4
|
||||
[env:esp32-s3-2_0_5]
|
||||
extends = esp32, esp32_2_0_5
|
||||
[env:esp32-s3-2_0_6]
|
||||
extends = esp32, esp32_2_0_6
|
||||
[env:esp32-s3-2_0_7]
|
||||
extends = esp32, esp32_2_0_7
|
||||
[env:esp32-s3-2_0_8]
|
||||
extends = esp32, esp32_2_0_8
|
||||
[env:esp32-s3-default]
|
||||
extends = esp32s3, esp32_default
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
[esp8266_default]
|
||||
platform = espressif8266
|
||||
|
||||
[esp8266_3_0_0]
|
||||
platform = espressif8266@3.0.0
|
||||
|
||||
[esp8266_3_1_0]
|
||||
platform = espressif8266@3.1.0
|
||||
|
||||
[esp8266_3_2_0]
|
||||
platform = espressif8266@3.2.0
|
||||
|
||||
|
||||
[env:esp8266]
|
||||
|
||||
[env:esp8266-3_0_0]
|
||||
platform = ${esp8266_3_0_0.platform}
|
||||
board = d1_mini
|
||||
|
||||
[env:esp8266-3_1_0]
|
||||
platform = ${esp8266_3_1_0.platform}
|
||||
board = d1_mini
|
||||
|
||||
[env:esp8266-3_2_0]
|
||||
platform = ${esp8266_3_2_0.platform}
|
||||
board = d1_mini
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
[rpipico_default]
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||
board = pico
|
||||
framework = arduino
|
||||
board_build.core = earlephilhower
|
||||
|
||||
|
||||
|
||||
[env:pico-default]
|
||||
extends = rpipico_default
|
||||
build_flags =
|
||||
-DDUMMY_DISPLAY
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n
|
||||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <LovyanGFX.hpp>
|
||||
|
||||
static LGFX lcd;
|
||||
|
||||
static void tileRect(int x, int y, int w, int h, int tile, uint16_t color)
|
||||
{
|
||||
if (tile == 0) return;
|
||||
int px = 0;
|
||||
int py = 0;
|
||||
for (int i = 0;i < h; i++) {
|
||||
py = y + i;
|
||||
for (int j = 0;j < w; j++) {
|
||||
px = x + j;
|
||||
switch (tile >> 1) {
|
||||
case 0: if ((px+py)&4) { continue; }
|
||||
case 1: if (px&2) { continue; }
|
||||
case 2: if ((px+py)&2) { continue; }
|
||||
case 3: if (px&1) { continue; }
|
||||
}
|
||||
if ( (px+py) & 1 ) { lcd.drawPixel(px, py, color); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void drawTile(int y, int h, uint16_t r, uint16_t g, uint16_t b)
|
||||
{
|
||||
uint16_t color = lcd.color565(r,g,b);
|
||||
int step = 10;
|
||||
int x1 = lcd.width() / step;
|
||||
int x2 = (step-1) * lcd.width() / step;
|
||||
lcd.fillRect(0, y, x2, h, 0);
|
||||
lcd.fillRect(x2, y, lcd.width() - x2, h, color);
|
||||
for (uint32_t i = 1; i < step; i++) {
|
||||
x2 = i * lcd.width() / step;
|
||||
tileRect(x1, y, x2 - x1, h, i, color);
|
||||
x1 = x2;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawStep(int y, int h, int step, uint32_t r, uint32_t g, uint32_t b)
|
||||
{
|
||||
int x1 = 0;
|
||||
int x2 = 0;
|
||||
for (uint32_t i = 0; i < step; i++) {
|
||||
x2 = (i+1) * lcd.width() / step;
|
||||
uint16_t color = i == 0 ? 0
|
||||
: lcd.color565(r ? r*((i+1)>>1)/(step>>1) : 0
|
||||
,g ? g*((i+1)>>1)/(step>>1) : 0
|
||||
,b ? b*((i+1)>>1)/(step>>1) : 0);
|
||||
lcd.fillRect( x1, y, x2 - x1, h
|
||||
, color
|
||||
);
|
||||
x1 = x2;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawGrad(int y, int h, uint16_t r, uint16_t g, uint16_t b)
|
||||
{
|
||||
int x1 = 0;
|
||||
int x2 = 0;
|
||||
for (int i = 0; i <= 256; i++) {
|
||||
x2 = i * lcd.width() / 256;
|
||||
if (x1 < x2) {
|
||||
lcd.fillRect(x1, y, x2 - x1, h, lcd.color565(r*i>>8, g*i>>8, b*i>>8));
|
||||
x1 = x2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void drawTestPattern(void)
|
||||
{
|
||||
int w = lcd.width() >> 5;
|
||||
int h = (lcd.height() >> 5)+1;
|
||||
int minwh = std::min(w,h);
|
||||
|
||||
drawGrad(h* 0, h, 255, 0, 0);
|
||||
drawStep(h* 1, h,32 ,255, 0, 0);
|
||||
drawStep(h* 2, h,16 ,255, 0, 0);
|
||||
drawStep(h* 3, h, 8 ,255, 0, 0);
|
||||
drawTile(h* 4, h, 255, 0, 0);
|
||||
drawGrad(h* 5, h, 0, 255, 0);
|
||||
drawStep(h* 6, h,32 , 0, 255, 0);
|
||||
drawStep(h* 7, h,16 , 0, 255, 0);
|
||||
drawStep(h* 8, h, 8 , 0, 255, 0);
|
||||
drawTile(h* 9, h, 0, 255, 0);
|
||||
drawGrad(h*10, h, 0, 0, 255);
|
||||
drawStep(h*11, h,32 , 0, 0, 255);
|
||||
drawStep(h*12, h,16 , 0, 0, 255);
|
||||
drawStep(h*13, h, 8 , 0, 0, 255);
|
||||
drawTile(h*14, h, 0, 0, 255);
|
||||
drawGrad(h*15, h, 255, 255, 255);
|
||||
drawStep(h*16, h,32 ,255, 255, 255);
|
||||
drawStep(h*17, h,16 ,255, 255, 255);
|
||||
drawStep(h*18, h, 8 ,255, 255, 255);
|
||||
drawTile(h*19, h, 255, 255, 255);
|
||||
|
||||
for (int i = 0; i < minwh*6; i++) {
|
||||
lcd.drawRect( i, h*20+i, w*8-(i<<1), h*12-(i<<1), lcd.color565(255-(i<<4),0,0));
|
||||
lcd.drawRoundRect(w*8+i, h*20+i, w*8-(i<<1), h*12-(i<<1),(h*6-i)>>1, lcd.color565(0,255-(i<<4),0));
|
||||
lcd.drawCircle( w*20 , h*26, i, lcd.color565(0,0,255-(i<<4)));
|
||||
lcd.drawLine ( w*24, h*20 + (i<<1), lcd.width()-1, h*32-1-(i<<1), lcd.color565(i<<4,i<<4,255-(i<<4)));
|
||||
lcd.drawLine ( lcd.width()-1-(i<<1), h*20, w*24+(i<<1), h*32-1, lcd.color565(255-(i<<4), i<<4,i<<4));
|
||||
}
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
|
||||
lcd.fillScreen(0x00FF);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
static int count = 0;
|
||||
|
||||
lcd.startWrite();
|
||||
|
||||
lcd.fillScreen(0);
|
||||
lcd.setColorDepth((count & 1) ? 24 : 16);
|
||||
lcd.setRotation((count>>1) & 7);
|
||||
++count;
|
||||
|
||||
drawTestPattern();
|
||||
lcd.setCursor(0, 10);
|
||||
lcd.printf("color %d\nrotation %d", lcd.getColorDepth(), lcd.getRotation());
|
||||
delay(500);
|
||||
|
||||
int16_t ie = std::min(lcd.width() , lcd.height()) - 2;
|
||||
for (int i = 0; i < ie; ++i) {
|
||||
lcd.copyRect(i, i+1, lcd.width() - (i<<1), lcd.height() - i - 1, i, i);
|
||||
}
|
||||
delay(500);
|
||||
lcd.endWrite();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
cmake_minimum_required (VERSION 3.8)
|
||||
project(LGFX_LINUX_FB)
|
||||
|
||||
add_definitions(-DLGFX_LINUX_FB)
|
||||
|
||||
file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
|
||||
*.cpp
|
||||
LovyanGFX/src/lgfx/Fonts/efont/*.c
|
||||
LovyanGFX/src/lgfx/Fonts/IPA/*.c
|
||||
LovyanGFX/src/lgfx/utility/*.c
|
||||
LovyanGFX/src/lgfx/v1/*.cpp
|
||||
LovyanGFX/src/lgfx/v1/misc/*.cpp
|
||||
LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp
|
||||
LovyanGFX/src/lgfx/v1/platforms/framebuffer/*.cpp
|
||||
)
|
||||
|
||||
add_executable (LGFX_LINUX_FB ${Target_Files})
|
||||
target_include_directories(LGFX_LINUX_FB PUBLIC "LovyanGFX/src/")
|
||||
target_compile_features(LGFX_LINUX_FB PUBLIC cxx_std_17)
|
||||
target_link_libraries(LGFX_LINUX_FB -lpthread)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#include <linux/fb.h>
|
||||
#include <thread>
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
void loopThread(void)
|
||||
{
|
||||
setup();
|
||||
for (;;)
|
||||
{
|
||||
loop();
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::thread sub_thread(loopThread);
|
||||
for (;;)
|
||||
{
|
||||
std::this_thread::yield();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#include <stdio.h> // for drawBmpFile / drawJpgFile / drawPngFile
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
#define SCREEN_X 320
|
||||
#define SCREEN_Y 240
|
||||
#define DEVICE_NAME "/dev/fb0"
|
||||
|
||||
// 引数1 画面の幅
|
||||
// 引数2 画面の高さ
|
||||
// 引数3 操作対象とするフレームバッファのパス名、またはデバイス名称 ("st7789") 等の文字列
|
||||
LGFX lcd ( SCREEN_X, SCREEN_Y, DEVICE_NAME );
|
||||
|
||||
int32_t target_x = (SCREEN_X / 2) * 256;
|
||||
int32_t target_y = (SCREEN_Y / 2) * 256;
|
||||
int32_t current_x = 0;
|
||||
int32_t current_y = 0;
|
||||
int32_t add_x = 0;
|
||||
int32_t add_y = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
static int i;
|
||||
++i;
|
||||
lcd.fillCircle(current_x >> 8, current_y >> 8, 5, i);
|
||||
current_x += add_x;
|
||||
current_y += add_y;
|
||||
add_x += (current_x < target_x) ? 1 : -1;
|
||||
add_y += (current_y < target_y) ? 1 : -1;
|
||||
lgfx::delay(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required (VERSION 3.8)
|
||||
project(LGFXOpenCV)
|
||||
|
||||
add_definitions(-DLGFX_OPENCV)
|
||||
|
||||
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>")
|
||||
|
||||
# ビルド対象にするファイルを指定する;
|
||||
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
|
||||
file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
|
||||
*.cpp
|
||||
../../../LovyanGFX/src/lgfx/Fonts/efont/*.c
|
||||
../../../LovyanGFX/src/lgfx/Fonts/IPA/*.c
|
||||
../../../LovyanGFX/src/lgfx/utility/*.c
|
||||
../../../LovyanGFX/src/lgfx/v1/*.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/misc/*.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/platforms/opencv/*.cpp
|
||||
)
|
||||
add_executable (LGFXOpenCV ${Target_Files})
|
||||
|
||||
# includeするファイルのパスを指定する;
|
||||
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
|
||||
target_include_directories(LGFXOpenCV PUBLIC "../../../LovyanGFX/src")
|
||||
|
||||
# OpenCVを配置したパス内のincludeのパスを指定する;
|
||||
target_include_directories(LGFXOpenCV PUBLIC "C:/opencv/build/include")
|
||||
|
||||
# OpenCVを配置したパス内の.libファイルのパスを指定する;
|
||||
target_link_libraries(LGFXOpenCV PUBLIC "C:/opencv/build/x64/vc15/lib/opencv_world452d.lib" )
|
||||
|
||||
target_compile_features(LGFXOpenCV PUBLIC cxx_std_17)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#include <stdio.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <thread>
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
void loopThread(void)
|
||||
{
|
||||
setup();
|
||||
for (;;)
|
||||
{
|
||||
std::this_thread::yield();
|
||||
loop();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::thread sub_thread(loopThread);
|
||||
for (;;)
|
||||
{
|
||||
std::this_thread::yield();
|
||||
lgfx::Panel_OpenCV::imshowall();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
// If you write this, you can use drawBmpFile / drawJpgFile / drawPngFile
|
||||
// #include <stdio.h>
|
||||
|
||||
// If you write this, you can use drawBmpUrl / drawJpgUrl / drawPngUrl ( for Windows )
|
||||
// #include <windows.h>
|
||||
// #include <winhttp.h>
|
||||
// #pragma comment (lib, "winhttp.lib")
|
||||
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
LGFX lcd ( 320, 240 );
|
||||
LGFX lcd2( 135, 240 );
|
||||
|
||||
int32_t target_x = 160 * 256;
|
||||
int32_t target_y = 120 * 256;
|
||||
int32_t current_x = 0;
|
||||
int32_t current_y = 0;
|
||||
int32_t add_x = 0;
|
||||
int32_t add_y = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
lcd2.init();
|
||||
|
||||
// lcd.drawJpgFile("C:\\test.jpg", 0, 0);
|
||||
// lcd.drawPngUrl("http://cyberjapandata.gsi.go.jp/xyz/pale/14/14550/6451.png", 0, 0);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
static int i;
|
||||
++i;
|
||||
lcd.fillCircle(current_x >> 8, current_y >> 8, 5, i);
|
||||
current_x += add_x;
|
||||
current_y += add_y;
|
||||
add_x += (current_x < target_x) ? 1 : -1;
|
||||
add_y += (current_y < target_y) ? 1 : -1;
|
||||
lgfx::touch_point_t new_tp;
|
||||
if (lcd.getTouch(&new_tp))
|
||||
{
|
||||
target_x = new_tp.x * 256;
|
||||
target_y = new_tp.y * 256;
|
||||
lcd.drawCircle(new_tp.x, new_tp.y, 5, TFT_WHITE);
|
||||
}
|
||||
lgfx::delay(1);
|
||||
|
||||
lcd2.fillRect(i & 127, i >> 7, 16, 16, i);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# See how to install sdl2: https://wiki.libsdl.org/SDL2/Installation
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
project(LGFX_SDL)
|
||||
|
||||
add_definitions(-DLGFX_SDL)
|
||||
|
||||
# ビルド対象にするファイルを指定する;
|
||||
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
|
||||
file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
|
||||
*.cpp
|
||||
../../../LovyanGFX/src/lgfx/Fonts/efont/*.c
|
||||
../../../LovyanGFX/src/lgfx/Fonts/IPA/*.c
|
||||
../../../LovyanGFX/src/lgfx/utility/*.c
|
||||
../../../LovyanGFX/src/lgfx/v1/*.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/misc/*.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/panel/Panel_FrameBufferBase.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/platforms/sdl/*.cpp
|
||||
)
|
||||
add_executable (LGFX_SDL ${Target_Files})
|
||||
|
||||
# includeするファイルのパスを指定する;
|
||||
# LovyanGFXのあるパスと位置関係を変えた場合は相対パス記述を環境に合わせて調整すること;
|
||||
target_include_directories(LGFX_SDL PUBLIC "../../../LovyanGFX/src/")
|
||||
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
||||
# Linux環境の場合;
|
||||
# SDL2_INCLUDE_DIRS と SDL2_LIBRARIES を事前に設定しておく;
|
||||
find_package(SDL2 REQUIRED SDL2)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(LGFX_SDL -lpthread ${SDL2_LIBRARIES})
|
||||
|
||||
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
|
||||
# Windows環境の場合;
|
||||
# SDL2を配置したパス内のincludeのパスを指定する;
|
||||
target_include_directories(LGFX_SDL PUBLIC "C:/SDL2/include")
|
||||
|
||||
# SDL2を配置したパス内の.libファイルのパスを指定する;
|
||||
target_link_libraries(LGFX_SDL PUBLIC "C:/SDL2/lib/x64/SDL2.lib")
|
||||
|
||||
|
||||
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>")
|
||||
|
||||
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
|
||||
# MacOS(Darwin)環境の場合;
|
||||
find_package(SDL2 REQUIRED COMPONENTS SDL2)
|
||||
target_link_libraries(LGFX_SDL PRIVATE SDL2::SDL2)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
target_compile_features(LGFX_SDL PUBLIC cxx_std_17)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\.out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\.out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${projectDir}\\.out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\.out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <lgfx/v1/platforms/sdl/Panel_sdl.hpp>
|
||||
#if defined ( SDL_h_ )
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
__attribute__((weak))
|
||||
int user_func(bool* running)
|
||||
{
|
||||
setup();
|
||||
do
|
||||
{
|
||||
loop();
|
||||
} while (*running);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
return lgfx::Panel_sdl::main(user_func);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
// If you write this, you can use drawBmpFile / drawJpgFile / drawPngFile
|
||||
// #include <stdio.h>
|
||||
|
||||
// If you write this, you can use drawBmpUrl / drawJpgUrl / drawPngUrl ( for Windows )
|
||||
// #include <windows.h>
|
||||
// #include <winhttp.h>
|
||||
// #pragma comment (lib, "winhttp.lib")
|
||||
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
LGFX lcd ( 320, 240 );
|
||||
LGFX lcd2( 135, 240 );
|
||||
|
||||
int32_t target_x = 160 * 256;
|
||||
int32_t target_y = 120 * 256;
|
||||
int32_t current_x = 0;
|
||||
int32_t current_y = 0;
|
||||
int32_t add_x = 0;
|
||||
int32_t add_y = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
lcd2.init();
|
||||
|
||||
// lcd.drawJpgFile("C:\\test.jpg", 0, 0);
|
||||
// lcd.drawPngUrl("http://cyberjapandata.gsi.go.jp/xyz/pale/14/14550/6451.png", 0, 0);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
static int i;
|
||||
++i;
|
||||
lcd.fillCircle(current_x >> 8, current_y >> 8, 5, i);
|
||||
current_x += add_x;
|
||||
current_y += add_y;
|
||||
add_x += (current_x < target_x) ? 1 : -1;
|
||||
add_y += (current_y < target_y) ? 1 : -1;
|
||||
lgfx::touch_point_t new_tp;
|
||||
if (lcd.getTouch(&new_tp))
|
||||
{
|
||||
target_x = new_tp.x * 256;
|
||||
target_y = new_tp.y * 256;
|
||||
lcd.drawCircle(new_tp.x, new_tp.y, 5, TFT_WHITE);
|
||||
}
|
||||
lgfx::delay(1);
|
||||
|
||||
lcd2.fillRect(i & 127, i >> 7, 16, 16, i);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
cmake_minimum_required(VERSION 3.12)
|
||||
project (lv_wasm)
|
||||
|
||||
add_definitions(-DLGFX_SDL)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -s USE_SDL=2")
|
||||
|
||||
include_directories(../../../LovyanGFX/src/)
|
||||
|
||||
file(GLOB MY_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
|
||||
*.cpp
|
||||
../../../LovyanGFX/src/lgfx/Fonts/efont/*.c
|
||||
../../../LovyanGFX/src/lgfx/Fonts/IPA/*.c
|
||||
../../../LovyanGFX/src/lgfx/utility/*.c
|
||||
../../../LovyanGFX/src/lgfx/v1/*.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/misc/*.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/panel/Panel_FrameBufferBase.cpp
|
||||
../../../LovyanGFX/src/lgfx/v1/platforms/sdl/*.cpp
|
||||
)
|
||||
set(SOURCES ${MY_SOURCES})
|
||||
|
||||
add_executable(index ${SOURCES} ${INCLUDES})
|
||||
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
target_link_libraries(index -lembind)
|
||||
set_target_properties(index PROPERTIES LINK_FLAGS "--shell-file ${PROJECT_SOURCE_DIR}/lgfx_wasm.html -s SINGLE_FILE=1")
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
#include <emscripten.h>
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
void loopThread(void *arg)
|
||||
{
|
||||
loop();
|
||||
lgfx::Panel_sdl::sdl_event_handler();
|
||||
}
|
||||
|
||||
int monitor_hor_res, monitor_ver_res;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
setup();
|
||||
emscripten_set_main_loop_arg(loopThread, NULL, -1, true);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# WebAssembly port
|
||||
|
||||
# Step
|
||||
|
||||
## Install SDL
|
||||
|
||||
[follow this](https://wiki.libsdl.org/SDL2/Installation)
|
||||
|
||||
## Install Emscripten SDK
|
||||
[follow this](https://emscripten.org/docs/getting_started/downloads.html)
|
||||
|
||||
## Build and Run
|
||||
1. `mkdir build`
|
||||
2. `cd build`
|
||||
3. `emcmake cmake ..`
|
||||
4. `emmake make`
|
||||
5. open `index.html` in your browser.
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'/>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#output {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p id="output">
|
||||
<canvas id="canvas"></canvas>
|
||||
</p>
|
||||
<script>
|
||||
var canvas = document.getElementById('canvas');
|
||||
var Module = {
|
||||
print: function(text) {
|
||||
console.log("log: " + text);
|
||||
},
|
||||
printErr: function(text) {
|
||||
console.error(text);
|
||||
},
|
||||
canvas: (function() {
|
||||
return canvas;
|
||||
})(),
|
||||
};
|
||||
window.addEventListener("click", () => window.focus());
|
||||
</script>
|
||||
{{{ SCRIPT }}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
|
||||
// If you write this, you can use drawBmpFile / drawJpgFile / drawPngFile
|
||||
// #include <stdio.h>
|
||||
|
||||
// If you write this, you can use drawBmpUrl / drawJpgUrl / drawPngUrl ( for Windows )
|
||||
// #include <windows.h>
|
||||
// #include <winhttp.h>
|
||||
// #pragma comment (lib, "winhttp.lib")
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/bind.h>
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
LGFX lcd(320, 240);
|
||||
|
||||
int32_t target_x = 160 * 256;
|
||||
int32_t target_y = 120 * 256;
|
||||
int32_t current_x = 0;
|
||||
int32_t current_y = 0;
|
||||
int32_t add_x = 0;
|
||||
int32_t add_y = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
lcd.init();
|
||||
lcd.clear(TFT_PINK);
|
||||
lcd.setFont(&fonts::DejaVu24);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
static int i;
|
||||
++i;
|
||||
lcd.fillCircle(current_x >> 8, current_y >> 8, 5, i);
|
||||
current_x += add_x;
|
||||
current_y += add_y;
|
||||
add_x += (current_x < target_x) ? 1 : -1;
|
||||
add_y += (current_y < target_y) ? 1 : -1;
|
||||
lgfx::touch_point_t new_tp;
|
||||
if (lcd.getTouch(&new_tp))
|
||||
{
|
||||
target_x = new_tp.x * 256;
|
||||
target_y = new_tp.y * 256;
|
||||
lcd.drawCircle(new_tp.x, new_tp.y, 5, TFT_WHITE);
|
||||
}
|
||||
lcd.drawCenterString("LGFX & WASM", 160, 100);
|
||||
lgfx::delay(5);
|
||||
}
|
||||
|
||||
/// exported funcitons
|
||||
void lgfx_clear(int color)
|
||||
{
|
||||
lcd.clear(color);
|
||||
}
|
||||
|
||||
void lgfx_drawString(const std::string &s, uint32_t x, uint32_t y)
|
||||
{
|
||||
lcd.drawString(s.c_str(), x, y);
|
||||
}
|
||||
|
||||
void lgfx_drawRect(int32_t x, int32_t y, int32_t w, int32_t h, int color)
|
||||
{
|
||||
lcd.drawRect(x, y, w, h, color);
|
||||
}
|
||||
|
||||
void lgfx_drawTriangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int color)
|
||||
{
|
||||
lcd.drawTriangle(x0, y0, x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
void lgfx_drawCircle(int32_t x, int32_t y, int32_t r, int color)
|
||||
{
|
||||
lcd.drawCircle(x, y, r, color);
|
||||
}
|
||||
|
||||
/// binding C++ functions to JavaScript
|
||||
EMSCRIPTEN_BINDINGS(lgfx_module)
|
||||
{
|
||||
function("clear", &lgfx_clear);
|
||||
function("drawString", &lgfx_drawString);
|
||||
function("drawRect", &lgfx_drawRect);
|
||||
function("drawTriangle", &lgfx_drawTriangle);
|
||||
function("drawCircle", &lgfx_drawCircle);
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
## Visual Studio Code + PlatformIO + SDL2 環境で LovyanGFXを使用する手順
|
||||
|
||||
まず最初にVisual Studio Code をインストールし、PlatformIO を使用できる状態にする。
|
||||
|
||||
---
|
||||
|
||||
### PlatformIOにて、 `platform = native` のビルドができる状態にする。
|
||||
|
||||
手順は下記 URL から `Installation` の項目を読んで実施する。
|
||||
https://docs.platformio.org/en/latest/platforms/native.html#installation
|
||||
|
||||
#### Linuxの場合
|
||||
|
||||
`apt` で `build-essential` をインストールする。
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install build-essential
|
||||
```
|
||||
|
||||
#### macOSの場合
|
||||
ターミナルから `xcode-select` をインストールする。
|
||||
```
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
#### Windowsの場合
|
||||
`MSYS2` をここ https://www.msys2.org/ から入手してインストールする。
|
||||
そのあと、Windowsの`システムのプロパティ`->`環境変数` を開き、 `PATH` に以下の3つのパスを追加する。
|
||||
```
|
||||
C:\msys64\mingw64\bin
|
||||
C:\msys64\ucrt64\bin
|
||||
C:\msys64\usr\bin
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### PlatformIOにて、 SDL2 が使用できる状態にする。
|
||||
|
||||
手順は下記 URL から `Install SDL2` の項目を読んで実施する。
|
||||
https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html#install-sdl-2
|
||||
|
||||
|
||||
#### Linuxの場合
|
||||
|
||||
apt-getでlibsdl2をインストールする。
|
||||
|
||||
```
|
||||
sudo apt-get install libsdl2 libsdl2-dev
|
||||
```
|
||||
|
||||
#### MacOS OSXの場合
|
||||
|
||||
Homebrewを使ってsdl2をインストールする。
|
||||
```
|
||||
brew install sdl2
|
||||
```
|
||||
|
||||
#### Windowsの場合
|
||||
|
||||
`platform = native` のビルドを可能にする手順において、 msys2をインストール済みのはずなので、
|
||||
githubの SDLのリポジトリにアクセスし、SDL2-devel-x.xx.x-mingw のリリースパッケージを入手する。
|
||||
https://github.com/libsdl-org/SDL/releases
|
||||
|
||||
本記事作成時点のファイル名は `SDL2-devel-2.28.1-mingw.zip`
|
||||
これを解凍し、出てきたフォルダの中にある `x86_64-w64-mingw32` フォルダを開き、中に以下の 4つのフォルダがあることを確認。
|
||||
- share
|
||||
- bin
|
||||
- include
|
||||
- lib
|
||||
|
||||
C:\msys64\mingw64\ を開き、上記の4つのフォルダと同名のフォルダが存在することを確認したら、C:\msys64\mingw64\ 内に上記フォルダの内容を追加する。(上書きコピー)
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:native]
|
||||
platform = native
|
||||
build_type = debug
|
||||
build_flags = -O0 -xc++ -std=c++14 -lSDL2
|
||||
-I"/usr/local/include/SDL2" ; for intel mac homebrew SDL2
|
||||
-L"/usr/local/lib" ; for intel mac homebrew SDL2
|
||||
-I"${sysenv.HOMEBREW_PREFIX}/include/SDL2" ; for arm mac homebrew SDL2
|
||||
-L"${sysenv.HOMEBREW_PREFIX}/lib" ; for arm mac homebrew SDL2
|
||||
|
||||
[esp32_base]
|
||||
build_type = debug
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
upload_speed = 1500000
|
||||
monitor_speed = 115200
|
||||
monitor_filters = esp32_exception_decoder
|
||||
|
||||
[env:esp32_arduino]
|
||||
extends = esp32_base
|
||||
framework = arduino
|
||||
|
||||
[env:esp32_idf]
|
||||
extends = esp32_base
|
||||
framework = espidf
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <lgfx/v1/platforms/sdl/Panel_sdl.hpp>
|
||||
#if defined ( SDL_h_ )
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
__attribute__((weak))
|
||||
int user_func(bool* running)
|
||||
{
|
||||
setup();
|
||||
do
|
||||
{
|
||||
loop();
|
||||
} while (*running);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
return lgfx::Panel_sdl::main(user_func);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#define LGFX_AUTODETECT
|
||||
#include <LovyanGFX.h>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
#if defined ( SDL_h_ )
|
||||
static LGFX lcd ( 320, 240, 2 );
|
||||
#else
|
||||
static LGFX lcd;
|
||||
#endif
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
lcd.fillCircle(rand()%lcd.width(), rand()%lcd.height(), 16, rand());
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined ( ESP_PLATFORM ) && !defined ( ARDUINO )
|
||||
extern "C" {
|
||||
int app_main(int, char**)
|
||||
{
|
||||
setup();
|
||||
for (;;) {
|
||||
loop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
71
libraries/LovyanGFX/LovyanGFX/examples_for_PC/README.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
# How to build LovyanGFX for Windows.
|
||||
|
||||
### VisualStudio で clang を使用できるようにする
|
||||
|
||||
- [VisualStudioのサイト](https://visualstudio.microsoft.com/ja/vs/)から `VisualStudio Community 2022` をダウンロード
|
||||
- VisualStudio をインストールする際に以下のオプションを追加する
|
||||
- ` C++ によるデスクトップ開発 ` にチェックを入れる
|
||||
- 右ペインの ` インストールの詳細 ` から ` Windows用 C++ Clang ツール ` にチェックを入れる <br>
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### SDL または OpenCV を入手し任意のフォルダに配置する
|
||||
- SDLの場合 [こちらのダウンロードページ](https://www.libsdl.org/download-2.0.php) から `Development Libraries` を入手 <br>
|
||||

|
||||
- OpenCVの場合 [こちらのダウンロードページ](https://opencv.org/releases/) から `Releases` の `Windows` を入手 <br>
|
||||

|
||||
- OpenCVの場合、インストーラを起動して任意の場所に展開。例ではC直下に作成 (C:\opencvに作成される) <br>
|
||||

|
||||
- サンプルのCMakeListsは `C:\SDL2` や `C:\opencv` に配置した場合のパスを初期設定値としている
|
||||
|
||||
---
|
||||
|
||||
### 環境変数の編集を行い、パスを追加する
|
||||
- 環境変数 > ユーザー環境変数 > `Path` を選択 > 編集 > 新規
|
||||
- SDL2の場合、`C:/SDL2/lib/x64/` を追加 ( 配置した場所に合わせて調整すること )
|
||||
- OpenCVの場合、`C:/opencv/build/x64/vc15\bin` を追加 ( 配置した場所に合わせて調整すること )
|
||||
- ※ パスの場所にDLLファイルが含まれていることを確認すること
|
||||
- ※ パスを追加したあと、PCを再起動(または再ログオン)すること <br>
|
||||

|
||||
|
||||
---
|
||||
|
||||
### サンプルフォルダ内のCMakeLists.txtを調整する
|
||||
- CMakeLists.txt を開き、環境に合わせてパスやファイル名の記述を調整する
|
||||
- SDL2 の場合 `examples_for_PC/CMake_SDL/CMakeLists.txt`
|
||||
- OpenCV の場合 `examples_for_PC/CMake_OpenCV/CMakeLists.txt`
|
||||
- OpenCV の場合は`.lib`ファイル名にバージョン番号が含まれているので、これも入手したバージョンと一致するよう調整する <br>
|
||||

|
||||
|
||||
---
|
||||
|
||||
### VisualStudioを起動し、サンプルフォルダを開く
|
||||
- VisualStudioを起動して `ローカル フォルダーを開く` をクリックし、サンプルフォルダを選択する
|
||||
- SDL2 の場合 examples_for_PC/CMake_SDL
|
||||
- OpenCV の場合 examples_for_PC/CMake_OpenCV <br>
|
||||

|
||||
|
||||
|
||||
- 画面上部にあるビルドターゲットの設定枠で `LGFX_SDL` または `LGFX_OpenCV` を選択する
|
||||
- `デバッグ` > `デバッグの開始` をクリックする <br>
|
||||

|
||||

|
||||
|
||||
- デバッグ中の様子(サンプルコード) <br>
|
||||

|
||||
|
||||
- デバッグの停止<br>
|
||||

|
||||
|
||||
- ビルド時に以下のようなエラーが出る場合や、実行時にDLLが見つからないエラーが出る場合は、環境設定のパスやCMakeLists.txtのパスおよびファイル名を見直す。環境設定後は再起動(または再ログオン)を忘れずに。
|
||||
|
||||
```txt
|
||||
重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
||||
エラー 'C:/opencv/build/x64/vc15/lib/opencv_world452d.lib', needed by 'LGFXOpenCV.exe', missing and no known rule to make it C:\sandbox\LovyanGFX\examples\Advanced\CMake_OpenCV\out\build\x64-Debug\CMake_OpenCV C:\sandbox\LovyanGFX\examples\Advanced\CMake_OpenCV\out\build\x64-Debug\ninja 1
|
||||
```
|
||||

|
||||

|
||||
|
||||
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 164 KiB |
BIN
libraries/LovyanGFX/LovyanGFX/examples_for_PC/images/vs_open.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
21
libraries/LovyanGFX/LovyanGFX/library.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "LovyanGFX",
|
||||
"description": "TFT LCD Graphics driver with touch for ESP32, ESP8266, SAMD21, SAMD51, RP2040",
|
||||
"keywords": "lcd,tft,gfx,lgfx,esp32,esp8266,samd21,samd51,m5stack,m5stackcore2,m5stickc,m5stickcplus,odroid-go,ttgo t-watch,ttgo t-wristband,esp-wrover-kit,wioterminal,wifiboy,makepython,hx8357,ili9163,ili9342,ili9341,ili9486,ili9488,st7735,st7789,st7796,ssd1351",
|
||||
"authors": {
|
||||
"name": "lovyan03",
|
||||
"url": "https://github.com/lovyan03",
|
||||
"maintainer": true
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lovyan03/LovyanGFX.git"
|
||||
},
|
||||
"version": "1.1.8",
|
||||
"frameworks": ["arduino", "espidf", "*"],
|
||||
"platforms": ["espressif32", "espressif8266", "atmelsam", "native"],
|
||||
"headers": "LovyanGFX.hpp",
|
||||
"build": {
|
||||
"libArchive": false
|
||||
}
|
||||
}
|
||||
10
libraries/LovyanGFX/LovyanGFX/library.properties
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
name=LovyanGFX
|
||||
version=1.1.8
|
||||
author=lovyan03
|
||||
maintainer=lovyan03
|
||||
sentence=TFT LCD Graphics driver with touch for ESP32, ESP8266, SAMD21, SAMD51, RP2040
|
||||
paragraph=Supports TFT LCD displays using drivers that operate with hardware SPI. ESP32, ESP8266, SAMD21, SAMD51, RP2040, M5Stack, M5StackCore2, M5StickC, M5StickCPlus, ODROID-GO, TTGO T-Watch, TTGO T-Wristband, ESP-WROVER-KIT, WioTerminal, WiFiBoy, MakePython, HX8357, ILI9163, ILI9342, ILI9341, ILI9486, ILI9488, ST7735, ST7789, ST7796, SSD1351
|
||||
category=Display
|
||||
url=https://github.com/lovyan03/LovyanGFX
|
||||
includes=LovyanGFX.hpp
|
||||
architectures=esp32,esp8266,samd,rp2040,mbed_rp2040,mbed_nano
|
||||