Skip to content

Commit 7614fa3

Browse files
authored
Merge pull request #164 from m5stack/develop
0.2.17
2 parents 6c93c68 + b7ff485 commit 7614fa3

File tree

6 files changed

+33
-4
lines changed

6 files changed

+33
-4
lines changed

examples/Basic/AnalogMeter/AnalogMeter.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void setup(void)
165165
needle_y = (meter_height*2 + display.width()) / 3;
166166
osx = needle_x;
167167
osy = needle_y;
168-
liner_count = std::min(6, display.width() / 40);
168+
liner_count = std::min<int>(6, display.width() / 40);
169169

170170
analogMeter(); // Draw analogue meter
171171
int w = display.width() / liner_count;

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.2.16",
13+
"version": "0.2.17",
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.2.16
2+
version=0.2.17
33
author=M5Stack
44
maintainer=M5Stack
55
sentence=Library for M5Stack All Display

src/lgfx/v1/gitTagVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define LGFX_VERSION_MAJOR 1
22
#define LGFX_VERSION_MINOR 2
3-
#define LGFX_VERSION_PATCH 16
3+
#define LGFX_VERSION_PATCH 17
44
#define LOVYANGFX_VERSION F( LGFX_VERSION_MAJOR "." LGFX_VERSION_MINOR "." LGFX_VERSION_PATCH )

src/lgfx/v1/platforms/esp32/Bus_EPD.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ bool Bus_EPD::init(void)
131131
bus_config.bus_width = _config.bus_width;
132132
for (int i = 0; i < _config.bus_width; ++i) {
133133
bus_config.data_gpio_nums[i] = _config.pin_data[i];
134+
// starting from ESP-IDF v5.4, esp_lcd_new_i80_bus removed `gpio_set_direction` call on all pins include these data pins,
135+
// for somehow unknown reason, some of data pin like GPIO11, GPIO12 are Open-Drain mode when bootup and remains OD after
136+
// `esp_lcd_new_i80_bus`, which will cause screen not works as expected.
137+
// but on older IDF, those pins will disable OD in `gpio_set_direction`, so set these pin output and disable OD before `esp_lcd_new_i80_bus`
138+
lgfx::pinMode(_config.pin_data[i], lgfx::pin_mode_t::output);
134139
}
135140
if (ESP_OK != esp_lcd_new_i80_bus(&bus_config, &_i80_bus_handle))
136141
{ return false; }

src/lgfx/v1/platforms/esp32/common.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,10 @@ namespace lgfx
10571057
#endif
10581058
}
10591059

1060+
#if defined ( ARDUINO ) && __has_include (<Wire.h>)
1061+
#elif __has_include(<driver/i2c_master.h>)
1062+
i2c_master_bus_handle_t i2c_bus_handle = nullptr;
1063+
#endif
10601064
private:
10611065
uint32_t _reg_store[22];
10621066
};
@@ -1276,6 +1280,12 @@ namespace lgfx
12761280
#endif
12771281
#endif
12781282
#endif
1283+
#elif __has_include(<driver/i2c_master.h>)
1284+
auto bus_handle = i2c_context[i2c_port].i2c_bus_handle;
1285+
if (bus_handle) {
1286+
i2c_context[i2c_port].i2c_bus_handle = nullptr;
1287+
i2c_del_master_bus(bus_handle);
1288+
}
12791289
#else
12801290
i2c_periph_disable(i2c_port);
12811291
#endif
@@ -1370,6 +1380,20 @@ namespace lgfx
13701380
#else
13711381
twowire->begin((int)pin_sda, (int)pin_scl);
13721382
#endif
1383+
#elif __has_include(<driver/i2c_master.h>)
1384+
i2c_master_bus_handle_t bus_handle = nullptr;
1385+
i2c_master_bus_config_t bus_config;
1386+
memset(&bus_config, 0, sizeof(i2c_master_bus_config_t));
1387+
bus_config.i2c_port = i2c_port;
1388+
bus_config.sda_io_num = pin_sda;
1389+
bus_config.scl_io_num = pin_scl;
1390+
bus_config.clk_source = I2C_CLK_SRC_DEFAULT;
1391+
bus_config.glitch_ignore_cnt = 7;
1392+
bus_config.flags.enable_internal_pullup = true;
1393+
bus_config.intr_priority = 1;
1394+
1395+
i2c_new_master_bus(&bus_config, &bus_handle);
1396+
i2c_context[i2c_port].i2c_bus_handle = bus_handle;
13731397
#else
13741398
i2c_periph_enable(i2c_port);
13751399
#endif

0 commit comments

Comments
 (0)