update AXP2101 firmware, enable POWERON IRQ

This commit is contained in:
916BGAI
2024-11-08 15:10:40 +08:00
parent 2588dd8dec
commit 8ad8100af7
4 changed files with 20 additions and 7 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -234,7 +234,7 @@ public:
~XPowersAXP2101()
{
log_i("~XPowersAXP2101");
// log_i("~XPowersAXP2101");
deinit();
}
@@ -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);

View File

@@ -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;
@@ -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");
@@ -82,8 +84,19 @@ int main(int argc, char* argv[])
std::string arg = argv[i];
if (arg == "--log" || arg == "-l") {
log_enabled = true;
} 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) {
@@ -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();