Final commit

This commit is contained in:
Eddy 2026-05-09 09:34:16 +02:00
commit 6e04d90b7c
308 changed files with 2350859 additions and 0 deletions

View file

@ -0,0 +1,102 @@
name: Arduino Build
on:
push:
paths:
- '**.ino'
- '**.cpp'
- '**.hpp'
- '**.h'
- '**.c'
- '.github/workflows/ArduinoBuild.yml'
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.board }} (${{ matrix.esp32_version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# ===================
# Espressif Board Manager
# ===================
# ESP32
- board: esp32:esp32:esp32
esp32_version: 2.0.17
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
- board: esp32:esp32:esp32
esp32_version: 3.1.1
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
# ESP32-S3
- board: esp32:esp32:esp32s3
esp32_version: 2.0.17
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
- board: esp32:esp32:esp32s3
esp32_version: 3.1.1
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
# ESP32-C3
- board: esp32:esp32:esp32c3
esp32_version: 2.0.17
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
- board: esp32:esp32:esp32c3
esp32_version: 3.1.1
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
# ESP32-C6 (v3 only)
- board: esp32:esp32:esp32c6
esp32_version: 3.1.1
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
# ESP32-P4 (v3 only)
- board: esp32:esp32:esp32p4
esp32_version: 3.1.1
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
# ESP32-H2 (v3 only)
- board: esp32:esp32:esp32h2
esp32_version: 3.1.1
board_manager_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
# ===================
# M5Stack Board Manager
# ===================
# M5Core (ESP32)
- board: m5stack:esp32:m5stack_core
esp32_version: 2.1.4
board_manager_url: https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json
- board: m5stack:esp32:m5stack_core
esp32_version: 3.2.5
board_manager_url: https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json
# M5CoreS3 (ESP32-S3, v3 only)
- board: m5stack:esp32:m5stack_cores3
esp32_version: 3.2.5
board_manager_url: https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install arduino-cli
run: |
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 1.1.1
echo "$PWD/bin" >> $GITHUB_PATH
- name: Configure arduino-cli
run: |
arduino-cli config init
arduino-cli config add board_manager.additional_urls ${{ matrix.board_manager_url }}
- name: Install board package
run: |
arduino-cli core update-index
# Extract core (package:architecture) from FQBN (package:architecture:board)
CORE=$(echo "${{ matrix.board }}" | cut -d: -f1,2)
arduino-cli core install "${CORE}@${{ matrix.esp32_version }}"
- name: Install library
run: |
mkdir -p "$HOME/Arduino/libraries"
ln -s "$GITHUB_WORKSPACE" "$HOME/Arduino/libraries/M5GFX"
- name: Build
run: |
arduino-cli compile --fqbn ${{ matrix.board }} examples/Test/build_test/build_test.ino

View file

@ -0,0 +1,62 @@
name: ESP-IDF Build
on:
push:
paths:
- '**.cpp'
- '**.hpp'
- '**.h'
- '**.c'
- '**/CMakeLists.txt'
- '.github/workflows/IDFBuild.yml'
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.target }} (IDF ${{ matrix.idf_version }})
runs-on: ubuntu-latest
container:
image: espressif/idf:v${{ matrix.idf_version }}
strategy:
fail-fast: false
matrix:
include:
# ESP32
- target: esp32
idf_version: "5.3"
- target: esp32
idf_version: "5.1.6"
# ESP32-S3
- target: esp32s3
idf_version: "5.3"
- target: esp32s3
idf_version: "5.1.6"
# ESP32-C3
- target: esp32c3
idf_version: "5.3"
- target: esp32c3
idf_version: "5.1.6"
# ESP32-C6 (IDF 5.3+ only)
- target: esp32c6
idf_version: "5.3"
# ESP32-H2
- target: esp32h2
idf_version: "5.3"
- target: esp32h2
idf_version: "5.1.6"
# ESP32-P4 (IDF 5.3+ only)
- target: esp32p4
idf_version: "5.3"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
working-directory: examples/Test/build_test
shell: bash
run: |
. $IDF_PATH/export.sh
idf.py set-target ${{ matrix.target }}
idf.py build

View file

@ -0,0 +1 @@
{"type": "library", "name": "M5GFX", "version": "0.2.20", "spec": {"owner": "m5stack", "id": 12302, "name": "M5GFX", "requirements": null, "uri": null}}

View file

@ -0,0 +1,36 @@
set(COMPONENT_ADD_INCLUDEDIRS
src
)
file(GLOB SRCS
src/*.cpp
src/lgfx/Fonts/efont/*.c
src/lgfx/Fonts/IPA/*.c
src/lgfx/Fonts/lvgl/*.c
src/lgfx/utility/*.c
src/lgfx/v1/*.cpp
src/lgfx/v1/lv_font/*.c
src/lgfx/v1/misc/*.cpp
src/lgfx/v1/panel/*.cpp
src/lgfx/v1/platforms/esp32/*.cpp
src/lgfx/v1/platforms/esp32c3/*.cpp
src/lgfx/v1/platforms/esp32s3/*.cpp
src/lgfx/v1/platforms/esp32p4/*.cpp
src/lgfx/v1/touch/*.cpp
)
set(COMPONENT_SRCS ${SRCS})
if (IDF_VERSION_MAJOR GREATER_EQUAL 5)
set(COMPONENT_REQUIRES nvs_flash efuse driver esp_timer esp_lcd esp_mm)
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 "M5GFX use components = ${COMPONENT_REQUIRES}")
register_component()

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 M5Stack
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.

View file

@ -0,0 +1,55 @@
# M5GFX
Graphics library for M5Stack series
Supported framework
----------------
- ESP-IDF
- Arduino for ESP32
Supported device
----------------
- M5Stack ( Basic / Gray / GO / Fire )
- M5Stack Core2
- M5Stack CoreS3 / CoreS3SE
- M5Stack CoreInk
- M5Stick C
- M5Stick C Plus
- M5Stick C Plus2
- M5Paper
- M5PaperS3
- M5Tough
- M5Station
- M5ATOMS3 / ATOMS3R
- M5Dial
- M5DinMeter
- M5Cardputer
- M5CardputerADV
- M5VAMeter
- M5Tab5
- ArduinoNessoN1
- UnitOLED
- UnitMiniOLED
- UnitLCD
- [UnitRCA / ModuleRCA](docs/UnitRCA.md)
- [UnitGLASS](docs/UnitGLASS.md)
- UnitGLASS2
- [AtomDisplay](docs/ATOMDisplay.md) / ModuleDisplay
License
----------------
M5GFX : [MIT](LICENSE)
LovyanGFX : [FreeBSD](https://github.com/lovyan03/LovyanGFX/blob/master/license.txt) lovyan03
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

View 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

View file

@ -0,0 +1,212 @@
#include <Arduino.h>
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5AtomDisplay.h>
//M5AtomDisplay display; // default setting
//M5AtomDisplay display ( 320, 180 ); // width, height
static constexpr float deg_to_rad = 0.017453292519943295769236907684886;
static constexpr int TFT_GREY = 0x5AEB;
static constexpr int LOOP_PERIOD = 35; // Display updates every 35 ms
int value[6] = {0, 0, 0, 0, 0, 0};
int old_value[6] = { -1, -1, -1, -1, -1, -1};
int liner_count = 6;
int d = 0;
int liner_height;
int meter_height;
int needle_x;
int needle_y;
int needle_r;
int osx, osy; // Saved x & y coords
uint32_t updateTime = 0; // time for next update
void plotNeedle(int value)
{
float sdeg = map(value, 0, 100, -135, -45); // Map value to angle
// Calcualte tip of needle coords
float sx = cosf(sdeg * deg_to_rad);
float sy = sinf(sdeg * deg_to_rad);
display.setClipRect(0, 0, display.width(), meter_height - 5);
// Erase old needle image
display.drawLine(needle_x - 1, needle_y, osx - 1, osy, TFT_WHITE);
display.drawLine(needle_x + 1, needle_y, osx + 1, osy, TFT_WHITE);
display.drawLine(needle_x , needle_y, osx , osy, TFT_WHITE);
// Re-plot text under needle
display.setTextColor(TFT_BLACK);
if (display.width() > 100)
{
display.setFont(&fonts::Font4);
display.setTextDatum(textdatum_t::middle_center);
display.drawString("%RH", needle_x, needle_y>>1);
}
display.setFont(&fonts::Font2);
display.setTextDatum(textdatum_t::bottom_left);
display.drawString("%RH", display.width() - 36, meter_height - 8);
display.setTextColor(TFT_BLACK, TFT_WHITE);
display.setTextDatum(textdatum_t::bottom_right);
display.drawNumber(value, 36, meter_height - 8);
// Store new needle end coords for next erase
osx = roundf(sx * needle_r) + needle_x;
osy = roundf(sy * needle_r) + needle_y;
// Draw the needle in the new postion, magenta makes needle a bit bolder
// draws 3 lines to thicken needle
display.drawLine(needle_x - 1, needle_y, osx - 1, osy, TFT_RED);
display.drawLine(needle_x + 1, needle_y, osx + 1, osy, TFT_RED);
display.drawLine(needle_x , needle_y, osx , osy, TFT_MAGENTA);
display.clearClipRect();
}
void analogMeter()
{
display.fillRect(0, 0, display.width() , meter_height , TFT_WHITE);
display.drawRect(1, 1, display.width()-2 , meter_height-2, TFT_BLACK);
int r3 = needle_y * 13 / 15;
int r2 = needle_y * 12 / 15;
int r1 = needle_y * 11 / 15;
needle_r = r1 - 3;
display.fillArc(needle_x, needle_y, r1, r3, 270, 292, TFT_GREEN);
display.fillArc(needle_x, needle_y, r1, r3, 292, 315, TFT_ORANGE);
display.fillArc(needle_x, needle_y, r1, r1, 225, 315, TFT_BLACK);
display.setTextColor(TFT_BLACK);
display.setFont(&fonts::Font2);
display.setTextDatum(textdatum_t::bottom_center);
for (int i = 0; i <= 20; i++)
{
display.fillArc(needle_x, needle_y, r1, (i % 5) ? r2 : r3, 225 + i * 4.5f, 225 + i * 4.5f, TFT_BLACK);
if (0 == (i % 5) && display.width() > 100)
{
display.drawNumber(i * 5, needle_x - cosf((45+i*4.5) * deg_to_rad) * r3
, needle_y - sinf((45+i*4.5) * deg_to_rad) * r3 - 2);
}
}
}
void plotLinear(const char *label, int x, int y, int w, int h)
{
display.drawRect(x, y, w, h, TFT_GREY);
display.fillRect(x + 2, y + 18, w - 3, h - 36, TFT_WHITE);
display.setTextColor(TFT_CYAN, TFT_BLACK);
display.setTextDatum(textdatum_t::middle_center);
display.setFont(&fonts::Font2);
display.setTextPadding(display.textWidth("100"));
display.drawString(label, x + w / 2, y + 10);
int plot_height = h - (19*2);
for (int i = 0; i <= 10; i ++)
{
display.drawFastHLine(x + w/2, y + 19 + (i+1) * plot_height / 12, w*(3+(0==(i%5)))/16, TFT_BLACK);
}
}
void plotPointer(void)
{
display.setTextColor(TFT_GREEN, TFT_BLACK);
display.setTextDatum(textdatum_t::middle_right);
int plot_height = liner_height - (19*2);
int pw = (display.width() / liner_count) / 3;
for (int i = 0; i < liner_count; i++)
{
display.drawNumber(value[i], display.width() * (i + 0.8) / liner_count, display.height() - 10);
int dx = display.width() * i / liner_count + 3;
int dy = meter_height + 19 + (old_value[i]+10) * plot_height / 120;
display.fillTriangle(dx, dy - 5, dx, dy + 5, dx + pw, dy, TFT_WHITE);
old_value[i] = value[i];
dy = meter_height + 19 + (old_value[i]+10) * plot_height / 120;
display.fillTriangle(dx, dy - 5, dx, dy + 5, dx + pw, dy, TFT_RED);
}
}
void setup(void)
{
display.begin();
display.setEpdMode(epd_mode_t::epd_fastest);
if (display.width() > display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
display.startWrite();
display.fillScreen(TFT_BLACK);
liner_height = display.height() * 3 / 5;
meter_height = display.height() * 2 / 5;
needle_x = display.width() / 2;
needle_y = (meter_height*2 + display.width()) / 3;
osx = needle_x;
osy = needle_y;
liner_count = std::min<int>(6, display.width() / 40);
analogMeter(); // Draw analogue meter
int w = display.width() / liner_count;
char name[] = "A0";
// Draw linear meters
for (int i = 0; i < liner_count; i++)
{
name[1] = '0' + i;
plotLinear(name, display.width() * i / liner_count, meter_height, w, liner_height);
}
display.endWrite();
updateTime = millis(); // Next update time
}
void loop(void)
{
auto msec = millis();
if (updateTime <= msec)
{
d = (msec >> 3) % 360;
// Create a Sine wave for testing
value[0] = 50 + roundf(50 * sinf((d + 0) * deg_to_rad));
value[1] = 50 + roundf(50 * sinf((d + 60) * deg_to_rad));
value[2] = 50 + roundf(50 * sinf((d + 120) * deg_to_rad));
value[3] = 50 + roundf(50 * sinf((d + 180) * deg_to_rad));
value[4] = 50 + roundf(50 * sinf((d + 240) * deg_to_rad));
value[5] = 50 + roundf(50 * sinf((d + 300) * deg_to_rad));
//value[0] = map(analogRead(36), 0, 4095, 0, 100); // Test with value form GPIO36
if (!display.displayBusy())
{
updateTime = msec + LOOP_PERIOD;
//unsigned long t = millis();
display.startWrite();
plotPointer();
plotNeedle(roundf(value[0]));
display.endWrite();
//Serial.println(millis()-t); // Print time taken for meter update
}
}
}

View file

@ -0,0 +1,103 @@
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
// #include <M5AtomDisplay.h>
// M5AtomDisplay display;
static constexpr size_t BAR_COUNT = 64;
static int max_y[BAR_COUNT];
static int prev_y[BAR_COUNT];
static uint32_t colors[BAR_COUNT];
void setup(void)
{
display.init();
display.startWrite();
display.fillScreen(TFT_BLACK);
if (display.isEPD())
{
display.setEpdMode(epd_mode_t::epd_fastest);
}
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
for (int x = 0; x < BAR_COUNT; ++x)
{
prev_y[x] = display.height();
max_y[x] = display.height();
int r=0,g=0,b=0;
switch (x >> 4)
{
case 0:
b = 255;
g = x*0x11;
break;
case 1:
b = 255 - (x&15)*0x11;
g = 255;
break;
case 2:
g = 255;
r = (x&15)*0x11;
break;
case 3:
r = 255;
g = 255 - (x&15)*0x11;
break;
}
colors[x] = display.color888(r,g,b);
}
}
void loop(void)
{
int h = display.height();
static int i;
++i;
display.waitDisplay();
for (int x = 0; x < BAR_COUNT; ++x)
{
int y = (h>>1) - (sinf((float)((x-24)*i) / 3210.0f) + sinf((float)((x-40)*i) / 1234.0f)) * (h>>2);
int xpos = x * display.width() / BAR_COUNT;
int w = ((x+1) * display.width() / BAR_COUNT) - xpos - 1;
if (max_y[x]+1 >= y) { max_y[x] = y-1; }
else
{
if ((i & 3) ==0 )
{
display.fillRect(xpos, max_y[x]-3, w, 1, TFT_BLACK);
max_y[x]++;
}
}
display.fillRect(xpos, max_y[x]-3, w, 3, TFT_WHITE);
if (prev_y[x] < y)
{
display.fillRect(xpos, prev_y[x], w, y - prev_y[x], TFT_BLACK);
}
else
{
display.fillRect(xpos, y, w, prev_y[x] - y, colors[x]);
}
prev_y[x] = y;
}
display.display();
}

View file

@ -0,0 +1,141 @@
//The Game of Life, also known simply as Life, is a cellular automaton
//devised by the British mathematician John Horton Conway in 1970.
// https://en.wikipedia.org/wiki/Conway's_Game_of_Life
#include <Arduino.h>
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5AtomDisplay.h>
//M5AtomDisplay display;
M5Canvas canvas[2];
void setup(void)
{
display.begin();
display.setColorDepth(8);
display.setEpdMode(epd_mode_t::epd_fastest);
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
display.setPivot(display.width() /2 -0.5, display.height() /2 - 0.5);
}
int z = 0;
int width;
do
{
width = display.width() / ++z;
} while (width > 192);
z = 0;
int height;
do
{
height = display.height() / ++z;
} while (height > 160);
for (int i = 0; i < 2; i++)
{
canvas[i].setColorDepth(8);
canvas[i].createSprite(width, height);
canvas[i].createPalette();
canvas[i].setPaletteColor(1, TFT_WHITE);
canvas[i].setPivot(canvas[i].width() /2 -0.5, canvas[i].height() /2 - 0.5);
}
canvas[0].setTextColor(1);
canvas[0].setTextDatum(textdatum_t::bottom_center);
canvas[0].drawString("Conway's", canvas[0].width() >> 1, canvas[0].height() >> 1);
canvas[0].setTextDatum(textdatum_t::top_center);
canvas[0].drawString("Game of Life", canvas[0].width() >> 1, canvas[0].height() >> 1);
canvas[0].pushRotateZoom(&display, 0, (float)display.width() / canvas[0].width(), (float)display.height() / canvas[0].height());
delay(2000);
display.clear();
}
void loop(void)
{
bool flip = false;
int width = canvas[flip].width();
int height = canvas[flip].height();
int xz = display.width() / width;
int yz = display.height() / height;
int y = 1;
do
{
int x = 1;
do
{
if (random(6) == 0) { canvas[flip].drawPixel(x, y, 1); }
} while (++x < width - 1);
} while (++y < height - 1);
int diff;
display.startWrite();
do
{
flip = !flip;
diff = 0;
auto old_buf = (uint8_t*)canvas[!flip].getBuffer();
auto new_buf = (uint8_t*)canvas[ flip].getBuffer();
int width = canvas[flip].width();
int height = canvas[flip].height();
int py;
int y = height - 1;
int ny = 0;
do
{
py = y;
y = ny;
if (++ny == height) ny = 0;
int px;
int x = width - 1;
int nx = 0;
do
{
px = x;
x = nx;
if (++nx == width) nx = 0;
int neighbors = old_buf[px + py * width]
+ old_buf[ x + py * width]
+ old_buf[nx + py * width]
+ old_buf[px + y * width]
+ old_buf[nx + y * width]
+ old_buf[px + ny * width]
+ old_buf[ x + ny * width]
+ old_buf[nx + ny * width];
int idx = x + y * width;
bool flg = (neighbors == 3) || (neighbors == 2 && old_buf[idx]);
if (flg != new_buf[idx])
{
display.fillRect(x * xz, y * yz, xz, yz, flg ? TFT_WHITE : TFT_BLACK);
new_buf[idx] = flg;
++diff;
}
} while (nx);
} while (ny);
display.display();
// canvas[flip].pushRotateZoom(&display, 0, (float)display.width() / width, (float)display.height() / height);
} while (diff);
display.endWrite();
}

View file

@ -0,0 +1,77 @@
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5AtomDisplay.h>
//M5AtomDisplay display;
M5Canvas canvas(&display);
static constexpr char text[] = "Hello world ! こんにちは世界! this is long long string sample. 寿限無、寿限無、五劫の擦り切れ、海砂利水魚の、水行末・雲来末・風来末、喰う寝る処に住む処、藪ら柑子の藪柑子、パイポ・パイポ・パイポのシューリンガン、シューリンガンのグーリンダイ、グーリンダイのポンポコピーのポンポコナの、長久命の長助";
static constexpr size_t textlen = sizeof(text) / sizeof(text[0]);
int textpos = 0;
int scrollstep = 2;
void setup(void)
{
display.begin();
display.setColorDepth(8);
if (display.isEPD())
{
scrollstep = 16;
display.setEpdMode(epd_mode_t::epd_fastest);
display.invertDisplay(true);
display.clear(TFT_BLACK);
}
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
canvas.setColorDepth(1); // mono color
canvas.setFont(&fonts::lgfxJapanMinchoP_32);
canvas.setTextWrap(false);
canvas.setTextSize(2);
canvas.createSprite(display.width() + 64, 72);
}
void loop(void)
{
int32_t cursor_x = canvas.getCursorX() - scrollstep;
if (cursor_x <= 0)
{
textpos = 0;
cursor_x = display.width();
}
canvas.setCursor(cursor_x, 0);
canvas.scroll(-scrollstep, 0);
while (textpos < textlen && cursor_x <= display.width())
{
canvas.print(text[textpos++]);
cursor_x = canvas.getCursorX();
}
display.waitDisplay();
int y = (display.height() - canvas.height()) >> 1;
/*
display.copyRect(0, y, display.width(), canvas.height(), scrollstep, y);
display.setClipRect(display.width()-scrollstep, y, scrollstep, canvas.height());
canvas.pushSprite(&display, 0, (display.height() - canvas.height()) >> 1);
display.clearClipRect();
/*/
canvas.pushSprite(&display, 0, y);
//*/
}

View file

@ -0,0 +1,286 @@
#if defined ( ARDUINO )
#include <Arduino.h>
// If you use SD card, write this.
#include <SD.h>
// If you use SPIFFS, write this.
#include <SPIFFS.h>
#endif
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#include <M5Unified.h>
extern const uint8_t montserrat_bff_12[];
extern "C" {
extern const lv_font_t montserrat_16;
}
lgfx::LVGLfont user_lv_font_montserrat_16(&montserrat_16);
void setup(void)
{
auto cfg = M5.config();
cfg.output_power = false;
M5.begin(cfg);
M5.Lcd.setTextColor(TFT_BLACK, TFT_WHITE);
// BFFfont
M5.Lcd.loadFont(montserrat_bff_12, lgfx::IFont::font_type_t::ft_lvgl);
M5.Lcd.println("ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz0123456789");
// lvgl built-in font
M5.Lcd.setFont(&fonts::lv_font_montserrat_14);
M5.Lcd.println("ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz0123456789");
// LVGL user font
M5.Lcd.setFont(&user_lv_font_montserrat_16);
M5.Lcd.println("ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz0123456789");
}
void loop(void)
{
M5.delay(10);
}
// for ESP-IDF compat
#if !defined ( ARDUINO ) && defined ( ESP_PLATFORM )
extern "C" {
void loopTask(void*)
{
setup();
for (;;) {
loop();
}
vTaskDelete(NULL);
}
void app_main()
{
xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, NULL, 1);
}
}
#endif
constexpr uint8_t montserrat_bff_12[] = {
0x30, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x00,
0x0C, 0x00, 0xFD, 0xFF, 0x0C, 0x00, 0xFD, 0xFF, 0x00, 0x00, 0xFD, 0xFF, 0x0C, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x04, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x1C, 0x00, 0x00, 0x00, 0x63, 0x6D, 0x61, 0x70, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x01, 0x00, 0x5F, 0x00, 0x02, 0x00, 0xCC, 0x00, 0x00, 0x00,
0x6C, 0x6F, 0x63, 0x61, 0x60, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0B, 0x00, 0x1C, 0x00,
0x27, 0x00, 0x53, 0x00, 0x84, 0x00, 0xB4, 0x00, 0xE4, 0x00, 0xEB, 0x00, 0x02, 0x01, 0x19, 0x01,
0x29, 0x01, 0x45, 0x01, 0x4E, 0x01, 0x55, 0x01, 0x5B, 0x01, 0x85, 0x01, 0xAC, 0x01, 0xC1, 0x01,
0xE4, 0x01, 0x07, 0x02, 0x2E, 0x02, 0x51, 0x02, 0x78, 0x02, 0x9B, 0x02, 0xC2, 0x02, 0xE5, 0x02,
0xF3, 0x02, 0x04, 0x03, 0x20, 0x03, 0x35, 0x03, 0x51, 0x03, 0x74, 0x03, 0xBF, 0x03, 0xEF, 0x03,
0x16, 0x04, 0x42, 0x04, 0x6E, 0x04, 0x91, 0x04, 0xB4, 0x04, 0xE0, 0x04, 0x07, 0x05, 0x13, 0x05,
0x31, 0x05, 0x58, 0x05, 0x7B, 0x05, 0xAB, 0x05, 0xD2, 0x05, 0x02, 0x06, 0x29, 0x06, 0x68, 0x06,
0x8F, 0x06, 0xB2, 0x06, 0xD5, 0x06, 0xFC, 0x06, 0x2C, 0x07, 0x6E, 0x07, 0x95, 0x07, 0xC1, 0x07,
0xE8, 0x07, 0xFF, 0x07, 0x29, 0x08, 0x40, 0x08, 0x58, 0x08, 0x5E, 0x08, 0x65, 0x08, 0x81, 0x08,
0xA7, 0x08, 0xC3, 0x08, 0xEE, 0x08, 0x0A, 0x09, 0x26, 0x09, 0x51, 0x09, 0x77, 0x09, 0x89, 0x09,
0xAD, 0x09, 0xD3, 0x09, 0xE0, 0x09, 0x0A, 0x0A, 0x26, 0x0A, 0x45, 0x0A, 0x6B, 0x0A, 0x96, 0x0A,
0xA7, 0x0A, 0xBF, 0x0A, 0xD9, 0x0A, 0xF5, 0x0A, 0x14, 0x0B, 0x3E, 0x0B, 0x5A, 0x0B, 0x85, 0x0B,
0x9D, 0x0B, 0xBA, 0x0B, 0xCA, 0x0B, 0xE7, 0x0B, 0xF4, 0x0B, 0x00, 0x00, 0x67, 0x6C, 0x79, 0x66,
0x18, 0x00, 0x00, 0x18, 0x00, 0x72, 0x1E, 0x81, 0xE6, 0x1E, 0x61, 0xE4, 0x1C, 0x41, 0xA2, 0x06,
0x01, 0x24, 0x3C, 0x80, 0x28, 0x0A, 0x88, 0x78, 0x3C, 0x76, 0x1C, 0x76, 0x1C, 0x2A, 0x0E, 0x40,
0x01, 0x32, 0x00, 0x90, 0x05, 0x40, 0x00, 0x0C, 0xE0, 0x90, 0x00, 0x9F, 0xFF, 0xFF, 0xFE, 0x20,
0x14, 0x61, 0x0A, 0x00, 0x01, 0x82, 0x14, 0x60, 0x00, 0x1A, 0x01, 0x82, 0x01, 0x5F, 0xFF, 0xFF,
0xF6, 0x00, 0x36, 0x01, 0xA0, 0x00, 0x07, 0x40, 0x36, 0x00, 0x00, 0x38, 0x3C, 0xFA, 0x00, 0x12,
0x40, 0x00, 0x01, 0x24, 0x00, 0x09, 0x9F, 0xF6, 0x63, 0xEF, 0x4A, 0xE8, 0x9C, 0x12, 0x40, 0x03,
0xF1, 0x64, 0x00, 0x07, 0x7F, 0xB0, 0x00, 0x01, 0x2F, 0x96, 0x00, 0x12, 0x49, 0xEB, 0x69, 0x4B,
0x76, 0x11, 0xBF, 0xF4, 0x20, 0x01, 0x24, 0x00, 0x00, 0x08, 0x20, 0x00, 0x50, 0x01, 0x52, 0x15,
0x72, 0x00, 0x18, 0x20, 0xCC, 0x12, 0x60, 0xEC, 0x01, 0x06, 0x0E, 0xA5, 0x80, 0x00, 0xAE, 0x14,
0x56, 0x40, 0x00, 0x13, 0x8E, 0xD0, 0xB9, 0x40, 0x00, 0x03, 0x83, 0x80, 0xCE, 0x00, 0x14, 0x87,
0x20, 0x54, 0x00, 0xB2, 0x03, 0x60, 0x90, 0x01, 0x82, 0x00, 0xF7, 0x62, 0x40, 0x3F, 0x34, 0x01,
0x3D, 0xCA, 0x00, 0x00, 0xB8, 0x07, 0xC0, 0x00, 0x0B, 0x80, 0x98, 0x00, 0x00, 0x1B, 0x7A, 0x40,
0x00, 0x07, 0xBE, 0xA0, 0x20, 0x05, 0xC4, 0x7C, 0x8F, 0x00, 0xD6, 0x00, 0x9D, 0xC6, 0x09, 0xE8,
0x27, 0xBE, 0x40, 0x0D, 0xDF, 0xAE, 0xDA, 0x00, 0x00, 0x00, 0x00, 0x20, 0x18, 0x0A, 0x48, 0x78,
0x76, 0x76, 0x2A, 0x20, 0x7A, 0x7A, 0x14, 0xE3, 0xE2, 0xD8, 0x13, 0x01, 0x6C, 0x1A, 0x81, 0xA8,
0x1A, 0x81, 0x6C, 0x13, 0x00, 0xD6, 0x03, 0xE2, 0x14, 0xE0, 0x20, 0x3A, 0x7A, 0xD6, 0x01, 0xE4,
0x16, 0xE0, 0xF4, 0x0B, 0x80, 0x9C, 0x07, 0xC0, 0x9C, 0x0B, 0x80, 0xF4, 0x16, 0xE1, 0xE4, 0xD6,
0x00, 0x28, 0x0A, 0xAA, 0x01, 0x60, 0x11, 0x39, 0x6A, 0x17, 0xF2, 0x10, 0xF9, 0x2A, 0x01, 0x40,
0x00, 0x38, 0x02, 0xEE, 0x00, 0x0C, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x1E, 0x00, 0x07, 0xDD,
0xFD, 0xC4, 0x02, 0x5E, 0x22, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x12, 0x00, 0x00, 0x18, 0x3C, 0x68,
0x54, 0x09, 0xE2, 0x1A, 0x09, 0x00, 0x28, 0x04, 0x84, 0x9F, 0xFA, 0x04, 0x44, 0x18, 0x00, 0x64,
0x76, 0x09, 0xC2, 0x27, 0xFE, 0xDA, 0x00, 0x00, 0x68, 0x00, 0x01, 0x6A, 0x00, 0x01, 0xE2, 0x00,
0x0B, 0x60, 0x00, 0x14, 0xC0, 0x00, 0x1C, 0x20, 0x00, 0x98, 0x00, 0x01, 0x2E, 0x00, 0x01, 0xC4,
0x00, 0x07, 0xA0, 0x00, 0x10, 0xE0, 0x00, 0x1A, 0x40, 0x00, 0x5A, 0x00, 0x00, 0x40, 0x01, 0x12,
0x01, 0x3F, 0xF2, 0x00, 0x15, 0x88, 0x99, 0x40, 0x5E, 0x40, 0x05, 0xE4, 0xBA, 0x00, 0x01, 0xAA,
0xD8, 0x00, 0x01, 0x8C, 0xBA, 0x00, 0x01, 0xAA, 0x5E, 0x40, 0x05, 0xE4, 0x15, 0x88, 0x99, 0x40,
0x01, 0x3F, 0xF2, 0x00, 0x20, 0x00, 0x93, 0xDF, 0xE6, 0x45, 0xE6, 0x01, 0xE6, 0x01, 0xE6, 0x01,
0xE6, 0x01, 0xE6, 0x01, 0xE6, 0x01, 0xE6, 0x01, 0xE6, 0x38, 0x00, 0xF2, 0x35, 0xDF, 0x86, 0x13,
0x48, 0x75, 0xC0, 0x00, 0x00, 0x3E, 0x20, 0x00, 0x09, 0xC0, 0x00, 0x05, 0xCC, 0x00, 0x03, 0xB0,
0x00, 0x03, 0xB0, 0x00, 0x03, 0xB4, 0x44, 0x43, 0x1F, 0xFF, 0xFE, 0xE0, 0x38, 0x00, 0xF3, 0x3F,
0xFF, 0xFE, 0x02, 0x44, 0x9C, 0xC0, 0x00, 0x3A, 0xC0, 0x00, 0x13, 0xF6, 0x60, 0x00, 0x25, 0x3C,
0x00, 0x00, 0x01, 0xC8, 0x20, 0x00, 0x1E, 0x99, 0x28, 0x75, 0xC0, 0x77, 0xFF, 0x86, 0x00, 0x40,
0x01, 0x12, 0x00, 0x01, 0x36, 0x00, 0x00, 0x09, 0xC2, 0x00, 0x00, 0x3C, 0xA0, 0x00, 0x01, 0x54,
0x00, 0x00, 0x0B, 0xC2, 0x1A, 0x80, 0x3C, 0x80, 0x1A, 0x81, 0x1F, 0xFF, 0xFF, 0xFA, 0x24, 0x44,
0x5C, 0xC4, 0x00, 0x00, 0x1C, 0x80, 0x38, 0x00, 0xF2, 0x19, 0xFF, 0xFE, 0x01, 0xCA, 0x44, 0x40,
0x1E, 0x20, 0x00, 0x03, 0xFF, 0xF8, 0x80, 0x04, 0x47, 0x1E, 0x40, 0x00, 0x01, 0xAC, 0x00, 0x00,
0x1A, 0xD3, 0x68, 0x71, 0xE2, 0x55, 0xDF, 0xA8, 0x00, 0x38, 0x01, 0x12, 0x00, 0xFB, 0xFC, 0xA0,
0x11, 0xAA, 0x46, 0x40, 0x3E, 0x40, 0x00, 0x00, 0xBA, 0xDB, 0xD4, 0x20, 0xDF, 0x86, 0x77, 0x60,
0xBE, 0x40, 0x05, 0xE0, 0x5E, 0x40, 0x05, 0xE0, 0x17, 0x64, 0x57, 0x60, 0x03, 0x5F, 0xF4, 0x20,
0x38, 0x00, 0xF3, 0x5F, 0xFF, 0xFF, 0x75, 0x24, 0x45, 0xAE, 0xEC, 0x00, 0x7E, 0x20, 0x00, 0x15,
0x20, 0x00, 0x03, 0xE6, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x1C, 0xA0, 0x00, 0x0B, 0xC0, 0x00, 0x01,
0x90, 0x00, 0x00, 0x40, 0x01, 0x12, 0x07, 0x9F, 0xF4, 0x20, 0x1D, 0x02, 0x59, 0x40, 0x5E, 0x00,
0x0B, 0xC0, 0x1C, 0xC0, 0x15, 0x40, 0x11, 0xFF, 0xFE, 0x80, 0x7E, 0x60, 0x0F, 0xC0, 0xF8, 0x00,
0x01, 0xE4, 0x7E, 0xC2, 0x53, 0xC0, 0x0B, 0xBF, 0xF6, 0x40, 0x38, 0x00, 0xF2, 0x0F, 0xDF, 0x88,
0x0D, 0xC8, 0x2B, 0xC5, 0x50, 0x00, 0x15, 0x2F, 0xA2, 0x07, 0xD8, 0x15, 0xFF, 0xB3, 0xA0, 0x00,
0x20, 0xF6, 0x00, 0x00, 0x1A, 0xE0, 0xA4, 0x77, 0xC0, 0x39, 0xFF, 0x42, 0x00, 0x18, 0x00, 0x6E,
0x9C, 0x27, 0x60, 0x00, 0x00, 0x00, 0x00, 0x07, 0x60, 0x9C, 0x20, 0x18, 0x3C, 0x72, 0x9C, 0x27,
0x60, 0x00, 0x00, 0x00, 0x00, 0x05, 0x40, 0x9E, 0x21, 0xA0, 0x90, 0x00, 0x38, 0x02, 0xEE, 0x00,
0x00, 0x04, 0x20, 0x00, 0x97, 0xC4, 0x0F, 0xB8, 0xA0, 0x07, 0xF0, 0x00, 0x00, 0x09, 0x7C, 0xE2,
0x00, 0x00, 0x53, 0xC4, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0xEA, 0x7F, 0xFF, 0xFE, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xDD, 0xDD, 0xC4, 0x02, 0x22, 0x22, 0x00, 0x38, 0x02, 0xEE,
0x24, 0x00, 0x00, 0x05, 0xD6, 0x80, 0x00, 0x00, 0xB9, 0xAE, 0x00, 0x00, 0x11, 0xE6, 0x02, 0xFD,
0x68, 0x05, 0xD2, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xF2, 0x35, 0xFF, 0x86, 0x13,
0x46, 0x55, 0xC0, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x15, 0x40, 0x00, 0x13, 0x80, 0x00, 0x05, 0xE2,
0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x60, 0x3B, 0x98, 0x00,
0x0B, 0x7B, 0xBB, 0x22, 0x00, 0x01, 0x56, 0x40, 0x00, 0xBA, 0x60, 0x0F, 0x20, 0x00, 0x00, 0x03,
0xA2, 0x1C, 0x01, 0x3D, 0xD1, 0xA6, 0xCE, 0x94, 0x13, 0x62, 0x0F, 0xE6, 0x36, 0xCE, 0x1C, 0x40,
0x01, 0xC6, 0x1A, 0xCE, 0x1C, 0x60, 0x01, 0xC6, 0x18, 0x94, 0x13, 0x82, 0x11, 0xEA, 0xD0, 0x1A,
0x01, 0x3F, 0xF2, 0xDF, 0x82, 0x0F, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x56, 0x40, 0x02, 0x80,
0x00, 0x00, 0x0B, 0x9D, 0xDA, 0xC0, 0x00, 0x4F, 0xC1, 0x52, 0x00, 0x00, 0xDE, 0x60, 0x00, 0x00,
0x01, 0xBB, 0x20, 0x00, 0x00, 0x09, 0xC5, 0xE2, 0x00, 0x00, 0x16, 0xE1, 0x6E, 0x00, 0x00, 0x5E,
0x20, 0xBC, 0x00, 0x01, 0x14, 0x00, 0x1C, 0x80, 0x01, 0xDF, 0xDD, 0xDF, 0x60, 0x0D, 0xA2, 0x22,
0x27, 0xE4, 0x18, 0xC0, 0x00, 0x01, 0x52, 0x48, 0x41, 0x13, 0x7F, 0xFF, 0xF8, 0x41, 0x6E, 0x22,
0x55, 0xA1, 0x6E, 0x00, 0x05, 0xE1, 0x6E, 0x00, 0x11, 0x81, 0x7F, 0xFF, 0xFE, 0xA1, 0x70, 0x44,
0x4D, 0xE7, 0x6E, 0x00, 0x01, 0x8F, 0x6E, 0x22, 0x2B, 0xE9, 0x7F, 0xFF, 0xFA, 0xE0, 0x48, 0x01,
0x32, 0x00, 0x77, 0xFF, 0x88, 0x00, 0xBF, 0x26, 0x71, 0xC0, 0x1C, 0xC0, 0x00, 0x00, 0x0B, 0xC0,
0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x0B, 0xC0, 0x00, 0x00, 0x00, 0x1C, 0xC0, 0x00, 0x00,
0x00, 0xBF, 0x06, 0x71, 0xC0, 0x00, 0x97, 0xFF, 0x66, 0x00, 0x50, 0x41, 0x33, 0x7F, 0xFF, 0xF6,
0x60, 0x17, 0x04, 0x47, 0x3E, 0x81, 0x6E, 0x00, 0x00, 0xFC, 0x16, 0xE0, 0x00, 0x01, 0xE7, 0x6E,
0x00, 0x00, 0x1A, 0xB6, 0xE0, 0x00, 0x01, 0xE7, 0x6E, 0x00, 0x00, 0xFC, 0x17, 0x04, 0x47, 0x3E,
0x81, 0x7F, 0xFF, 0xF6, 0x60, 0x00, 0x40, 0x40, 0xF3, 0x7F, 0xFF, 0xFE, 0x77, 0x04, 0x44, 0x41,
0x6E, 0x00, 0x00, 0x16, 0xE0, 0x00, 0x01, 0x7F, 0xFF, 0xF4, 0x17, 0x04, 0x44, 0x21, 0x6E, 0x00,
0x00, 0x17, 0x04, 0x44, 0x41, 0x7F, 0xFF, 0xFE, 0xA0, 0x40, 0x40, 0xF3, 0x7F, 0xFF, 0xFE, 0x77,
0x04, 0x44, 0x41, 0x6E, 0x00, 0x00, 0x16, 0xE0, 0x00, 0x01, 0x7F, 0xFF, 0xF4, 0x17, 0x04, 0x44,
0x21, 0x6E, 0x00, 0x00, 0x16, 0xE0, 0x00, 0x01, 0x6E, 0x00, 0x00, 0x00, 0x48, 0x01, 0x32, 0x00,
0x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 0x88, 0x00, 0x0B, 0xF0, 0x67, 0x1E, 0xC0, 0x1C, 0xC0,
0x00, 0x0B, 0xE2, 0x9C, 0x00, 0x00, 0x01, 0xAC, 0xD8, 0x00, 0x00, 0x01, 0x6E, 0x9C, 0x00, 0x00,
0x01, 0xAC, 0x1C, 0xC0, 0x00, 0x0B, 0xE2, 0x0B, 0xF0, 0x67, 0x1E, 0xC0, 0x00, 0x77, 0xFF, 0x88,
0x00, 0x00, 0x00, 0x1B, 0x40, 0x50, 0x00, 0x00, 0x03, 0x7F, 0xEC, 0x00, 0x00, 0x00, 0x02, 0x00,
0x48, 0x41, 0x13, 0x7F, 0xFF, 0xD2, 0x01, 0x70, 0x44, 0x9B, 0x41, 0x6E, 0x00, 0x09, 0xE1, 0x6E,
0x00, 0x07, 0xE1, 0x6E, 0x00, 0x37, 0x61, 0x7F, 0xFF, 0xF6, 0x21, 0x70, 0x45, 0x72, 0x01, 0x6E,
0x00, 0x3E, 0x61, 0x6E, 0x00, 0x0F, 0xA0, 0x38, 0x00, 0xF2, 0x09, 0x9F, 0xF6, 0x63, 0xEE, 0x44,
0xE8, 0x9C, 0x00, 0x00, 0x03, 0xF0, 0x40, 0x00, 0x07, 0x7F, 0xB0, 0x00, 0x00, 0x09, 0x96, 0x00,
0x00, 0x09, 0xEB, 0x68, 0x47, 0x76, 0x11, 0xBF, 0xD4, 0x20, 0x38, 0x00, 0xF3, 0xFF, 0xFF, 0xFF,
0xE4, 0x47, 0xE6, 0x44, 0x00, 0x3E, 0x20, 0x00, 0x03, 0xE2, 0x00, 0x00, 0x3E, 0x20, 0x00, 0x03,
0xE2, 0x00, 0x00, 0x3E, 0x20, 0x00, 0x03, 0xE2, 0x00, 0x00, 0x3E, 0x20, 0x00, 0x48, 0x41, 0x13,
0xAC, 0x00, 0x01, 0xC9, 0xAC, 0x00, 0x01, 0xC9, 0xAC, 0x00, 0x01, 0xC9, 0xAC, 0x00, 0x01, 0xC9,
0xAC, 0x00, 0x01, 0xC9, 0x8C, 0x00, 0x01, 0xC9, 0x54, 0x00, 0x05, 0xE2, 0x7F, 0x06, 0x9B, 0x60,
0x09, 0x9F, 0xD2, 0x00, 0x4F, 0xC1, 0x52, 0x18, 0xE0, 0x00, 0x01, 0xAA, 0x0D, 0xC0, 0x00, 0x09,
0xC0, 0x01, 0xE8, 0x00, 0x15, 0x00, 0x01, 0x36, 0x00, 0x3E, 0x40, 0x00, 0x5E, 0x40, 0xF6, 0x00,
0x00, 0x19, 0x01, 0xC8, 0x00, 0x00, 0x0B, 0xCB, 0xC0, 0x00, 0x00, 0x01, 0xDE, 0xE0, 0x00, 0x00,
0x01, 0x1E, 0x20, 0x00, 0x70, 0x01, 0xD2, 0xF8, 0x00, 0x01, 0xD0, 0x00, 0x05, 0xE0, 0x5E, 0x20,
0x07, 0xFA, 0x00, 0x0F, 0x40, 0x1A, 0xC0, 0x11, 0x3E, 0x40, 0x18, 0xA0, 0x11, 0x60, 0x1A, 0x76,
0xE0, 0x3E, 0x00, 0x07, 0xE0, 0x7C, 0x0B, 0x80, 0xD6, 0x00, 0x01, 0xCB, 0x12, 0x03, 0xE3, 0x6C,
0x00, 0x01, 0x35, 0xA8, 0x01, 0x6F, 0xE2, 0x00, 0x00, 0x9F, 0xC0, 0x00, 0xDF, 0x80, 0x00, 0x00,
0x1F, 0x40, 0x00, 0x3E, 0xE0, 0x00, 0x40, 0x01, 0x12, 0xBE, 0x20, 0x01, 0xCA, 0x15, 0x60, 0x13,
0x40, 0x03, 0xCC, 0x9C, 0x20, 0x00, 0x9F, 0xCA, 0x00, 0x00, 0x1B, 0xC0, 0x00, 0x00, 0xFB, 0xB0,
0x00, 0x05, 0xE6, 0x7E, 0x60, 0x19, 0x00, 0x0F, 0xA1, 0x1A, 0x00, 0x01, 0x92, 0x47, 0xC1, 0x32,
0x19, 0x00, 0x00, 0x15, 0x00, 0x7E, 0x20, 0x07, 0xC0, 0x01, 0x54, 0x01, 0x8C, 0x00, 0x03, 0xE6,
0xBA, 0x00, 0x00, 0x0F, 0x9C, 0x80, 0x00, 0x00, 0x1D, 0x60, 0x00, 0x00, 0x01, 0x6E, 0x00, 0x00,
0x00, 0x16, 0xE0, 0x00, 0x00, 0x01, 0x6E, 0x00, 0x00, 0x40, 0x01, 0x12, 0xDF, 0xFF, 0xFF, 0xEA,
0x04, 0x44, 0x53, 0xA0, 0x00, 0x00, 0x9E, 0x60, 0x00, 0x03, 0xCC, 0x00, 0x00, 0x19, 0x40, 0x00,
0x01, 0x1A, 0x00, 0x00, 0x09, 0xE6, 0x00, 0x00, 0x3D, 0x04, 0x44, 0x42, 0xFF, 0xFF, 0xFF, 0xF0,
0x20, 0x7A, 0x7B, 0x7F, 0x96, 0xC1, 0x6C, 0x16, 0xC1, 0x6C, 0x16, 0xC1, 0x6C, 0x16, 0xC1, 0x6C,
0x16, 0xC1, 0x6C, 0x16, 0xC1, 0x7F, 0x80, 0x27, 0xFE, 0xDA, 0x6A, 0x00, 0x00, 0x5C, 0x00, 0x00,
0x1A, 0x60, 0x00, 0x11, 0x00, 0x00, 0x07, 0xA0, 0x00, 0x01, 0xA4, 0x00, 0x01, 0x0E, 0x00, 0x00,
0x78, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x12, 0xE0, 0x00, 0x09, 0x80, 0x00, 0x01, 0xE2, 0x00, 0x01,
0x4C, 0x20, 0x3A, 0x7B, 0x9F, 0x60, 0xF6, 0x0D, 0x60, 0xD6, 0x0D, 0x60, 0xD6, 0x0D, 0x60, 0xD6,
0x0D, 0x60, 0xD6, 0x0D, 0x60, 0xF7, 0x9F, 0x60, 0x38, 0x04, 0xEC, 0x00, 0x10, 0x00, 0x00, 0x0B,
0xEA, 0x00, 0x01, 0x6B, 0x80, 0x00, 0x58, 0x18, 0x40, 0x10, 0xC0, 0xD0, 0x01, 0xA0, 0x01, 0xA0,
0x30, 0x3E, 0xC3, 0xBB, 0xBB, 0xBA, 0x38, 0x50, 0x84, 0x4E, 0x20, 0x0B, 0x82, 0x38, 0x00, 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 0xD7, 0x60, 0x01, 0x8E, 0x1A, 0xC0, 0xF8, 0x00,
0x7E, 0x40, 0x3F, 0xFB, 0x14, 0x1A, 0xA0, 0x01, 0x30, 0x0F, 0x60, 0x01, 0xC4, 0x03, 0xE4, 0x0B,
0x80, 0x01, 0x50, 0x16, 0xA0, 0x00, 0x9A, 0x3C, 0x00, 0x00, 0x1D, 0x72, 0x00, 0x00, 0x11, 0xE6,
0x00, 0x00, 0x0B, 0xA0, 0x00, 0x0A, 0x38, 0xC0, 0x00, 0x3B, 0xF4, 0x00, 0x00, 0x30, 0x00, 0xCE,
0xFF, 0xFF, 0xF6, 0x00, 0x05, 0xE6, 0x00, 0x18, 0xE0, 0x01, 0x16, 0x00, 0x09, 0xC2, 0x00, 0x3C,
0xA0, 0x01, 0x1F, 0xFF, 0xFA, 0x20, 0x3A, 0x9A, 0x01, 0x7E, 0x09, 0xC2, 0x0B, 0x80, 0x0B, 0x80,
0x0B, 0x80, 0x0D, 0x80, 0x9E, 0xE0, 0x0F, 0x80, 0x0B, 0x80, 0x0B, 0x80, 0x0B, 0x80, 0x09, 0xC2,
0x01, 0x7E, 0x20, 0x7A, 0x5B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B,
0x6B, 0x6A, 0x20, 0x3A, 0x9B, 0x9A, 0x40, 0x17, 0x00, 0x13, 0x20, 0x13, 0x20, 0x13, 0x20, 0x11,
0x20, 0x09, 0xEE, 0x11, 0x60, 0x13, 0x20, 0x13, 0x20, 0x13, 0x20, 0x17, 0x01, 0x9A, 0x40, 0x38,
0x06, 0xE4, 0x17, 0xF0, 0x14, 0x67, 0x21, 0x3F, 0x60, 0x00, 0x00, 0x00
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,124 @@
#include <Arduino.h>
#include <vector>
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5AtomDisplay.h>
//M5AtomDisplay display;
#define LINE_COUNT 6
std::vector<int> points[LINE_COUNT];
int colors[] = { TFT_RED, TFT_GREEN, TFT_BLUE, TFT_CYAN, TFT_MAGENTA, TFT_YELLOW };
int xoffset, yoffset, point_count;
int virtual_width;
int virtual_height;
int zoom = 1;
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)
{
display.begin();
if (display.isEPD())
{
display.setEpdMode(epd_mode_t::epd_fastest);
display.invertDisplay(true);
display.clear(TFT_BLACK);
}
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
if (display.getBoard() == m5gfx::boards::board_t::board_M5StackCoreInk)
{
zoom = 2;
}
else if (display.getBoard() == m5gfx::boards::board_t::board_M5Paper)
{
zoom = 3;
}
else
{
zoom = (display.width() / 480) + 1;
}
virtual_width = display.width() / zoom;
virtual_height = display.height()/ zoom;
xoffset = virtual_width >> 1;
yoffset = virtual_height >> 1;
point_count = virtual_width + 1;
for (int i = 0; i < LINE_COUNT; i++)
{
points[i].resize(point_count);
}
display.startWrite();
for (int y = 0; y < virtual_height; y++)
{
for (int x = 0; x < virtual_width; x++)
{
auto color = getBaseColor(x, y - yoffset);
if (color)
{
display.fillRect(x * zoom, y * zoom, zoom, zoom, color);
}
}
}
display.endWrite();
}
void loop(void)
{
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))) * (virtual_height >> 2);
}
++count;
display.waitDisplay();
display.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])
{
display.fillRect(x * zoom, (y + yoffset) * zoom, zoom, zoom, getBaseColor(x, y));
}
}
for (int i = 0; i < LINE_COUNT; i++)
{
int y = points[i][index1];
display.fillRect(x * zoom, (y + yoffset) * zoom, zoom, zoom, colors[i]);
}
}
display.endWrite();
}

