Skip to content

Commit

Permalink
Merge pull request #65 from m5stack/develop
Browse files Browse the repository at this point in the history
0.1.10
  • Loading branch information
lovyan03 authored Oct 12, 2023
2 parents f1e8df4 + a94e9f2 commit b6e8eec
Show file tree
Hide file tree
Showing 28 changed files with 212 additions and 37 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Supported device
- M5Tough
- M5Station
- M5ATOMS3
- M5Dial
- M5DinMeter
- M5Capsule
- M5Cardputer
- UnitOLED
- UnitMiniOLED
- UnitLCD
Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/AnalogMeter/AnalogMeter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display; // default setting
//M5AtomDisplay display ( 320, 180 ); // width, height
Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/BarGraph/BarGraph.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

// #include <M5AtomDisplay.h>
// M5AtomDisplay display;

Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/GameOfLife/GameOfLife.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display;

Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/LongTextScroll/LongTextScroll.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display;

Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/ScrollGraph/ScrollGraph.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display;

Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/SpinTile/SpinTile.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display; // default setting
//M5AtomDisplay display ( 320, 180 ); // width, height
Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/TextLogScroll/TextLogScroll.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display; // default setting
//M5AtomDisplay display ( 320, 180 ); // width, height
Expand Down
4 changes: 4 additions & 0 deletions examples/Basic/drawImageData/drawImageData.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ M5GFX display;
//M5UnitLCD display; // default setting
//M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5UnitGLASS2.h>
//M5UnitGLASS2 display; // default setting
//M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ

//#include <M5AtomDisplay.h>
//M5AtomDisplay display;

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "git",
"url": "https://github.com/m5stack/M5GFX.git"
},
"version": "0.1.9",
"version": "0.1.10",
"frameworks": ["arduino", "espidf", "*"],
"platforms": ["espressif32", "native"],
"headers": "M5GFX.h"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=M5GFX
version=0.1.9
version=0.1.10
author=M5Stack
maintainer=M5Stack
sentence=Library for M5Stack All Display
Expand Down
4 changes: 4 additions & 0 deletions src/M5AtomDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class M5AtomDisplay : public M5GFX
return true;
}

#if !defined (CONFIG_IDF_TARGET_ESP32C3)

#if defined (SDL_h_)
auto p = new lgfx::Panel_sdl();
if (!p) {
Expand Down Expand Up @@ -230,6 +232,8 @@ class M5AtomDisplay : public M5GFX
#endif
setPanel(p);
_panel_last.reset(p);
#endif

if (lgfx::LGFX_Device::init_impl(use_reset, use_clear))
{
return true;
Expand Down
47 changes: 47 additions & 0 deletions src/M5GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,7 @@ namespace m5gfx
cfg.panel_height = 240;
cfg.offset_x = 52;
cfg.offset_y = 40;
cfg.offset_rotation = 2;
cfg.readable = true;
cfg.invert = true;
p->config(cfg);
Expand All @@ -1329,6 +1330,52 @@ namespace m5gfx
bus_spi->release();
}

if (board == 0 || board == board_t::board_M5Cardputer)
{
bus_cfg.pin_mosi = GPIO_NUM_35;
bus_cfg.pin_miso = GPIO_NUM_NC;
bus_cfg.pin_sclk = GPIO_NUM_36;
bus_cfg.pin_dc = GPIO_NUM_34;
bus_cfg.spi_mode = 0;
bus_cfg.spi_3wire = true;
bus_spi->config(bus_cfg);
bus_spi->init();
_pin_reset(GPIO_NUM_33, use_reset); // LCD RST
id = _read_panel_id(bus_spi, GPIO_NUM_37);
if ((id & 0xFF) == 0x81)
{ // check panel (ST7789V2)
board = board_t::board_M5Cardputer;
ESP_LOGW(LIBRARY_NAME, "[Autodetect] board_M5Cardputer");
bus_spi->release();
bus_cfg.spi_host = SPI3_HOST;
bus_cfg.freq_write = 40000000;
bus_cfg.freq_read = 16000000;
bus_spi->config(bus_cfg);
bus_spi->init();
auto p = new Panel_ST7789();
p->bus(bus_spi);
{
auto cfg = p->config();
cfg.pin_cs = GPIO_NUM_37;
cfg.pin_rst = GPIO_NUM_33;
cfg.panel_width = 135;
cfg.panel_height = 240;
cfg.offset_x = 52;
cfg.offset_y = 40;
cfg.offset_rotation = 0;
cfg.readable = true;
cfg.invert = true;
p->config(cfg);
}
_panel_last.reset(p);
_set_pwm_backlight(GPIO_NUM_38, 7, 256, false, 16);

goto init_clear;
}
lgfx::pinMode(GPIO_NUM_33, lgfx::pin_mode_t::input); // LCD RST
bus_spi->release();
}

#endif

board = board_t::board_unknown;
Expand Down
9 changes: 8 additions & 1 deletion src/M5GFX.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) M5Stack. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#pragma once
#ifndef __M5GFX_H__
#define __M5GFX_H__

