Skip to content

Commit

Permalink
update AXP2101 firmware, enable POWERON IRQ
Browse files Browse the repository at this point in the history
  • Loading branch information
916BGAI committed Nov 8, 2024
1 parent 2588dd8 commit 8ad8100
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion buildroot/package/axp2101/axp2101.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
################################################################################

AXP2101_VERSION = 1.0.0
AXP2101_VERSION = 1.1.0
AXP2101_SITE = $(TOPDIR)/package/axp2101/src
AXP2101_SITE_METHOD = local
AXP2101_CFLAGS = -Iinclude -IXPowersLib -IXPowersLib/REG -Wall -Wextra
Expand Down
4 changes: 1 addition & 3 deletions buildroot/package/axp2101/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ OBJ_O = $(patsubst %.cpp,${DIR_BIN}/%.o,$(notdir ${OBJ_C}))

TARGET = axp2101

DEBUG = -DXPOWERS_NO_ERROR

$(shell mkdir -p $(DIR_BIN))

MSG = -g -O0 -Wall
CFLAGS += $(MSG) $(DEBUG)
CFLAGS += $(MSG)

${TARGET}:${OBJ_O}
$(CXX) $(CFLAGS) $(OBJ_O) -o $@ $(LIB)
Expand Down
4 changes: 2 additions & 2 deletions buildroot/package/axp2101/src/XPowersLib/XPowersAXP2101.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public:

~XPowersAXP2101()
{
log_i("~XPowersAXP2101");
// log_i("~XPowersAXP2101");
deinit();
}

Expand Down Expand Up @@ -3045,7 +3045,7 @@ protected:
{
int res = 0;
uint8_t data = 0, value = 0;
log_d("%s - HEX:0x%x \n", enable ? "ENABLE" : "DISABLE", opts);
// log_d("%s - HEX:0x%x \n", enable ? "ENABLE" : "DISABLE", opts);
if (opts & 0x0000FF) {
value = opts & 0xFF;
// log_d("Write INT0: %x\n", value);
Expand Down
17 changes: 16 additions & 1 deletion buildroot/package/axp2101/src/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#define I2C_BUS (4)
#define AXP2101_SLAVE_ADDRESS (0x34)
#define APP_VERSION "1.1.0"

int i2c_dev = -1;
XPowersLibInterface *PMU = NULL;
Expand Down Expand Up @@ -44,6 +45,7 @@ static int set_i2c_slave(int file, int addr)
int main(int argc, char* argv[])
{
bool log_enabled = false;
bool version_enabled = false;

printf("PMU: Init axp2101 pmu\n");

Expand Down Expand Up @@ -82,8 +84,19 @@ int main(int argc, char* argv[])
std::string arg = argv[i];
if (arg == "--log" || arg == "-l") {
log_enabled = true;
break;
} else if (arg == "--version" || arg == "-v") {
version_enabled = true;
}
break;
}

if (version_enabled) {
std::cout << "version: " << APP_VERSION << std::endl;
if (PMU != nullptr) {
delete PMU;
PMU = NULL;
}
return 0;
}

if (log_enabled) {
Expand Down Expand Up @@ -223,6 +236,8 @@ int main(int argc, char* argv[])
// Set the button power-on press time
PMU->setPowerKeyPressOnTime(XPOWERS_POWERON_128MS);
PMU->enableLongPressShutdown();
PMU->enableIRQ(XPOWERS_AXP2101_PKEY_POSITIVE_IRQ);
PMU->enableIRQ(XPOWERS_AXP2101_PKEY_NEGATIVE_IRQ);

PMU->disableTSPinMeasure();
PMU->enableVbusVoltageMeasure();
Expand Down

0 comments on commit 8ad8100

Please sign in to comment.