From 03c812cb62ff1d84055714c470f82d15e6083040 Mon Sep 17 00:00:00 2001 From: lovyan03 <42724151+lovyan03@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:11:28 +0900 Subject: [PATCH] tweak for M5Station --- README.md | 56 +++++++++++++++++++------------------ src/utility/Power_Class.cpp | 6 +++- src/utility/Power_Class.hpp | 14 +++++----- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index b33b5b8..0f5d8b1 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ - M5Stack Core2 / Tough - M5Stick C / CPlus - M5Stack CoreInk + - M5Station - M5Paper - M5ATOM Lite / Matrix / ECHO / PSRAM / U - M5STAMP PICO / C3 / C3U @@ -31,13 +32,13 @@ |:------------------:|:---------------------------------:|:---------------------------------:|:-------------------------------------:|:----------------------------:|:----------------------:|:---------------------:|:---------------------:|:---------------------------------------:|:------------------:|:------------------:| |GPIO 0
`ADC2_CH1`|`M-Bus`
IIS_MK |`M-Bus`
IIS_MK |`M-Bus`
**SPK_LRCK
PDM_C**(Core2)|`HAT`
`PAD`
**PDM_C** |**EPD_RST** | --- | --- | --- | |GPIO 0
`ADC2_CH1`| |GPIO 1
`USB_TX` |`M-Bus`
**Serial** |`M-Bus`
**Serial** |`M-Bus`
**Serial** |**Serial** |**Serial** |**Serial** |**Serial** |**Serial** |**Serial** |GPIO 1
`USB_TX` | -|GPIO 2
`ADC2_CH2`|`M-Bus`
|`M-Bus`
|`M-Bus`
**SPK D** |`PAD`
**Beep**(CPlus) |**Beep** |**PW_Hold** | REn? | --- | --- |GPIO 2
`ADC2_CH2`| +|GPIO 2
`ADC2_CH2`|`M-Bus`
|`M-Bus`
|`M-Bus`
**SPK D** |`PAD`
**Beep**(CPlus) |**Beep** |**PW_Hold** |**ReadEn** | --- | --- |GPIO 2
`ADC2_CH2`| |GPIO 3
`USB_RX` |`M-Bus`
**Serial** |`M-Bus`
**Serial** |`M-Bus`
**Serial** |**Serial** |**Serial** |**Serial** |**Serial** |**Serial** |**Serial** |GPIO 3
`USB_RX` | |GPIO 4
`ADC2_CH0`|**TF_CS** |**TF_CS** |**TF_CS** | --- |**EPD_BUSY** |**TF_CS** |**RGB LED** | --- | --- |GPIO 4
`ADC2_CH0`| -|GPIO 5 |`M-Bus` |`M-Bus` |**LCD_CS** |**LCD_CS** |**BTN_HAT** |**EXT_5V** |**LCD_CS** |(PSRAM)
**PDM_C**(U) | --- |GPIO 5 | +|GPIO 5 |`M-Bus` |`M-Bus` |**LCD_CS** |**LCD_CS** |**BTN_HAT** |**EXT_5V** |**LCD_CS** |`Bus`(P)
**PDM_C**(U) | --- |GPIO 5 | |GPIO 9 | --- | --- | --- |**InfraRed** |**EPD_CS** | --- | --- | --- | --- |GPIO 9 | |GPIO10 | --- | --- | --- |**LED** |**LED** | --- | --- | --- | --- |GPIO10 | -|GPIO12
`ADC2_CH5`|`M-Bus`
IIS_SK |`M-Bus`
IIS_SK |**SPK BCLK** | --- |**PW_Hold** |**SPI_MOSI** | USB? |**InfraRed** | --- |GPIO12
`ADC2_CH5`| +|GPIO12
`ADC2_CH5`|`M-Bus`
IIS_SK |`M-Bus`
IIS_SK |**SPK BCLK** | --- |**PW_Hold** |**SPI_MOSI** |**USB_PW** |**InfraRed** | --- |GPIO12
`ADC2_CH5`| |GPIO13
`ADC2_CH4`|`M-Bus`
IIS_WS |`M-Bus`
IIS_WS |`M-Bus`
RXD2 |**SPI_SCLK** |`MI-Bus`
RXD2 |**SPI_MISO** |`PORT.C1` | --- | --- |GPIO13
`ADC2_CH4`| |GPIO14
`ADC2_CH6`|**LCD_CS** |**LCD_CS** |`M-Bus`
TXD2 | --- |`MI-Bus`
TXD2 |**SPI_SCLK** |`PORT.C1` | --- | --- |GPIO14
`ADC2_CH6`| |GPIO15
`ADC2_CH3`|`M-Bus`
IIS_OUT |`M-Bus`
**RGB LED** |**LCD_D/C** |**SPI_MOSI** |**EPD_D/C** |**EPD_CS** |**LCD_RST** | --- | --- |GPIO15
`ADC2_CH3`| @@ -84,21 +85,21 @@ ### AXP192 IO list -| |M5Stack
Core2 |M5Stack
Tough |M5Stick
C |M5Stick
CPlus| | -|:------------:|:-----------------:|:-----------------:|:--------------:|:--------------:|:------------:| -|GPIO0
LDO0 |BUS PW EN |BUS PW EN |MIC VCC |MIC VCC |GPIO0
LDO0 | -| GPIO1 |SYS LED |TP RST | --- | --- | GPIO1 | -| GPIO2 |SPK EN |SPK EN | --- | --- | GPIO2 | -| GPIO3 | --- | --- | --- | --- | GPIO3 | -| GPIO4 |LCD RST
TP RST |LCD RST | --- | --- | GPIO4 | -| EXTEN |PORT 5V EN |PORT 5V EN |PORT 5V EN |PORT 5V EN | EXTEN | -| BACKUP |RTC BAT |RTC BAT |RTC BAT |RTC BAT | BACKUP | -| LDO1 |RTC VDD |RTC VDD |RTC VDD |RTC VDD | LDO1 | -| LDO2 |LCD PW
Periph PW|LCD PW
Periph PW|LCD BL |LCD BL | LDO2 | -| LDO3 |VIB MOTOR |LCD BL |LCD PW |LCD PW | LDO3 | -| DCDC1 |ESP32 VDD |ESP32 VDD |ESP32 VDD |ESP32 VDD | DCDC1 | -| DCDC2 | --- | --- | --- | --- | DCDC2 | -| DCDC3 |LCD BL | --- | --- | --- | DCDC3 | +| |M5Stack
Core2 |M5Stack
Tough |M5Stick
C |M5Stick
CPlus| M5Station | | +|:------------:|:-----------------:|:-----------------:|:--------------:|:--------------:|:-----------:|:------------:| +|GPIO0
LDO0 |BUS PW EN |BUS PW EN |MIC VCC |MIC VCC |PortA1.A2 EN |GPIO0
LDO0 | +| GPIO1 |SYS LED |TP RST | --- | --- |PortB1 EN | GPIO1 | +| GPIO2 |SPK EN |SPK EN | --- | --- |PortB2 EN | GPIO2 | +| GPIO3 | --- | --- | --- | --- |PortC1 EN | GPIO3 | +| GPIO4 |LCD RST
TP RST |LCD RST | --- | --- |PortC2 EN | GPIO4 | +| EXTEN |PORT 5V EN |PORT 5V EN |PORT 5V EN |PORT 5V EN |PORT 5V EN | EXTEN | +| BACKUP |RTC BAT |RTC BAT |RTC BAT |RTC BAT | --- | BACKUP | +| LDO1 |RTC VDD |RTC VDD |RTC VDD |RTC VDD |RTC VDD | LDO1 | +| LDO2 |LCD PW
Periph PW|LCD PW
Periph PW|LCD BL |LCD BL | --- | LDO2 | +| LDO3 |VIB MOTOR |LCD BL |LCD PW |LCD PW |LCD BL | LDO3 | +| DCDC1 |ESP32 VDD |ESP32 VDD |ESP32 VDD |ESP32 VDD |ESP32 VDD | DCDC1 | +| DCDC2 | --- | --- | --- | --- | --- | DCDC2 | +| DCDC3 |LCD BL | --- | --- | --- | --- | DCDC3 | ### PinMap @@ -236,14 +237,15 @@ ### I2C device -| |M5Stack
BASIC/GRAY
GO/FIRE |M5Stack
Core2 |M5Stack
Tough |M5Stick
C
CPlus|M5Stack
CoreInk |M5Paper |ATOM
Matrix | | -|:--------------:|:---------------------------------:|:--------------------:|:------------------:|:-------------------:|:-----------------:|:-------------------:|:--------------:|:--------------:| -|Touch
Panel | --- |`FT6336U`
38h |`CHSC6540`
2Eh | --- | --- |`GT911`
14h or 5Dh| --- |Touch
Panel | -|RTC | --- |`BM8563`
51h |`BM8563`
51h |`BM8563`
51h |`BM8563`
51h |`BM8563`
51h | --- |RTC | -|Power
Manage |`IP5306`
75h |`AXP192`
34h |`AXP192`
34h |`AXP192`
34h | --- | --- | --- |Power
Manage | -|IMU |`MPU6886`
68h |`MPU6886`
68h (Ext)| --- |`MPU6886`
68h | --- | --- |`MPU6886`
68h|IMU | -|IMU
(old lot)|`SH200Q`
6Ch | --- | --- |`SH200Q`
6Ch | --- | --- | --- |IMU
(old lot)| -|ENV | --- | --- | --- | --- | --- |`SHT30`
44h | --- |ENV | -|EEPROM | --- | --- | --- | --- | --- |`FM24C02`
50h | --- |EEPROM | +| |M5Stack
BASIC/GRAY
GO/FIRE |M5Stack
Core2 |M5Stack
Tough |M5Stick
C
CPlus|M5Stack
CoreInk |M5Paper |ATOM
Matrix |M5Station | | +|:---------------------------:|:---------------------------------:|:--------------------:|:------------------:|:-------------------:|:-----------------:|:-------------------:|:--------------:|:---------------------------:|:---------------------------:| +|Touch
Panel | --- |`FT6336U`
38h |`CHSC6540`
2Eh | --- | --- |`GT911`
14h or 5Dh| --- | --- |Touch
Panel | +|RTC | --- |`BM8563`
51h |`BM8563`
51h |`BM8563`
51h |`BM8563`
51h |`BM8563`
51h | --- |`BM8563`
51h |RTC | +|Power
Manage |`IP5306`
75h |`AXP192`
34h |`AXP192`
34h |`AXP192`
34h | --- | --- | --- |`AXP192`
34h |Power
Manage | +|IMU |`MPU6886`
68h |`MPU6886`
68h (Ext)| --- |`MPU6886`
68h | --- | --- |`MPU6886`
68h|`MPU6886`
68h (opt) |IMU | +|IMU
(old lot) |`SH200Q`
6Ch | --- | --- |`SH200Q`
6Ch | --- | --- | --- | --- |IMU
(old lot) | +|ENV | --- | --- | --- | --- | --- |`SHT30`
44h | --- | --- |ENV | +|EEPROM | --- | --- | --- | --- | --- |`FM24C02`
50h | --- | --- |EEPROM | +|Current
Voltage
Monitor| --- | --- | --- | --- | --- | --- | --- |`INA3221`
40h/41h
(opt)|Current
Voltage
Monitor| diff --git a/src/utility/Power_Class.cpp b/src/utility/Power_Class.cpp index ad5b4c6..9560696 100644 --- a/src/utility/Power_Class.cpp +++ b/src/utility/Power_Class.cpp @@ -265,7 +265,7 @@ namespace m5 if (enable && !Axp192.isACIN() && (0 >= Axp192.getBatteryLevel())) { /// ACINがfalseの時(USB非接続)かつバッテリー無しの状態のときは、M-BusやPort.A等から電力を得ている状態と判断できる。; /// 電力を外部に供給する設定にすると、外部からの電力供給を受けられなくなり、電源を喪失するため、設定不可とする; - ESP_LOGD("Power","setExtPower(true) but non ACIN."); + ESP_LOGW("Power","setExtPower(true) but non ACIN."); } else { @@ -288,6 +288,10 @@ namespace m5 if (enable) { m5gfx::gpio_hi(GPIO_NUM_12); } // GPIO12 = M5Station USB power control else { m5gfx::gpio_lo(GPIO_NUM_12); } } + if (port_mask & ext_port_mask_t::ext_MAIN) + { + Axp192.setEXTEN(enable); + } default: break; diff --git a/src/utility/Power_Class.hpp b/src/utility/Power_Class.hpp index 9998c99..f69a690 100644 --- a/src/utility/Power_Class.hpp +++ b/src/utility/Power_Class.hpp @@ -17,13 +17,13 @@ namespace m5 enum ext_port_mask_t { ext_none = 0 - , ext_PA = 0b00000001 - , ext_PB1 = 0b00000010 - , ext_PB2 = 0b00000100 - , ext_PC1 = 0b00001000 - , ext_PC2 = 0b00010000 - , ext_USB = 0b00100000 - , ext_HAT = 0b01000000 + , ext_PA = 0b00000001 + , ext_PB1 = 0b00000010 + , ext_PB2 = 0b00000100 + , ext_PC1 = 0b00001000 + , ext_PC2 = 0b00010000 + , ext_USB = 0b00100000 + , ext_MAIN = 0b10000000 }; class Power_Class