// If you want to use a set of functions to handle SD/SPIFFS/HTTP,
// please include <SD.h>,<SPIFFS.h>,<HTTPClient.h> before <M5GFX.h>
Expand Down Expand Up @@ -255,3 +256,9 @@ using namespace m5gfx::tft_command;
using M5GFX = m5gfx::M5GFX;
using M5Canvas = m5gfx::M5Canvas;
using RGBColor = m5gfx::bgr888_t;

#endif

#ifdef USE_M5_FONT_CREATOR
using EncodeRange = lgfx::EncodeRange;
#endif
4 changes: 4 additions & 0 deletions src/M5ModuleDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class M5ModuleDisplay : public M5GFX
return true;
}

#if !defined (CONFIG_IDF_TARGET_ESP32C3)

#if defined (SDL_h_)
auto p = new lgfx::Panel_sdl();
if (!p) {
Expand Down Expand Up @@ -227,6 +229,8 @@ class M5ModuleDisplay : public M5GFX
#endif
setPanel(p);
_panel_last.reset(p);
#endif

if (lgfx::LGFX_Device::init_impl(use_reset, use_clear))
{
return true;
Expand Down
12 changes: 9 additions & 3 deletions src/M5UnitGLASS.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ class M5UnitGLASS : public M5GFX
#if defined (SDL_h_)

M5UnitGLASS(const config_t &cfg)
{ }
{
setup(cfg.pin_sda, cfg.pin_scl, cfg.i2c_freq, cfg.i2c_port, cfg.i2c_addr);
}
M5UnitGLASS(uint8_t pin_sda = M5UNITGLASS_SDA, uint8_t pin_scl = M5UNITGLASS_SCL, uint32_t i2c_freq = M5UNITGLASS_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITGLASS_ADDR)
{ }
{
setup(pin_sda, pin_scl, i2c_freq, i2c_port, i2c_addr);
}

using lgfx::LGFX_Device::init;
bool init(uint8_t pin_sda, uint8_t pin_scl, uint32_t i2c_freq = M5UNITGLASS_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITGLASS_ADDR)
Expand All @@ -79,7 +83,9 @@ class M5UnitGLASS : public M5GFX
}

void setup(uint8_t pin_sda = M5UNITGLASS_SDA, uint8_t pin_scl = M5UNITGLASS_SCL, uint32_t i2c_freq = M5UNITGLASS_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITGLASS_ADDR)
{ }
{
_board = lgfx::board_t::board_M5UnitGLASS;
}

bool init_impl(bool use_reset, bool use_clear)
{
Expand Down
12 changes: 9 additions & 3 deletions src/M5UnitGLASS2.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ class M5UnitGLASS2 : public M5GFX
#if defined (SDL_h_)

M5UnitGLASS2(const config_t &cfg)
{ }
{
setup(cfg.pin_sda, cfg.pin_scl, cfg.i2c_freq, cfg.i2c_port, cfg.i2c_addr);
}
M5UnitGLASS2(uint8_t pin_sda = M5UNITGLASS2_SDA, uint8_t pin_scl = M5UNITGLASS2_SCL, uint32_t i2c_freq = M5UNITGLASS2_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITGLASS2_ADDR)
{ }
{
setup(pin_sda, pin_scl, i2c_freq, i2c_port, i2c_addr);
}

using lgfx::LGFX_Device::init;
bool init(uint8_t pin_sda, uint8_t pin_scl, uint32_t i2c_freq = M5UNITGLASS2_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITGLASS2_ADDR)
Expand All @@ -79,7 +83,9 @@ class M5UnitGLASS2 : public M5GFX
}

void setup(uint8_t pin_sda = M5UNITGLASS2_SDA, uint8_t pin_scl = M5UNITGLASS2_SCL, uint32_t i2c_freq = M5UNITGLASS2_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITGLASS2_ADDR)
{ }
{
_board = lgfx::board_t::board_M5UnitGLASS2;
}

bool init_impl(bool use_reset, bool use_clear)
{
Expand Down
12 changes: 9 additions & 3 deletions src/M5UnitLCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ class M5UnitLCD : public M5GFX
#if defined (SDL_h_)

M5UnitLCD(const config_t &cfg)
{ }
{
setup(cfg.pin_sda, cfg.pin_scl, cfg.i2c_freq, cfg.i2c_port, cfg.i2c_addr);
}
M5UnitLCD(uint8_t pin_sda = M5UNITLCD_SDA, uint8_t pin_scl = M5UNITLCD_SCL, uint32_t i2c_freq = M5UNITLCD_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITLCD_ADDR)
{ }
{
setup(pin_sda, pin_scl, i2c_freq, i2c_port, i2c_addr);
}

using lgfx::LGFX_Device::init;
bool init(uint8_t pin_sda, uint8_t pin_scl, uint32_t i2c_freq = M5UNITLCD_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITLCD_ADDR)
Expand All @@ -79,7 +83,9 @@ class M5UnitLCD : public M5GFX
}

void setup(uint8_t pin_sda = M5UNITLCD_SDA, uint8_t pin_scl = M5UNITLCD_SCL, uint32_t i2c_freq = M5UNITLCD_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITLCD_ADDR)
{ }
{
_board = lgfx::board_t::board_M5UnitLCD;
}

bool init_impl(bool use_reset, bool use_clear)
{
Expand Down
12 changes: 9 additions & 3 deletions src/M5UnitMiniOLED.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ class M5UnitMiniOLED : public M5GFX
#if defined (SDL_h_)

M5UnitMiniOLED(const config_t &cfg)
{ }
{
setup(cfg.pin_sda, cfg.pin_scl, cfg.i2c_freq, cfg.i2c_port, cfg.i2c_addr);
}
M5UnitMiniOLED(uint8_t pin_sda = M5UNITMINIOLED_SDA, uint8_t pin_scl = M5UNITMINIOLED_SCL, uint32_t i2c_freq = M5UNITMINIOLED_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITMINIOLED_ADDR)
{ }
{
setup(pin_sda, pin_scl, i2c_freq, i2c_port, i2c_addr);
}

using lgfx::LGFX_Device::init;
bool init(uint8_t pin_sda, uint8_t pin_scl, uint32_t i2c_freq = M5UNITMINIOLED_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITMINIOLED_ADDR)
Expand All @@ -79,7 +83,9 @@ class M5UnitMiniOLED : public M5GFX
}

void setup(uint8_t pin_sda = M5UNITMINIOLED_SDA, uint8_t pin_scl = M5UNITMINIOLED_SCL, uint32_t i2c_freq = M5UNITMINIOLED_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITMINIOLED_ADDR)
{ }
{
_board = lgfx::board_t::board_M5UnitMiniOLED;
}

bool init_impl(bool use_reset, bool use_clear)
{
Expand Down
12 changes: 9 additions & 3 deletions src/M5UnitOLED.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ class M5UnitOLED : public M5GFX
#if defined (SDL_h_)

M5UnitOLED(const config_t &cfg)
{ }
{
setup(cfg.pin_sda, cfg.pin_scl, cfg.i2c_freq, cfg.i2c_port, cfg.i2c_addr);
}
M5UnitOLED(uint8_t pin_sda = M5UNITOLED_SDA, uint8_t pin_scl = M5UNITOLED_SCL, uint32_t i2c_freq = M5UNITOLED_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITOLED_ADDR)
{ }
{
setup(pin_sda, pin_scl, i2c_freq, i2c_port, i2c_addr);
}

using lgfx::LGFX_Device::init;
bool init(uint8_t pin_sda, uint8_t pin_scl, uint32_t i2c_freq = M5UNITOLED_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITOLED_ADDR)
Expand All @@ -79,7 +83,9 @@ class M5UnitOLED : public M5GFX
}

void setup(uint8_t pin_sda = M5UNITOLED_SDA, uint8_t pin_scl = M5UNITOLED_SCL, uint32_t i2c_freq = M5UNITOLED_FREQ, int8_t i2c_port = -1, uint8_t i2c_addr = M5UNITOLED_ADDR)
{ }
{
_board = lgfx::board_t::board_M5UnitOLED;
}

bool init_impl(bool use_reset, bool use_clear)
{
Expand Down
1 change: 1 addition & 0 deletions src/lgfx/boards.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace lgfx // This should not be changed to "m5gfx"
, board_M5AtomS3Lite
, board_M5AtomS3U
, board_M5Capsule
, board_M5Cardputer

/// external displays
, board_M5AtomDisplay = 192
Expand Down
2 changes: 1 addition & 1 deletion src/lgfx/v1/gitTagVersion.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define LGFX_VERSION_MAJOR 1
#define LGFX_VERSION_MINOR 1
#define LGFX_VERSION_PATCH 9
#define LGFX_VERSION_PATCH 10
#define LOVYANGFX_VERSION F( LGFX_VERSION_MAJOR "." LGFX_VERSION_MINOR "." LGFX_VERSION_PATCH )
Loading

0 comments on commit b6e8eec

Please sign in to comment.