View file

@ -0,0 +1,196 @@
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5AtomDisplay.h>
//M5AtomDisplay display; // default setting
//M5AtomDisplay display ( 320, 180 ); // width, height
static constexpr const int qsintab[256]={
0x8000,0x80c9,0x8192,0x825b,0x8324,0x83ee,0x84b7,0x8580,
0x8649,0x8712,0x87db,0x88a4,0x896c,0x8a35,0x8afe,0x8bc6,
0x8c8e,0x8d57,0x8e1f,0x8ee7,0x8fae,0x9076,0x913e,0x9205,
0x92cc,0x9393,0x945a,0x9521,0x95e7,0x96ad,0x9773,0x9839,
0x98fe,0x99c4,0x9a89,0x9b4d,0x9c12,0x9cd6,0x9d9a,0x9e5e,
0x9f21,0x9fe4,0xa0a7,0xa169,0xa22b,0xa2ed,0xa3af,0xa470,
0xa530,0xa5f1,0xa6b1,0xa770,0xa830,0xa8ef,0xa9ad,0xaa6b,
0xab29,0xabe6,0xaca3,0xad5f,0xae1b,0xaed7,0xaf92,0xb04d,
0xb107,0xb1c0,0xb27a,0xb332,0xb3ea,0xb4a2,0xb559,0xb610,
0xb6c6,0xb77c,0xb831,0xb8e5,0xb999,0xba4d,0xbb00,0xbbb2,
0xbc64,0xbd15,0xbdc6,0xbe76,0xbf25,0xbfd4,0xc082,0xc12f,
0xc1dc,0xc288,0xc334,0xc3df,0xc489,0xc533,0xc5dc,0xc684,
0xc72c,0xc7d3,0xc879,0xc91f,0xc9c3,0xca67,0xcb0b,0xcbae,
0xcc4f,0xccf1,0xcd91,0xce31,0xced0,0xcf6e,0xd00b,0xd0a8,
0xd144,0xd1df,0xd279,0xd313,0xd3ac,0xd443,0xd4db,0xd571,
0xd606,0xd69b,0xd72f,0xd7c2,0xd854,0xd8e5,0xd975,0xda05,
0xda93,0xdb21,0xdbae,0xdc3a,0xdcc5,0xdd4f,0xddd9,0xde61,
0xdee9,0xdf6f,0xdff5,0xe07a,0xe0fd,0xe180,0xe202,0xe283,
0xe303,0xe382,0xe400,0xe47d,0xe4fa,0xe575,0xe5ef,0xe668,
0xe6e0,0xe758,0xe7ce,0xe843,0xe8b7,0xe92b,0xe99d,0xea0e,
0xea7e,0xeaed,0xeb5b,0xebc8,0xec34,0xec9f,0xed09,0xed72,
0xedda,0xee41,0xeea7,0xef0b,0xef6f,0xefd1,0xf033,0xf093,
0xf0f2,0xf150,0xf1ad,0xf209,0xf264,0xf2be,0xf316,0xf36e,
0xf3c4,0xf41a,0xf46e,0xf4c1,0xf513,0xf564,0xf5b3,0xf602,
0xf64f,0xf69b,0xf6e6,0xf730,0xf779,0xf7c1,0xf807,0xf84d,
0xf891,0xf8d4,0xf916,0xf956,0xf996,0xf9d4,0xfa11,0xfa4d,
0xfa88,0xfac1,0xfafa,0xfb31,0xfb67,0xfb9c,0xfbd0,0xfc02,
0xfc33,0xfc63,0xfc92,0xfcc0,0xfcec,0xfd17,0xfd42,0xfd6a,
0xfd92,0xfdb8,0xfdde,0xfe01,0xfe24,0xfe46,0xfe66,0xfe85,
0xfea3,0xfec0,0xfedb,0xfef5,0xff0e,0xff26,0xff3c,0xff52,
0xff66,0xff79,0xff8a,0xff9b,0xffaa,0xffb8,0xffc4,0xffd0,
0xffda,0xffe3,0xffeb,0xfff1,0xfff6,0xfffa,0xfffd,0xffff,
};
static int isin(int i) {
i=(i&1023);
if (i>=512) return -isin(i-512);
if (i>=256) i=(511-i);
return qsintab[i]-0x8000;
}
static int icos(int i) {
return isin(i+256);
}
int32_t lcd_width;
int32_t lcd_height;
uint32_t f;
uint8_t colors[8];
size_t scale = 1;
void setup(void)
{
display.init();
display.startWrite();
display.fillScreen(TFT_BLACK);
if (display.isEPD())
{
display.setEpdMode(epd_mode_t::epd_fastest);
}
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
if (display.width() > 800)
{
scale = 4;
}
lcd_width = display.width() / scale;
lcd_height = display.height() / scale;
display.startWrite();
display.setColorDepth(8);
display.fillScreen(TFT_BLACK);
f = 0;
for (int i = 0; i < 8; ++i)
{
uint32_t p = 0;
if (i & 1) p =0x03;
if (i & 2) p+=0x1C;
if (i & 4) p+=0xE0;
colors[i] = p;
}
}
uint32_t p_dxx = 0;
uint32_t p_dxy = 0;
uint32_t p_dyx = 0;
uint32_t p_dyy = 0;
int rcos = 0;
int rsin = 0;
int zoom = 0;
int px = 0;
int py = 0;
void loop(void)
{
uint32_t p_cxx = (zoom * ((px) * rcos - (py) * rsin) ) >> (20 - 8);
uint32_t p_cxy = (zoom * ((py) * rcos + (px) * rsin) ) >> (20 - 8);
++f;
rcos=icos(f*3);
rsin=isin(f*3);
zoom=((isin(f*5)+0x10000)>>8)+128;
px=(isin(f)>>7)-110;
py=(icos(f)>>7)-110;
uint32_t cxx = (zoom * ((px) * rcos - (py) * rsin) ) >> (20 - 8);
uint32_t cxy = (zoom * ((py) * rcos + (px) * rsin) ) >> (20 - 8);
uint32_t dxx = (zoom * (( 1) * rcos - ( 0) * rsin) ) >> (20 - 8);
uint32_t dxy = (zoom * (( 0) * rcos + ( 1) * rsin) ) >> (20 - 8);
uint32_t dyx = (zoom * (( 0) * rcos - ( 1) * rsin) ) >> (20 - 8);
uint32_t dyy = (zoom * (( 1) * rcos + ( 0) * rsin) ) >> (20 - 8);
display.waitDisplay();
for (uint32_t y = 0; y < lcd_height; y++)
{
uint32_t ypos = y * scale;
p_cxx+=p_dxx;
p_cxy+=p_dxy;
cxx+=dxx;
cxy+=dxy;
uint32_t cx=cxx;
uint32_t cy=cxy;
uint32_t p_cx = p_cxx;
uint32_t p_cy = p_cxy;
uint32_t x = 0;
uint32_t prev_x = 0;
uint32_t prev_color = 0xAA;
bool flg = false;
do
{
p_cx+=p_dyx;
p_cy+=p_dyy;
cx+=dyx;
cy+=dyy;
auto color = ((cx^cy) >> 16) & 7;
bool diff = color != (((p_cx ^ p_cy) >> 16) & 7);
if (flg)
{
if (!diff || prev_color != color)
{
if (x)
{
display.writeFillRectPreclipped(prev_x * scale, ypos, (x - prev_x) * scale, scale, colors[prev_color]);
}
flg = diff;
prev_x = x;
prev_color = color;
}
}
else
{
if (diff)
{
flg = true;
prev_x = x;
prev_color = color;
}
}
} while (++x < lcd_width);
if (flg)
{
display.writeFillRect(prev_x * scale, ypos, (x - prev_x) * scale, scale, colors[prev_color]);
}
}
display.display();
p_dxx = dxx;
p_dxy = dxy;
p_dyx = dyx;
p_dyy = dyy;
}

