Merge pull request #265 from lyusupov/ESP_PMU
Espressif port: add XPowersLib PMU component
This commit is contained in:
commit
33240b33b2
20 changed files with 8012 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
idf_component_register(SRCS boards.c board_flash.c
|
||||
INCLUDE_DIRS "." "${BOARD}"
|
||||
#PRIV_REQUIRES "driver"
|
||||
REQUIRES app_update spi_flash led_strip lcd ssd1306)
|
||||
REQUIRES app_update spi_flash led_strip lcd ssd1306 XPowersLib)
|
||||
|
||||
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
|
||||
|
||||
|
|
|
|||
6
ports/espressif/components/XPowersLib/.gitignore
vendored
Normal file
6
ports/espressif/components/XPowersLib/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.pio
|
||||
.vscode
|
||||
test
|
||||
.travis.yml
|
||||
test
|
||||
assets
|
||||
5
ports/espressif/components/XPowersLib/CMakeLists.txt
Normal file
5
ports/espressif/components/XPowersLib/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
set(src_dirs ./src)
|
||||
set(include_dirs ./src
|
||||
./src/REG)
|
||||
idf_component_register(SRC_DIRS ${src_dirs} INCLUDE_DIRS ${include_dirs})
|
||||
|
||||
47
ports/espressif/components/XPowersLib/Kconfig.projbuild
Normal file
47
ports/espressif/components/XPowersLib/Kconfig.projbuild
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
menu "XPowersLib Configuration"
|
||||
|
||||
choice PMU_Type
|
||||
prompt "XPowers chip type"
|
||||
default XPOWERS_CHIP_AXP2102 if IDF_TARGET_ESP32S3
|
||||
default XPOWERS_CHIP_AXP192 if IDF_TARGET_ESP32
|
||||
help
|
||||
Defines the default peripheral for xpowers example
|
||||
|
||||
config XPOWERS_CHIP_AXP2102
|
||||
bool "Xpowers AXP2101"
|
||||
config XPOWERS_CHIP_AXP192
|
||||
bool "Xpowers AXP192"
|
||||
endchoice
|
||||
|
||||
config I2C_MASTER_PORT_NUM
|
||||
int "PMU I2C Port Number"
|
||||
default 1
|
||||
help
|
||||
Port number for I2C Master device.
|
||||
|
||||
config I2C_MASTER_FREQUENCY
|
||||
int "Master Frequency"
|
||||
default 100000
|
||||
help
|
||||
I2C Speed of Master device.
|
||||
|
||||
config PMU_I2C_SCL
|
||||
int "PMU SCL GPIO Num"
|
||||
default 41
|
||||
help
|
||||
GPIO number for I2C PMU clock line.
|
||||
|
||||
config PMU_I2C_SDA
|
||||
int "PMU SDA GPIO Num"
|
||||
default 42
|
||||
help
|
||||
GPIO number for I2C PMU data line.
|
||||
|
||||
config PMU_INTERRUPT_PIN
|
||||
int "PMU Interrupt Pin"
|
||||
default 40
|
||||
help
|
||||
PMU interrupt pin.
|
||||
|
||||
|
||||
endmenu
|
||||
21
ports/espressif/components/XPowersLib/LICENSE
Normal file
21
ports/espressif/components/XPowersLib/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 lewis he
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
63
ports/espressif/components/XPowersLib/README.md
Normal file
63
ports/espressif/components/XPowersLib/README.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
|
||||
|
||||
```
|
||||
__ __ _____ _ _ _
|
||||
\ \ / / | __ \ | | (_) |
|
||||
\ V /_____| |__) |____ _____ _ __ ___| | _| |__
|
||||
> <______| ___/ _ \ \ /\ / / _ \ '__/ __| | | | '_ \
|
||||
/ . \ | | | (_) \ V V / __/ | \__ \ |____| | |_) |
|
||||
/_/ \_\ |_| \___/ \_/\_/ \___|_| |___/______|_|_.__/
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
🎉 LilyGo invests time and resources to provide this open source code, please support LilyGo
|
||||
and open source hardware by purchasing products from LilyGo!
|
||||
Written by Lewis He for LilyGo. MIT license, all text above must be included in
|
||||
any redistribution
|
||||
```
|
||||
|
||||
# ❗️❗️❗️ WARN:
|
||||
|
||||
```
|
||||
⚠️ Please do not run the example without knowing the external load voltage of the PMU,
|
||||
it may burn your external load,please check the voltage setting before running the example,
|
||||
if there is any loss,please bear it by yourself
|
||||
```
|
||||
|
||||
|
||||
✨ Library specially written for XPowers, supporting **CircuitPython**, **Micropython**, **Arduino**, **ESP-IDF**
|
||||
|
||||
✨ Through esp32,esp32s3 verification,other platforms have not been tested. Due to the many functions of the chip,it cannot be verified one by one.
|
||||
|
||||
✨ At present, other XPowers models except AXP2101 have been discontinued and are not supported for the time being
|
||||
|
||||
# Chip Resource List
|
||||
|
||||
| CHIP | AXP192 | AXP2101 | Remarks |
|
||||
| ---------- | ----------------- | -------------------------------------- | ---------------- |
|
||||
| DC1 | 0.7V-3.5V /1.2A | 1.5-3.4V /2A | |
|
||||
| DC2 | 0.7-2.275V /1.6A | 0.5-1.2V,1.22-1.54V /2A | |
|
||||
| DC3 | 0.7-3.5V /0.7A | 0.5-1.2V,1.22-1.54V,1.6-3.4V /2A | |
|
||||
| DC4 | x | 0.5-1.2V,1.22-1.84V /1.5A | |
|
||||
| DC5 | x | 1.2V,1.4-3.7V /1A | |
|
||||
| LDO1(VRTC) | 3.3V /30mA | 1.8V /30mA | |
|
||||
| LDO2 | 1.8V-3.3V /200mA | x | |
|
||||
| LDO3 | 1.8-3.3V /200mA | x | |
|
||||
| LDO4 | X | x | |
|
||||
| LDO5/IO0 | 1.8-3.3V /50mA | x | |
|
||||
| ALDO1 | x | 0.5-3.5V /300mA | |
|
||||
| ALDO2 | x | 0.5-3.5V /300mA | |
|
||||
| ALDO3 | x | 0.5-3.5V /300mA | |
|
||||
| ALDO4 | x | 0.5-3.5V /300mA | |
|
||||
| BLDO1 | x | 0.5-3.5V /300mA | |
|
||||
| BLDO2 | x | 0.5-3.5V /300mA | |
|
||||
| DLDO1 | x | 0.5-3.3V/ 0.5-1.4V /300mA | |
|
||||
| DLDO1 | x | 0.5-3.3V/ 0.5-1.4V /300mA | |
|
||||
| CPUSLDO | x | 0.5-1.4V /30mA | Dependent on DC4 |
|
||||
|
||||
|
||||
# AXP2101 Notes:
|
||||
* Whether DLDO1/DLDO2/RTCLDO2/GPIO1 can be used depends on the chip. It is not available by default. RTCLDO1 has a default voltage, which is generally 1.8V by default. The voltage value cannot be changed or turned off through the register.
|
||||
756
ports/espressif/components/XPowersLib/keywords.txt
Normal file
756
ports/espressif/components/XPowersLib/keywords.txt
Normal file
|
|
@ -0,0 +1,756 @@
|
|||
#######################################
|
||||
# Syntax Coloring Map For XPowersLib By lewis He
|
||||
# github:https://github.com/lewisxhe
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
# Datatypes (KEYWORD1)
|
||||
#######################################
|
||||
XPowersPMU KEYWORD1
|
||||
XPowersAXP192 KEYWORD1
|
||||
XPowersAXP202 KEYWORD1
|
||||
XPowersAXP2101 KEYWORD1
|
||||
PMU KEYWORD1
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
# AXP192
|
||||
begin KEYWORD2
|
||||
isAcinVbusStart KEYWORD2
|
||||
isDischarge KEYWORD2
|
||||
isVbusIn KEYWORD2
|
||||
isAcinEfficient KEYWORD2
|
||||
isAcinIn KEYWORD2
|
||||
isVbusGood KEYWORD2
|
||||
isOverTemperature KEYWORD2
|
||||
isCharging KEYWORD2
|
||||
isBatteryConnect KEYWORD2
|
||||
isBattInActiveMode KEYWORD2
|
||||
isChargeCurrLessPreset KEYWORD2
|
||||
getBatfetState KEYWORD2
|
||||
enableVbusVoltageLimit KEYWORD2
|
||||
disableVbusVoltageLimit KEYWORD2
|
||||
setVbusVoltageLimit KEYWORD2
|
||||
enableVbusCurrLimit KEYWORD2
|
||||
disableVbusCurrLimit KEYWORD2
|
||||
setVbusCurrentLimit KEYWORD2
|
||||
setMinSystemVoltage KEYWORD2
|
||||
getMinSystemVoltage KEYWORD2
|
||||
shutdown KEYWORD2
|
||||
enableCharge KEYWORD2
|
||||
disableCharge KEYWORD2
|
||||
setChargerVoltageLimit KEYWORD2
|
||||
getChargerVoltageLimit KEYWORD2
|
||||
setChargeCurrent KEYWORD2
|
||||
getChargeCurrent KEYWORD2
|
||||
setChargerTerminationCurr KEYWORD2
|
||||
getChargerTerminationCurr KEYWORD2
|
||||
setChargerConstantCurr KEYWORD2
|
||||
getChargerConstantCurr KEYWORD2
|
||||
setPrechargeTimeout KEYWORD2
|
||||
setChargerExternChannelCurr KEYWORD2
|
||||
enableChargerExternChannel KEYWORD2
|
||||
disableChargerExternChannel KEYWORD2
|
||||
setChargerConstantTimeout KEYWORD2
|
||||
enableBackupBattCharger KEYWORD2
|
||||
disableBackupBattCharger KEYWORD2
|
||||
setBackupBattChargerVoltage KEYWORD2
|
||||
setBackupBattChargerCurr KEYWORD2
|
||||
getTemperature KEYWORD2
|
||||
enableTemperatureMeasure KEYWORD2
|
||||
disableTemperatureMeasure KEYWORD2
|
||||
isEnableLDOio KEYWORD2
|
||||
enableLDOio KEYWORD2
|
||||
disableLDOio KEYWORD2
|
||||
setLDOioVoltage KEYWORD2
|
||||
getLDOioVoltage KEYWORD2
|
||||
isEnableLDO2 KEYWORD2
|
||||
enableLDO2 KEYWORD2
|
||||
disableLDO2 KEYWORD2
|
||||
setLDO2Voltage KEYWORD2
|
||||
getLDO2Voltage KEYWORD2
|
||||
isEnableLDO3 KEYWORD2
|
||||
enableLDO3 KEYWORD2
|
||||
disableLDO3 KEYWORD2
|
||||
setLDO3Voltage KEYWORD2
|
||||
getLDO3Voltage KEYWORD2
|
||||
setDC1PwmMode KEYWORD2
|
||||
setDC1AutoMode KEYWORD2
|
||||
isEnableDC1 KEYWORD2
|
||||
enableDC1 KEYWORD2
|
||||
disableDC1 KEYWORD2
|
||||
setDC1Voltage KEYWORD2
|
||||
getDC1Voltage KEYWORD2
|
||||
setDC2PwmMode KEYWORD2
|
||||
setDC2AutoMode KEYWORD2
|
||||
enableDC2VRC KEYWORD2
|
||||
disableDC2VRC KEYWORD2
|
||||
setDC2VRC KEYWORD2
|
||||
isEanbleDC2VRC KEYWORD2
|
||||
isEnableDC2 KEYWORD2
|
||||
enableDC2 KEYWORD2
|
||||
disableDC2 KEYWORD2
|
||||
setDC2Voltage KEYWORD2
|
||||
getDC2Voltage KEYWORD2
|
||||
setDC3PwmMode KEYWORD2
|
||||
setDC3AutoMode KEYWORD2
|
||||
isEnableDC3 KEYWORD2
|
||||
enableDC3 KEYWORD2
|
||||
disableDC3 KEYWORD2
|
||||
setDC3Voltage KEYWORD2
|
||||
getDC3Voltage KEYWORD2
|
||||
enableExternalPin KEYWORD2
|
||||
disableExternalPin KEYWORD2
|
||||
isEnableExternalPin KEYWORD2
|
||||
getIrqStatus KEYWORD2
|
||||
clearIrqStatus KEYWORD2
|
||||
enableIRQ KEYWORD2
|
||||
disableIRQ KEYWORD2
|
||||
isAcinOverVoltageIrq KEYWORD2
|
||||
isAcinInserIrq KEYWORD2
|
||||
isAcinRemoveIrq KEYWORD2
|
||||
isVbusOverVoltageIrq KEYWORD2
|
||||
isVbusInsertIrq KEYWORD2
|
||||
isVbusRemoveIrq KEYWORD2
|
||||
isVbusLowVholdIrq KEYWORD2
|
||||
isBatInsertIrq KEYWORD2
|
||||
isBatRemoveIrq KEYWORD2
|
||||
isBattEnterActivateIrq KEYWORD2
|
||||
isBattExitActivateIrq KEYWORD2
|
||||
isBatChagerStartIrq KEYWORD2
|
||||
isBatChagerDoneIrq KEYWORD2
|
||||
isBattTempHighIrq KEYWORD2
|
||||
isBattTempLowIrq KEYWORD2
|
||||
isChipOverTemperatureIrq KEYWORD2
|
||||
isChargingCurrentLessIrq KEYWORD2
|
||||
isDC1VoltageLessIrq KEYWORD2
|
||||
isDC2VoltageLessIrq KEYWORD2
|
||||
isDC3VoltageLessIrq KEYWORD2
|
||||
isPekeyShortPressIrq KEYWORD2
|
||||
isPekeyLongPressIrq KEYWORD2
|
||||
isNOEPowerOnIrq KEYWORD2
|
||||
isNOEPowerDownIrq KEYWORD2
|
||||
isVbusEffectiveIrq KEYWORD2
|
||||
isVbusInvalidIrq KEYWORD2
|
||||
isVbusSessionIrq KEYWORD2
|
||||
isVbusSessionEndIrq KEYWORD2
|
||||
isLowVoltageLevel2Irq KEYWORD2
|
||||
isWdtExpireIrq KEYWORD2
|
||||
isGpio2EdgeTriggerIrq KEYWORD2
|
||||
isGpio1EdgeTriggerIrq KEYWORD2
|
||||
isGpio0EdgeTriggerIrq KEYWORD2
|
||||
enableBattDetection KEYWORD2
|
||||
disableBattDetection KEYWORD2
|
||||
enableVbusVoltageMeasure KEYWORD2
|
||||
disableVbusVoltageMeasure KEYWORD2
|
||||
enableBattVoltageMeasure KEYWORD2
|
||||
disableBattVoltageMeasure KEYWORD2
|
||||
enableSystemVoltageMeasure KEYWORD2
|
||||
disableSystemVoltageMeasure KEYWORD2
|
||||
enableTSPinMeasure KEYWORD2
|
||||
disableTSPinMeasure KEYWORD2
|
||||
enableAdcChannel KEYWORD2
|
||||
disableAdcChannel KEYWORD2
|
||||
getVbusVoltage KEYWORD2
|
||||
getVbusCurrent KEYWORD2
|
||||
getBattVoltage KEYWORD2
|
||||
getBattDischargeCurrent KEYWORD2
|
||||
getAcinVoltage KEYWORD2
|
||||
getAcinCurrent KEYWORD2
|
||||
getSystemVoltage KEYWORD2
|
||||
setTimerout KEYWORD2
|
||||
disableTimer KEYWORD2
|
||||
clearTimerFlag KEYWORD2
|
||||
writeDataBuffer KEYWORD2
|
||||
readDataBuffer KEYWORD2
|
||||
setChargingLedMode KEYWORD2
|
||||
setChargingLedFreq KEYWORD2
|
||||
enableCoulomb KEYWORD2
|
||||
disableCoulomb KEYWORD2
|
||||
stopCoulomb KEYWORD2
|
||||
clearCoulomb KEYWORD2
|
||||
getBattChargeCoulomb KEYWORD2
|
||||
getBattDischargeCoulomb KEYWORD2
|
||||
getAdcSamplingRate KEYWORD2
|
||||
getCoulombData KEYWORD2
|
||||
getBatteryChargeCurrent KEYWORD2
|
||||
getGpio0Voltage KEYWORD2
|
||||
getGpio1Voltage KEYWORD2
|
||||
pwmSetup KEYWORD2
|
||||
pwmEnable KEYWORD2
|
||||
getBatteryPercent KEYWORD2
|
||||
getChipID KEYWORD2
|
||||
pinMode KEYWORD2
|
||||
digitalRead KEYWORD2
|
||||
digitalWrite KEYWORD2
|
||||
analogRead KEYWORD2
|
||||
enableSleep KEYWORD2
|
||||
setPowerKeyPressOnTime KEYWORD2
|
||||
getPowerKeyPressOnTime KEYWORD2
|
||||
setPowerKeyPressOffTime KEYWORD2
|
||||
getPowerKeyPressOffTime KEYWORD2
|
||||
setPowerKeyLongPressOnTime KEYWORD2
|
||||
enablePowerKeyLongPressPowerOff KEYWORD2
|
||||
disablePowerKeyLongPressPowerOff KEYWORD2
|
||||
|
||||
|
||||
# AXP2102
|
||||
isBatInActiveModeState KEYWORD2
|
||||
getThermalRegulationStatus KEYWORD2
|
||||
getCurrnetLimitStatus KEYWORD2
|
||||
isStandby KEYWORD2
|
||||
isPowerOn KEYWORD2
|
||||
isPowerOff KEYWORD2
|
||||
getChargerStatus KEYWORD2
|
||||
enableInternalDischarge KEYWORD2
|
||||
disableInternalDischarge KEYWORD2
|
||||
enablePwrOkPinPullLow KEYWORD2
|
||||
disablePwrOkPinPullLow KEYWORD2
|
||||
enablePwronShutPMIC KEYWORD2
|
||||
disablePwronShutPMIC KEYWORD2
|
||||
resetPmuSocSystem KEYWORD2
|
||||
softPowerOff KEYWORD2
|
||||
setBatfetDieOverTempLevel1 KEYWORD2
|
||||
getBatfetDieOverTempLevel1 KEYWORD2
|
||||
enableBatfetDieOverTempDetect KEYWORD2
|
||||
disableBatfetDieOverTempDetect KEYWORD2
|
||||
setDieOverTempLevel1 KEYWORD2
|
||||
getDieOverTempLevel1 KEYWORD2
|
||||
enableDieOverTempDetect KEYWORD2
|
||||
disableDieOverTempDetect KEYWORD2
|
||||
getVbusVoltageLimit KEYWORD2
|
||||
getVinCurrentLimit KEYWORD2
|
||||
resetGauge KEYWORD2
|
||||
resetGaugeBesides KEYWORD2
|
||||
enableGauge KEYWORD2
|
||||
disableGauge KEYWORD2
|
||||
enableButtonBatteryCharge KEYWORD2
|
||||
disableButtonBatteryCharge KEYWORD2
|
||||
enableCellbatteryCharge KEYWORD2
|
||||
disableCellbatteryCharge KEYWORD2
|
||||
enableWatchdog KEYWORD2
|
||||
disableWatchdog KEYWORD2
|
||||
setWatchdogConfig KEYWORD2
|
||||
getWatchConfig KEYWORD2
|
||||
clrWatchdog KEYWORD2
|
||||
setWatchdogTimeout KEYWORD2
|
||||
getWatchdogTimerout KEYWORD2
|
||||
setLowBatWarnThreshold KEYWORD2
|
||||
getLowBatWarnThreshold KEYWORD2
|
||||
setLowBatShutdownThreshold KEYWORD2
|
||||
getLowBatShutdownThreshold KEYWORD2
|
||||
enablePoweronAlwaysHighSource KEYWORD2
|
||||
disablePoweronAlwaysHighSource KEYWORD2
|
||||
enableBattInsertOnSource KEYWORD2
|
||||
disableBattInsertOnSource KEYWORD2
|
||||
enableBattNormalOnSource KEYWORD2
|
||||
disableBattNormalOnSource KEYWORD2
|
||||
enableVbusInsertOnSource KEYWORD2
|
||||
disableVbusInsertOnSource KEYWORD2
|
||||
enableIrqLowOnSource KEYWORD2
|
||||
disableIrqLowOnSource KEYWORD2
|
||||
enablePwronLowOnSource KEYWORD2
|
||||
disablePwronLowOnSource KEYWORD2
|
||||
enableOverTemperatureOffSource KEYWORD2
|
||||
disableOverTemperatureOffSource KEYWORD2
|
||||
enableDcOverVoltageOffSource KEYWORD2
|
||||
disableDcOverVoltageOffSource KEYWORD2
|
||||
enableDcUnderVoltageOffSource KEYWORD2
|
||||
disableDcUnderVoltageOffSource KEYWORD2
|
||||
enableVbusOverVoltageOffSource KEYWORD2
|
||||
disableVbusOverVoltageOffSource KEYWORD2
|
||||
enableVsysUnderVoltageOffSource KEYWORD2
|
||||
disableVsysUnderVoltageOffSource KEYWORD2
|
||||
enablePwronAlwaysLowOffSource KEYWORD2
|
||||
disablePwronAlwaysLowOffSource KEYWORD2
|
||||
enableSwConfigOffSource KEYWORD2
|
||||
disableSwConfigOffSource KEYWORD2
|
||||
enablePwrSourcePullDown KEYWORD2
|
||||
disablePwrSourcePullDown KEYWORD2
|
||||
enableOverTemperatureLevel2PowerOff KEYWORD2
|
||||
disableOverTemperaturePowerOff KEYWORD2
|
||||
enablePwrOnOverVolOffLevelPowerOff KEYWORD2
|
||||
disablePwrOnOverVolOffLevelPowerOff KEYWORD2
|
||||
enablePwrOffSelectFunction KEYWORD2
|
||||
disablePwrOffSelectFunction KEYWORD2
|
||||
enableDCHighVoltageTurnOff KEYWORD2
|
||||
disableDCHighVoltageTurnOff KEYWORD2
|
||||
enableDC5LowVoltageTurnOff KEYWORD2
|
||||
disableDC5LowVoltageTurnOff KEYWORD2
|
||||
enableDC4LowVoltageTurnOff KEYWORD2
|
||||
disableDC4LowVoltageTurnOff KEYWORD2
|
||||
enableDC3LowVoltageTurnOff KEYWORD2
|
||||
disableDC3LowVoltageTurnOff KEYWORD2
|
||||
enableDC2LowVoltageTurnOff KEYWORD2
|
||||
disableDC2LowVoltageTurnOff KEYWORD2
|
||||
enableDC1LowVoltageTurnOff KEYWORD2
|
||||
disableDC1LowVoltageTurnOff KEYWORD2
|
||||
setVsysPowerOffThreshold KEYWORD2
|
||||
getVsysPowerOffThreshold KEYWORD2
|
||||
wakeupControl KEYWORD2
|
||||
enableWakeup KEYWORD2
|
||||
disableWakeup KEYWORD2
|
||||
disableSleep KEYWORD2
|
||||
setIrqLevel KEYWORD2
|
||||
setOffLevel KEYWORD2
|
||||
setOnLevel KEYWORD2
|
||||
setDc4FastStartSequence KEYWORD2
|
||||
setDc3FastStartSequence KEYWORD2
|
||||
setDc2FastStartSequence KEYWORD2
|
||||
setDc1FastStartSequence KEYWORD2
|
||||
setAldo3FastStartSequence KEYWORD2
|
||||
setAldo2FastStartSequence KEYWORD2
|
||||
setAldo1FastStartSequence KEYWORD2
|
||||
setDc5FastStartSequence KEYWORD2
|
||||
setCpuldoFastStartSequence KEYWORD2
|
||||
setBldo2FastStartSequence KEYWORD2
|
||||
setBldo1FastStartSequence KEYWORD2
|
||||
setAldo4FastStartSequence KEYWORD2
|
||||
setDldo2FastStartSequence KEYWORD2
|
||||
setDldo1FastStartSequence KEYWORD2
|
||||
setFastPowerOnLevel KEYWORD2
|
||||
enableFastPowerOn KEYWORD2
|
||||
disableFastPowerOn KEYWORD2
|
||||
enableFastWakeup KEYWORD2
|
||||
disableFastWakeup KEYWORD2
|
||||
setDCHighVoltagePowerDowm KEYWORD2
|
||||
getDCHighVoltagePowerDowmEn KEYWORD2
|
||||
isEnableDC1 KEYWORD2
|
||||
enableDC1 KEYWORD2
|
||||
disableDC1 KEYWORD2
|
||||
getDC1WorkMode KEYWORD2
|
||||
setDC1LowVoltagePowerDowm KEYWORD2
|
||||
getDC1LowVoltagePowerDowmEn KEYWORD2
|
||||
getDC2WorkMode KEYWORD2
|
||||
setDC2LowVoltagePowerDowm KEYWORD2
|
||||
getDC2LowVoltagePowerDowmEn KEYWORD2
|
||||
getDC3WorkMode KEYWORD2
|
||||
setDC3LowVoltagePowerDowm KEYWORD2
|
||||
getDC3LowVoltagePowerDowmEn KEYWORD2
|
||||
isEnableDC4 KEYWORD2
|
||||
enableDC4 KEYWORD2
|
||||
disableDC4 KEYWORD2
|
||||
setDC4Voltage KEYWORD2
|
||||
getDC4Voltage KEYWORD2
|
||||
setDC4LowVoltagePowerDowm KEYWORD2
|
||||
getDC4LowVoltagePowerDowmEn KEYWORD2
|
||||
isEnableDC5 KEYWORD2
|
||||
enableDC5 KEYWORD2
|
||||
disableDC5 KEYWORD2
|
||||
setDC5Voltage KEYWORD2
|
||||
getDC5Voltage KEYWORD2
|
||||
isDC5FreqCompensationEn KEYWORD2
|
||||
enableDC5FreqCompensation KEYWORD2
|
||||
disableFreqCompensation KEYWORD2
|
||||
setDC5LowVoltagePowerDowm KEYWORD2
|
||||
getDC5LowVoltagePowerDowmEn KEYWORD2
|
||||
isEnableALDO1 KEYWORD2
|
||||
enableALDO1 KEYWORD2
|
||||
disableALDO1 KEYWORD2
|
||||
setALDO1Voltage KEYWORD2
|
||||
getALDO1Voltage KEYWORD2
|
||||
isEnableALDO2 KEYWORD2
|
||||
enableALDO2 KEYWORD2
|
||||
disableALDO2 KEYWORD2
|
||||
setALDO2Voltage KEYWORD2
|
||||
getALDO2Voltage KEYWORD2
|
||||
isEnableALDO3 KEYWORD2
|
||||
enableALDO3 KEYWORD2
|
||||
disableALDO3 KEYWORD2
|
||||
setALDO3Voltage KEYWORD2
|
||||
getALDO3Voltage KEYWORD2
|
||||
isEnableALDO4 KEYWORD2
|
||||
enableALDO4 KEYWORD2
|
||||
disableALDO4 KEYWORD2
|
||||
setALDO4Voltage KEYWORD2
|
||||
getALDO4Voltage KEYWORD2
|
||||
isEnableBLDO1 KEYWORD2
|
||||
enableBLDO1 KEYWORD2
|
||||
disableBLDO1 KEYWORD2
|
||||
setBLDO1Voltage KEYWORD2
|
||||
getBLDO1Voltage KEYWORD2
|
||||
isEnableBLDO2 KEYWORD2
|
||||
enableBLDO2 KEYWORD2
|
||||
disableBLDO2 KEYWORD2
|
||||
setBLDO2Voltage KEYWORD2
|
||||
getBLDO2Voltage KEYWORD2
|
||||
isEnableCPUSLDO KEYWORD2
|
||||
enableCPUSLDO KEYWORD2
|
||||
disableCPUSLDO KEYWORD2
|
||||
setCPUSLDOVoltage KEYWORD2
|
||||
getCPUSLDOVoltage KEYWORD2
|
||||
isEnableDLDO1 KEYWORD2
|
||||
enableDLDO1 KEYWORD2
|
||||
disableDLDO1 KEYWORD2
|
||||
setDLDO1Voltage KEYWORD2
|
||||
getDLDO1Voltage KEYWORD2
|
||||
isEnableDLDO2 KEYWORD2
|
||||
enableDLDO2 KEYWORD2
|
||||
disableDLDO2 KEYWORD2
|
||||
setDLDO2Voltage KEYWORD2
|
||||
getDLDO2Voltage KEYWORD2
|
||||
setIrqLevelTime KEYWORD2
|
||||
getIrqLevelTime KEYWORD2
|
||||
setPowerKeyPressOffTime KEYWORD2
|
||||
getPowerKeyPressOffTime KEYWORD2
|
||||
setPowerKeyPressOnTime KEYWORD2
|
||||
getPowerKeyPressOnTime KEYWORD2
|
||||
enableGeneralAdcChannel KEYWORD2
|
||||
disableGeneralAdcChannel KEYWORD2
|
||||
enableTemperatureMeasure KEYWORD2
|
||||
disableTemperatureMeasure KEYWORD2
|
||||
getTemperature KEYWORD2
|
||||
enableSystemVoltageMeasure KEYWORD2
|
||||
disableSystemVoltageMeasure KEYWORD2
|
||||
getSystemVoltage KEYWORD2
|
||||
enableVbusVoltageMeasure KEYWORD2
|
||||
disableVbusVoltageMeasure KEYWORD2
|
||||
getVbusVoltage KEYWORD2
|
||||
enableTSPinMeasure KEYWORD2
|
||||
disableTSPinMeasure KEYWORD2
|
||||
enableTSPinLowFreqSample KEYWORD2
|
||||
disableTSPinLowFreqSample KEYWORD2
|
||||
getTsTemperature KEYWORD2
|
||||
enableBattVoltageMeasure KEYWORD2
|
||||
disableBattVoltageMeasure KEYWORD2
|
||||
enableBattDetection KEYWORD2
|
||||
disableBattDetection KEYWORD2
|
||||
getBattVoltage KEYWORD2
|
||||
getBatteryPercent KEYWORD2
|
||||
setChargingLedMode KEYWORD2
|
||||
getChargingLedMode KEYWORD2
|
||||
setButtonBatteryChargeVoltage KEYWORD2
|
||||
setPrechargeCurr KEYWORD2
|
||||
getPrechargeCurr KEYWORD2
|
||||
setChargerConstantCurr KEYWORD2
|
||||
getChargerConstantCurr KEYWORD2
|
||||
setChargerTerminationCurr KEYWORD2
|
||||
getChargerTerminationCurr KEYWORD2
|
||||
enableChargerTerminationLimit KEYWORD2
|
||||
disableChargerTerminationLimit KEYWORD2
|
||||
isChargerTerminationLimit KEYWORD2
|
||||
setChargeTargetVoltage KEYWORD2
|
||||
getChargeTargetVoltage KEYWORD2
|
||||
setThermaThreshold KEYWORD2
|
||||
getThermaThreshold KEYWORD2
|
||||
getBatteryParameter KEYWORD2
|
||||
isDropWarningLevel2Irq KEYWORD2
|
||||
isDropWarningLevel1Irq KEYWORD2
|
||||
isGaugeWdtTimeoutIrq KEYWORD2
|
||||
isBatChargerOverTemperatureIrq KEYWORD2
|
||||
isBatChargerUnderTemperatureIrq KEYWORD2
|
||||
isBatWorkOverTemperatureIrq KEYWORD2
|
||||
isBatWorkUnderTemperatureIrq KEYWORD2
|
||||
isPekeyNegativeIrq KEYWORD2
|
||||
isPekeyPositiveIrq KEYWORD2
|
||||
isLdoOverCurrentIrq KEYWORD2
|
||||
isBatfetOverCurrentIrq KEYWORD2
|
||||
isBatDieOverTemperatureIrq KEYWORD2
|
||||
isChagerOverTimeoutIrq KEYWORD2
|
||||
isBatOverVoltageIrq KEYWORD2
|
||||
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
||||
|
||||
XPOWERS_BAT_NOR_UNDER_TEMP_IRQ LITERAL1
|
||||
XPOWERS_BAT_NOR_OVER_TEMP_IRQ LITERAL1
|
||||
XPOWERS_BAT_CHG_UNDER_TEMP_IRQ LITERAL1
|
||||
XPOWERS_BAT_CHG_OVER_TEMP_IRQ LITERAL1
|
||||
XPOWERS_GAUGE_NEW_SOC_IRQ LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_IRQ LITERAL1
|
||||
XPOWERS_WARNING_LEVEL1_IRQ LITERAL1
|
||||
XPOWERS_WARNING_LEVEL2_IRQ LITERAL1
|
||||
XPOWERS_PKEY_POSITIVE_IRQ LITERAL1
|
||||
XPOWERS_PKEY_NEGATIVE_IRQ LITERAL1
|
||||
XPOWERS_PKEY_LONG_IRQ LITERAL1
|
||||
XPOWERS_PKEY_SHORT_IRQ LITERAL1
|
||||
XPOWERS_BAT_REMOVE_IRQ LITERAL1
|
||||
XPOWERS_BAT_INSERT_IRQ LITERAL1
|
||||
XPOWERS_VBUS_REMOVE_IRQ LITERAL1
|
||||
XPOWERS_VBUS_INSERT_IRQ LITERAL1
|
||||
XPOWERS_BAT_OVER_VOL_IRQ LITERAL1
|
||||
XPOWERS_CHAGER_TIMER_IRQ LITERAL1
|
||||
XPOWERS_DIE_OVER_TEMP_IRQ LITERAL1
|
||||
XPOWERS_BAT_CHG_START_IRQ LITERAL1
|
||||
XPOWERS_BAT_CHG_DONE_IRQ LITERAL1
|
||||
XPOWERS_BATFET_OVER_CURR_IRQ LITERAL1
|
||||
XPOWERS_LDO_OVER_CURR_IRQ LITERAL1
|
||||
XPOWERS_WDT_EXPIRE_IRQ LITERAL1
|
||||
XPOWERS_ALL_IRQ LITERAL1
|
||||
|
||||
XPOWERS_VBUS_VHOLD_LOW_IRQ LITERAL1
|
||||
XPOWERS_VBUS_OVER_VOL_IRQ LITERAL1
|
||||
XPOWERS_ACIN_REMOVED_IRQ LITERAL1
|
||||
XPOWERS_ACIN_CONNECT_IRQ LITERAL1
|
||||
XPOWERS_ACIN_OVER_VOL_IRQ LITERAL1
|
||||
XPOWERS_BATT_LOW_TEMP_IRQ LITERAL1
|
||||
XPOWERS_BATT_OVER_TEMP_IRQ LITERAL1
|
||||
XPOWERS_BATT_EXIT_ACTIVATE_IRQ LITERAL1
|
||||
XPOWERS_BATT_ACTIVATE_IRQ LITERAL1
|
||||
XPOWERS_DC3_LOW_VOL_IRQ LITERAL1
|
||||
XPOWERS_DC2_LOW_VOL_IRQ LITERAL1
|
||||
XPOWERS_DC1_LOW_VOL_IRQ LITERAL1
|
||||
XPOWERS_CHARGE_LOW_CUR_IRQ LITERAL1
|
||||
XPOWERS_CHIP_TEMP_HIGH_IRQ LITERAL1
|
||||
XPOWERS_APS_LOW_VOL_LEVEL_IRQ LITERAL1
|
||||
XPOWERS_VBUS_SESSION_END_IRQ LITERAL1
|
||||
XPOWERS_VBUS_SESSION_AB_IRQ LITERAL1
|
||||
XPOWERS_VBUS_INVALID_IRQ LITERAL1
|
||||
XPOWERS_VBUS_VAILD_IRQ LITERAL1
|
||||
XPOWERS_NOE_OFF_IRQ LITERAL1
|
||||
XPOWERS_NOE_ON_IRQ LITERAL1
|
||||
XPOWERS_GPIO0_EDGE_TRIGGER_IRQ LITERAL1
|
||||
XPOWERS_GPIO1_EDGE_TRIGGER_IRQ LITERAL1
|
||||
XPOWERS_GPIO2_EDGE_TRIGGER_IRQ LITERAL1
|
||||
XPOWERS_TIMER_TIMEOUT_IRQ LITERAL1
|
||||
XPOWERS_ALL_IRQ LITERAL1
|
||||
XPOWERS_CHIP_AXP192 LITERAL1
|
||||
XPOWERS_CHIP_AXP202 LITERAL1
|
||||
XPOWERS_CHIP_AXP2102 LITERAL1
|
||||
|
||||
|
||||
# AXP2102
|
||||
|
||||
XPOWERS_IRQ_TIME_1S LITERAL1
|
||||
XPOWERS_IRQ_TIME_1S5 LITERAL1
|
||||
XPOWERS_IRQ_TIME_2S LITERAL1
|
||||
XPOWERS_PRESSOFF_2S5 LITERAL1
|
||||
XPOWERS_POWEROFF_4S LITERAL1
|
||||
XPOWERS_POWEROFF_6S LITERAL1
|
||||
XPOWERS_POWEROFF_8S LITERAL1
|
||||
XPOWERS_POWEROFF_10S LITERAL1
|
||||
XPOWERS_POWERON_128MS LITERAL1
|
||||
XPOWERS_POWERON_512MS LITERAL1
|
||||
XPOWERS_POWERON_1S LITERAL1
|
||||
XPOWERS_POWERON_2S LITERAL1
|
||||
XPOWERS_CHG_LED_FRE_0HZ LITERAL1
|
||||
XPOWERS_CHG_LED_FRE_1HZ LITERAL1
|
||||
XPOWERS_CHG_LED_FRE_4HZ LITERAL1
|
||||
XPOWERS_CHG_LED_DISABLE LITERAL1
|
||||
XPOWERS_PRECHARGE_0MA LITERAL1
|
||||
XPOWERS_PRECHARGE_25MA LITERAL1
|
||||
XPOWERS_PRECHARGE_50MA LITERAL1
|
||||
XPOWERS_PRECHARGE_75MA LITERAL1
|
||||
XPOWERS_PRECHARGE_100MA LITERAL1
|
||||
XPOWERS_PRECHARGE_125MA LITERAL1
|
||||
XPOWERS_PRECHARGE_150MA LITERAL1
|
||||
XPOWERS_PRECHARGE_175MA LITERAL1
|
||||
XPOWERS_PRECHARGE_200MA LITERAL1
|
||||
XPOWERS_ICC_CHG_0MA LITERAL1
|
||||
XPOWERS_ICC_CHG_100MA LITERAL1
|
||||
XPOWERS_ICC_CHG_125MA LITERAL1
|
||||
XPOWERS_ICC_CHG_150MA LITERAL1
|
||||
XPOWERS_ICC_CHG_175MA LITERAL1
|
||||
XPOWERS_ICC_CHG_200MA LITERAL1
|
||||
XPOWERS_ICC_CHG_300MA LITERAL1
|
||||
XPOWERS_ICC_CHG_400MA LITERAL1
|
||||
XPOWERS_ICC_CHG_500MA LITERAL1
|
||||
XPOWERS_ICC_CHG_600MA LITERAL1
|
||||
XPOWERS_ICC_CHG_700MA LITERAL1
|
||||
XPOWERS_ICC_CHG_800MA LITERAL1
|
||||
XPOWERS_ICC_CHG_900MA LITERAL1
|
||||
XPOWERS_ICC_CHG_1000MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_0MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_25MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_50MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_75MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_100MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_125MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_150MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_175MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_200MA LITERAL1
|
||||
XPOWERS_CHG_VOL_4V LITERAL1
|
||||
XPOWERS_CHG_VOL_4V1 LITERAL1
|
||||
XPOWERS_CHG_VOL_4V2 LITERAL1
|
||||
XPOWERS_CHG_VOL_4V35 LITERAL1
|
||||
XPOWERS_CHG_VOL_4V4 LITERAL1
|
||||
XPOWERS_THREMAL_60DEG LITERAL1
|
||||
XPOWERS_THREMAL_80DEG LITERAL1
|
||||
XPOWERS_THREMAL_100DEG LITERAL1
|
||||
XPOWERS_THREMAL_120DEG LITERAL1
|
||||
XPOWERS_CHG_TRI_STATE LITERAL1
|
||||
XPOWERS_CHG_PRE_STATE LITERAL1
|
||||
XPOWERS_CHG_CC_STATE LITERAL1
|
||||
XPOWERS_CHG_CV_STATE LITERAL1
|
||||
XPOWERS_CHG_DONE_STATE LITERAL1
|
||||
XPOWERS_CHG_STOP_STATE LITERAL1
|
||||
XPOWERS_WAKEUP_IRQ_PIN_TO_LOW LITERAL1
|
||||
XPOWERS_WAKEUP_PWROK_TO_LOW LITERAL1
|
||||
XPOWERS_WAKEUP_DC_DLO_SELECT LITERAL1
|
||||
XPOWERS_FAST_DCDC1 LITERAL1
|
||||
XPOWERS_FAST_DCDC2 LITERAL1
|
||||
XPOWERS_FAST_DCDC3 LITERAL1
|
||||
XPOWERS_FAST_DCDC4 LITERAL1
|
||||
XPOWERS_FAST_DCDC5 LITERAL1
|
||||
XPOWERS_FAST_ALDO1 LITERAL1
|
||||
XPOWERS_FAST_ALDO2 LITERAL1
|
||||
XPOWERS_FAST_ALDO3 LITERAL1
|
||||
XPOWERS_FAST_ALDO4 LITERAL1
|
||||
XPOWERS_FAST_BLDO1 LITERAL1
|
||||
XPOWERS_FAST_BLDO2 LITERAL1
|
||||
XPOWERS_FAST_CPUSLDO LITERAL1
|
||||
XPOWERS_FAST_DLDO1 LITERAL1
|
||||
XPOWERS_FAST_DLDO2 LITERAL1
|
||||
XPOWERS_SEQUENCE_LEVEL_0 LITERAL1
|
||||
XPOWERS_SEQUENCE_LEVEL_1 LITERAL1
|
||||
XPOWERS_SEQUENCE_LEVEL_2 LITERAL1
|
||||
XPOWERS_SEQUENCE_DISABLE LITERAL1
|
||||
XPOWERS_WDT_IRQ_TO_PIN LITERAL1
|
||||
XPOWERS_WDT_IRQ_AND_RSET LITERAL1
|
||||
XPOWERS_WDT_IRQ_AND_RSET_PD_PWROK LITERAL1
|
||||
XPOWERS_WDT_IRQ_AND_RSET_ALL_OFF LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_1S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_2S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_4S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_8S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_16S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_32S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_64S LITERAL1
|
||||
XPOWERS_WDT_TIMEOUT_128S LITERAL1
|
||||
XPOWER_CHGLED_TYPEA LITERAL1
|
||||
XPOWER_CHGLED_TYPEB LITERAL1
|
||||
XPOWER_CHGLED_MANUAL LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_3V88 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_3V96 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V04 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V12 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V20 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V28 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V36 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V44 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V52 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V60 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V68 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V76 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V84 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V92 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_5V LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_5V08 LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_100MA LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_500MA LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_900MA LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_1000MA LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_1500MA LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_2000MA LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V1 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V2 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V3 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V4 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V5 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V6 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V7 LITERAL1
|
||||
XPOWERS_VSYS_VOL_4V8 LITERAL1
|
||||
|
||||
#AXP192
|
||||
|
||||
MONITOR_TS_PIN LITERAL1
|
||||
MONITOR_APS_VOLTAGE LITERAL1
|
||||
MONITOR_USB_CURRENT LITERAL1
|
||||
MONITOR_USB_VOLTAGE LITERAL1
|
||||
MONITOR_AC_CURRENT LITERAL1
|
||||
MONITOR_AC_VOLTAGE LITERAL1
|
||||
MONITOR_BAT_CURRENT LITERAL1
|
||||
MONITOR_BAT_VOLTAGE LITERAL1
|
||||
MONITOR_ADC_IO3 LITERAL1
|
||||
MONITOR_ADC_IO2 LITERAL1
|
||||
MONITOR_ADC_IO1 LITERAL1
|
||||
MONITOR_ADC_IO0 LITERAL1
|
||||
MONITOR_TEMPERATURE LITERAL1
|
||||
XPOWERS_BOOT_TIME_128MS LITERAL1
|
||||
XPOWERS_BOOT_TIME_512MS LITERAL1
|
||||
XPOWERS_BOOT_TIME_1S LITERAL1
|
||||
XPOWERS_BOOT_TIME_2S LITERAL1
|
||||
PMU_GPIO0 LITERAL1
|
||||
PMU_GPIO1 LITERAL1
|
||||
PMU_GPIO2 LITERAL1
|
||||
PMU_GPIO3 LITERAL1
|
||||
PMU_GPIO4 LITERAL1
|
||||
PMU_GPIO5 LITERAL1
|
||||
PMU_TS_PIN LITERAL1
|
||||
XPOWERS_CHG_CUR_100MA LITERAL1
|
||||
XPOWERS_CHG_CUR_190MA LITERAL1
|
||||
XPOWERS_CHG_CUR_280MA LITERAL1
|
||||
XPOWERS_CHG_CUR_360MA LITERAL1
|
||||
XPOWERS_CHG_CUR_450MA LITERAL1
|
||||
XPOWERS_CHG_CUR_550MA LITERAL1
|
||||
XPOWERS_CHG_CUR_630MA LITERAL1
|
||||
XPOWERS_CHG_CUR_700MA LITERAL1
|
||||
XPOWERS_CHG_CUR_780MA LITERAL1
|
||||
XPOWERS_CHG_CUR_880MA LITERAL1
|
||||
XPOWERS_CHG_CUR_960MA LITERAL1
|
||||
XPOWERS_CHG_CUR_1000MA LITERAL1
|
||||
XPOWERS_CHG_CUR_1080MA LITERAL1
|
||||
XPOWERS_CHG_CUR_1160MA LITERAL1
|
||||
XPOWERS_CHG_CUR_1240MA LITERAL1
|
||||
XPOWERS_CHG_CUR_1320MA LITERAL1
|
||||
XPOWERS_CHG_ITERM_LESS_10_PERCENT LITERAL1
|
||||
XPOWERS_CHG_ITERM_LESS_15_PERCENT LITERAL1
|
||||
XPOWERS_ICC_CHG_100MA LITERAL1
|
||||
XPOWERS_ICC_CHG_190MA LITERAL1
|
||||
XPOWERS_ICC_CHG_280MA LITERAL1
|
||||
XPOWERS_ICC_CHG_360MA LITERAL1
|
||||
XPOWERS_ICC_CHG_450MA LITERAL1
|
||||
XPOWERS_ICC_CHG_550MA LITERAL1
|
||||
XPOWERS_ICC_CHG_630MA LITERAL1
|
||||
XPOWERS_ICC_CHG_700MA LITERAL1
|
||||
XPOWERS_ICC_CHG_780MA LITERAL1
|
||||
XPOWERS_ICC_CHG_880MA LITERAL1
|
||||
XPOWERS_ICC_CHG_960MA LITERAL1
|
||||
XPOWERS_ICC_CHG_1000MA LITERAL1
|
||||
XPOWERS_ICC_CHG_1080MA LITERAL1
|
||||
XPOWERS_ICC_CHG_1160MA LITERAL1
|
||||
XPOWERS_ICC_CHG_1240MA LITERAL1
|
||||
XPOWERS_ICC_CHG_1320MA LITERAL1
|
||||
XPOWERS_POWERON_128MS LITERAL1
|
||||
XPOWERS_POWERON_512MS LITERAL1
|
||||
XPOWERS_POWERON_1S LITERAL1
|
||||
XPOWERS_POWERON_2S LITERAL1
|
||||
XPOWERS_LONGPRESS_1000MS LITERAL1
|
||||
XPOWERS_LONGPRESS_1500MS LITERAL1
|
||||
XPOWERS_LONGPRESS_2000MS LITERAL1
|
||||
XPOWERS_LONGPRESS_2500MS LITERAL1
|
||||
XPOWERS_POWEROFF_4S LITERAL1
|
||||
XPOWERS_POWEROFF_65 LITERAL1
|
||||
XPOWERS_POWEROFF_8S LITERAL1
|
||||
XPOWERS_POWEROFF_16S LITERAL1
|
||||
XPOWERS_CHG_LED_DISABLE LITERAL1
|
||||
XPOWERS_CHG_LED_FRE_1HZ LITERAL1
|
||||
XPOWERS_CHG_LED_FRE_4HZ LITERAL1
|
||||
XPOWERS_CHG_LED_LEVEL_LOW LITERAL1
|
||||
XPOWERS_CHG_LED_CTRL_CHG LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V1 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V2 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V3 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V4 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V5 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V6 LITERAL1
|
||||
XPOWERS_VBUS_VOL_LIM_4V7 LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_500MA LITERAL1
|
||||
XPOWERS_VBUS_CUR_LIM_100MA LITERAL1
|
||||
XPOWER_CHGLED_CTRL_CHGER LITERAL1
|
||||
XPOWER_CHGLED_CTRL_MANUAL LITERAL1
|
||||
XPOWERS_CHG_VOL_4V1 LITERAL1
|
||||
XPOWERS_CHG_VOL_4V15 LITERAL1
|
||||
XPOWERS_CHG_VOL_4V2 LITERAL1
|
||||
XPOWERS_CHG_VOL_4V36 LITERAL1
|
||||
XPOWERS_CHG_CONS_TIMEOUT_7H LITERAL1
|
||||
XPOWERS_CHG_CONS_TIMEOUT_8H LITERAL1
|
||||
XPOWERS_CHG_CONS_TIMEOUT_9H LITERAL1
|
||||
XPOWERS_CHG_CONS_TIMEOUT_10H LITERAL1
|
||||
XPOWERS_BACKUP_BAT_VOL_3V1 LITERAL1
|
||||
XPOWERS_BACKUP_BAT_VOL_3V LITERAL1
|
||||
XPOWERS_BACKUP_BAT_VOL_3V0 LITERAL1
|
||||
XPOWERS_BACKUP_BAT_VOL_2V5 LITERAL1
|
||||
XPOWERS_BACKUP_BAT_CUR_50UA LITERAL1
|
||||
XPOWERS_BACKUP_BAT_CUR_100UA LITERAL1
|
||||
XPOWERS_BACKUP_BAT_CUR_200UA LITERAL1
|
||||
XPOWERS_BACKUP_BAT_CUR_400UA LITERAL1
|
||||
XPOWERS_DATA_BUFFER_SIZE LITERAL1
|
||||
AXP192_SLAVE_ADDRESS LITERAL1
|
||||
AXP202_SLAVE_ADDRESS LITERAL1
|
||||
AXP2101_SLAVE_ADDRESS LITERAL1
|
||||
|
||||
|
||||
30
ports/espressif/components/XPowersLib/library.json
Normal file
30
ports/espressif/components/XPowersLib/library.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "XPowersLib",
|
||||
"version": "0.1.4",
|
||||
"description": "Arduino,CircuitPython,Micropython library for x-powers power management series",
|
||||
"keywords": "AXP192 AXP202 AXP2101 x-powers",
|
||||
"authors": [{
|
||||
"name": "LewisHe",
|
||||
"url": "https://github.com/lewisxhe",
|
||||
"maintainer": true
|
||||
}],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lewisxhe/XPowersLib.git"
|
||||
},
|
||||
"homepage": "https://github.com/lewisxhe/XPowersLib",
|
||||
"export": {
|
||||
"include": [
|
||||
"LICENSE",
|
||||
"library.json",
|
||||
"library.properties",
|
||||
"README.md",
|
||||
"keywords.txt",
|
||||
"src/*",
|
||||
"examples/*"
|
||||
]
|
||||
},
|
||||
"frameworks": ["arduino", "espidf"],
|
||||
"platforms": "esp32",
|
||||
"headers": "XPowersLib.h"
|
||||
}
|
||||
9
ports/espressif/components/XPowersLib/library.properties
Normal file
9
ports/espressif/components/XPowersLib/library.properties
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
name=XPowersLib
|
||||
version=0.1.4
|
||||
author=Lewis He
|
||||
maintainer=Lewis He <lewishe@outlook.com>
|
||||
sentence=Arduino,CircuitPython,Micropython library for x-powers power management series
|
||||
paragraph=Arduino,CircuitPython,Micropython library for x-powers power management series
|
||||
category=Communication
|
||||
url=https://github.com/lewisxhe/XPowersLib
|
||||
architectures=esp32
|
||||
182
ports/espressif/components/XPowersLib/src/REG/AXP192Constants.h
Normal file
182
ports/espressif/components/XPowersLib/src/REG/AXP192Constants.h
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
#pragma once
|
||||
|
||||
#define AXP192_SLAVE_ADDRESS (0x34)
|
||||
|
||||
#define XPOWERS_AXP192_CHIP_ID (0x03)
|
||||
|
||||
#define XPOWERS_AXP192_STATUS (0x00)
|
||||
#define XPOWERS_AXP192_MODE_CHGSTATUS (0x01)
|
||||
#define XPOWERS_AXP192_OTG_STATUS (0x02)
|
||||
#define XPOWERS_AXP192_IC_TYPE (0x03)
|
||||
|
||||
#define XPOWERS_AXP192_DATA_BUFFER1 (0x06)
|
||||
#define XPOWERS_AXP192_DATA_BUFFER2 (0x07)
|
||||
#define XPOWERS_AXP192_DATA_BUFFER3 (0x08)
|
||||
#define XPOWERS_AXP192_DATA_BUFFER4 (0x09)
|
||||
#define XPOWERS_AXP192_DATA_BUFFER5 (0x0A)
|
||||
#define XPOWERS_AXP192_DATA_BUFFER6 (0x0B)
|
||||
#define XPOWERS_AXP192_DATA_BUFFER_SIZE (6)
|
||||
|
||||
|
||||
#define XPOWERS_AXP192_LDO23_DC123_EXT_CTL (0x12)
|
||||
#define XPOWERS_AXP192_DC2OUT_VOL (0x23)
|
||||
#define XPOWERS_AXP192_DC2_DVM (0x25)
|
||||
#define XPOWERS_AXP192_DC3OUT_VOL (0x27)
|
||||
#define XPOWERS_AXP192_LDO24OUT_VOL (0x28)
|
||||
#define XPOWERS_AXP192_LDO3OUT_VOL (0x29)
|
||||
#define XPOWERS_AXP192_IPS_SET (0x30)
|
||||
#define XPOWERS_AXP192_VOFF_SET (0x31)
|
||||
#define XPOWERS_AXP192_OFF_CTL (0x32)
|
||||
#define XPOWERS_AXP192_CHARGE1 (0x33)
|
||||
#define XPOWERS_AXP192_CHARGE2 (0x34)
|
||||
#define XPOWERS_AXP192_BACKUP_CHG (0x35)
|
||||
#define XPOWERS_AXP192_POK_SET (0x36)
|
||||
#define XPOWERS_AXP192_DCDC_FREQSET (0x37)
|
||||
#define XPOWERS_AXP192_VLTF_CHGSET (0x38)
|
||||
#define XPOWERS_AXP192_VHTF_CHGSET (0x39)
|
||||
#define XPOWERS_AXP192_APS_WARNING1 (0x3A)
|
||||
#define XPOWERS_AXP192_APS_WARNING2 (0x3B)
|
||||
#define XPOWERS_AXP192_TLTF_DISCHGSET (0x3C)
|
||||
#define XPOWERS_AXP192_THTF_DISCHGSET (0x3D)
|
||||
#define XPOWERS_AXP192_DCDC_MODESET (0x80)
|
||||
#define XPOWERS_AXP192_ADC_EN1 (0x82)
|
||||
#define XPOWERS_AXP192_ADC_EN2 (0x83)
|
||||
#define XPOWERS_AXP192_ADC_SPEED (0x84)
|
||||
#define XPOWERS_AXP192_ADC_INPUTRANGE (0x85)
|
||||
#define XPOWERS_AXP192_ADC_IRQ_RETFSET (0x86)
|
||||
#define XPOWERS_AXP192_ADC_IRQ_FETFSET (0x87)
|
||||
#define XPOWERS_AXP192_TIMER_CTL (0x8A)
|
||||
#define XPOWERS_AXP192_VBUS_DET_SRP (0x8B)
|
||||
#define XPOWERS_AXP192_HOTOVER_CTL (0x8F)
|
||||
|
||||
#define XPOWERS_AXP192_PWM1_FREQ_SET (0x98)
|
||||
#define XPOWERS_AXP192_PWM1_DUTY_SET1 (0x99)
|
||||
#define XPOWERS_AXP192_PWM1_DUTY_SET2 (0x9A)
|
||||
|
||||
#define XPOWERS_AXP192_PWM2_FREQ_SET (0x9B)
|
||||
#define XPOWERS_AXP192_PWM2_DUTY_SET1 (0x9C)
|
||||
#define XPOWERS_AXP192_PWM2_DUTY_SET2 (0x9D)
|
||||
|
||||
|
||||
// INTERRUPT REGISTER
|
||||
#define XPOWERS_AXP192_INTEN1 (0x40)
|
||||
#define XPOWERS_AXP192_INTEN2 (0x41)
|
||||
#define XPOWERS_AXP192_INTEN3 (0x42)
|
||||
#define XPOWERS_AXP192_INTEN4 (0x43)
|
||||
#define XPOWERS_AXP192_INTEN5 (0x4A)
|
||||
|
||||
// INTERRUPT STATUS REGISTER
|
||||
#define XPOWERS_AXP192_INTSTS1 (0x44)
|
||||
#define XPOWERS_AXP192_INTSTS2 (0x45)
|
||||
#define XPOWERS_AXP192_INTSTS3 (0x46)
|
||||
#define XPOWERS_AXP192_INTSTS4 (0x47)
|
||||
#define XPOWERS_AXP192_INTSTS5 (0x4D)
|
||||
#define XPOWERS_AXP192_INTSTS_CNT (5)
|
||||
|
||||
#define XPOWERS_AXP192_DC1_VLOTAGE (0x26)
|
||||
#define XPOWERS_AXP192_LDO23OUT_VOL (0x28)
|
||||
#define XPOWERS_AXP192_GPIO0_CTL (0x90)
|
||||
#define XPOWERS_AXP192_GPIO0_VOL (0x91)
|
||||
#define XPOWERS_AXP192_GPIO1_CTL (0X92)
|
||||
#define XPOWERS_AXP192_GPIO2_CTL (0x93)
|
||||
#define XPOWERS_AXP192_GPIO012_SIGNAL (0x94)
|
||||
#define XPOWERS_AXP192_GPIO34_CTL (0x95)
|
||||
#define XPOWERS_AXP192_GPIO34_SIGNAL (0x96)
|
||||
#define XPOWERS_AXP192_GPIO012_PULLDOWN (0x97)
|
||||
#define XPOWERS_AXP192_GPIO5_CTL (0x9E)
|
||||
|
||||
#define XPOWERS_AXP192_GPIO0_VOL_ADC_H8 (0x64)
|
||||
#define XPOWERS_AXP192_GPIO0_VOL_ADC_L4 (0x65)
|
||||
#define XPOWERS_AXP192_GPIO1_VOL_ADC_H8 (0x66)
|
||||
#define XPOWERS_AXP192_GPIO1_VOL_ADC_L4 (0x67)
|
||||
#define XPOWERS_AXP192_GPIO2_VOL_ADC_H8 (0x68)
|
||||
#define XPOWERS_AXP192_GPIO2_VOL_ADC_L4 (0x69)
|
||||
#define XPOWERS_AXP192_GPIO3_VOL_ADC_H8 (0x6A)
|
||||
#define XPOWERS_AXP192_GPIO3_VOL_ADC_L4 (0x6B)
|
||||
|
||||
#define XPOWERS_AXP192_GPIO0_STEP (0.5F)
|
||||
#define XPOWERS_AXP192_GPIO1_STEP (0.5F)
|
||||
#define XPOWERS_AXP192_TS_IN_H8 (0x62)
|
||||
#define XPOWERS_AXP192_TS_IN_L4 (0x63)
|
||||
|
||||
#define XPOWERS_AXP192_BAT_AVERCHGCUR_H8 (0x7A)
|
||||
#define XPOWERS_AXP192_BAT_AVERCHGCUR_L5 (0x7B)
|
||||
|
||||
|
||||
#define XPOWERS_AXP192_ACIN_VOL_H8 (0x56)
|
||||
#define XPOWERS_AXP192_ACIN_VOL_L4 (0x57)
|
||||
#define XPOWERS_AXP192_ACIN_CUR_H8 (0x58)
|
||||
#define XPOWERS_AXP192_ACIN_CUR_L4 (0x59)
|
||||
#define XPOWERS_AXP192_VBUS_VOL_H8 (0x5A)
|
||||
#define XPOWERS_AXP192_VBUS_VOL_L4 (0x5B)
|
||||
#define XPOWERS_AXP192_VBUS_CUR_H8 (0x5C)
|
||||
#define XPOWERS_AXP192_VBUS_CUR_L4 (0x5D)
|
||||
|
||||
#define XPOWERS_AXP192_BAT_AVERDISCHGCUR_H8 (0x7C)
|
||||
#define XPOWERS_AXP192_BAT_AVERDISCHGCUR_L5 (0x7D)
|
||||
#define XPOWERS_AXP192_APS_AVERVOL_H8 (0x7E)
|
||||
#define XPOWERS_AXP192_APS_AVERVOL_L4 (0x7F)
|
||||
#define XPOWERS_AXP192_BAT_AVERVOL_H8 (0x78)
|
||||
#define XPOWERS_AXP192_BAT_AVERVOL_L4 (0x79)
|
||||
|
||||
#define XPOWERS_AXP192_BAT_CHGCOULOMB3 (0xB0)
|
||||
#define XPOWERS_AXP192_BAT_CHGCOULOMB2 (0xB1)
|
||||
#define XPOWERS_AXP192_BAT_CHGCOULOMB1 (0xB2)
|
||||
#define XPOWERS_AXP192_BAT_CHGCOULOMB0 (0xB3)
|
||||
#define XPOWERS_AXP192_BAT_DISCHGCOULOMB3 (0xB4)
|
||||
#define XPOWERS_AXP192_BAT_DISCHGCOULOMB2 (0xB5)
|
||||
#define XPOWERS_AXP192_BAT_DISCHGCOULOMB1 (0xB6)
|
||||
#define XPOWERS_AXP192_BAT_DISCHGCOULOMB0 (0xB7)
|
||||
#define XPOWERS_AXP192_COULOMB_CTL (0xB8)
|
||||
|
||||
|
||||
#define XPOWERS_AXP192_BATT_VOLTAGE_STEP (1.1F)
|
||||
#define XPOWERS_AXP192_BATT_DISCHARGE_CUR_STEP (0.5F)
|
||||
#define XPOWERS_AXP192_BATT_CHARGE_CUR_STEP (0.5F)
|
||||
#define XPOWERS_AXP192_ACIN_VOLTAGE_STEP (1.7F)
|
||||
#define XPOWERS_AXP192_ACIN_CUR_STEP (0.625F)
|
||||
#define XPOWERS_AXP192_VBUS_VOLTAGE_STEP (1.7F)
|
||||
#define XPOWERS_AXP192_VBUS_CUR_STEP (0.375F)
|
||||
#define XPOWERS_AXP192_APS_VOLTAGE_STEP (1.4F)
|
||||
#define XPOWERS_AXP192_TS_PIN_OUT_STEP (0.8F)
|
||||
|
||||
|
||||
#define XPOWERS_AXP192_LDO2_VOL_MIN (1800u)
|
||||
#define XPOWERS_AXP192_LDO2_VOL_MAX (3300u)
|
||||
#define XPOWERS_AXP192_LDO2_VOL_STEPS (100u)
|
||||
#define XPOWERS_AXP192_LDO2_VOL_BIT_MASK (4u)
|
||||
|
||||
#define XPOWERS_AXP192_LDO3_VOL_MIN (1800u)
|
||||
#define XPOWERS_AXP192_LDO3_VOL_MAX (3300u)
|
||||
#define XPOWERS_AXP192_LDO3_VOL_STEPS (100u)
|
||||
|
||||
|
||||
#define XPOWERS_AXP192_DC1_VOL_STEPS (25u)
|
||||
#define XPOWERS_AXP192_DC1_VOL_MIN (700u)
|
||||
#define XPOWERS_AXP192_DC1_VOL_MAX (3500u)
|
||||
|
||||
#define XPOWERS_AXP192_DC2_VOL_STEPS (25u)
|
||||
#define XPOWERS_AXP192_DC2_VOL_MIN (700u)
|
||||
#define XPOWERS_AXP192_DC2_VOL_MAX (3500u)
|
||||
|
||||
#define XPOWERS_AXP192_DC3_VOL_STEPS (25u)
|
||||
#define XPOWERS_AXP192_DC3_VOL_MIN (700u)
|
||||
#define XPOWERS_AXP192_DC3_VOL_MAX (3500u)
|
||||
|
||||
#define XPOWERS_AXP192_LDOIO_VOL_STEPS (100)
|
||||
#define XPOWERS_AXP192_LDOIO_VOL_MIN (1800)
|
||||
#define XPOWERS_AXP192_LDOIO_VOL_MAX (3300)
|
||||
|
||||
#define XPOWERS_AXP192_SYS_VOL_STEPS (100)
|
||||
#define XPOWERS_AXP192_VOFF_VOL_MIN (2600)
|
||||
#define XPOWERS_AXP192_VOFF_VOL_MAX (3300)
|
||||
|
||||
#define XPOWERS_AXP192_CHG_EXT_CURR_MIN (300)
|
||||
#define XPOWERS_AXP192_CHG_EXT_CURR_MAX (1000)
|
||||
#define XPOWERS_AXP192_CHG_EXT_CURR_STEP (100)
|
||||
|
||||
|
||||
#define XPOWERS_AXP192_INTERNAL_TEMP_H8 (0x5E)
|
||||
#define XPOWERS_AXP192_INTERNAL_TEMP_L4 (0x5F)
|
||||
#define XPOWERS_AXP192_INTERNAL_TEMP_STEP (0.1F)
|
||||
#define XPOWERS_AXP192_INERNAL_TEMP_OFFSET (144.7)
|
||||
151
ports/espressif/components/XPowersLib/src/REG/AXP202Constants.h
Normal file
151
ports/espressif/components/XPowersLib/src/REG/AXP202Constants.h
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#pragma once
|
||||
|
||||
#define AXP202_SLAVE_ADDRESS (0x35)
|
||||
|
||||
#define XPOWERS_AXP202_CHIP_ID (0x41)
|
||||
|
||||
#define XPOWERS_AXP202_STATUS (0x00)
|
||||
#define XPOWERS_AXP202_MODE_CHGSTATUS (0x01)
|
||||
#define XPOWERS_AXP202_OTG_STATUS (0x02)
|
||||
#define XPOWERS_AXP202_IC_TYPE (0x03)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER1 (0x04)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER2 (0x05)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER3 (0x06)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER4 (0x07)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER5 (0x08)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER6 (0x09)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER7 (0x0A)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER8 (0x0B)
|
||||
#define XPOWERS_AXP202_DATA_BUFFER9 (0x0C)
|
||||
#define XPOWERS_AXP202_DATA_BUFFERA (0x0D)
|
||||
#define XPOWERS_AXP202_DATA_BUFFERB (0x0E)
|
||||
#define XPOWERS_AXP202_DATA_BUFFERC (0x0F)
|
||||
#define XPOWERS_AXP202_LDO234_DC23_CTL (0x12)
|
||||
#define XPOWERS_AXP202_DC2OUT_VOL (0x23)
|
||||
#define XPOWERS_AXP202_LDO3_DC2_DVM (0x25)
|
||||
#define XPOWERS_AXP202_DC3OUT_VOL (0x27)
|
||||
#define XPOWERS_AXP202_LDO24OUT_VOL (0x28)
|
||||
#define XPOWERS_AXP202_LDO3OUT_VOL (0x29)
|
||||
#define XPOWERS_AXP202_IPS_SET (0x30)
|
||||
#define XPOWERS_AXP202_VOFF_SET (0x31)
|
||||
#define XPOWERS_AXP202_OFF_CTL (0x32)
|
||||
#define XPOWERS_AXP202_CHARGE1 (0x33)
|
||||
#define XPOWERS_AXP202_CHARGE2 (0x34)
|
||||
#define XPOWERS_AXP202_BACKUP_CHG (0x35)
|
||||
#define XPOWERS_AXP202_POK_SET (0x36)
|
||||
#define XPOWERS_AXP202_DCDC_FREQSET (0x37)
|
||||
#define XPOWERS_AXP202_VLTF_CHGSET (0x38)
|
||||
#define XPOWERS_AXP202_VHTF_CHGSET (0x39)
|
||||
#define XPOWERS_AXP202_APS_WARNING1 (0x3A)
|
||||
#define XPOWERS_AXP202_APS_WARNING2 (0x3B)
|
||||
#define XPOWERS_AXP202_TLTF_DISCHGSET (0x3C)
|
||||
#define XPOWERS_AXP202_THTF_DISCHGSET (0x3D)
|
||||
#define XPOWERS_AXP202_DCDC_MODESET (0x80)
|
||||
#define XPOWERS_AXP202_ADC_EN1 (0x82)
|
||||
#define XPOWERS_AXP202_ADC_EN2 (0x83)
|
||||
#define XPOWERS_AXP202_ADC_SPEED (0x84)
|
||||
#define XPOWERS_AXP202_ADC_INPUTRANGE (0x85)
|
||||
#define XPOWERS_AXP202_ADC_IRQ_RETFSET (0x86)
|
||||
#define XPOWERS_AXP202_ADC_IRQ_FETFSET (0x87)
|
||||
#define XPOWERS_AXP202_TIMER_CTL (0x8A)
|
||||
#define XPOWERS_AXP202_VBUS_DET_SRP (0x8B)
|
||||
#define XPOWERS_AXP202_HOTOVER_CTL (0x8F)
|
||||
|
||||
|
||||
#define XPOWERS_AXP202_GPIO0_CTL (0x90)
|
||||
#define XPOWERS_AXP202_GPIO0_VOL (0x91)
|
||||
#define XPOWERS_AXP202_GPIO1_CTL (0x92)
|
||||
#define XPOWERS_AXP202_GPIO2_CTL (0x93)
|
||||
#define XPOWERS_AXP202_GPIO012_SIGNAL (0x94)
|
||||
#define XPOWERS_AXP202_GPIO3_CTL (0x95)
|
||||
|
||||
// INTERRUPT REGISTER
|
||||
#define XPOWERS_AXP202_INTEN1 (0x40)
|
||||
#define XPOWERS_AXP202_INTEN2 (0x41)
|
||||
#define XPOWERS_AXP202_INTEN3 (0x42)
|
||||
#define XPOWERS_AXP202_INTEN4 (0x43)
|
||||
#define XPOWERS_AXP202_INTEN5 (0x44)
|
||||
|
||||
//INTERRUPT STATUS REGISTER
|
||||
#define XPOWERS_AXP202_INTSTS1 (0x48)
|
||||
#define XPOWERS_AXP202_INTSTS2 (0x49)
|
||||
#define XPOWERS_AXP202_INTSTS3 (0x4A)
|
||||
#define XPOWERS_AXP202_INTSTS4 (0x4B)
|
||||
#define XPOWERS_AXP202_INTSTS5 (0x4C)
|
||||
#define XPOWERS_AXP202_INTSTS_CNT (5)
|
||||
|
||||
|
||||
//AXP ADC DATA REGISTER
|
||||
#define XPOWERS_AXP202_GPIO0_VOL_ADC_H8 (0x64)
|
||||
#define XPOWERS_AXP202_GPIO0_VOL_ADC_L4 (0x65)
|
||||
#define XPOWERS_AXP202_GPIO1_VOL_ADC_H8 (0x66)
|
||||
#define XPOWERS_AXP202_GPIO1_VOL_ADC_L4 (0x67)
|
||||
|
||||
|
||||
#define XPOWERS_AXP202_GPIO0_STEP (0.5F)
|
||||
#define XPOWERS_AXP202_GPIO1_STEP (0.5F)
|
||||
|
||||
#define XPOWERS_AXP202_BAT_AVERVOL_H8 (0x78)
|
||||
#define XPOWERS_AXP202_BAT_AVERVOL_L4 (0x79)
|
||||
|
||||
#define XPOWERS_AXP202_BAT_AVERCHGCUR_H8 (0x7A)
|
||||
#define XPOWERS_AXP202_BAT_AVERCHGCUR_L4 (0x7B)
|
||||
|
||||
#define XPOWERS_AXP202_BAT_AVERCHGCUR_L5 (0x7B)
|
||||
#define XPOWERS_AXP202_ACIN_VOL_H8 (0x56)
|
||||
#define XPOWERS_AXP202_ACIN_VOL_L4 (0x57)
|
||||
#define XPOWERS_AXP202_ACIN_CUR_H8 (0x58)
|
||||
#define XPOWERS_AXP202_ACIN_CUR_L4 (0x59)
|
||||
#define XPOWERS_AXP202_VBUS_VOL_H8 (0x5A)
|
||||
#define XPOWERS_AXP202_VBUS_VOL_L4 (0x5B)
|
||||
#define XPOWERS_AXP202_VBUS_CUR_H8 (0x5C)
|
||||
#define XPOWERS_AXP202_VBUS_CUR_L4 (0x5D)
|
||||
#define XPOWERS_AXP202_INTERNAL_TEMP_H8 (0x5E)
|
||||
#define XPOWERS_AXP202_INTERNAL_TEMP_L4 (0x5F)
|
||||
#define XPOWERS_AXP202_TS_IN_H8 (0x62)
|
||||
#define XPOWERS_AXP202_TS_IN_L4 (0x63)
|
||||
#define XPOWERS_AXP202_GPIO0_VOL_ADC_H8 (0x64)
|
||||
#define XPOWERS_AXP202_GPIO0_VOL_ADC_L4 (0x65)
|
||||
#define XPOWERS_AXP202_GPIO1_VOL_ADC_H8 (0x66)
|
||||
#define XPOWERS_AXP202_GPIO1_VOL_ADC_L4 (0x67)
|
||||
|
||||
#define XPOWERS_AXP202_BAT_AVERDISCHGCUR_H8 (0x7C)
|
||||
#define XPOWERS_AXP202_BAT_AVERDISCHGCUR_L5 (0x7D)
|
||||
#define XPOWERS_AXP202_APS_AVERVOL_H8 (0x7E)
|
||||
#define XPOWERS_AXP202_APS_AVERVOL_L4 (0x7F)
|
||||
#define XPOWERS_AXP202_INT_BAT_CHGCUR_H8 (0xA0)
|
||||
#define XPOWERS_AXP202_INT_BAT_CHGCUR_L4 (0xA1)
|
||||
#define XPOWERS_AXP202_EXT_BAT_CHGCUR_H8 (0xA2)
|
||||
#define XPOWERS_AXP202_EXT_BAT_CHGCUR_L4 (0xA3)
|
||||
#define XPOWERS_AXP202_INT_BAT_DISCHGCUR_H8 (0xA4)
|
||||
#define XPOWERS_AXP202_INT_BAT_DISCHGCUR_L4 (0xA5)
|
||||
#define XPOWERS_AXP202_EXT_BAT_DISCHGCUR_H8 (0xA6)
|
||||
#define XPOWERS_AXP202_EXT_BAT_DISCHGCUR_L4 (0xA7)
|
||||
#define XPOWERS_AXP202_BAT_CHGCOULOMB3 (0xB0)
|
||||
#define XPOWERS_AXP202_BAT_CHGCOULOMB2 (0xB1)
|
||||
#define XPOWERS_AXP202_BAT_CHGCOULOMB1 (0xB2)
|
||||
#define XPOWERS_AXP202_BAT_CHGCOULOMB0 (0xB3)
|
||||
#define XPOWERS_AXP202_BAT_DISCHGCOULOMB3 (0xB4)
|
||||
#define XPOWERS_AXP202_BAT_DISCHGCOULOMB2 (0xB5)
|
||||
#define XPOWERS_AXP202_BAT_DISCHGCOULOMB1 (0xB6)
|
||||
#define XPOWERS_AXP202_BAT_DISCHGCOULOMB0 (0xB7)
|
||||
#define XPOWERS_AXP202_COULOMB_CTL (0xB8)
|
||||
#define XPOWERS_AXP202_BATT_PERCENTAGE (0xB9)
|
||||
|
||||
#define XPOWERS_AXP202_BAT_POWERH8 (0x70)
|
||||
#define XPOWERS_AXP202_BAT_POWERM8 (0x71)
|
||||
#define XPOWERS_AXP202_BAT_POWERL8 (0x72)
|
||||
|
||||
#define XPOWERS_AXP202_BATT_VOLTAGE_STEP (1.1F)
|
||||
#define XPOWERS_AXP202_BATT_DISCHARGE_CUR_STEP (0.5F)
|
||||
#define XPOWERS_AXP202_BATT_CHARGE_CUR_STEP (0.5F)
|
||||
#define XPOWERS_AXP202_ACIN_VOLTAGE_STEP (1.7F)
|
||||
#define XPOWERS_AXP202_ACIN_CUR_STEP (0.625F)
|
||||
#define XPOWERS_AXP202_VBUS_VOLTAGE_STEP (1.7F)
|
||||
#define XPOWERS_AXP202_VBUS_CUR_STEP (0.375F)
|
||||
#define XPOWERS_AXP202_INTERNAL_TEMP_STEP (0.1F)
|
||||
#define XPOWERS_AXP202_APS_VOLTAGE_STEP (1.4F)
|
||||
#define XPOWERS_AXP202_TS_PIN_OUT_STEP (0.8F)
|
||||
|
||||
|
||||
|
||||
238
ports/espressif/components/XPowersLib/src/REG/AXP2101Constants.h
Normal file
238
ports/espressif/components/XPowersLib/src/REG/AXP2101Constants.h
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
#pragma once
|
||||
|
||||
#define AXP2101_SLAVE_ADDRESS (0x34)
|
||||
|
||||
#define XPOWERS_AXP2101_CHIP_ID (0x4A)
|
||||
|
||||
#define XPOWERS_AXP2101_STATUS1 (0x00)
|
||||
#define XPOWERS_AXP2101_STATUS2 (0x01)
|
||||
#define XPOWERS_AXP2101_IC_TYPE (0x03)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_DATA_BUFFER1 (0x04)
|
||||
#define XPOWERS_AXP2101_DATA_BUFFER2 (0x05)
|
||||
#define XPOWERS_AXP2101_DATA_BUFFER3 (0x06)
|
||||
#define XPOWERS_AXP2101_DATA_BUFFER4 (0x07)
|
||||
#define XPOWERS_AXP2101_DATA_BUFFER_SIZE (4u)
|
||||
|
||||
#define XPOWERS_AXP2101_COMMON_CONFIG (0x10)
|
||||
#define XPOWERS_AXP2101_BATFET_CTRL (0x12)
|
||||
#define XPOWERS_AXP2101_DIE_TEMP_CTRL (0x13)
|
||||
#define XPOWERS_AXP2101_MIN_SYS_VOL_CTRL (0x14)
|
||||
#define XPOWERS_AXP2101_INPUT_VOL_LIMIT_CTRL (0x15)
|
||||
#define XPOWERS_AXP2101_INPUT_CUR_LIMIT_CTRL (0x16)
|
||||
#define XPOWERS_AXP2101_RESET_FUEL_GAUGE (0x17)
|
||||
#define XPOWERS_AXP2101_CHARGE_GAUGE_WDT_CTRL (0x18)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_WDT_CTRL (0x19)
|
||||
#define XPOWERS_AXP2101_LOW_BAT_WARN_SET (0x1A)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_PWRON_STATUS (0x20)
|
||||
#define XPOWERS_AXP2101_PWROFF_STATUS (0x21)
|
||||
#define XPOWERS_AXP2101_PWROFF_EN (0x22)
|
||||
#define XPOWERS_AXP2101_DC_OVP_UVP_CTRL (0x23)
|
||||
#define XPOWERS_AXP2101_VOFF_SET (0x24)
|
||||
#define XPOWERS_AXP2101_PWROK_SEQU_CTRL (0x25)
|
||||
#define XPOWERS_AXP2101_SLEEP_WAKEUP_CTRL (0x26)
|
||||
#define XPOWERS_AXP2101_IRQ_OFF_ON_LEVEL_CTRL (0x27)
|
||||
|
||||
#define XPOWERS_AXP2101_FAST_PWRON_SET0 (0x28)
|
||||
#define XPOWERS_AXP2101_FAST_PWRON_SET1 (0x29)
|
||||
#define XPOWERS_AXP2101_FAST_PWRON_SET2 (0x2A)
|
||||
#define XPOWERS_AXP2101_FAST_PWRON_CTRL (0x2B)
|
||||
|
||||
#define XPOWERS_AXP2101_ADC_CHANNEL_CTRL (0x30)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST0 (0x34)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST1 (0x35)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST2 (0x36)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST3 (0x37)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST4 (0x38)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST5 (0x39)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST6 (0x3A)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST7 (0x3B)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST8 (0x3C)
|
||||
#define XPOWERS_AXP2101_ADC_DATA_RELUST9 (0x3D)
|
||||
|
||||
|
||||
//XPOWERS INTERRUPT REGISTER
|
||||
#define XPOWERS_AXP2101_INTEN1 (0x40)
|
||||
#define XPOWERS_AXP2101_INTEN2 (0x41)
|
||||
#define XPOWERS_AXP2101_INTEN3 (0x42)
|
||||
|
||||
|
||||
//XPOWERS INTERRUPT STATUS REGISTER
|
||||
#define XPOWERS_AXP2101_INTSTS1 (0x48)
|
||||
#define XPOWERS_AXP2101_INTSTS2 (0x49)
|
||||
#define XPOWERS_AXP2101_INTSTS3 (0x4A)
|
||||
#define XPOWERS_AXP2101_INTSTS_CNT (3u)
|
||||
|
||||
#define XPOWERS_AXP2101_TS_PIN_CTRL (0x50)
|
||||
#define XPOWERS_AXP2101_TS_HYSL2H_SET (0x52)
|
||||
#define XPOWERS_AXP2101_TS_LYSL2H_SET (0x53)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_VLTF_CHG_SET (0x54)
|
||||
#define XPOWERS_AXP2101_VHLTF_CHG_SET (0x55)
|
||||
#define XPOWERS_AXP2101_VLTF_WORK_SET (0x56)
|
||||
#define XPOWERS_AXP2101_VHLTF_WORK_SET (0x57)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_JIETA_EN_CTRL (0x58)
|
||||
#define XPOWERS_AXP2101_JIETA_SET0 (0x59)
|
||||
#define XPOWERS_AXP2101_JIETA_SET1 (0x5A)
|
||||
#define XPOWERS_AXP2101_JIETA_SET2 (0x5B)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_IPRECHG_SET (0x61)
|
||||
#define XPOWERS_AXP2101_ICC_CHG_SET (0x62)
|
||||
#define XPOWERS_AXP2101_ITERM_CHG_SET_CTRL (0x63)
|
||||
|
||||
#define XPOWERS_AXP2101_CV_CHG_VOL_SET (0x64)
|
||||
|
||||
#define XPOWERS_AXP2101_THE_REGU_THRES_SET (0x65)
|
||||
#define XPOWERS_AXP2101_CHG_TIMEOUT_SET_CTRL (0x67)
|
||||
|
||||
#define XPOWERS_AXP2101_BAT_DET_CTRL (0x68)
|
||||
#define XPOWERS_AXP2101_CHGLED_SET_CTRL (0x69)
|
||||
|
||||
#define XPOWERS_AXP2101_BTN_VOL_MIN (2600)
|
||||
#define XPOWERS_AXP2101_BTN_VOL_MAX (3300)
|
||||
#define XPOWERS_AXP2101_BTN_VOL_STEPS (100)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_BTN_BAT_CHG_VOL_SET (0x6A)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_DC_ONOFF_DVM_CTRL (0x80)
|
||||
#define XPOWERS_AXP2101_DC_FORCE_PWM_CTRL (0x81)
|
||||
#define XPOWERS_AXP2101_DC_VOL0_CTRL (0x82)
|
||||
#define XPOWERS_AXP2101_DC_VOL1_CTRL (0x83)
|
||||
#define XPOWERS_AXP2101_DC_VOL2_CTRL (0x84)
|
||||
#define XPOWERS_AXP2101_DC_VOL3_CTRL (0x85)
|
||||
#define XPOWERS_AXP2101_DC_VOL4_CTRL (0x86)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_LDO_ONOFF_CTRL0 (0x90)
|
||||
#define XPOWERS_AXP2101_LDO_ONOFF_CTRL1 (0x91)
|
||||
#define XPOWERS_AXP2101_LDO_VOL0_CTRL (0x92)
|
||||
#define XPOWERS_AXP2101_LDO_VOL1_CTRL (0x93)
|
||||
#define XPOWERS_AXP2101_LDO_VOL2_CTRL (0x94)
|
||||
#define XPOWERS_AXP2101_LDO_VOL3_CTRL (0x95)
|
||||
#define XPOWERS_AXP2101_LDO_VOL4_CTRL (0x96)
|
||||
#define XPOWERS_AXP2101_LDO_VOL5_CTRL (0x97)
|
||||
#define XPOWERS_AXP2101_LDO_VOL6_CTRL (0x98)
|
||||
#define XPOWERS_AXP2101_LDO_VOL7_CTRL (0x99)
|
||||
#define XPOWERS_AXP2101_LDO_VOL8_CTRL (0x9A)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_BAT_PARAME (0xA1)
|
||||
#define XPOWERS_AXP2101_FUEL_GAUGE_CTRL (0xA2)
|
||||
#define XPOWERS_AXP2101_BAT_PERCENT_DATA (0xA4)
|
||||
|
||||
// DCDC 1~5
|
||||
#define XPOWERS_AXP2101_DCDC1_VOL_MIN (1500)
|
||||
#define XPOWERS_AXP2101_DCDC1_VOL_MAX (3400)
|
||||
#define XPOWERS_AXP2101_DCDC1_VOL_STEPS (100u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL1_MIN (500u)
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL1_MAX (1200u)
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL2_MIN (1220u)
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL2_MAX (1540u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL_STEPS1 (10u)
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL_STEPS2 (20u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL_STEPS1_BASE (0u)
|
||||
#define XPOWERS_AXP2101_DCDC2_VOL_STEPS2_BASE (71u)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL1_MIN (500u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL1_MAX (1200u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL2_MIN (1220u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL2_MAX (1540u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL3_MIN (1600u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL3_MAX (3400u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_MAX (3400)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_STEPS1 (10u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_STEPS2 (20u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_STEPS3 (100u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_STEPS1_BASE (0u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_STEPS2_BASE (71u)
|
||||
#define XPOWERS_AXP2101_DCDC3_VOL_STEPS3_BASE (88u)
|
||||
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL1_MIN (500u)
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL1_MAX (1200u)
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL2_MIN (1220u)
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL2_MAX (1840u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL_STEPS1 (10u)
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL_STEPS2 (20u)
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL_STEPS1_BASE (0u)
|
||||
#define XPOWERS_AXP2101_DCDC4_VOL_STEPS2_BASE (71u)
|
||||
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_DCDC5_VOL_1200MV (1200)
|
||||
#define XPOWERS_AXP2101_DCDC5_VOL_VAL (0x19)
|
||||
#define XPOWERS_AXP2101_DCDC5_VOL_MIN (1400)
|
||||
#define XPOWERS_AXP2101_DCDC5_VOL_MAX (3700)
|
||||
#define XPOWERS_AXP2101_DCDC5_VOL_STEPS (100u)
|
||||
|
||||
#define XPOWERS_AXP2101_VSYS_VOL_THRESHOLD_MIN (2600)
|
||||
#define XPOWERS_AXP2101_VSYS_VOL_THRESHOLD_MAX (3300)
|
||||
#define XPOWERS_AXP2101_VSYS_VOL_THRESHOLD_STEPS (100)
|
||||
|
||||
// ALDO 1~4
|
||||
|
||||
#define XPOWERS_AXP2101_ALDO1_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_ALDO1_VOL_MAX (3500)
|
||||
#define XPOWERS_AXP2101_ALDO1_VOL_STEPS (100u)
|
||||
|
||||
#define XPOWERS_AXP2101_ALDO2_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_ALDO2_VOL_MAX (3500)
|
||||
#define XPOWERS_AXP2101_ALDO2_VOL_STEPS (100u)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_ALDO3_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_ALDO3_VOL_MAX (3500)
|
||||
#define XPOWERS_AXP2101_ALDO3_VOL_STEPS (100u)
|
||||
|
||||
|
||||
#define XPOWERS_AXP2101_ALDO4_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_ALDO4_VOL_MAX (3500)
|
||||
#define XPOWERS_AXP2101_ALDO4_VOL_STEPS (100u)
|
||||
|
||||
// BLDO 1~2
|
||||
|
||||
#define XPOWERS_AXP2101_BLDO1_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_BLDO1_VOL_MAX (3500)
|
||||
#define XPOWERS_AXP2101_BLDO1_VOL_STEPS (100u)
|
||||
|
||||
#define XPOWERS_AXP2101_BLDO2_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_BLDO2_VOL_MAX (3500)
|
||||
#define XPOWERS_AXP2101_BLDO2_VOL_STEPS (100u)
|
||||
|
||||
// CPUSLDO
|
||||
|
||||
#define XPOWERS_AXP2101_CPUSLDO_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_CPUSLDO_VOL_MAX (1400)
|
||||
#define XPOWERS_AXP2101_CPUSLDO_VOL_STEPS (50)
|
||||
|
||||
|
||||
// DLDO 1~2
|
||||
#define XPOWERS_AXP2101_DLDO1_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_DLDO1_VOL_MAX (3400)
|
||||
#define XPOWERS_AXP2101_DLDO1_VOL_STEPS (100u)
|
||||
|
||||
#define XPOWERS_AXP2101_DLDO2_VOL_MIN (500)
|
||||
#define XPOWERS_AXP2101_DLDO2_VOL_MAX (3400)
|
||||
#define XPOWERS_AXP2101_DLDO2_VOL_STEPS (100u)
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
#pragma once
|
||||
|
||||
#define AXP216_SLAVE_ADDRESS (0x34)
|
||||
|
||||
#define XPOWERS_AXP216_CHIP_ID (0x41)
|
||||
|
||||
//CONTROL REGISTER
|
||||
#define XPOWERS_AXP216_STATUS (0x00)
|
||||
#define XPOWERS_AXP216_MODE_CHGSTATUS (0x01)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER1 (0x04)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER2 (0x05)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER3 (0x06)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER4 (0x07)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER5 (0x08)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER6 (0x09)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER7 (0x0A)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER8 (0x0B)
|
||||
#define XPOWERS_AXP216_DATA_BUFFER9 (0x0C)
|
||||
#define XPOWERS_AXP216_DATA_BUFFERA (0x0D)
|
||||
#define XPOWERS_AXP216_DATA_BUFFERB (0x0E)
|
||||
#define XPOWERS_AXP216_DATA_BUFFERC (0x0F)
|
||||
|
||||
#define XPOWERS_AXP216_IC_TYPE (0x03)
|
||||
|
||||
#define XPOWERS_AXP216_DC12345_ALDO12_CTL (0x10)
|
||||
#define XPOWERS_AXP216_LDO123_CTL (0x12)
|
||||
#define XPOWERS_AXP216_OUTPUT_CTL (0x13)
|
||||
#define XPOWERS_AXP216_ELDO1_VCTL (0x19)
|
||||
#define XPOWERS_AXP216_ELDO2_VCTL (0x1A)
|
||||
#define XPOWERS_AXP216_DCDC1_VCTL (0x21)
|
||||
#define XPOWERS_AXP216_DCDC2_VCTL (0x22)
|
||||
#define XPOWERS_AXP216_DCDC3_VCTL (0x23)
|
||||
|
||||
#define XPOWERS_AXP216_DCDC4_VCTL (0x24)
|
||||
#define XPOWERS_AXP216_DCDC5_VCTL (0x25)
|
||||
#define XPOWERS_AXP216_DCDC23_VOLX (0x27)
|
||||
#define XPOWERS_AXP216_ALDO1_VCTL (0x28)
|
||||
#define XPOWERS_AXP216_ALDO2_VCTL (0x29)
|
||||
#define XPOWERS_AXP216_ALDO3_VCTL (0x2A)
|
||||
#define XPOWERS_AXP216_VBUS_IPSOUT (0x30)
|
||||
#define XPOWERS_AXP216_VOFF_SET (0x31)
|
||||
#define XPOWERS_AXP216_OFF_CTL (0x32)
|
||||
#define XPOWERS_AXP216_CHARGE1 (0x33)
|
||||
#define XPOWERS_AXP216_CHARGE2 (0x34)
|
||||
#define XPOWERS_AXP216_CHARGE3 (0x35)
|
||||
#define XPOWERS_AXP216_PEK_SET (0x36)
|
||||
#define XPOWERS_AXP216_OFFLEVEL (0x37)
|
||||
#define XPOWERS_AXP216_VLTF_CHGSET (0x38)
|
||||
#define XPOWERS_AXP216_VHTF_CHGSET (0x39)
|
||||
#define XPOWERS_AXP216_DCDC_FREQ (0x3B)
|
||||
#define XPOWERS_AXP216_TLTF_DISCHGSET (0x3C)
|
||||
#define XPOWERS_AXP216_THTF_DISCHGSET (0x3D)
|
||||
#define XPOWERS_AXP216_DCDC_MODESET (0x80)
|
||||
#define XPOWERS_AXP216_ADC_CTL (0x82)
|
||||
#define XPOWERS_AXP216_ADC_SPEED (0x84)
|
||||
#define XPOWERS_AXP216_TS_ADC (0x85)
|
||||
#define XPOWERS_AXP216_TIMER_CTL (0x8A)
|
||||
#define XPOWERS_AXP216_HOTOVER_CTL (0x8F)
|
||||
|
||||
//GPIO REGISTER
|
||||
#define XPOWERS_AXP216_GPIO1_CTL (0x92)
|
||||
#define XPOWERS_AXP216_GPIO1_LDO_CTL (0x93)
|
||||
#define XPOWERS_AXP216_GPIO01_STATUS (0x94)
|
||||
#define XPOWERS_AXP216_GPIO1_PULLDOWN_CTL (0x97)
|
||||
|
||||
//XPOWERS INTERRUPT REGISTER
|
||||
#define XPOWERS_AXP216_INTEN1 (0x40)
|
||||
#define XPOWERS_AXP216_INTEN2 (0x41)
|
||||
#define XPOWERS_AXP216_INTEN3 (0x42)
|
||||
#define XPOWERS_AXP216_INTEN4 (0x43)
|
||||
#define XPOWERS_AXP216_INTEN5 (0x44)
|
||||
|
||||
//XPOWERS INTERRUPT STATUS REGISTER
|
||||
#define XPOWERS_AXP216_INTSTS1 (0x48)
|
||||
#define XPOWERS_AXP216_INTSTS2 (0x49)
|
||||
#define XPOWERS_AXP216_INTSTS3 (0x4A)
|
||||
#define XPOWERS_AXP216_INTSTS4 (0x4B)
|
||||
#define XPOWERS_AXP216_INTSTS5 (0x4C)
|
||||
|
||||
//XPOWERS ADC DATA REGISTER
|
||||
#define XPOWERS_AXP216_INTERNAL_TEMP_H8 (0x56)
|
||||
#define XPOWERS_AXP216_INTERNAL_TEMP_L4 (0x57)
|
||||
#define XPOWERS_AXP216_TS_IN_H8 (0x58)
|
||||
#define XPOWERS_AXP216_TS_IN_L4 (0x59)
|
||||
#define XPOWERS_AXP216_BAT_VOLTAGE_H8 (0x78)
|
||||
#define XPOWERS_AXP216_BAT_VOLTAGE_L4 (0x79)
|
||||
#define XPOWERS_AXP216_BAT_CHGCURCUR_H8 (0x7A)
|
||||
#define XPOWERS_AXP216_BAT_CHGCURCUR_L4 (0x7B)
|
||||
#define XPOWERS_AXP216_BAT_DISCHGCUR_H8 (0x7C)
|
||||
#define XPOWERS_AXP216_BAT_DISCHGCUR_L4 (0x7D)
|
||||
#define XPOWERS_AXP216_FUEL_GAUGE_CTRL (0xB8)
|
||||
#define XPOWERS_AXP216_FUEL_GAUGE_REULST (0xB9)
|
||||
#define XPOWERS_AXP216_BAT_CAPACITY_0 (0xE0)
|
||||
#define XPOWERS_AXP216_BAT_CAPACITY_1 (0xE1)
|
||||
#define XPOWERS_AXP216_BAT_LOW_WARNING_CTRL (0xE6)
|
||||
2072
ports/espressif/components/XPowersLib/src/XPowersAXP192.tpp
Normal file
2072
ports/espressif/components/XPowersLib/src/XPowersAXP192.tpp
Normal file
File diff suppressed because it is too large
Load diff
2996
ports/espressif/components/XPowersLib/src/XPowersAXP2101.tpp
Normal file
2996
ports/espressif/components/XPowersLib/src/XPowersAXP2101.tpp
Normal file
File diff suppressed because it is too large
Load diff
288
ports/espressif/components/XPowersLib/src/XPowersCommon.tpp
Normal file
288
ports/espressif/components/XPowersLib/src/XPowersCommon.tpp
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
/**
|
||||
*
|
||||
* @license MIT License
|
||||
*
|
||||
* Copyright (c) 2022 lewis he
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* @file XPowersCommon.h
|
||||
* @author Lewis He (lewishe@outlook.com)
|
||||
* @date 2022-05-07
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(ARDUINO)
|
||||
#include <Wire.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef _BV
|
||||
#undef _BV
|
||||
#endif
|
||||
#define _BV(b) (1ULL << (uint64_t)(b))
|
||||
|
||||
|
||||
#ifndef constrain
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
#endif
|
||||
|
||||
|
||||
#define XPOWERS_ATTR_NOT_IMPLEMENTED __attribute__((error("Not implemented")))
|
||||
#define IS_BIT_SET(val,mask) (((val)&(mask)) == (mask))
|
||||
|
||||
#if !defined(ARDUINO)
|
||||
#define log_e(...)
|
||||
#define log_i(...)
|
||||
#define log_d(...)
|
||||
|
||||
#define LOW 0x0
|
||||
#define HIGH 0x1
|
||||
|
||||
//GPIO FUNCTIONS
|
||||
#define INPUT 0x01
|
||||
#define OUTPUT 0x03
|
||||
#define PULLUP 0x04
|
||||
#define INPUT_PULLUP 0x05
|
||||
#define PULLDOWN 0x08
|
||||
#define INPUT_PULLDOWN 0x09
|
||||
|
||||
#define RISING 0x01
|
||||
#define FALLING 0x02
|
||||
|
||||
#endif
|
||||
|
||||
template <class chipType>
|
||||
class XPowersCommon
|
||||
{
|
||||
typedef int (*iic_fptr_t)(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint8_t len);
|
||||
|
||||
public:
|
||||
|
||||
#if defined(ARDUINO)
|
||||
bool begin(TwoWire &w, uint8_t addr, int sda, int scl)
|
||||
{
|
||||
if (__has_init)return thisChip().initImpl();
|
||||
__has_init = true;
|
||||
__wire = &w;
|
||||
__wire->begin(sda, scl);
|
||||
__addr = addr;
|
||||
return thisChip().initImpl();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool begin(uint8_t addr, iic_fptr_t readRegCallback, iic_fptr_t writeRegCallback)
|
||||
{
|
||||
if (__has_init)return thisChip().initImpl();
|
||||
__has_init = true;
|
||||
thisReadRegCallback = readRegCallback;
|
||||
thisWriteRegCallback = writeRegCallback;
|
||||
__addr = addr;
|
||||
return thisChip().initImpl();
|
||||
}
|
||||
|
||||
int readRegister(uint8_t reg)
|
||||
{
|
||||
uint8_t val = 0;
|
||||
if (thisReadRegCallback) {
|
||||
if (thisReadRegCallback(__addr, reg, &val, 1) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
#if defined(ARDUINO)
|
||||
if (__wire) {
|
||||
__wire->beginTransmission(__addr);
|
||||
__wire->write(reg);
|
||||
if (__wire->endTransmission() != 0) {
|
||||
return -1;
|
||||
}
|
||||
__wire->requestFrom(__addr, 1U);
|
||||
return __wire->read();
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
int writeRegister(uint8_t reg, uint8_t val)
|
||||
{
|
||||
if (thisWriteRegCallback) {
|
||||
return thisWriteRegCallback(__addr, reg, &val, 1);
|
||||
}
|
||||
#if defined(ARDUINO)
|
||||
if (__wire) {
|
||||
__wire->beginTransmission(__addr);
|
||||
__wire->write(reg);
|
||||
__wire->write(val);
|
||||
return (__wire->endTransmission() == 0) ? 0 : -1;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
int readRegister(uint8_t reg, uint8_t *buf, uint8_t lenght)
|
||||
{
|
||||
if (thisReadRegCallback) {
|
||||
return thisReadRegCallback(__addr, reg, buf, lenght);
|
||||
}
|
||||
#if defined(ARDUINO)
|
||||
if (__wire) {
|
||||
__wire->beginTransmission(__addr);
|
||||
__wire->write(reg);
|
||||
if (__wire->endTransmission() != 0) {
|
||||
return -1;
|
||||
}
|
||||
__wire->requestFrom(__addr, lenght);
|
||||
return __wire->readBytes(buf, lenght) == lenght ? 0 : -1;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
int writeRegister(uint8_t reg, uint8_t *buf, uint8_t lenght)
|
||||
{
|
||||
if (thisWriteRegCallback) {
|
||||
return thisWriteRegCallback(__addr, reg, buf, lenght);
|
||||
}
|
||||
#if defined(ARDUINO)
|
||||
if (__wire) {
|
||||
__wire->beginTransmission(__addr);
|
||||
__wire->write(reg);
|
||||
__wire->write(buf, lenght);
|
||||
return (__wire->endTransmission() == 0) ? 0 : -1;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool inline clrRegisterBit(uint8_t registers, uint8_t bit)
|
||||
{
|
||||
int val = readRegister(registers);
|
||||
if (val == -1) {
|
||||
return false;
|
||||
}
|
||||
return writeRegister(registers, (val & (~_BV(bit)))) == 0;
|
||||
}
|
||||
|
||||
bool inline setRegisterBit(uint8_t registers, uint8_t bit)
|
||||
{
|
||||
int val = readRegister(registers);
|
||||
if (val == -1) {
|
||||
return false;
|
||||
}
|
||||
return writeRegister(registers, (val | (_BV(bit)))) == 0;
|
||||
}
|
||||
|
||||
bool inline getRegisterBit(uint8_t registers, uint8_t bit)
|
||||
{
|
||||
int val = readRegister(registers);
|
||||
if (val == -1) {
|
||||
return false;
|
||||
}
|
||||
return val & _BV(bit);
|
||||
}
|
||||
|
||||
uint16_t inline readRegisterH8L4(uint8_t highReg, uint8_t lowReg)
|
||||
{
|
||||
int h8 = readRegister(highReg);
|
||||
int l4 = readRegister(lowReg);
|
||||
if (h8 == -1 || l4 == -1)return 0;
|
||||
return (h8 << 4) | (l4 & 0x0F);
|
||||
}
|
||||
|
||||
uint16_t inline readRegisterH8L5(uint8_t highReg, uint8_t lowReg)
|
||||
{
|
||||
int h8 = readRegister(highReg);
|
||||
int l5 = readRegister(lowReg);
|
||||
if (h8 == -1 || l5 == -1)return 0;
|
||||
return (h8 << 5) | (l5 & 0x1F);
|
||||
}
|
||||
|
||||
uint16_t inline readRegisterH6L8(uint8_t highReg, uint8_t lowReg)
|
||||
{
|
||||
int h6 = readRegister(highReg);
|
||||
int l8 = readRegister(lowReg);
|
||||
if (h6 == -1 || l8 == -1)return 0;
|
||||
return ((h6 & 0x3F) << 8) | l8;
|
||||
}
|
||||
|
||||
uint16_t inline readRegisterH5L8(uint8_t highReg, uint8_t lowReg)
|
||||
{
|
||||
int h5 = readRegister(highReg);
|
||||
int l8 = readRegister(lowReg);
|
||||
if (h5 == -1 || l8 == -1)return 0;
|
||||
return ((h5 & 0x1F) << 8) | l8;
|
||||
}
|
||||
|
||||
/*
|
||||
* CRTP Helper
|
||||
*/
|
||||
protected:
|
||||
|
||||
bool begin()
|
||||
{
|
||||
#if defined(ARDUINO)
|
||||
if (__has_init) return thisChip().initImpl();
|
||||
__has_init = true;
|
||||
log_i("SDA:%d SCL:%d", __sda, __scl);
|
||||
__wire->begin(__sda, __scl);
|
||||
#endif /*ARDUINO*/
|
||||
return thisChip().initImpl();
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
#if defined(ARDUINO)
|
||||
if (__wire) {
|
||||
#if defined(ESP_IDF_VERSION)
|
||||
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(4,4,0)
|
||||
__wire->end();
|
||||
#endif /*ESP_IDF_VERSION*/
|
||||
#endif /*ESP_IDF_VERSION*/
|
||||
}
|
||||
#endif /*ARDUINO*/
|
||||
}
|
||||
|
||||
|
||||
inline const chipType &thisChip() const
|
||||
{
|
||||
return static_cast<const chipType &>(*this);
|
||||
}
|
||||
|
||||
inline chipType &thisChip()
|
||||
{
|
||||
return static_cast<chipType &>(*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
bool __has_init = false;
|
||||
#if defined(ARDUINO)
|
||||
TwoWire *__wire = NULL;
|
||||
#endif
|
||||
int __sda = -1;
|
||||
int __scl = -1;
|
||||
uint8_t __addr = 0xFF;
|
||||
iic_fptr_t thisReadRegCallback = NULL;
|
||||
iic_fptr_t thisWriteRegCallback = NULL;
|
||||
};
|
||||
34
ports/espressif/components/XPowersLib/src/XPowersLib.h
Normal file
34
ports/espressif/components/XPowersLib/src/XPowersLib.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* @file XPowersLib.h
|
||||
* @author Lewis He (lewishe@outlook.com)
|
||||
* @license MIT
|
||||
* @copyright Copyright (c) 2022
|
||||
* @date 2022-05-07
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __XPOWERSLIB_H__
|
||||
#define __XPOWERSLIB_H__
|
||||
|
||||
|
||||
#if defined(XPOWERS_CHIP_AXP192)
|
||||
#include "XPowersAXP192.tpp"
|
||||
typedef XPowersAXP192 XPowersPMU;
|
||||
#elif defined(XPOWERS_CHIP_AXP202)
|
||||
// #include "XPowersAXP202.tpp"
|
||||
// typedef XPowersAXP202 XPowersPMU;
|
||||
#error "Not currently supported!"
|
||||
#elif defined(XPOWERS_CHIP_AXP2102)
|
||||
#include "XPowersAXP2101.tpp"
|
||||
typedef XPowersAXP2101 XPowersPMU;
|
||||
#else
|
||||
#error "Please define power management chip model"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /*__XPOWERSLIB_H__*/
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
*
|
||||
* @license MIT License
|
||||
*
|
||||
* Copyright (c) 2022 lewis he
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* @file XPowersLibInterface.cpp
|
||||
* @author Lewis He (lewishe@outlook.com)
|
||||
* @date 2022-08-28
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO)
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
#include "XPowersLibInterface.hpp"
|
||||
|
||||
|
||||
bool XPowersLibInterface::isChannelAvailable(uint8_t channel)
|
||||
{
|
||||
if (__chipModel == XPOWERS_AXP192) {
|
||||
switch (channel) {
|
||||
case XPOWERS_DCDC1:
|
||||
case XPOWERS_DCDC2:
|
||||
case XPOWERS_DCDC3:
|
||||
case XPOWERS_LDO2:
|
||||
case XPOWERS_LDO3:
|
||||
case XPOWERS_LDOIO:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else if (__chipModel == XPOWERS_AXP202) {
|
||||
|
||||
switch (channel) {
|
||||
case XPOWERS_DCDC2:
|
||||
case XPOWERS_DCDC3:
|
||||
case XPOWERS_LDO2:
|
||||
case XPOWERS_LDO3:
|
||||
case XPOWERS_LDO4:
|
||||
case XPOWERS_LDO5:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (__chipModel == XPOWERS_AXP2101) {
|
||||
switch (channel) {
|
||||
case XPOWERS_DCDC1:
|
||||
case XPOWERS_DCDC2:
|
||||
case XPOWERS_DCDC3:
|
||||
case XPOWERS_DCDC4:
|
||||
case XPOWERS_DCDC5:
|
||||
case XPOWERS_ALDO1:
|
||||
case XPOWERS_ALDO2:
|
||||
case XPOWERS_ALDO3:
|
||||
case XPOWERS_ALDO4:
|
||||
case XPOWERS_BLDO1:
|
||||
case XPOWERS_BLDO2:
|
||||
case XPOWERS_VBACKUP:
|
||||
case XPOWERS_CPULDO:
|
||||
return true;
|
||||
default:
|
||||
// DLDO is not available, will also return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void XPowersLibInterface::setProtectedChannel(uint8_t channel)
|
||||
{
|
||||
__protectedMask |= _BV(channel);
|
||||
}
|
||||
|
||||
void XPowersLibInterface::setUnprotectChannel(uint8_t channel)
|
||||
{
|
||||
__protectedMask &= (~_BV(channel));
|
||||
}
|
||||
|
||||
bool XPowersLibInterface::getProtectedChannel(uint8_t channel)
|
||||
{
|
||||
return __protectedMask & _BV(channel);
|
||||
}
|
||||
|
||||
|
||||
uint16_t XPowersLibInterface::getVbusVoltage()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,624 @@
|
|||
/**
|
||||
*
|
||||
* @license MIT License
|
||||
*
|
||||
* Copyright (c) 2022 lewis he
|
||||
*
|
||||
* Permission is hereby granted,free of charge,to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"),to deal
|
||||
* in the Software without restriction,including without limitation the rights
|
||||
* to use,copy,modify,merge,publish,distribute,sublicense,and/or sell
|
||||
* copies of the Software,and to permit persons to whom the Software is
|
||||
* furnished to do so,subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
|
||||
* IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER
|
||||
* LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* @file XPowersLibInterface.hpp
|
||||
* @author Lewis He (lewishe@outlook.com)
|
||||
* @date 2022-08-28
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "XPowersParams.hpp"
|
||||
|
||||
/*
|
||||
| CHIP | AXP173 | AXP192 | AXP202 | AXP2101 |
|
||||
| ---------- | ----------------- | ----------------- | ----------------- | -------------------------------------- |
|
||||
| DC1 | 0.7V-3.5V /1.2A | 0.7V-3.5V /1.2A | X | 1.5-3.4V /2A |
|
||||
| DC2 | 0.7-2.275V/0.6A | 0.7-2.275V /1.6A | 0.7-2.275V /1.6A | 0.5-1.2V,1.22-1.54V /2A |
|
||||
| DC3 | X | 0.7-3.5V /0.7A | 0.7-3.5V /1.2A | 0.5-1.2V,1.22-1.54V,1.6-3.4V /2A |
|
||||
| DC4 | X | x | x | 0.5-1.2V,1.22-1.84V /1.5A |
|
||||
| DC5 | X | x | x | 1.2V,1.4-3.7V /1A |
|
||||
| LDO1(VRTC) | 3.3V /30mA | 3.3V /30mA | 3.3V /30mA | 1.8V /30mA |
|
||||
| LDO2 | 1.8V-3.3V /200mA | 1.8V-3.3V /200mA | 1.8V-3.3V /200mA | x |
|
||||
| LDO3 | 1.8V-3.3V /200mA | 1.8-3.3V /200mA | 0.7-3.5V /200mA | x |
|
||||
| LDO4 | 0.7-3.5V /500mA | X | 1.8V-3.3V /200mA | x |
|
||||
| LDO5/IO0 | X | 1.8-3.3V /50mA | 1.8-3.3V /50mA | x |
|
||||
| ALDO1 | x | x | x | 0.5-3.5V /300mA |
|
||||
| ALDO2 | x | x | x | 0.5-3.5V /300mA |
|
||||
| ALDO3 | x | x | x | 0.5-3.5V /300mA |
|
||||
| ALDO4 | x | x | x | 0.5-3.5V /300mA |
|
||||
| BLDO1 | x | x | x | 0.5-3.5V /300mA |
|
||||
| BLDO2 | x | x | x | 0.5-3.5V /300mA |
|
||||
| DLDO1 | x | x | x | 0.5-3.3V/ 0.5-1.4V /300mA |
|
||||
| DLDO1 | x | x | x | 0.5-3.3V/ 0.5-1.4V /300mA |
|
||||
| CPUSLDO | x | x | x | 0.5-1.4V /30mA |
|
||||
| | | | | |
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// @brief Each chip resource is different,please refer to the table above
|
||||
typedef enum __XPowersPowerChannel {
|
||||
|
||||
XPOWERS_DCDC1,
|
||||
XPOWERS_DCDC2,
|
||||
XPOWERS_DCDC3,
|
||||
XPOWERS_DCDC4,
|
||||
XPOWERS_DCDC5,
|
||||
|
||||
XPOWERS_LDO1,
|
||||
XPOWERS_LDO2,
|
||||
XPOWERS_LDO3,
|
||||
XPOWERS_LDO4,
|
||||
XPOWERS_LDO5,
|
||||
|
||||
XPOWERS_LDOIO,
|
||||
|
||||
XPOWERS_ALDO1,
|
||||
XPOWERS_ALDO2,
|
||||
XPOWERS_ALDO3,
|
||||
XPOWERS_ALDO4,
|
||||
|
||||
XPOWERS_BLDO1,
|
||||
XPOWERS_BLDO2,
|
||||
|
||||
XPOWERS_DLDO1,
|
||||
XPOWERS_DLDO2,
|
||||
|
||||
XPOWERS_VBACKUP,
|
||||
|
||||
XPOWERS_CPULDO,
|
||||
|
||||
} XPowersPowerChannel_t;
|
||||
|
||||
// @brief Chip type
|
||||
typedef enum __XPowersChipModel {
|
||||
XPOWERS_AXP173,
|
||||
XPOWERS_AXP192,
|
||||
XPOWERS_AXP202,
|
||||
XPOWERS_AXP216,
|
||||
XPOWERS_AXP2101,
|
||||
XPOWERS_UNDEFINED,
|
||||
} XPowersChipModel_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Compatible with subclasses of the Meshtastic-devic project
|
||||
*/
|
||||
class HasBatteryLevel
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Get battery percentage
|
||||
* @retval 0~100% , -1 no battery is connected
|
||||
*/
|
||||
virtual int getBatteryPercent()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get battery Voltage
|
||||
* @retval Voltage unit: millivolt , 0 is no battery is connected
|
||||
*/
|
||||
virtual uint16_t getBattVoltage()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Query whether the current battery is connected
|
||||
* @retval true to access,false to not access
|
||||
*/
|
||||
virtual bool isBatteryConnect()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Query whether the current USB is connected
|
||||
* @retval true to access,false to not access
|
||||
*/
|
||||
virtual bool isVbusIn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Query whether it is currently in charging state
|
||||
* @retval true to charge,false to not charge
|
||||
*/
|
||||
virtual bool isCharging()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// @brief Power resource interface class
|
||||
class XPowersLibInterface : public HasBatteryLevel
|
||||
{
|
||||
public:
|
||||
|
||||
XPowersLibInterface() : __chipModel(XPOWERS_UNDEFINED), __protectedMask(0) {};
|
||||
|
||||
virtual ~XPowersLibInterface() {}
|
||||
|
||||
/**
|
||||
* @brief Calling the XPowersLibInterface interface class
|
||||
* requires calling init for initialization
|
||||
* @retval
|
||||
*/
|
||||
virtual bool init() = 0;
|
||||
|
||||
/**
|
||||
* @brief When calling the XPowersLibInterface interface class,
|
||||
* calling deinit releases the Wire handle
|
||||
* @retval None
|
||||
*/
|
||||
virtual void deinit() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the PMU sleep flag,
|
||||
* need to manually close the power channel after setting
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableSleep() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set shutdown, calling shutdown will turn off all power channels,
|
||||
* only VRTC belongs to normal power supply
|
||||
* @retval None
|
||||
*/
|
||||
virtual void shutdown() = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Query chip ID
|
||||
* @retval Chip ID
|
||||
*/
|
||||
virtual uint8_t getChipID() = 0;
|
||||
|
||||
//Status function
|
||||
/**
|
||||
* @brief Query whether it is currently in charging state
|
||||
* @retval true to charge,false to not charge
|
||||
*/
|
||||
// virtual bool isCharging() = 0;
|
||||
|
||||
/**
|
||||
* @brief Query whether the current USB is connected
|
||||
* @retval true to access,false to not access
|
||||
*/
|
||||
// virtual bool isVbusIn() = 0;
|
||||
|
||||
/**
|
||||
* @brief Query whether the current battery is connected
|
||||
* @retval true to access,false to not access
|
||||
*/
|
||||
// virtual bool isBatteryConnect() = 0;
|
||||
|
||||
/**
|
||||
* @brief Query whether the current is in the discharge state
|
||||
* @retval true the battery is discharged,false is not discharged
|
||||
*/
|
||||
virtual bool isDischarge() = 0;
|
||||
|
||||
//Power Channel Control
|
||||
|
||||
/**
|
||||
* @brief Turn on the power channel
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enablePowerOutput(uint8_t channel) = 0;
|
||||
|
||||
/**
|
||||
* @brief Turn off the power channel
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disablePowerOutput(uint8_t channel) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get whether the power channel is enabled
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool isPowerChannelEnable(uint8_t channel) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get the set voltage of the power channel
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual uint16_t getPowerChannelVoltage(uint8_t channel) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set the output voltage of a channel power supply
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool setPowerChannelVoltage(uint8_t channel, uint16_t millivolt) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set a channel power protection,after setting this channel
|
||||
* will not be able to be set and closed
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
*/
|
||||
virtual void setProtectedChannel(uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Unprotect the channel, call this to unprotect the channel lock
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
*/
|
||||
virtual void setUnprotectChannel(uint8_t channel);
|
||||
|
||||
/**
|
||||
* * @brief Get whether a channel power supply has been protected
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true is set,false is not set
|
||||
*/
|
||||
virtual bool getProtectedChannel(uint8_t channel);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Query whether the PMU input parameter channel is valid
|
||||
* @param channel: Parameters See XPowersPowerChannel_t enumeration
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isChannelAvailable(uint8_t channel);
|
||||
|
||||
|
||||
//battery
|
||||
/**
|
||||
* @brief Get battery Voltage
|
||||
* @retval Voltage unit: millivolt , 0 is no battery is connected
|
||||
*/
|
||||
// virtual uint16_t getBattVoltage() = 0;
|
||||
|
||||
/**
|
||||
* @brief Get battery percentage
|
||||
* @retval 0~100% , -1 no battery is connected
|
||||
*/
|
||||
// virtual int getBatteryPercent(void);
|
||||
|
||||
// Vbus
|
||||
/**
|
||||
* @brief Get PMU VBUS/USB Voltage
|
||||
* @retval Voltage unit: millivolt , 0 is no vbus is connected
|
||||
*/
|
||||
virtual uint16_t getVbusVoltage();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set VBUS Current Input Limit.
|
||||
* @param opt: View the related chip type xpowers_axpxxx_vbus_cur_limit_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool setVbusCurrentLimit(uint8_t opt) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get VBUS Current Input Limit.
|
||||
* @retval View the related chip type xpowers_axpxxx_vbus_cur_limit_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
*/
|
||||
virtual uint8_t getVbusCurrentLimit(void) = 0;
|
||||
|
||||
|
||||
// SYS
|
||||
/**
|
||||
* @brief Get PMU SYS main Voltage
|
||||
* @retval Voltage unit: millivolt
|
||||
*/
|
||||
virtual uint16_t getSystemVoltage();
|
||||
|
||||
/**
|
||||
* @brief Set PMU Low Voltage Shutdown Threshold
|
||||
* @param millivolt: 2600mV ~ 3300mV
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool setSysPowerDownVoltage(uint16_t millivolt) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get PMU Low Voltage Shutdown Threshold
|
||||
* @retval Voltage unit: millivolt
|
||||
*/
|
||||
virtual uint16_t getSysPowerDownVoltage() = 0;
|
||||
|
||||
/**
|
||||
* @brief Set charge target voltage.
|
||||
* @param opt: View the related chip type xpowers_axpxxx_chg_vol_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool setChargeTargetVoltage(uint8_t opt) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get charge target voltage.
|
||||
* @retval View the related chip type xpowers_axpxxx_chg_vol_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* parameters in "XPowersParams.hpp"
|
||||
*/
|
||||
virtual uint8_t getChargeTargetVoltage() = 0;
|
||||
|
||||
/**
|
||||
* @brief Set charge current.
|
||||
* @param opt: View the related chip type xpowers_axpxxx_chg_curr_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool setChargerConstantCurr(uint8_t opt);
|
||||
|
||||
/**
|
||||
* @brief Get charge current.
|
||||
* @retval View the related chip type xpowers_axpxxx_chg_curr_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
*/
|
||||
virtual uint8_t getChargerConstantCurr();
|
||||
|
||||
|
||||
//!PMU Interrupt control
|
||||
/*
|
||||
* Example of interrupt usage
|
||||
* if (pmuInterrupt) {
|
||||
* pmuInterrupt = false;
|
||||
*
|
||||
* Read interrupt status
|
||||
* uint64_t mask = PMU->getIrqStatus();
|
||||
* Serial.print("IRQ Mask:0b");
|
||||
* Serial.println(mask,BIN);
|
||||
*
|
||||
* if (PMU->isPekeyShortPressIrq()) {
|
||||
* Serial.println("isPekeyShortPressIrq");
|
||||
* }
|
||||
* if (PMU->isBatChagerStartIrq()) {
|
||||
* Serial.println("isBatChagerStart");
|
||||
* }
|
||||
* ......
|
||||
*
|
||||
* After reading the interrupt status,you need to manually clear the status register
|
||||
* PMU->clearIrqStatus();
|
||||
* }
|
||||
* * * */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the interrupt controller mask value.
|
||||
* @retval Mask value corresponds to xpowers_axpxxx_irq_t ,
|
||||
*/
|
||||
virtual uint64_t getIrqStatus() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clear interrupt controller state.
|
||||
*/
|
||||
virtual void clearIrqStatus() = 0;
|
||||
|
||||
/**
|
||||
* @brief Eanble PMU interrupt control mask .
|
||||
* @param opt: View the related chip type xpowers_axpxxx_irq_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool enableIRQ(uint64_t opt) = 0;
|
||||
|
||||
/**
|
||||
* @brief Disable PMU interrupt control mask .
|
||||
* @param opt: View the related chip type xpowers_axpxxx_irq_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval
|
||||
*/
|
||||
virtual bool disableIRQ(uint64_t opt) = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU PEKEY is short pressed
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isPekeyShortPressIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU PEKEY is long pressed
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isPekeyLongPressIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU battery is connected
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isBatInsertIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU battery is removed
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isBatRemoveIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU USB is plugged in
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isVbusInsertIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU USB is removed
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isVbusRemoveIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU charging is complete
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isBatChagerDoneIrq() = 0;
|
||||
|
||||
/**
|
||||
* @brief Interrupt response when PMU charging starts
|
||||
* @retval true valid false invalid
|
||||
*/
|
||||
virtual bool isBatChagerStartIrq() = 0;
|
||||
|
||||
|
||||
//Data collection function
|
||||
|
||||
/**
|
||||
* @brief Enable battery detection function,the default is on
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableBattDetection();
|
||||
|
||||
/**
|
||||
* @brief Disable battery detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disableBattDetection();
|
||||
|
||||
/**
|
||||
* @brief Enable USB input voltage detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableVbusVoltageMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Disable USB input voltage detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disableVbusVoltageMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Enable system voltage detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableSystemVoltageMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Disable system voltage detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disableSystemVoltageMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Enable PMU internal temperature sensor detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableTemperatureMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Disable PMU internal temperature sensor detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disableTemperatureMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Enable battery input voltage detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableBattVoltageMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Disable battery input voltage detection
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disableBattVoltageMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Enable NTC thermistor detection (requires hardware support)
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool enableTSPinMeasure(void);
|
||||
|
||||
/**
|
||||
* @brief Disable NTC thermistor detection (requires hardware support)
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool disableTSPinMeasure(void);
|
||||
|
||||
// Charge indicator function
|
||||
/**
|
||||
* @brief Set charging led mode
|
||||
* @param opt: View the related chip type xpowers_chg_led_mode_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
*/
|
||||
virtual void setChargingLedMode(uint8_t mode) = 0;
|
||||
|
||||
|
||||
|
||||
// PMU PEKEY settings
|
||||
/**
|
||||
* @brief Set PEKEY press power on time
|
||||
* @param opt: View the related chip type xpowers_press_on_time_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool setPowerKeyPressOnTime(uint8_t opt);
|
||||
|
||||
/**
|
||||
* @brief Get PEKEY press power on time
|
||||
* @retval View the related chip type xpowers_press_on_time_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
*/
|
||||
virtual uint8_t getPowerKeyPressOnTime();
|
||||
|
||||
/**
|
||||
* @brief Set PEKEY press power off time
|
||||
* @param opt: View the related chip type xpowers_press_off_time_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
* @retval true success false failed
|
||||
*/
|
||||
virtual bool setPowerKeyPressOffTime(uint8_t opt);
|
||||
|
||||
/**
|
||||
* @brief Get PEKEY press power off time
|
||||
* @retval View the related chip type xpowers_press_off_time_t enumeration
|
||||
* parameters in "XPowersParams.hpp"
|
||||
*/
|
||||
virtual uint8_t getPowerKeyPressOffTime();
|
||||
|
||||
/**
|
||||
* @brief Get the chip model
|
||||
* @retval See XPowersChipModel_t enumeration
|
||||
*/
|
||||
uint8_t getChipModel()
|
||||
{
|
||||
return __chipModel;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void setChipModel(uint8_t m)
|
||||
{
|
||||
__chipModel = m;
|
||||
}
|
||||
|
||||
uint8_t __chipModel;
|
||||
uint32_t __protectedMask;
|
||||
|
||||
};
|
||||
|
||||
286
ports/espressif/components/XPowersLib/src/XPowersParams.hpp
Normal file
286
ports/espressif/components/XPowersLib/src/XPowersParams.hpp
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
/**
|
||||
*
|
||||
* @license MIT License
|
||||
*
|
||||
* Copyright (c) 2022 lewis he
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* @file XPowersParams.hpp
|
||||
* @author Lewis He (lewishe@outlook.com)
|
||||
* @date 2022-08-28
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _BV
|
||||
#undef _BV
|
||||
#endif
|
||||
#define _BV(b) (1ULL << (uint64_t)(b))
|
||||
|
||||
|
||||
//TODO:Unified interface functions and parameters
|
||||
|
||||
/**
|
||||
* @brief PMU PEKEY Press off time parameters.
|
||||
*/
|
||||
typedef enum __xpowers_press_off_time {
|
||||
XPOWERS_POWEROFF_4S,
|
||||
XPOWERS_POWEROFF_6S,
|
||||
XPOWERS_POWEROFF_8S,
|
||||
XPOWERS_POWEROFF_10S,
|
||||
} xpowers_press_off_time_t;
|
||||
|
||||
/**
|
||||
* @brief PMU PEKEY Press on time parameters.
|
||||
*/
|
||||
typedef enum __xpowers_press_on_time {
|
||||
XPOWERS_POWERON_128MS,
|
||||
XPOWERS_POWERON_512MS,
|
||||
XPOWERS_POWERON_1S,
|
||||
XPOWERS_POWERON_2S,
|
||||
} xpowers_press_on_time_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Charging led mode parameters.
|
||||
*/
|
||||
typedef enum __xpowers_chg_led_mode {
|
||||
XPOWERS_CHG_LED_OFF,
|
||||
XPOWERS_CHG_LED_BLINK_1HZ,
|
||||
XPOWERS_CHG_LED_BLINK_4HZ,
|
||||
XPOWERS_CHG_LED_ON,
|
||||
XPOWERS_CHG_LED_CTRL_CHG, // The charging indicator is controlled by the charger
|
||||
} xpowers_chg_led_mode_t;
|
||||
|
||||
/**
|
||||
* @brief axp2101 charge target voltage parameters.
|
||||
*/
|
||||
typedef enum __xpowers_axp2101_chg_vol {
|
||||
XPOWERS_AXP2101_CHG_VOL_4V = 1,
|
||||
XPOWERS_AXP2101_CHG_VOL_4V1,
|
||||
XPOWERS_AXP2101_CHG_VOL_4V2,
|
||||
XPOWERS_AXP2101_CHG_VOL_4V35,
|
||||
XPOWERS_AXP2101_CHG_VOL_4V4,
|
||||
XPOWERS_AXP2101_CHG_VOL_MAX
|
||||
} xpowers_axp2101_chg_vol_t;
|
||||
|
||||
/**
|
||||
* @brief axp2101 charge currnet voltage parameters.
|
||||
*/
|
||||
typedef enum __xpowers_axp2101_chg_curr {
|
||||
XPOWERS_AXP2101_CHG_CUR_0MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_100MA = 4,
|
||||
XPOWERS_AXP2101_CHG_CUR_125MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_150MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_175MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_200MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_300MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_400MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_500MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_600MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_700MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_800MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_900MA,
|
||||
XPOWERS_AXP2101_CHG_CUR_1000MA,
|
||||
} xpowers_axp2101_chg_curr_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief axp192 charge target voltage parameters.
|
||||
*/
|
||||
typedef enum __xpowers_axp192_chg_vol {
|
||||
XPOWERS_AXP192_CHG_VOL_4V1,
|
||||
XPOWERS_AXP192_CHG_VOL_4V15,
|
||||
XPOWERS_AXP192_CHG_VOL_4V2,
|
||||
XPOWERS_AXP192_CHG_VOL_4V36,
|
||||
XPOWERS_AXP192_CHG_VOL_MAX,
|
||||
} xpowers_axp192_chg_vol_t;
|
||||
|
||||
/**
|
||||
* @brief axp192 charge currnet voltage parameters.
|
||||
*/
|
||||
typedef enum __xpowers_axp192_chg_curr {
|
||||
XPOWERS_AXP192_CHG_CUR_100MA,
|
||||
XPOWERS_AXP192_CHG_CUR_190MA,
|
||||
XPOWERS_AXP192_CHG_CUR_280MA,
|
||||
XPOWERS_AXP192_CHG_CUR_360MA,
|
||||
XPOWERS_AXP192_CHG_CUR_450MA,
|
||||
XPOWERS_AXP192_CHG_CUR_550MA,
|
||||
XPOWERS_AXP192_CHG_CUR_630MA,
|
||||
XPOWERS_AXP192_CHG_CUR_700MA,
|
||||
XPOWERS_AXP192_CHG_CUR_780MA,
|
||||
XPOWERS_AXP192_CHG_CUR_880MA,
|
||||
XPOWERS_AXP192_CHG_CUR_960MA,
|
||||
XPOWERS_AXP192_CHG_CUR_1000MA,
|
||||
XPOWERS_AXP192_CHG_CUR_1080MA,
|
||||
XPOWERS_AXP192_CHG_CUR_1160MA,
|
||||
XPOWERS_AXP192_CHG_CUR_1240MA,
|
||||
XPOWERS_AXP192_CHG_CUR_1320MA,
|
||||
} xpowers_axp192_chg_curr_t;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief axp2101 vbus currnet limit parameters.
|
||||
*/
|
||||
typedef enum {
|
||||
XPOWERS_AXP2101_VBUS_CUR_LIM_100MA,
|
||||
XPOWERS_AXP2101_VBUS_CUR_LIM_500MA,
|
||||
XPOWERS_AXP2101_VBUS_CUR_LIM_900MA,
|
||||
XPOWERS_AXP2101_VBUS_CUR_LIM_1000MA,
|
||||
XPOWERS_AXP2101_VBUS_CUR_LIM_1500MA,
|
||||
XPOWERS_AXP2101_VBUS_CUR_LIM_2000MA,
|
||||
} xpowers_axp2101_vbus_cur_limit_t;
|
||||
|
||||
/**
|
||||
* @brief axp192 vbus currnet limit parameters.
|
||||
*/
|
||||
typedef enum {
|
||||
XPOWERS_AXP192_VBUS_CUR_LIM_500MA,
|
||||
XPOWERS_AXP192_VBUS_CUR_LIM_100MA,
|
||||
XPOWERS_AXP192_VBUS_CUR_LIM_OFF,
|
||||
} xpowers_axp192_vbus_cur_limit_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief axp192 interrupt control mask parameters.
|
||||
*/
|
||||
typedef enum __xpowers_axp192_irq {
|
||||
//! IRQ1 REG 40H
|
||||
XPOWERS_AXP192_VBUS_VHOLD_LOW_IRQ = _BV(1), //VBUS is available, but lower than V HOLD, IRQ enable
|
||||
XPOWERS_AXP192_VBUS_REMOVE_IRQ = _BV(2), //VBUS removed, IRQ enable
|
||||
XPOWERS_AXP192_VBUS_INSERT_IRQ = _BV(3), //VBUS connected, IRQ enable
|
||||
XPOWERS_AXP192_VBUS_OVER_VOL_IRQ = _BV(4), //VBUS over-voltage, IRQ enable
|
||||
XPOWERS_AXP192_ACIN_REMOVED_IRQ = _BV(5), //ACIN removed, IRQ enable
|
||||
XPOWERS_AXP192_ACIN_CONNECT_IRQ = _BV(6), //ACIN connected, IRQ enable
|
||||
XPOWERS_AXP192_ACIN_OVER_VOL_IRQ = _BV(7), //ACIN over-voltage, IRQ enable
|
||||
|
||||
//! IRQ2 REG 41H
|
||||
XPOWERS_AXP192_BATT_LOW_TEMP_IRQ = _BV(8), //Battery low-temperature, IRQ enable
|
||||
XPOWERS_AXP192_BATT_OVER_TEMP_IRQ = _BV(9), //Battery over-temperature, IRQ enable
|
||||
XPOWERS_AXP192_BAT_CHG_DONE_IRQ = _BV(10), //Charge finished, IRQ enable
|
||||
XPOWERS_AXP192_BAT_CHG_START_IRQ = _BV(11), //Be charging, IRQ enable
|
||||
XPOWERS_AXP192_BATT_EXIT_ACTIVATE_IRQ = _BV(12), //Exit battery activate mode, IRQ enable
|
||||
XPOWERS_AXP192_BATT_ACTIVATE_IRQ = _BV(13), //Battery activate mode, IRQ enable
|
||||
XPOWERS_AXP192_BAT_REMOVE_IRQ = _BV(14), //Battery removed, IRQ enable
|
||||
XPOWERS_AXP192_BAT_INSERT_IRQ = _BV(15), //Battery connected, IRQ enable
|
||||
|
||||
//! IRQ3 REG 42H
|
||||
XPOWERS_AXP192_PKEY_LONG_IRQ = _BV(16), //PEK long press, IRQ enable
|
||||
XPOWERS_AXP192_PKEY_SHORT_IRQ = _BV(17), //PEK short press, IRQ enable
|
||||
//**Reserved and unchangeable BIT 2
|
||||
XPOWERS_AXP192_DC3_LOW_VOL_IRQ = _BV(19), //DC-DC3output voltage is lower than the set value, IRQ enable
|
||||
XPOWERS_AXP192_DC2_LOW_VOL_IRQ = _BV(20), //DC-DC2 output voltage is lower than the set value, IRQ enable
|
||||
XPOWERS_AXP192_DC1_LOW_VOL_IRQ = _BV(21), //DC-DC1 output voltage is lower than the set value, IRQ enable
|
||||
XPOWERS_AXP192_CHARGE_LOW_CUR_IRQ = _BV(22), //Charge current is lower than the set current, IRQ enable
|
||||
XPOWERS_AXP192_CHIP_TEMP_HIGH_IRQ = _BV(23), //XPOWERS internal over-temperature, IRQ enable
|
||||
|
||||
//! IRQ4 REG 43H
|
||||
XPOWERS_AXP192_APS_LOW_VOL_LEVEL_IRQ = _BV(24), //APS low-voltage, IRQ enable
|
||||
//**Reserved and unchangeable BIT 1
|
||||
XPOWERS_AXP192_VBUS_SESSION_END_IRQ = _BV(26), //VBUS Session End IRQ enable
|
||||
XPOWERS_AXP192_VBUS_SESSION_AB_IRQ = _BV(27), //VBUS Session A/B IRQ enable
|
||||
XPOWERS_AXP192_VBUS_INVALID_IRQ = _BV(28), //VBUS invalid, IRQ enable
|
||||
XPOWERS_AXP192_VBUS_VAILD_IRQ = _BV(29), //VBUS valid, IRQ enable
|
||||
XPOWERS_AXP192_NOE_OFF_IRQ = _BV(30), //N_OE shutdown, IRQ enable
|
||||
XPOWERS_AXP192_NOE_ON_IRQ = _BV(31), //N_OE startup, IRQ enable
|
||||
|
||||
//! IRQ5 REG 4AH
|
||||
XPOWERS_AXP192_GPIO0_EDGE_TRIGGER_IRQ = _BV(32), //GPIO0 input edge trigger, IRQ enable
|
||||
XPOWERS_AXP192_GPIO1_EDGE_TRIGGER_IRQ = _BV(33), //GPIO1input edge trigger or ADC input, IRQ enable
|
||||
XPOWERS_AXP192_GPIO2_EDGE_TRIGGER_IRQ = _BV(34), //GPIO2input edge trigger, IRQ enable
|
||||
//**Reserved and unchangeable BIT 3
|
||||
//**Reserved and unchangeable BIT 4
|
||||
//**Reserved and unchangeable BIT 5
|
||||
//**Reserved and unchangeable BIT 6
|
||||
XPOWERS_AXP192_TIMER_TIMEOUT_IRQ = _BV(39), //Timer timeout, IRQ enable
|
||||
|
||||
XPOWERS_AXP192_ALL_IRQ = (0xFFFFFFFFFFULL)
|
||||
} xpowers_axp192_irq_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief axp2101 interrupt control mask parameters.
|
||||
*/
|
||||
typedef enum __xpowers_axp2101_irq {
|
||||
//! IRQ1 REG 40H
|
||||
XPOWERS_AXP2101_BAT_NOR_UNDER_TEMP_IRQ = _BV(0), // Battery Under Temperature in Work
|
||||
XPOWERS_AXP2101_BAT_NOR_OVER_TEMP_IRQ = _BV(1), // Battery Over Temperature in Work mode
|
||||
XPOWERS_AXP2101_BAT_CHG_UNDER_TEMP_IRQ = _BV(2), // Battery Under Temperature in Charge mode IRQ(bcut_irq)
|
||||
XPOWERS_AXP2101_BAT_CHG_OVER_TEMP_IRQ = _BV(3), // Battery Over Temperature in Charge mode IRQ(bcot_irq) enable
|
||||
XPOWERS_AXP2101_GAUGE_NEW_SOC_IRQ = _BV(4), // Gauge New SOC IRQ(lowsoc_irq) enable ???
|
||||
XPOWERS_AXP2101_WDT_TIMEOUT_IRQ = _BV(5), // Gauge Watchdog Timeout IRQ(gwdt_irq) enable
|
||||
XPOWERS_AXP2101_WARNING_LEVEL1_IRQ = _BV(6), // SOC drop to Warning Level1 IRQ(socwl1_irq) enable
|
||||
XPOWERS_AXP2101_WARNING_LEVEL2_IRQ = _BV(7), // SOC drop to Warning Level2 IRQ(socwl2_irq) enable
|
||||
|
||||
//! IRQ2 REG 41H
|
||||
XPOWERS_AXP2101_PKEY_POSITIVE_IRQ = _BV(8), // POWERON Positive Edge IRQ(ponpe_irq_en) enable
|
||||
XPOWERS_AXP2101_PKEY_NEGATIVE_IRQ = _BV(9), // POWERON Negative Edge IRQ(ponne_irq_en) enable
|
||||
XPOWERS_AXP2101_PKEY_LONG_IRQ = _BV(10), // POWERON Long PRESS IRQ(ponlp_irq) enable
|
||||
XPOWERS_AXP2101_PKEY_SHORT_IRQ = _BV(11), // POWERON Short PRESS IRQ(ponsp_irq_en) enable
|
||||
XPOWERS_AXP2101_BAT_REMOVE_IRQ = _BV(12), // Battery Remove IRQ(bremove_irq) enable
|
||||
XPOWERS_AXP2101_BAT_INSERT_IRQ = _BV(13), // Battery Insert IRQ(binsert_irq) enabl
|
||||
XPOWERS_AXP2101_VBUS_REMOVE_IRQ = _BV(14), // VBUS Remove IRQ(vremove_irq) enabl
|
||||
XPOWERS_AXP2101_VBUS_INSERT_IRQ = _BV(15), // VBUS Insert IRQ(vinsert_irq) enable
|
||||
|
||||
//! IRQ3 REG 42H
|
||||
XPOWERS_AXP2101_BAT_OVER_VOL_IRQ = _BV(16), // Battery Over Voltage Protection IRQ(bovp_irq) enable
|
||||
XPOWERS_AXP2101_CHAGER_TIMER_IRQ = _BV(17), // Charger Safety Timer1/2 expire IRQ(chgte_irq) enable
|
||||
XPOWERS_AXP2101_DIE_OVER_TEMP_IRQ = _BV(18), // DIE Over Temperature level1 IRQ(dotl1_irq) enable
|
||||
XPOWERS_AXP2101_BAT_CHG_START_IRQ = _BV(19), // Charger start IRQ(chgst_irq) enable
|
||||
XPOWERS_AXP2101_BAT_CHG_DONE_IRQ = _BV(20), // Battery charge done IRQ(chgdn_irq) enable
|
||||
XPOWERS_AXP2101_BATFET_OVER_CURR_IRQ = _BV(21), // BATFET Over Current Protection IRQ(bocp_irq) enable
|
||||
XPOWERS_AXP2101_LDO_OVER_CURR_IRQ = _BV(22), // LDO Over Current IRQ(ldooc_irq) enable
|
||||
XPOWERS_AXP2101_WDT_EXPIRE_IRQ = _BV(23), // Watchdog Expire IRQ(wdexp_irq) enable
|
||||
|
||||
XPOWERS_AXP2101_ALL_IRQ = (0xFFFFFFFFUL)
|
||||
} xpowers_axp2101_irq_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in a new issue