Skip to content

Commit 28a34af

Browse files
authored
Merge pull request #108 from m5stack/develop
0.2.0
2 parents ff11e09 + 3a4c85e commit 28a34af

22 files changed

+371
-133
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: pioPkgPublish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
17+
18+
- name: Cache pip
19+
uses: actions/cache@v3
20+
with:
21+
path: ~/.cache/pip
22+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
23+
restore-keys: |
24+
${{ runner.os }}-pip-
25+
- name: Cache PlatformIO
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.platformio
29+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
30+
- name: Set up Python
31+
uses: actions/setup-python@v4
32+
33+
- name: Install PlatformIO
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install --upgrade platformio
37+
38+
- name: Run PlatformIO
39+
env:
40+
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
41+
run: |
42+
pio package publish --owner m5stack --non-interactive

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "git",
1111
"url": "https://github.com/m5stack/M5GFX.git"
1212
},
13-
"version": "0.1.17",
13+
"version": "0.2.0",
1414
"frameworks": ["arduino", "espidf", "*"],
1515
"platforms": ["espressif32", "native"],
1616
"headers": "M5GFX.h"

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=M5GFX
2-
version=0.1.17
2+
version=0.2.0
33
author=M5Stack
44
maintainer=M5Stack
55
sentence=Library for M5Stack All Display

src/M5AtomDisplay.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ class M5AtomDisplay : public M5GFX
148148
int spi_miso = GPIO_NUM_22;
149149
int spi_sclk = GPIO_NUM_5;
150150

