Skip to content

Commit 8a30424

Browse files
authored
Merge pull request #122 from lovyan03/develop
0.3.12
2 parents ba9b029 + 0262e57 commit 8a30424

File tree

9 files changed

+88
-19
lines changed

9 files changed

+88
-19
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ Pngle : [MIT](https://github.com/kikuchan/pngle/blob/master/LICENSE) kikuchan
469469
QRCode : [MIT](https://github.com/ricmoo/QRCode/blob/master/LICENSE.txt) Richard Moore and Nayuki
470470
GFX font and GLCD font : [2-clause BSD](https://github.com/adafruit/Adafruit-GFX-Library/blob/master/license.txt) Adafruit Industries
471471
Font 2,4,6,7,8 : [FreeBSD](https://github.com/Bodmer/TFT_eSPI/blob/master/license.txt) Bodmer
472-
converted IPA font : [IPA Font License](src/Fonts/IPA/IPA_Font_License_Agreement_v1.0.txt)
473-
efont : [3-Clause BSD License](src/Fonts/efont/COPYRIGHT.txt)
472+
converted IPA font : [IPA Font License](src/lgfx/Fonts/IPA/IPA_Font_License_Agreement_v1.0.txt) IPA
473+
efont : [3-Clause BSD](src/lgfx/Fonts/efont/COPYRIGHT.txt) The Electronic Font Open Laboratory
474474
475475

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.3.11",
14+
"version": "0.3.12",
1515
"frameworks": ["arduino", "espidf"],
1616
"platforms": ["espressif32", "atmelsam"],
1717
"build": {

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=LovyanGFX
2-
version=0.3.11
2+
version=0.3.12
33
author=lovyan03
44
maintainer=Lovyan <[email protected]>
55
sentence=TFT LCD Graphics driver with touch for ESP32 and SAMD51

src/lgfx/v0/config/LGFX_Config_AutoDetectESP32.hpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,60 @@ namespace lgfx
11081108
}
11091109
#endif
11101110

1111+
#if defined ( LGFX_WT32_SC01 )
1112+
if (nvs_board == 0 || nvs_board == lgfx::board_t::board_WT32_SC01) {
1113+
releaseBus();
1114+
_spi_mosi = 13;
1115+
_spi_miso = -1;
1116+
_spi_sclk = 14;
1117+
initBus();
1118+
1119+
p_tmp.spi_cs = 15;
1120+
p_tmp.spi_dc = 21;
1121+
p_tmp.gpio_rst = -1;
1122+
setPanel(&p_tmp);
1123+
1124+
/* if ( determination here ) */ {
1125+
ESP_LOGW("LovyanGFX", "[Autodetect] WT32-SC01");
1126+
board = lgfx::board_t::board_WT32_SC01;
1127+
auto p = new lgfx::Panel_ST7796();
1128+
releaseBus();
1129+
_spi_host = HSPI_HOST;
1130+
initBus();
1131+
p->spi_3wire = true;
1132+
p->spi_read = false;
1133+
p->spi_cs = 15;
1134+
p->spi_dc = 21;
1135+
p->gpio_rst = 22;
1136+
p->gpio_bl = 23;
1137+
p->pwm_ch_bl = 7;
1138+
p->rotation = 1;
1139+
setPanel(p);
1140+
1141+
auto t = new lgfx::Touch_FT5x06();
1142+
t->gpio_int = 39; // INT pin number
1143+
t->i2c_sda = 18; // I2C SDA pin number
1144+
t->i2c_scl = 19; // I2C SCL pin number
1145+
t->i2c_addr = 0x38; // I2C device addr
1146+
t->i2c_port = I2C_NUM_1;// I2C port number
1147+
t->freq = 400000; // I2C freq
1148+
t->x_min = 0;
1149+
t->x_max = 319;
1150+
t->y_min = 0;
1151+
t->y_max = 479;
1152+
touch(t);
1153+
_touch_affine[0] = 1;
1154+
_touch_affine[1] = 0;
1155+
_touch_affine[2] = 0;
1156+
_touch_affine[3] = 0;
1157+
_touch_affine[4] = 1;
1158+
_touch_affine[5] = 0;
1159+
1160+
goto init_clear;
1161+
}
1162+
}
1163+
#endif
1164+
11111165
// DSTIKE D-Duino32XS については読出しが出来ないため無条件設定となる。
11121166
// そのためLGFX_AUTO_DETECTでは機能しないようにしておく。
11131167
#if defined ( LGFX_DDUINO32_XS )

src/lgfx/v0/gitTagVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define LOVYANGFX_VERSION F("0.3.11")
1+
#define LOVYANGFX_VERSION F("0.3.12")

src/lgfx/v0/lgfx_common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ namespace lgfx
5555
, board_M5Stack_CoreInk
5656
, board_M5Paper
5757
, board_ESP32_S2_Kaluga_1
58+
, board_WT32_SC01
5859
};
5960
}
6061
using namespace boards;

src/lgfx/v0/panel/Panel_GDEW0154M09.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ namespace lgfx
4444
fp_pushBlock = pushBlock;
4545
fp_writePixels = writePixels;
4646
fp_readRect = readRect;
47+
48+
_range_old.top = INT_MAX;
49+
_range_old.left = INT_MAX;
50+
_range_old.right = 0;
51+
_range_old.bottom = 0;
52+
_range_new = _range_old;
4753
}
4854

4955
bool isEPD(void) const override { return true; }

src/lgfx/v0/platforms/esp32_common.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ namespace lgfx
174174
if (spi_host == VSPI_HOST) {
175175
SPI.end();
176176
SPI.begin(spi_sclk, spi_miso, spi_mosi);
177+
_spi_handle[spi_host] = SPI.bus();
177178
}
178179

179180
if (_spi_handle[spi_host] == nullptr) {
@@ -263,7 +264,10 @@ namespace lgfx
263264
if (spi_host == VSPI_HOST) {
264265
SPI.end();
265266
}
266-
spiStopBus(_spi_handle[spi_host]);
267+
else
268+
{
269+
spiStopBus(_spi_handle[spi_host]);
270+
}
267271
#else // ESP-IDF
268272
spi_bus_remove_device(_spi_handle[spi_host]);
269273
spi_bus_free(static_cast<spi_host_device_t>(spi_host));

src/lgfx/v0/touch/Touch_FT5x06.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,27 @@ namespace lgfx
5353
if (!_inited || number > 4) return 0;
5454
if (gpio_int >= 0 && gpio_in(gpio_int)) return 0;
5555

56-
std::uint_fast16_t tx, ty;
57-
std::int32_t retry = 3;
58-
std::uint32_t base = number * 6;
59-
std::uint8_t tmp[base + 5];
56+
std::size_t base = number * 6;
57+
std::size_t len = base + 5;
58+
59+
std::uint8_t tmp[2][len];
60+
lgfx::i2c::readRegister(i2c_port, i2c_addr, 2, tmp[0], len);
61+
std::int32_t retry = 5;
6062
do {
61-
lgfx::i2c::readRegister(i2c_port, i2c_addr, 2, tmp, 5 + base);
62-
if (number >= tmp[0]) return 0;
63-
tx = (tmp[base + 1] & 0x0F) << 8 | tmp[base + 2];
64-
ty = (tmp[base + 3] & 0x0F) << 8 | tmp[base + 4];
65-
} while ((tx > x_max || ty > y_max) && --retry);
63+
lgfx::i2c::readRegister(i2c_port, i2c_addr, 2, tmp[retry & 1], len);
64+
} while (memcmp(tmp[0], tmp[1], len) && --retry);
65+
66+
if ((std::uint8_t)number >= tmp[0][0]) return 0;
67+
6668
if (tp)
6769
{
68-
tp->x = tx;
69-
tp->y = ty;
70-
tp->id = tmp[base + 3] >> 4;
70+
auto data = &tmp[0][base];
71+
tp->size = 1;
72+
tp->x = (data[1] & 0x0F) << 8 | data[2];
73+
tp->y = (data[3] & 0x0F) << 8 | data[4];
74+
tp->id = data[3] >> 4;
7175
}
72-
return tmp[0];
76+
return tmp[0][0];
7377
}
7478

7579
//----------------------------------------------------------------------------

0 commit comments

Comments
 (0)