Skip to content

Commit e069f9e

Browse files
authored
Merge pull request #1 from m5stack/develop
0.0.2
2 parents 2a936cd + 6d9c361 commit e069f9e

File tree

15 files changed

+54
-33
lines changed

15 files changed

+54
-33
lines changed

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"
1212
},
13-
"version": "0.0.1",
13+
"version": "0.0.2",
1414
"framework": "arduino",
1515
"platforms": "espressif32"
1616
}

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.0.1
2+
version=0.0.2
33
author=M5Stack
44
maintainer=lovyan03<[email protected]>
55
sentence=Library for M5Stack All Display

src/M5GFX.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined (ESP32) || defined (CONFIG_IDF_TARGET_ESP32) || defined (CONFIG_IDF_TARGET_ESP32S2) || defined (ESP_PLATFORM)
2+
13
#include "M5GFX.h"
24

35
#include "lgfx/v1/panel/Panel_ILI9342.hpp"
@@ -540,6 +542,7 @@ namespace m5gfx
540542
// AXP192_LDO2 = LCD PWR
541543
// AXP192_DC3 = LCD BL
542544
// AXP192_IO4 = LCD RST
545+
543546
if (use_reset) lgfx::i2c::registerWrite8(axp_i2c_port, axp_i2c_addr, 0x96, 0, ~0x02, axp_i2c_freq); // GPIO4 LOW (LCD RST)
544547
lgfx::i2c::registerWrite8(axp_i2c_port, axp_i2c_addr, 0x28, 0xF0, ~0, axp_i2c_freq); // set LDO2 3300mv // LCD PWR
545548
lgfx::i2c::registerWrite8(axp_i2c_port, axp_i2c_addr, 0x12, 0x06, ~0, axp_i2c_freq); // LDO2 and DC3 enable (DC3 = LCD BL)
@@ -642,3 +645,5 @@ ESP_LOGI("nvs_board","_board:%d", board);
642645
}
643646

644647
}
648+
649+
#endif

src/M5GFX.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#include <FS.h>
1010
#endif
1111

12+
/// Use of std::min instead of macro definitions is recommended.
13+
#ifdef min
14+
#undef min
15+
#endif
16+
1217
#ifdef setFont
1318
#undef setFont
1419
#endif
@@ -189,5 +194,3 @@ using namespace m5gfx::ili9341_colors;
189194
using namespace m5gfx::tft_command;
190195
using M5GFX = m5gfx::M5GFX;
191196
using M5Canvas = m5gfx::M5Canvas;
192-
193-
#undef LGFX_NS

src/lgfx/utility/lgfx_tjpgd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,14 @@ JRESULT lgfx_jd_prepare (
827827
ofs = 2;
828828

829829
for (;;) {
830-
if (infunc(jd, seg, 4) != 4) return JDR_INP;
831-
uint_fast16_t len = LDB_WORD(seg + 2) - 2; /* Length field */
830+
if (infunc(jd, seg, 1) != 1) return JDR_INP;
832831
if (seg[0] != 0xFF) return JDR_FMT1; /* Check a JPEG marker */
832+
do
833+
{
834+
if (infunc(jd, &seg[1], 1) != 1) return JDR_INP;
835+
} while (seg[1] == 0xFF);
836+
if (infunc(jd, &seg[2], 2) != 2) return JDR_INP;
837+
uint_fast16_t len = LDB_WORD(seg + 2) - 2; /* Length field */
833838
ofs += 4 + len; /* Number of bytes loaded */
834839

835840
switch (seg[1]) { /* Marker */

src/lgfx/v1/LGFXBase.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,7 +2850,7 @@ namespace lgfx
28502850
static Panel_NULL nullobj;
28512851
_panel = (nullptr == panel)
28522852
? &nullobj
2853-
: reinterpret_cast<IPanel*>(panel);
2853+
: panel;
28542854
}
28552855

28562856
bool LGFX_Device::init_impl(bool use_reset, bool use_clear)
@@ -2862,7 +2862,7 @@ namespace lgfx
28622862
setBaseColor(TFT_WHITE);
28632863
setTextColor(TFT_BLACK, TFT_WHITE);
28642864
}
2865-
if (_panel->init(use_reset))
2865+
if (getPanel()->init(use_reset))
28662866
{
28672867
startWrite();
28682868
invertDisplay(_panel->getInvert());
@@ -2875,6 +2875,7 @@ namespace lgfx
28752875
setPivot(width()>>1, height()>>1);
28762876
endWrite();
28772877
setBrightness(_brightness);
2878+
getPanel()->initTouch();
28782879
return true;
28792880
}
28802881
}

src/lgfx/v1/LGFXBase.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,11 +1142,10 @@ namespace lgfx
11421142
inline std::uint8_t getBrightness(void) const { return _brightness; }
11431143

11441144
inline ITouch* touch(void) const { return _panel ? panel()->touch() : nullptr; }
1145+
inline void convertRawXY(std::int32_t *x, std::int32_t *y) { panel()->convertRawXY(x, y); }
11451146
std::uint_fast8_t getTouchRaw(touch_point_t *tp, std::uint_fast8_t number = 0) { return panel()->getTouchRaw(tp, number); }
11461147
std::uint_fast8_t getTouch(touch_point_t *tp, std::uint_fast8_t number = 0) { return panel()->getTouch(tp, number); }
1147-
inline void convertRawXY(std::int32_t *x, std::int32_t *y) { panel()->convertRawXY(x, y); }
1148-
1149-
touch_point_t getTouch(std::uint_fast8_t number = 0)
1148+
touch_point_t getTouch(std::int_fast8_t number = 0)
11501149
{
11511150
touch_point_t res;
11521151
getTouch(&res, number);

src/lgfx/v1/LGFX_Sprite.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ namespace lgfx
4040

4141
void beginTransaction(void) override {}
4242
void endTransaction(void) override {}
43-
bool init(bool use_reset) override { return true; }
4443
void setInvert(bool invert) override {}
4544
void setSleep(bool flg_sleep) override {}
4645
void setPowerSave(bool flg_partial) override {}

src/lgfx/v1/Panel.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ namespace lgfx
7171

7272
virtual void beginTransaction(void) = 0;
7373
virtual void endTransaction(void) = 0;
74-
virtual bool init(bool use_reset) = 0;
7574

7675
virtual void setBrightness(std::uint8_t brightness) {};
7776

src/lgfx/v1/panel/Panel_Device.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ namespace lgfx
6363
{
6464
_light->init(0);
6565
}
66-
if (_touch)
67-
{
68-
_touch->init();
69-
}
7066
if (use_reset)
7167
{
7268
reset();
@@ -75,6 +71,15 @@ namespace lgfx
7571
return true;
7672
}
7773

74+
bool Panel_Device::initTouch(void)
75+
{
76+
if (_touch)
77+
{
78+
return _touch->init();
79+
}
80+
return false;
81+
}
82+
7883
void Panel_Device::initDMA(void)
7984
{
8085
_bus->initDMA();

0 commit comments

Comments
 (0)