View file

@ -0,0 +1,764 @@
/*
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 <M5GFX.h>
M5GFX tft;
// #include <M5AtomDisplay.h>
// M5AtomDisplay tft(1920, 1080);
// M5AtomDisplay tft(1280, 720);
// M5AtomDisplay tft(960, 540);
// M5AtomDisplay tft(640, 360);
// M5AtomDisplay tft(480, 270);
// M5AtomDisplay tft(320, 180);
/*
M5AtomDisplay tft( 240 // width
, 360 // height
, 60 // refresh rate
, 1280 // output width
, 720 // output height
, 2 // X scaling
, 2 // Y scaling
);
//*/
unsigned long total = 0;
unsigned long tn = 0;
void setup() {
Serial.begin(115200);
Serial.println(""); Serial.println("");
Serial.println("M5GFX 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(" M5GFX 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.pushBlock(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 = 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 = 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 = 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 = 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 = 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 = 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
****************************************************/

View file

@ -0,0 +1,93 @@
#include <M5GFX.h>
M5GFX display;
//#include <M5UnitOLED.h>
//M5UnitOLED display; // default setting
//M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitLCD.h>
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ
//#include <M5AtomDisplay.h>
//M5AtomDisplay display; // default setting
//M5AtomDisplay display ( 320, 180 ); // width, height
static constexpr char text0[] = "hello world";
static constexpr char text1[] = "this";
static constexpr char text2[] = "is";
static constexpr char text3[] = "text";
static constexpr char text4[] = "log";
static constexpr char text5[] = "vertical";
static constexpr char text6[] = "scroll";
static constexpr char text7[] = "sample";
static constexpr const char* text[] = { text0, text1, text2, text3, text4, text5, text6, text7 };
//*
/// Example of using canvas
M5Canvas canvas(&display);
void setup(void)
{
display.begin();
if (display.isEPD())
{
display.setEpdMode(epd_mode_t::epd_fastest);
display.invertDisplay(true);
display.clear(TFT_BLACK);
}
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
canvas.setColorDepth(1); // mono color
canvas.createSprite(display.width(), display.height());
canvas.setTextSize((float)canvas.width() / 160);
canvas.setTextScroll(true);
}
void loop(void)
{
static int count = 0;
canvas.printf("%04d:%s\r\n", count, text[count & 7]);
canvas.pushSprite(0, 0);
++count;
}
/*/
/// Example without canvas
void setup(void)
{
display.begin();
if (display.isEPD())
{
display.setEpdMode(epd_mode_t::epd_fastest);
display.invertDisplay(true);
display.clear(TFT_BLACK);
}
if (display.width() < display.height())
{
display.setRotation(display.getRotation() ^ 1);
}
display.setTextSize((float)display.width() / 160);
display.setTextScroll(true);
}
void loop(void)
{
static int count = 0;
display.printf("%04d:%s\r\n", count, text[count & 7]);
++count;
}
//*/

View file

@ -0,0 +1,73 @@
#include <M5GFX.h>
M5GFX display;
void setup(void)
{
display.init();
display.setFont(&fonts::Font4);
if (!display.touch())
{
display.setTextDatum(textdatum_t::middle_center);
display.drawString("Touch not found.", display.width() / 2, display.height() / 2);
}
display.setEpdMode(epd_mode_t::epd_fastest);
display.startWrite();
}
void loop(void)
{
static bool drawed = false;
lgfx::touch_point_t tp[3];
int nums = display.getTouchRaw(tp, 3);
if (nums)
{
for (int i = 0; i < nums; ++i)
{
display.setCursor(16, 16 + i * 24);
display.printf("Raw X:%03d Y:%03d", tp[i].x, tp[i].y);
}
display.convertRawXY(tp, nums);
for (int i = 0; i < nums; ++i)
{
display.setCursor(16, 128 + i * 24);
display.printf("Convert X:%03d Y:%03d", tp[i].x, tp[i].y);
}
display.display();
display.setColor(display.isEPD() ? TFT_BLACK : TFT_WHITE);
for (int i = 0; i < nums; ++i)
{
int s = tp[i].size + 3;
switch (tp[i].id)
{
case 0:
display.fillCircle(tp[i].x, tp[i].y, s);
break;
case 1:
display.drawLine(tp[i].x-s, tp[i].y-s, tp[i].x+s, tp[i].y+s);
display.drawLine(tp[i].x-s, tp[i].y+s, tp[i].x+s, tp[i].y-s);
break;
default:
display.fillTriangle(tp[i].x-s, tp[i].y +s, tp[i].x+s, tp[i].y+s, tp[i].x, tp[i].y-s);
break;
}
display.display();
}
drawed = true;
}
else if (drawed)
{
drawed = false;
display.waitDisplay();
display.clear();
display.display();
}
vTaskDelay(1);
}

View file

@ -0,0 +1,55 @@
#include <SD.h>
#include <SPIFFS.h>
#include <M5GFX.h>
M5GFX display;
static constexpr const uint8_t PIN_SD_CS = GPIO_NUM_4;
void setup(void)
{
display.init();
display.print("SD wait.\n");
SPIFFS.begin();
if (!display.loadFont(SPIFFS, "/font.vlw"))
{
#if defined (_SD_H_)
while (!SD.begin(PIN_SD_CS, SPI, 25000000))
{
ESP_LOGD("debug","SD begin failed");
delay(500);
}
if (!display.loadFont(SD, "/font.vlw"))
#endif
{
display.print("Font data not found...");
}
}
}
void loop(void)
{
display.print("Hello World !");
delay(500);
}
#if !defined ( ARDUINO )
extern "C" {
void loopTask(void*)
{
setup();
for (;;) {
loop();
}
vTaskDelete(NULL);
}
void app_main()
{
xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, NULL, 1);
}
}
#endif

Some files were not shown because too many files have changed in this diff Show more