Skip to content

Commit

Permalink
Merge pull request #28 from Spooks4576/Development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Spooks4576 authored Oct 26, 2024
2 parents d710122 + 4ef0891 commit 575f9ac
Show file tree
Hide file tree
Showing 275 changed files with 1,725,011 additions and 1,088 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
cmake_minimum_required(VERSION 3.16.0)
set(IDF_TARGET "esp32s3")
set(IDF_TARGET "esp32")
set(PARTITION_TABLE_CUSTOM_FILENAME "partitions/min_spiffs.csv")
set(PARTITION_TABLE_CUSTOM_PARTITION_FILENAME "partitions/min_spiffs.csv")
add_link_options("-Wl,-z,muldefs")
#add_compile_definitions(LED_DATA_PIN=10)
#add_compile_definitions(USB_MODULE=1)
#add_compile_definitions(DEBUG=1)
#add_compile_definitions(USE_TOUCHSCREEN)
add_compile_definitions(USE_TOUCHSCREEN)
add_compile_definitions(HOLD_LIMIT=1000) # for joystick
#add_compile_definitions(USE_JOYSTICK)
#add_compile_definitions(USE_CARDPUTER)
#add_compile_definitions(USE_CARDPUTER=1)
add_compile_definitions(WITH_SCREEN=1)
add_compile_definitions(TFT_WIDTH=135) # TFT Width TFT_WIDTH=240
add_compile_definitions(TFT_HEIGHT=240) # TFT Height TFT_WIDTH=320
add_compile_definitions(TFT_WIDTH=240) # TFT Width TFT_WIDTH=240
add_compile_definitions(TFT_HEIGHT=320) # TFT Height TFT_WIDTH=320
add_compile_definitions(LED_ORDER=0) # 2 For RGB 0 for GRB
add_compile_definitions(NUM_LEDS=1)
add_compile_definitions(NUM_LEDS=3)
add_compile_definitions(IS_GHOST_BOARD=0)
add_compile_definitions(USING_SPI=0)
add_compile_definitions(USING_MMC=0)
add_compile_definitions(DNS_SERVER_MAX_ITEMS=1)
Expand Down
33 changes: 33 additions & 0 deletions components/M5GFX/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
set(COMPONENT_ADD_INCLUDEDIRS
src
)
file(GLOB SRCS
src/*.cpp
src/lgfx/Fonts/efont/*.c
src/lgfx/Fonts/IPA/*.c
src/lgfx/utility/*.c
src/lgfx/v1/*.cpp
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/touch/*.cpp
)
set(COMPONENT_SRCS ${SRCS})

if (IDF_VERSION_MAJOR GREATER_EQUAL 5)
set(COMPONENT_REQUIRES nvs_flash efuse driver esp_timer)
elseif ((IDF_VERSION_MAJOR EQUAL 4) AND (IDF_VERSION_MINOR GREATER 3) OR IDF_VERSION_MAJOR GREATER 4)
set(COMPONENT_REQUIRES nvs_flash efuse esp_lcd)
else()
set(COMPONENT_REQUIRES nvs_flash efuse)
endif()

### If you use arduino-esp32 components, please activate next comment line.
# list(APPEND COMPONENT_REQUIRES arduino-esp32)


message(STATUS "M5GFX use components = ${COMPONENT_REQUIRES}")

register_component()
21 changes: 21 additions & 0 deletions components/M5GFX/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
51 changes: 51 additions & 0 deletions components/M5GFX/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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
- M5Tough
- M5Station
- M5ATOMS3
- M5Dial
- M5DinMeter
- M5Cardputer
- M5VAMeter
- 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


7 changes: 7 additions & 0 deletions components/M5GFX/component.mk
Original file line number Diff line number Diff line change
@@ -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
147 changes: 147 additions & 0 deletions components/M5GFX/docs/ATOMDisplay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# ATOM Display library


![M5Stack ATOM Display](https://static-cdn.m5stack.com/resource/docs/products/atom/atom_display/atom_display_01.webp "ATOM Display")

### Notes.
- Audio output function is not included.
- If the image does not appear, reinsert the USB cable and wait a few seconds.
- When inserting or removing the USB cable, please hold the ATOM itself. Repeatedly inserting and removing the USB cable while holding the docking base side may cause stress on the pin headers and result in poor contact.

### 注意事項
- 音声出力機能は含まれません。
- 画像が表示されない場合はUSBケーブルを挿し直し、数秒待機してください。
- USBケーブルを挿抜する際はATOM本体を保持してください。ドッキングベース側を保持した状態でUSB挿抜を行うと、ピンヘッダに応力が掛かり接触不良を引き起こす可能性があります。


Sample Code:
```
#include <M5AtomDisplay.h>
// Create an instance of M5AtomDisplay
// M5AtomDisplay のインスタンスを用意
M5AtomDisplay display;
// Set the resolution in the argument (width, height, refresh rate). default : 1280, 720, 60 .
// The value of width x height x refresh rate must be within 55,296,000.
// If the display does not match the supported resolution or frequency of the display, it will not be displayed correctly.
// 引数で解像度(幅,高さ,リフレッシュレート)を設定できます。 省略時は 1280, 720, 60
// 幅 × 高さ × リフレッシュレート の値が 55,296,000 以下である必要があります。
// また、ディスプレイが指定の解像度や周波数に対応していない場合は正しく表示されません。
// M5AtomDisplay display(1920, 480);
// M5AtomDisplay display(1280, 720);
// M5AtomDisplay display(1024, 768);
// M5AtomDisplay display( 960, 540);
// M5AtomDisplay display( 800, 600);
// M5AtomDisplay display( 640, 480);
// M5AtomDisplay display( 640, 400);
// M5AtomDisplay display( 640, 360);
// M5AtomDisplay display( 512, 212);
// M5AtomDisplay display( 256, 192);
// M5AtomDisplay display( 320, 240);
// M5AtomDisplay display( 240, 320);
// M5AtomDisplay display( 200, 200);
// M5AtomDisplay display( 240, 135);
// M5AtomDisplay display( 135, 240);
// M5AtomDisplay display( 160, 160);
// M5AtomDisplay display( 160, 80);
// M5AtomDisplay display( 80, 160);
// M5AtomDisplay display( 80, 80);
// M5AtomDisplay display( 480, 1920);
// M5AtomDisplay display(1920, 1080, 24);
// M5AtomDisplay display(1920, 960, 30);
// Depending on the supported resolution of the display, it may not be displayed correctly.
// Arguments 4 and 5 allow you to set the resolution (width and height) to be output to the display.
// Arguments 6 and 7 allow you to set the scaling factor for width and height.
// Argument 8 allows you to set the pixel clock frequency.
// If the enlarged resolution is less than the output resolution, there will be a gap around the perimeter of the screen.
// ディスプレイの対応解像度によっては正しく表示できない場合があります。
// 引数4と5でディスプレイに出力する解像度(幅,高さ)を設定できます。
// 引数6と7で幅と高さの拡大倍率を設定できます。
// 引数8でピクセルクロックの周波数を設定できます。
// なお拡大後の解像度が出力解像度に満たない場合、画面外周に隙間が生じます。
// M5AtomDisplay display ( 512, 384, 60, 1280, 800, 2, 2, 74250000 );
// ※ The width scaling factor must be a number that is divisible by the width of the output resolution.
// ※ 幅の拡大倍率は、出力解像度の幅を割り切れる数である必要があります。
// ex: M5AtomDisplay display ( 400, 250, 60, 1280, 800, 3, 3, 74250000 );
// In this example, 1280 is not divisible by 3, so the horizontal scaling factor will be changed to 2.
// この例は 1280 を 3で割り切れないため、横方向の拡大倍率は2に変更されます。
void setup(void)
{
// initialize
// 初期化
display.init();
// Set the display orientation
// ディスプレイの向きを設定
// 0 = 270 deg / 1 = normal / 2 = 90 deg / 3 = 180 deg / 4~7 = upside down
display.setRotation(1);
// Set the color depth ( bpp )
// 色深度を設定
display.setColorDepth(24); // 24bit per pixel color setting
//display.setColorDepth(16); // 16bit per pixel color setting ( default )
//display.setColorDepth( 8); // 8bit per pixel color setting
display.startWrite();
for (int y = 0; y < display.height(); ++y)
{
for (int x = 0; x < display.width(); ++x)
{
display.writePixel(x, y, display.color888(x, x+y, y));
}
}
display.endWrite();
for (int i = 0; i < 16; ++i)
{
int x = rand() % display.width();
int y = rand() % display.height();
display.drawCircle(x, y, 16, rand());
}
}
void loop(void)
{
display.startWrite();
static constexpr const char hello_str[] = "Hello ATOM Display !";
display.setFont(&fonts::Orbitron_Light_32);
for (int i = -display.textWidth(hello_str); i < display.width(); ++i)
{
display.drawString(hello_str, i, (display.height() - display.fontHeight()) >> 1);
}
display.endWrite();
}
```


#### Is PSRAM required ? can I use it with ATOM Lite or ATOM Matrix?
- PSRAM is NOT required. it will work with ATOM Lite and ATOM Matrix. The label on the product that says "FOR ATOM PSRAM ONLY" is incorrect.
- In fact, in the early stages of development, we assumed that we would build a 1280x720 frame buffer in the ESP32's PSRAM and output the images. As the development progressed, the frame buffer was placed on the FPGA side, and in the final product, there was no need to have a frame buffer on the ESP32 side.

#### What is the difference between ATOM Lite and ATOM PSRAM?
- ATOM Lite has ESP32 PICO-D4, ATOM PSRAM has ESP32 PICO-V3-02.
- Some of the pins on the back are different. The ATOM PSRAM has a G5 pin where the ATOM Lite had a G23 pin, but the G23 pin is gone.



#### PSRAMは必須ですか?ATOM LiteやATOM Matrixで使えますか?
- PSRAMは必須ではありません。ATOM LiteやATOM Matrixでも動作します。製品のラベルに記載されている "FOR ATOM PSRAM ONLY" という表記は誤りです。
- 実は開発初期段階では、ESP32のPSRAMに1280x720のフレームバッファを構築して画像を出力する想定でした。開発が進むにつれ、フレームバッファはFPGA側に持つようになり、最終製品ではESP32側にフレームバッファを持つ必要がなくなりました。

#### ATOM LiteとATOM PSRAMの違いは?
- ATOM Liteには ESP32 PICO D4が搭載されています。ATOM PSRAMには ESP32 PICO V3-02 が搭載されています。
- 背面のピンが一部違います。ATOM Liteの G23 が配置されていた箇所には、 ATOM PSRAM では G5 が配置されています。G23は無くなっているため、注意が必要です。

66 changes: 66 additions & 0 deletions components/M5GFX/docs/UnitGLASS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Unit GLASS library

<img src="https://static-cdn.m5stack.com/resource/docs/products/unit/Glass%20Unit/img-4384183e-b663-4dfc-bc3f-5070166c6e2b.webp">


Sample Code:
```
#include <M5UnitGLASS.h>
M5UnitGLASS display;
void setup(void)
{
// initialize
// 初期化
// SDA, SCL, Freq, I2C PortNumber
display.init(GPIO_NUM_21, GPIO_NUM_22, 400000u);
// Set the display orientation
// ディスプレイの向きを設定
// 0 = 270 deg / 1 = normal / 2 = 90 deg / 3 = 180 deg / 4~7 = upside down
display.setRotation(1);
display.startWrite();
for (int y = 0; y < display.height(); ++y)
{
for (int x = 0; x < display.width(); ++x)
{
display.drawPixel(x, y, display.color888(x*2, x*2+y*2, y*2));
}
}
display.endWrite();
for (int i = 0; i < 16; ++i)
{
int x = rand() % display.width();
int y = rand() % display.height();
display.drawCircle(x, y, 16, rand());
}
}
bool buz_en = false;
void loop(void)
{
static constexpr const char hello_str[] = "Hello Unit GLASS !";
int i_end = -display.textWidth(hello_str);
for (int i = display.width(); i > i_end; --i)
{
// get key A status : 0==pressed / 0!=released
if (display.getKey(0) == 0) {
buz_en = !buz_en;
display.setBuzzerEnable(buz_en);
}
// get key B status : 0==pressed / 0!=released
if (display.getKey(1) == 0) {
display.setBuzzer((i - i_end) << 4, 128);
}
display.drawString(hello_str, i, (display.height() - display.fontHeight()) >> 1);
}
delay(5);
}
```
Loading

0 comments on commit 575f9ac

Please sign in to comment.