Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/M5Unified.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static constexpr const uint8_t _pin_table_i2c_ex_in[][5] = {
{ board_t::board_M5AtomVoiceS3R,GPIO_NUM_0 ,GPIO_NUM_45 , GPIO_NUM_1 ,GPIO_NUM_2 },
{ board_t::board_M5AtomS3RCam , GPIO_NUM_0 ,GPIO_NUM_45 , GPIO_NUM_1 ,GPIO_NUM_2 },
{ board_t::board_M5PaperS3 , GPIO_NUM_42,GPIO_NUM_41 , GPIO_NUM_1 ,GPIO_NUM_2 },
{ board_t::board_M5PaperDIY , GPIO_NUM_42,GPIO_NUM_41 , GPIO_NUM_42,GPIO_NUM_41 },
{ board_t::board_M5StampPLC , GPIO_NUM_15,GPIO_NUM_13 , GPIO_NUM_1 ,GPIO_NUM_2 },
{ board_t::board_M5PowerHub , GPIO_NUM_48,GPIO_NUM_45 , GPIO_NUM_16,GPIO_NUM_15 },
{ board_t::board_M5StampS3Bat , GPIO_NUM_47,GPIO_NUM_48 , 255 ,255 },
Expand Down Expand Up @@ -190,6 +191,7 @@ static constexpr const uint8_t _pin_table_sd[][7] = {
{ board_t::board_M5Cardputer , GPIO_NUM_40, GPIO_NUM_14, GPIO_NUM_39, 255 , 255 , GPIO_NUM_12 },
{ board_t::board_M5CardputerADV,GPIO_NUM_40, GPIO_NUM_14, GPIO_NUM_39, 255 , 255 , GPIO_NUM_12 },
{ board_t::board_M5PaperS3 , GPIO_NUM_39, GPIO_NUM_38, GPIO_NUM_40, 255 , 255 , GPIO_NUM_47 },
{ board_t::board_M5PaperDIY , GPIO_NUM_39, GPIO_NUM_38, GPIO_NUM_40, 255 , 255 , GPIO_NUM_47 },
{ board_t::board_M5StampPLC , GPIO_NUM_7, GPIO_NUM_8, GPIO_NUM_9, 255 , 255 , GPIO_NUM_10 },
{ board_t::board_M5PaperColor , GPIO_NUM_15, GPIO_NUM_13, GPIO_NUM_14, 255 , 255 , GPIO_NUM_47 },
{ board_t::board_M5PaperMono , GPIO_NUM_13, GPIO_NUM_12, GPIO_NUM_11, GPIO_NUM_10, GPIO_NUM_9, GPIO_NUM_8 },
Expand Down Expand Up @@ -2060,6 +2062,11 @@ static constexpr const uint8_t _pin_table_mbus[][31] = {
this->In_I2C.bitOff(m5pm1_i2c_addr, 0x11, 1 << 3, 100000); // Set gpio3 output low
break;

case board_t::board_M5PaperDIY:
m5gfx::pinMode(GPIO_NUM_4, m5gfx::pin_mode_t::input);
m5gfx::pinMode(GPIO_NUM_3, m5gfx::pin_mode_t::input);
break;

case board_t::board_M5PaperColor:
m5gfx::pinMode(GPIO_NUM_1, m5gfx::pin_mode_t::input);
m5gfx::pinMode(GPIO_NUM_9, m5gfx::pin_mode_t::input);
Expand Down Expand Up @@ -3042,6 +3049,12 @@ static constexpr const uint8_t _pin_table_mbus[][31] = {
| ((!m5gfx::gpio_in(GPIO_NUM_12)) & 1) << 1;
break;

case board_t::board_M5PaperDIY:
use_rawstate_bits = 0b00011;
btn_rawstate_bits = ((!m5gfx::gpio_in(GPIO_NUM_4)) & 1)
| ((!m5gfx::gpio_in(GPIO_NUM_3)) & 1) << 1;
break;

case board_t::board_M5PaperColor:
use_rawstate_bits = 0b00111;
btn_rawstate_bits = ((!m5gfx::gpio_in(GPIO_NUM_10)) & 1)
Expand Down
18 changes: 18 additions & 0 deletions src/utility/Power_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ namespace m5
_adc_ratio = 2.0f;
_wakeupPin = GPIO_NUM_48; // touch panel INT
break;

case board_t::board_M5PaperDIY:
_pmic = pmic_t::pmic_m5pm1;
M5pm1.setGPIOFunction(M5PM1_Class::gpio2, M5PM1_Class::gpio);
M5pm1.setGPIOMode(M5PM1_Class::gpio2, M5PM1_Class::output);
M5pm1.setGPIODrive(M5PM1_Class::gpio2, M5PM1_Class::push_pull);
M5pm1.setGPIOOutput(M5PM1_Class::gpio2, true); // EPD_PWR
M5pm1.setGPIOFunction(M5PM1_Class::gpio3, M5PM1_Class::gpio);
M5pm1.setGPIOMode(M5PM1_Class::gpio3, M5PM1_Class::input);
M5pm1.setGPIOPull(M5PM1_Class::gpio3, M5PM1_Class::pull_up); // CHG_STAT, active low
break;

case board_t::board_M5PaperColor:
_rtcIntPin = GPIO_NUM_7;
Expand Down Expand Up @@ -1951,6 +1962,13 @@ namespace m5
return M5pm1.getGPIOInput(M5PM1_Class::gpio0) ? is_charging_t::is_discharging : is_charging_t::is_charging;
}
break;

case board_t::board_M5PaperDIY:
{
// PM1_G3 is CHG_STAT, low=charging / high=not charging
return M5pm1.getGPIOInput(M5PM1_Class::gpio3) ? is_charging_t::is_discharging : is_charging_t::is_charging;
}
break;

case board_t::board_M5StopWatch: // M5PM1_G2
case board_t::board_M5StampS3Bat: // M5PM1_G2
Expand Down
Loading