151-
std::uint32_t pkg_ver = lgfx::get_pkg_ver();
151+
uint32_t pkg_ver = lgfx::get_pkg_ver();
152152
#if defined ( ESP_LOGD )
153-
ESP_LOGD("LGFX","pkg:%d", pkg_ver);
153+
ESP_LOGD("LGFX","pkg:%d", (int)pkg_ver);
154154
#endif
155155
switch (pkg_ver)
156156
{

src/M5GFX.cpp

Lines changed: 60 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,10 @@ namespace m5gfx
11651165

11661166
std::uint32_t id;
11671167

1168-
// std::uint32_t pkg_ver = m5gfx::get_pkg_ver();
1169-
// ESP_LOGE("DEBUG","pkg_ver:%02x", (int)pkg_ver);
1168+
std::uint32_t pkg_ver = m5gfx::get_pkg_ver();
1169+
// ESP_LOGD(LIBRARY_NAME, "pkg_ver : %02x", (int)pkg_ver);
1170+
switch (pkg_ver) {
1171+
case 0: // EFUSE_PKG_VERSION_ESP32S3: // QFN56
11701172

11711173
if (board == 0 || board == board_t::board_M5StackCoreS3 || board == board_t::board_M5StackCoreS3SE)
11721174
{
@@ -1255,50 +1257,6 @@ namespace m5gfx
12551257
lgfx::i2c::release(i2c_port);
12561258
}
12571259

1258-
if (board == 0 || board == board_t::board_M5AtomS3R)
1259-
{
1260-
_pin_reset(GPIO_NUM_48, use_reset); // LCD RST
1261-
bus_cfg.pin_mosi = GPIO_NUM_21;
1262-
bus_cfg.pin_miso = (gpio_num_t)-1; //GPIO_NUM_NC;
1263-
bus_cfg.pin_sclk = GPIO_NUM_15;
1264-
bus_cfg.pin_dc = GPIO_NUM_42;
1265-
bus_cfg.spi_mode = 0;
1266-
bus_cfg.spi_3wire = true;
1267-
bus_spi->config(bus_cfg);
1268-
bus_spi->init();
1269-
id = _read_panel_id(bus_spi, GPIO_NUM_14);
1270-
if ((id & 0xFFFFFF) == 0x079100)
1271-
{ // check panel (GC9107)
1272-
board = board_t::board_M5AtomS3R;
1273-
ESP_LOGW(LIBRARY_NAME, "[Autodetect] board_M5AtomS3R");
1274-
bus_spi->release();
1275-
bus_cfg.spi_host = SPI3_HOST;
1276-
bus_cfg.freq_write = 40000000;
1277-
bus_cfg.freq_read = 16000000;
1278-
bus_spi->config(bus_cfg);
1279-
bus_spi->init();
1280-
auto p = new Panel_GC9107();
1281-
p->bus(bus_spi);
1282-
{
1283-
auto cfg = p->config();
1284-
cfg.pin_cs = GPIO_NUM_14;
1285-
cfg.pin_rst = GPIO_NUM_48;
1286-
cfg.panel_width = 128;
1287-
cfg.panel_height = 128;
1288-
cfg.offset_y = 32;
1289-
cfg.readable = false;
1290-
cfg.bus_shared = false;
1291-
p->config(cfg);
1292-
}
1293-
_panel_last.reset(p);
1294-
_set_backlight(new Light_M5StackAtomS3R());
1295-
1296-
goto init_clear;
1297-
}
1298-
lgfx::pinMode(GPIO_NUM_48, lgfx::pin_mode_t::input); // LCD RST
1299-
bus_spi->release();
1300-
}
1301-
13021260
if (board == 0 || board == board_t::board_M5AtomS3)
13031261
{
13041262
_pin_reset(GPIO_NUM_34, use_reset); // LCD RST
@@ -1346,7 +1304,7 @@ namespace m5gfx
13461304
{
13471305
_pin_reset(GPIO_NUM_8, use_reset); // LCD RST
13481306
bus_cfg.pin_mosi = GPIO_NUM_5;
1349-
bus_cfg.pin_miso = GPIO_NUM_NC;
1307+
bus_cfg.pin_miso = (gpio_num_t)-1; //GPIO_NUM_NC;
13501308
bus_cfg.pin_sclk = GPIO_NUM_6;
13511309
bus_cfg.pin_dc = GPIO_NUM_4;
13521310
bus_cfg.spi_mode = 0;
@@ -1415,7 +1373,7 @@ namespace m5gfx
14151373
{
14161374
_pin_reset(GPIO_NUM_8, use_reset); // LCD RST
14171375
bus_cfg.pin_mosi = GPIO_NUM_5;
1418-
bus_cfg.pin_miso = GPIO_NUM_NC;
1376+
bus_cfg.pin_miso = (gpio_num_t)-1; //GPIO_NUM_NC;
14191377
bus_cfg.pin_sclk = GPIO_NUM_6;
14201378
bus_cfg.pin_dc = GPIO_NUM_4;
14211379
bus_cfg.spi_mode = 0;
@@ -1460,7 +1418,7 @@ namespace m5gfx
14601418
{
14611419
_pin_reset(GPIO_NUM_33, use_reset); // LCD RST
14621420
bus_cfg.pin_mosi = GPIO_NUM_35;
1463-
bus_cfg.pin_miso = GPIO_NUM_NC;
1421+
bus_cfg.pin_miso = (gpio_num_t)-1; //GPIO_NUM_NC;
14641422
bus_cfg.pin_sclk = GPIO_NUM_36;
14651423
bus_cfg.pin_dc = GPIO_NUM_34;
14661424
bus_cfg.spi_mode = 0;
@@ -1533,7 +1491,7 @@ namespace m5gfx
15331491
{
15341492
_pin_reset( GPIO_NUM_2, true); // EPDがDeepSleepしている場合は自動認識に失敗する。そのためRST制御を必ず行う。;
15351493
bus_cfg.pin_mosi = GPIO_NUM_6;
1536-
bus_cfg.pin_miso = GPIO_NUM_NC;
1494+
bus_cfg.pin_miso = (gpio_num_t)-1; //GPIO_NUM_NC;
15371495
bus_cfg.pin_sclk = GPIO_NUM_5;
15381496
bus_cfg.pin_dc = GPIO_NUM_3;
15391497
bus_cfg.spi_3wire = true;
@@ -1577,6 +1535,58 @@ namespace m5gfx
15771535
bus_spi->release();
15781536
}
15791537

1538+
break;
1539+
case 1: // EFUSE_PKG_VERSION_ESP32S3PICO: // LGA56
1540+
1541+
if (board == 0 || board == board_t::board_M5AtomS3R)
1542+
{
1543+
_pin_reset(GPIO_NUM_48, use_reset); // LCD RST
1544+
bus_cfg.pin_mosi = GPIO_NUM_21;
1545+
bus_cfg.pin_miso = (gpio_num_t)-1; //GPIO_NUM_NC;
1546+
bus_cfg.pin_sclk = GPIO_NUM_15;
1547+
bus_cfg.pin_dc = GPIO_NUM_42;
1548+
bus_cfg.spi_mode = 0;
1549+
bus_cfg.spi_3wire = true;
1550+
bus_spi->config(bus_cfg);
1551+
bus_spi->init();
1552+
id = _read_panel_id(bus_spi, GPIO_NUM_14);
1553+
if ((id & 0xFFFFFF) == 0x079100)
1554+
{ // check panel (GC9107)
1555+
board = board_t::board_M5AtomS3R;
1556+
ESP_LOGW(LIBRARY_NAME, "[Autodetect] board_M5AtomS3R");
1557+
bus_spi->release();
1558+
bus_cfg.spi_host = SPI3_HOST;
1559+
bus_cfg.freq_write = 40000000;
1560+
bus_cfg.freq_read = 16000000;
1561+
bus_spi->config(bus_cfg);
1562+
bus_spi->init();
1563+
auto p = new Panel_GC9107();
1564+
p->bus(bus_spi);
1565+
{
1566+
auto cfg = p->config();
1567+
cfg.pin_cs = GPIO_NUM_14;
1568+
cfg.pin_rst = GPIO_NUM_48;
1569+
cfg.panel_width = 128;
1570+
cfg.panel_height = 128;
1571+
cfg.offset_y = 32;
1572+
cfg.readable = false;
1573+
cfg.bus_shared = false;
1574+
p->config(cfg);
1575+
}
1576+
_panel_last.reset(p);
1577+
_set_backlight(new Light_M5StackAtomS3R());
1578+
1579+
goto init_clear;
1580+
}
1581+
lgfx::pinMode(GPIO_NUM_48, lgfx::pin_mode_t::input); // LCD RST
1582+
bus_spi->release();
1583+
}
1584+
1585+
break;
1586+
1587+
default: break;
1588+
}
1589+
15801590
#endif
15811591

15821592
board = board_t::board_unknown;

src/M5ModuleRCA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#if defined ( CONFIG_IDF_TARGET_ESP32 ) || !defined ( CONFIG_IDF_TARGET )
1717
#define M5MODULERCA_PIN_DAC GPIO_NUM_26
1818
#else
19-
#define M5MODULERCA_PIN_DAC GPIO_NUM_NC
19+
#define M5MODULERCA_PIN_DAC ((gpio_num_t)-1) //GPIO_NUM_NC;
2020
#endif
2121
#endif
2222
#else

src/M5UnitRCA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#if defined ( CONFIG_IDF_TARGET_ESP32 ) || !defined ( CONFIG_IDF_TARGET )
1717
#define M5UNITRCA_PIN_DAC GPIO_NUM_26
1818
#else
19-
#define M5UNITRCA_PIN_DAC GPIO_NUM_NC
19+
#define M5UNITRCA_PIN_DAC ((gpio_num_t)-1) //GPIO_NUM_NC;
2020
#endif
2121
#endif
2222
#else

src/lgfx/boards.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ namespace lgfx // This should not be changed to "m5gfx"
2727
, board_M5AtomS3R
2828

2929
/// non display boards
30-
, board_M5Atom = 128
31-
, board_M5ATOM = board_M5Atom
30+
, board_M5AtomLite = 128
31+
, board_M5ATOM __attribute__ ((deprecated)) = board_M5AtomLite
32+
, board_M5Atom __attribute__ ((deprecated)) = board_M5AtomLite
3233
, board_M5AtomPsram
3334
, board_M5AtomU
3435
, board_M5Camera
@@ -41,6 +42,10 @@ namespace lgfx // This should not be changed to "m5gfx"
4142
, board_M5AtomS3U
4243
, board_M5Capsule
4344
, board_M5NanoC6
45+
, board_M5AtomMatrix
46+
, board_M5AtomEcho
47+
, board_M5AtomS3RExt
48+
, board_M5AtomS3RCam
4449

4550
/// external displays
4651
, board_M5AtomDisplay = 192

src/lgfx/utility/pgmspace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Original Source:
4141

4242
/// for not ESP8266
4343
#if !defined ( pgm_read_dword_with_offset )
44-
#if defined (__SAMD21__) || defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040)
44+
#if defined (__SAMD21__) || defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(USE_PICO_SDK)
4545
#define pgm_read_word_unaligned(addr) (uint16_t) \
4646
( *(const uint8_t *)((uintptr_t)addr) \
4747
| *(const uint8_t *)((uintptr_t)addr+1) << 8 )
@@ -64,7 +64,7 @@ Original Source:
6464
#define pgm_read_3byte_unaligned(addr) (pgm_read_dword_unaligned(addr) & 0xFFFFFFu)
6565
#endif
6666

67-
#if defined ( ESP8266 ) || defined (__SAMD21__) || defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040)
67+
#if defined ( ESP8266 ) || defined (__SAMD21__) || defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(USE_PICO_SDK)
6868
static inline void write_3byte_unaligned(void* addr, uint32_t value)
6969
{
7070
((uint8_t*)(addr))[0] = value;

src/lgfx/v1/LGFXBase.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,7 @@ namespace lgfx
25752575

25762576
//----------------------------------------------------------------------------
25772577

2578-
void LGFXBase::qrcode(const char *string, int32_t x, int32_t y, int32_t w, uint8_t version) {
2578+
void LGFXBase::qrcode(const char *string, int32_t x, int32_t y, int32_t w, uint8_t version, bool margin) {
25792579
if (w == -1) {
25802580
w = std::min(width(), height()) * 9 / 10;
25812581
}
@@ -2592,6 +2592,16 @@ namespace lgfx
25922592
int_fast16_t thickness = w / qrcode.size;
25932593
int_fast16_t lineLength = qrcode.size * thickness;
25942594
int_fast16_t offset = (w - lineLength) >> 1;
2595+
2596+
if(margin) {
2597+
int_fast16_t mlen = thickness * 4; // Need 4 cell or greater margin
2598+
if(offset < mlen) {
2599+
thickness = (w - (mlen << 1)) / qrcode.size;
2600+
lineLength = qrcode.size * thickness;
2601+
offset = (w - lineLength) >> 1;
2602+
}
2603+
}
2604+
25952605
startWrite();
25962606
writeFillRect(x, y, w, offset, TFT_WHITE);
25972607
int_fast16_t dy = y + offset;

0 commit comments

Comments
 (0)