Skip to content

Commit 6422cdc

Browse files
authored
Merge pull request #148 from lovyan03/develop
0.4.3
2 parents 3d49184 + 1f937ff commit 6422cdc

File tree

103 files changed

+3440
-789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3440
-789
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ file(GLOB SRCS
1010
src/lgfx/v0/platforms/*.cpp
1111
src/lgfx/v0/touch/*.cpp
1212
src/lgfx/v1/*.cpp
13+
src/lgfx/v1/misc/*.cpp
1314
src/lgfx/v1/panel/*.cpp
1415
src/lgfx/v1/platforms/arduino_default/*.cpp
1516
src/lgfx/v1/platforms/esp32/*.cpp

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LovyanGFX
22

3-
Display (LCD / OLED / EPD) graphics library (for ESP32 SPI, I2C, 8bitParallel / ESP8266 SPI / ATSAMD51 SPI).
3+
Display (LCD / OLED / EPD) graphics library (for ESP32 SPI, I2C, 8bitParallel / ESP8266 SPI, I2C / ATSAMD51 SPI).
44
M5Stack / M5StickC / TTGO T-Watch / ODROID-GO / ESP-WROVER-KIT / WioTerminal / and more...
55
[![examples](http://img.youtube.com/vi/SMOHRPqUZcQ/0.jpg)](http://www.youtube.com/watch?v=SMOHRPqUZcQ "examples")
66
[![examples](http://img.youtube.com/vi/F5gsp41Elac/0.jpg)](http://www.youtube.com/watch?v=F5gsp41Elac "MultiPanel")
@@ -21,6 +21,7 @@ This library mimics [AdafruitGFX](https://github.com/adafruit/Adafruit-GFX-Libra
2121
- オフスクリーンバッファ(スプライト)の高速な回転/拡縮描画
2222
- 複数ディスプレイの同時利用
2323
- モノクロディスプレイに対する減色描画の自動処理
24+
- OpenCVを描画先として利用でき、PC上で動作可能
2425

2526
This library has the following advantages.
2627
- ArduinoESP32 and ESP-IDF are supported.
@@ -29,6 +30,19 @@ This library has the following advantages.
2930
- Fast rotation/expansion of the off-screen buffer (sprite).
3031
- Simultaneous use of multiple displays.
3132
- Automatic processing of color reduction drawing for monochrome displays.
33+
- OpenCV can be used as a drawing destination and can run on a PC.
34+
35+
36+
| | SPI | I2C | 8bit Para|16bit Para|
37+
|:------:|:---:|:---:|:--------:|:--------:|
38+
|ESP32 | HW | HW | HW (I2S) | --- |
39+
|ESP32-S2| HW | HW | HW (I2S) | HW (I2S) |
40+
|ESP32-C3| HW | HW | --- | --- |
41+
|ESP8266 | HW | SW | --- | --- |
42+
|SAMD51 | HW | HW | --- | --- |
43+
|SAMD21 | HW | HW | --- | --- |
44+
45+
※ HW = HardWare Peripheral / SW = SoftWare implementation
3246

3347

3448
対応環境 support environments
@@ -60,7 +74,7 @@ This library has the following advantages.
6074
- ST7789 (M5StickCPlus, TTGO T-Watch, ESP-WROVER-KIT, Makerfabs MakePython, DSTIKE D-duino-32 XS)
6175
- ST7796 (WT32-SC01)
6276

63-
- タッチスクリーン TouchScreens (only ESP32)
77+
- タッチスクリーン TouchScreens
6478
- I2C FT5x06 (FT5206, FT5306, FT5406, FT6206, FT6236, FT6336, FT6436)
6579
- I2C GT911
6680
- SPI XPT2046
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cmake_minimum_required (VERSION 3.8)
2+
project(LGFXOpenCV)
3+
4+
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
5+
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
6+
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>")
7+
8+
file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
9+
*.cpp
10+
LovyanGFX/src/lgfx/Fonts/efont/*.c
11+
LovyanGFX/src/lgfx/Fonts/IPA/*.c
12+
LovyanGFX/src/lgfx/utility/*.c
13+
LovyanGFX/src/lgfx/v1/*.cpp
14+
LovyanGFX/src/lgfx/v1/misc/*.cpp
15+
LovyanGFX/src/lgfx/v1/panel/*.cpp
16+
LovyanGFX/src/lgfx/v1/platforms/opencv/*.cpp
17+
)
18+
add_executable (LGFXOpenCV ${Target_Files})
19+
20+
target_compile_features(LGFXOpenCV PUBLIC cxx_std_17)
21+
target_include_directories(LGFXOpenCV PUBLIC "LovyanGFX/src/")
22+
target_include_directories(LGFXOpenCV PUBLIC "C:/opencv/build/include")
23+
target_link_libraries(LGFXOpenCV PUBLIC "C:/opencv/build/x64/vc15/lib/opencv_world452d.lib" )
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <stdio.h> // for drawBmpFile / drawJpgFile / drawPngFile
2+
3+
#define LGFX_USE_V1
4+
#include <LovyanGFX.hpp>
5+
#include <LGFX_AUTODETECT.hpp>
6+
7+
LGFX lcd ( 320, 240 );
8+
LGFX lcd2( 135, 240 );
9+
10+
int32_t target_x = 160 * 256;
11+
int32_t target_y = 120 * 256;
12+
int32_t current_x = 0;
13+
int32_t current_y = 0;
14+
int32_t add_x = 0;
15+
int32_t add_y = 0;
16+
17+
void setup()
18+
{
19+
lcd.init();
20+
lcd2.init();
21+
}
22+
23+
void loop()
24+
{
25+
static int i;
26+
++i;
27+
lcd.fillCircle(current_x >> 8, current_y >> 8, 5, i);
28+
current_x += add_x;
29+
current_y += add_y;
30+
add_x += (current_x < target_x) ? 1 : -1;
31+
add_y += (current_y < target_y) ? 1 : -1;
32+
lgfx::touch_point_t new_tp;
33+
if (lcd.getTouch(&new_tp))
34+
{
35+
target_x = new_tp.x * 256;
36+
target_y = new_tp.y * 256;
37+
lcd.drawCircle(new_tp.x, new_tp.y, 5, TFT_WHITE);
38+
}
39+
lgfx::delay(1);
40+
41+
lcd2.fillRect(i & 127, i >> 7, 16, 16, i);
42+
// lcd2.drawJpgFile("C:\\test.jpg", i & 127, i >> 7);
43+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <opencv2/opencv.hpp>
2+
#include <thread>
3+
4+
#define LGFX_USE_V1
5+
#include <LovyanGFX.hpp>
6+
#include <LGFX_AUTODETECT.hpp>
7+
8+
void setup(void);
9+
void loop(void);
10+
11+
void loopThread(void)
12+
{
13+
setup();
14+
for (;;)
15+
{
16+
loop();
17+
std::this_thread::yield();
18+
}
19+
}
20+
21+
int main(int, char**)
22+
{
23+
std::thread sub_thread(loopThread);
24+
for (;;)
25+
{
26+
std::this_thread::yield();
27+
lgfx::Panel_OpenCV::imshowall();
28+
}
29+
}

examples/Advanced/EPD/EPD.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ LGFX_Sprite sp(&gfx);
1919
int w = 200;
2020
int h = 200;
2121

22+
#ifdef min
23+
#undef min
24+
#endif
25+
2226
void setup(void)
2327
{
2428
// M5.begin();

examples/Sprite/ClockSample/ClockSample.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ static int32_t halfwidth = width >> 1; // 時計盤の中心座標
1515
static auto transpalette = 0; // 透過色パレット番号
1616
static float zoom; // 表示倍率
1717

18+
#ifdef min
19+
#undef min
20+
#endif
21+
1822
void setup(void)
1923
{
2024
Serial.begin(115200);

examples/Sprite/MeterSample/MeterSample.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ static int32_t halfwidth = width >> 1; // 中心座標
1010
static auto transpalette = 0; // 透過色パレット番号
1111
static float zoom; // 表示倍率
1212

13+
#ifdef min
14+
#undef min
15+
#endif
16+
1317
void setup(void)
1418
{
1519
Serial.begin(115200);

examples/Sprite/PartyParrot/PartyParrot.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,10 @@ static LGFX_Sprite sprite[10];
22452245
static std::uint32_t count = 0;
22462246
static float zoom = 0;
22472247

2248+
#ifdef min
2249+
#undef min
2250+
#endif
2251+
22482252
void setup()
22492253
{
22502254
lcd.init();

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"type": "git",
1212
"url": "https://github.com/lovyan03/LovyanGFX.git"
1313
},
14-
"version": "0.4.2",
14+
"version": "0.4.3",
1515
"frameworks": ["arduino", "espidf"],
1616
"platforms": ["espressif32", "espressif8266", "atmelsam"],
1717
"build": {

0 commit comments

Comments
 (0)