Skip to content

Commit

Permalink
Merge pull request #435 from lovyan03/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
lovyan03 authored Aug 3, 2023
2 parents 0cabacd + 67f8d49 commit 19a2e71
Show file tree
Hide file tree
Showing 61 changed files with 1,490 additions and 847 deletions.
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report--------.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ assignees: ''
- Bus type: [SPI|I2C|Parallel8|Parallel16|other]
- LovyanGFX version: [v0.4.17|latest develop|other]
- FrameWork version: [ArduinoESP32 v2.0.3|ESP-IDF v4.4|other]
- Build Environment : [ArduinoIDE|PlatformIO|Eclipse|other]
- Build Environment: [ArduinoIDE|PlatformIO|Eclipse|other]
- Operating System: [Windows|Linux|macOS]

## Problem Description ( 問題の内容 )
Expand All @@ -36,6 +36,9 @@ assignees: ''

### Code to reproduce this issue ( 再現させるためのコード )

**Please submit complete source code that can reproduce your problem.**
**あなたの問題を再現できる完全なソースコードを提示してください。**

```cpp
// the code should be wrapped in the ```cpp tag so that it will be displayed better.
#include "esp_log.h"
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/SDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ file(GLOB Target_Files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
${LovyanGFX_DIR}/lgfx/v1/*.cpp
${LovyanGFX_DIR}/lgfx/v1/misc/*.cpp
${LovyanGFX_DIR}/lgfx/v1/panel/Panel_Device.cpp
${LovyanGFX_DIR}/lgfx/v1/panel/Panel_FrameBufferBase.cpp
${LovyanGFX_DIR}/lgfx/v1/platforms/sdl/*.cpp
)
add_executable (${PROJECT_NAME} ${Target_Files})
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/IDFBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

esp-idf-fqbn:
- esp32@v4.1
- esp32@v4.2
#- esp32@v4.2.5 # esp-idf tools broken by cython/openOCD
- esp32@v4.3.1
- esp32s2@v4.4.4
- esp32s3@v4.4.4
Expand All @@ -37,20 +37,23 @@ jobs:
- esp32@v5.0.1
- esp32s2@v5.0.1
- esp32s3@v5.0.1
- esp32@v5.1
- esp32s3@v5.1 # LGFX I2C not ready yet

include:
- { esp-idf-fqbn: esp32@v4.1, idf-board: esp32, idf-version: v4.1 }
- { esp-idf-fqbn: esp32@v4.2, idf-board: esp32, idf-version: v4.2 }
#- { esp-idf-fqbn: esp32@v4.2.5, idf-board: esp32, idf-version: v4.2.5 }
- { esp-idf-fqbn: esp32@v4.3.1, idf-board: esp32, idf-version: v4.3.1 }
- { esp-idf-fqbn: esp32s2@v4.4.4, idf-board: esp32s2, idf-version: v4.4.4 }
- { esp-idf-fqbn: esp32s3@v4.4.4, idf-board: esp32s3, idf-version: v4.4.4 }
- { esp-idf-fqbn: esp32@v5.0, idf-board: esp32, idf-version: v5.0 }
- { esp-idf-fqbn: esp32s2@v5.0, idf-board: esp32s2, idf-version: v5.0 }
- { esp-idf-fqbn: esp32s3@v5.0, idf-board: esp32s3, idf-version: v5.0 }
- { esp-idf-fqbn: esp32@v5.0.1, idf-board: esp32, idf-version: v5.0.1 }
- { esp-idf-fqbn: esp32s2@v5.0.1, idf-board: esp32s2, idf-version: v5.0.1 }
- { esp-idf-fqbn: esp32s3@v5.0.1, idf-board: esp32s3, idf-version: v5.0.1 }

- { esp-idf-fqbn: esp32@v5.0, idf-board: esp32, idf-version: v5.0 }
- { esp-idf-fqbn: esp32s2@v5.0, idf-board: esp32s2, idf-version: v5.0 }
- { esp-idf-fqbn: esp32s3@v5.0, idf-board: esp32s3, idf-version: v5.0 }
- { esp-idf-fqbn: esp32@v5.0.1, idf-board: esp32, idf-version: v5.0.1 }
- { esp-idf-fqbn: esp32s2@v5.0.1, idf-board: esp32s2, idf-version: v5.0.1 }
- { esp-idf-fqbn: esp32s3@v5.0.1, idf-board: esp32s3, idf-version: v5.0.1 }
- { esp-idf-fqbn: esp32@v5.1, idf-board: esp32, idf-version: v5.1 }
- { esp-idf-fqbn: esp32s3@v5.1, idf-board: esp32s3, idf-version: v5.1 }

fail-fast: false

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ This library has the following advantages.
- M5Stack AtomDisplay

- タッチスクリーン TouchScreens
- I2C CST816S
- I2C FT5x06 (FT5206, FT5306, FT5406, FT6206, FT6236, FT6336, FT6436)
- I2C GSLx680 (GSL1680)
- I2C GT911
Expand Down
4 changes: 2 additions & 2 deletions examples/Sprite/ClockSample/ClockSample.ino
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ void loop(void)
{
static uint32_t p_milli = 0;
uint32_t milli = lgfx::millis() % 1000;
if (p_milli < milli) count += (milli - p_milli);
else count += 1000 + (milli - p_milli);
if (p_milli > milli) count += 1000 + (milli - p_milli);
else count += (milli - p_milli);
p_milli = milli;

int32_t tmp = (count % 1000) >> 3;
Expand Down
2 changes: 0 additions & 2 deletions examples/Sprite/MeterSample/MeterSample.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ static float zoom; // 表示倍率

void setup(void)
{
Serial.begin(115200);

lcd.init();
int lw = std::min(lcd.width(), lcd.height());

Expand Down
1 change: 0 additions & 1 deletion examples_for_PC/CMake_SDL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")

# SDL2を配置したパス内の.libファイルのパスを指定する;
target_link_libraries(LGFX_SDL PUBLIC "C:/SDL2/lib/x64/SDL2.lib")
target_link_libraries(LGFX_SDL PUBLIC "C:/SDL2/lib/x64/SDL2main.lib")


add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
Expand Down
40 changes: 26 additions & 14 deletions examples_for_PC/CMake_SDL/CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,15 +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": ""
}
]
{
"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": []
}
]
}
29 changes: 0 additions & 29 deletions examples_for_PC/CMake_SDL/LGFX_SDL.cpp

This file was deleted.

23 changes: 23 additions & 0 deletions examples_for_PC/CMake_SDL/sdl_main.cpp
Original file line number Diff line number Diff line change
@@ -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
79 changes: 79 additions & 0 deletions examples_for_PC/PlatformIO_SDL/README.md
Original file line number Diff line number Diff line change
@@ -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\ 内に上記フォルダの内容を追加する。(上書きコピー)

---




34 changes: 34 additions & 0 deletions examples_for_PC/PlatformIO_SDL/platformio.ini
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions examples_for_PC/PlatformIO_SDL/src/sdl_main.cpp
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions examples_for_PC/PlatformIO_SDL/src/user_code.cpp
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"type": "git",
"url": "https://github.com/lovyan03/LovyanGFX.git"
},
"version": "1.1.7",
"frameworks": ["arduino", "espidf"],
"platforms": ["espressif32", "espressif8266", "atmelsam"],
"version": "1.1.8",
"frameworks": ["arduino", "espidf", "*"],
"platforms": ["espressif32", "espressif8266", "atmelsam", "native"],
"headers": "LovyanGFX.hpp",
"build": {
"libArchive": false
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=LovyanGFX
version=1.1.7
version=1.1.8
author=lovyan03
maintainer=lovyan03
sentence=TFT LCD Graphics driver with touch for ESP32, ESP8266, SAMD21, SAMD51, RP2040
Expand Down
Loading

0 comments on commit 19a2e71

Please sign in to comment.