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
1 change: 1 addition & 0 deletions src/M5StamPLC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ void M5_STAMPLC::rx8130_init()
if (!RX8130.begin()) {
ESP_LOGE(TAG, "rx8130 init failed!");
} else {
RX8130.initBat();
RX8130.disableIrq();
RX8130.clearIrqFlags();
}
Expand Down
8 changes: 8 additions & 0 deletions src/utils/rx8130/rx8130.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ bool RX8130_Class::begin()
return result;
}

void RX8130_Class::initBat()
{
uint8_t data = readRegister8(RX8130_REG_CTRL1);
// Enable backup battery charging
data |= 0b00110000;
writeRegister8(RX8130_REG_CTRL1, data);
}

void RX8130_Class::setTime(struct tm *time)
{
uint8_t rbuf = 0;
Expand Down
1 change: 1 addition & 0 deletions src/utils/rx8130/rx8130.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class RX8130_Class : public m5::I2C_Device {

bool begin();

void initBat();
void setTime(struct tm *time);
void getTime(struct tm *time);
void clearIrqFlags();
Expand Down