first commit
This commit is contained in:
commit
5893b00dd2
1669 changed files with 1982740 additions and 0 deletions
3
libraries/M5Unified/examples/PlatformIO_SDL/README.md
Normal file
3
libraries/M5Unified/examples/PlatformIO_SDL/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
# Check here for setup instructions.
|
||||
## [Steps to run M5GFX on a PC.](https://github.com/m5stack/M5GFX/blob/master/examples/PlatformIO_SDL/README.md)
|
||||
66
libraries/M5Unified/examples/PlatformIO_SDL/platformio.ini
Normal file
66
libraries/M5Unified/examples/PlatformIO_SDL/platformio.ini
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
; 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
|
||||
|
||||
[platformio]
|
||||
default_envs = native
|
||||
|
||||
[env]
|
||||
lib_extra_dirs=../../../
|
||||
|
||||
[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
|
||||
|
||||
[env:native_StickCPlus]
|
||||
extends = native
|
||||
platform = native
|
||||
build_flags = ${env:native.build_flags}
|
||||
-DM5GFX_SCALE=2
|
||||
-DM5GFX_ROTATION=0
|
||||
-DM5GFX_BOARD=board_M5StickCPlus
|
||||
|
||||
[env:native_Paper]
|
||||
extends = native
|
||||
platform = native
|
||||
build_flags = ${env:native.build_flags}
|
||||
-DM5GFX_ROTATION=0
|
||||
-DM5GFX_BOARD=board_M5Paper
|
||||
|
||||
[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:esp32c3_arduino]
|
||||
extends = esp32_base
|
||||
framework = arduino
|
||||
board = esp32-c3-devkitm-1
|
||||
|
||||
[env:esp32s3_arduino]
|
||||
extends = esp32_base
|
||||
framework = arduino
|
||||
board = esp32-s3-devkitc-1
|
||||
|
||||
[env:esp32_idf]
|
||||
extends = esp32_base
|
||||
framework = espidf
|
||||
|
||||
25
libraries/M5Unified/examples/PlatformIO_SDL/src/sdl_main.cpp
Normal file
25
libraries/M5Unified/examples/PlatformIO_SDL/src/sdl_main.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <M5GFX.h>
|
||||
#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**)
|
||||
{
|
||||
// The second argument is effective for step execution with breakpoints.
|
||||
// You can specify the time in milliseconds to perform slow execution that ensures screen updates.
|
||||
return lgfx::Panel_sdl::main(user_func, 128);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#include <M5Unified.h>
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
/// You may output logs to standard output.
|
||||
M5_LOGE("this is error LOG");
|
||||
M5_LOGW("this is warning LOG");
|
||||
M5_LOGI("this is info LOG");
|
||||
M5_LOGD("this is debug LOG");
|
||||
M5_LOGV("this is verbose LOG");
|
||||
|
||||
M5.begin();
|
||||
M5.Speaker.tone(2000, 100, 0, false);
|
||||
M5.Speaker.tone(1000, 100, 0, false);
|
||||
|
||||
M5.Display.printf("Please push cursor keys.\nButtonA == Left key\nButtonB == Down key\nButtonC == Right key\nButtonPWR == Up key\n");
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
M5.delay(8);
|
||||
M5.update();
|
||||
auto td = M5.Touch.getDetail();
|
||||
if (td.isPressed()) {
|
||||
M5.Display.fillCircle(td.x, td.y, 64, rand());
|
||||
int32_t tone = 880 + td.x + td.y;
|
||||
if (tone > 0) {
|
||||
M5.Speaker.tone(tone, 50, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (M5.BtnPWR.wasClicked()) {
|
||||
M5.Speaker.tone(4000, 200);
|
||||
M5_LOGD("BtnPWR Clicked");
|
||||
}
|
||||
if (M5.BtnA.wasClicked()) {
|
||||
M5.Speaker.tone(2000, 200);
|
||||
M5_LOGI("BtnA Clicked");
|
||||
}
|
||||
if (M5.BtnB.wasClicked()) {
|
||||
M5.Speaker.tone(1000, 200);
|
||||
M5_LOGW("BtnB Clicked");
|
||||
}
|
||||
if (M5.BtnC.wasClicked()) {
|
||||
M5.Speaker.tone(500, 200);
|
||||
M5_LOGE("BtnC Clicked");
|
||||
}
|
||||
}
|
||||
|
||||
#if defined ( ESP_PLATFORM ) && !defined ( ARDUINO )
|
||||
extern "C" {
|
||||
int app_main(int, char**)
|
||||
{
|
||||
setup();
|
||||
for (;;) {
|
||||
loop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue