9#define AXP192_DC_VOLT_STEP 25
10#define AXP192_DC_VOLT_MIN 700
11#define AXP192_DC_VOLT_MAX 3500
13#define AXP192_LDO_VOLT_STEP 100
14#define AXP192_LDO_VOLT_MIN 1800
15#define AXP192_LDO_VOLT_MAX 3300
17#define AXP192_VOFF_VOLT_STEP 100
18#define AXP192_VOFF_VOLT_MIN 2600
19#define AXP192_VOFF_VOLT_MAX 3300
21#define AXP192_LDO23_DC123_EXT_CTL_REG 0x12
22#define AXP192_DC1_EN_BIT (0)
23#define AXP192_DC3_EN_BIT (1)
24#define AXP192_LDO2_EN_BIT (2)
25#define AXP192_LDO3_EN_BIT (3)
26#define AXP192_DC2_EN_BIT (4)
27#define AXP192_EXT_EN_BIT (6)
29#define AXP192_DC1_VOLT_REG 0x26
30#define AXP192_DC2_VOLT_REG 0x23
31#define AXP192_DC3_VOLT_REG 0x27
32#define AXP192_LDO23_VOLT_REG 0x28
33#define AXP192_VBUS_IPSOUT_CTL_REG 0x30
34#define AXP192_VOFF_VOLT_REG 0x31
35#define AXP192_POWEROFF_REG 0x32
36#define AXP192_CHG_CTL1_REG 0x33
37#define AXP192_CHG_CTL2_REG 0x34
38#define AXP192_SPARE_CHG_CTL_REG 0x35
39#define AXP192_PEK_CTL_REG 0x36
40#define AXP192_CHG_BOOL_REG 0x01
42#define AXP192_ADC1_ENABLE_REG 0x82
43#define BAT_VOLT_BIT (7)
44#define BAT_CURRENT_BIT (6)
45#define ACIN_VOLT_BIT (5)
46#define ACIN_CURRENT_BIT (4)
47#define VBUS_VOLT_BIT (3)
48#define VBUS_CURRENT_BIT (2)
49#define APS_VOLT_BIT (1)
52#define AXP192_ACIN_ADC_VOLTAGE_REG 0x56
53#define AXP192_ACIN_ADC_CURRENT_REG 0x58
55#define AXP192_VBUS_ADC_VOLTAGE_REG 0x5A
56#define AXP192_VBUS_ADC_CURRENT_REG 0x5C
58#define AXP192_BAT_ADC_VOLTAGE_REG 0x78
59#define AXP192_BAT_ADC_CURRENT_IN_REG 0x7A
60#define AXP192_BAT_ADC_CURRENT_OUT_REG 0x7C
62#define AXP192_GPIO0_CTL_REG 0x90
63#define AXP192_GPIO0_VOLT_REG 0x91
64#define AXP192_GPIO1_CTL_REG 0x92
65#define AXP192_GPIO2_CTL_REG 0x93
66#define AXP192_GPIO34_CTL_REG 0x95
68#define AXP192_GPIO34_STATE_REG 0x96
69#define AXP192_GPIO012_STATE_REG 0x94
void Axp192_IsCharging()
Definition: axp192.c:179
void Axp192_IsBatIn()
Definition: axp192.c:175
Axp192_SpareChargeCurrent_t
Definition: axp192.h:113
@ SPARE_CHARGE_Current_100uA
Definition: axp192.h:115
@ SPARE_CHARGE_Current_200uA
Definition: axp192.h:116
@ SPARE_CHARGE_Current_400uA
Definition: axp192.h:117
@ SPARE_CHARGE_Current_50uA
Definition: axp192.h:114
void Axp192_EnableCharge(uint16_t state)
Enables or disables the battery charging circuit on the AXP192.
Definition: axp192.c:138
void Axp192_SetLDO23Volt(uint16_t ldo2_voltage, uint16_t ldo3_voltage)
Set both LDO 2 and LDO 3 voltage on the AXP192.
Definition: axp192.c:51
void Axp192_SetChargeCurrent(Axp192_ChargeCurrent_t cur)
Set the battery charge current on the AXP192.
Definition: axp192.c:147
void Axp192_GetInternalTemp()
Definition: axp192.c:163
void Axp192_SetChargeVoltage(Axp192_ChargeVolt_t volt)
Set the battery charge voltage on the AXP192.
Definition: axp192.c:143
float Axp192_GetBatCurrent()
Gets battery current flowing through the AXP192.
Definition: axp192.c:131
void Axp192_SetLDO2Volt(uint16_t voltage)
Set the LDO 2 voltage on the AXP192.
Definition: axp192.c:60
void Axp192_ReadDataStash()
Definition: axp192.c:199
void Axp192_EnableLDODCExt(uint8_t value)
Extends the DC voltage range of the Low-Dropout regulator (LDO) on the AXP192.
Definition: axp192.c:13
Axp192_ChargeCurrent_t
List of available charging current rates.
Definition: axp192.h:87
@ CHARGE_Current_630mA
Charge at 630mA.
Definition: axp192.h:94
@ CHARGE_Current_100mA
Charge at 100mA.
Definition: axp192.h:88
@ CHARGE_Current_1160mA
Charge at 1160mA.
Definition: axp192.h:101
@ CHARGE_Current_1240mA
Charge at 1240mA.
Definition: axp192.h:102
@ CHARGE_Current_960mA
Charge at 960mA.
Definition: axp192.h:98
@ CHARGE_Current_880mA
Charge at 880mA.
Definition: axp192.h:97
@ CHARGE_Current_1080mA
Charge at 1080mA.
Definition: axp192.h:100
@ CHARGE_Current_550mA
Charge at 550mA.
Definition: axp192.h:93
@ CHARGE_Current_1320mA
Charge at 1320mA.
Definition: axp192.h:103
@ CHARGE_Current_780mA
Charge at 780mA.
Definition: axp192.h:96
@ CHARGE_Current_190mA
Charge at 190mA.
Definition: axp192.h:89
@ CHARGE_Current_280mA
Charge at 280mA.
Definition: axp192.h:90
@ CHARGE_Current_450mA
Charge at 450mA.
Definition: axp192.h:92
@ CHARGE_Current_360mA
Charge at 360mA.
Definition: axp192.h:91
@ CHARGE_Current_1000mA
Charge at 1000mA.
Definition: axp192.h:99
@ CHARGE_Current_700mA
Charge at 700mA.
Definition: axp192.h:95
void Axp192_SetGPIO0Volt(uint16_t volt)
Sets the voltage of GPIO 0 on the AXP192.
Definition: axp192.c:215
float Axp192_GetAcinVolt()
Gets ACIN voltage on the AXP192.
Definition: axp192.c:111
void Axp192_SetLDO3Volt(uint16_t voltage)
Set the Low-Dropout (LDO) 3 voltage on the AXP192.
Definition: axp192.c:67
void Axp192_EnableDCDC3(uint8_t state)
Enables or disables DC/DC 3 Buck Boost converter.
Definition: axp192.c:46
float Axp192_GetBatVolt()
Gets battery voltage on the AXP192.
Definition: axp192.c:116
void Axp192_SetSpareBatCharge(uint8_t enable, Axp192_SpareChargeVolt_t volt, Axp192_SpareChargeCurrent_t current)
Definition: axp192.c:151
void Axp192_SetDCDC1Volt(uint16_t voltage)
Set the DC/DC 1 Buck Boost converter voltage on the AXP192.
Definition: axp192.c:74
void Axp192_SetPressStartupTime(Axp192_StartupTime_t time)
Sets how long the power button needs to be held to power on all components connected to the AXP192.
Definition: axp192.c:191
void Axp192_SetGPIO0Mode(uint8_t mode)
Sets the mode of GPIO 0 on the AXP192.
Definition: axp192.c:207
void Axp192_SetDCDC3Volt(uint16_t voltage)
Set the DC/DC 3 Buck Boost converter voltage on the AXP192.
Definition: axp192.c:88
Axp192_StartupTime_t
List of possible durations the power button must be held to power on the Core2 for AWS IoT EduKit.
Definition: axp192.h:125
@ STARTUP_2S
Power button hold for 2s to turn on.
Definition: axp192.h:129
@ STARTUP_1S
Power button hold for 1s to turn on.
Definition: axp192.h:128
@ STARTUP_128mS
Power button hold for 128ms to turn on.
Definition: axp192.h:126
@ STARTUP_512mS
Power button hold for 512ms to turn on.
Definition: axp192.h:127
void Axp192_PowerOff()
Powers down the device.
Definition: axp192.c:183
void Axp192_SetGPIO4Level(uint8_t level)
Sets the signal status level of GPIO 4.
Definition: axp192.c:245
Axp192_PoweroffTime_t
List of possible durations the power button must be held to power off the Core2 for AWS IoT EduKit.
Definition: axp192.h:138
@ POWEROFF_8S
Power button hold for 8s to turn off.
Definition: axp192.h:141
@ POWEROFF_4S
Power button hold for 4s to turn off.
Definition: axp192.h:139
@ POWEROFF_10S
Power button hold for 10s to turn off.
Definition: axp192.h:142
@ POWEROFF_6S
Power button hold for 6s to turn off.
Definition: axp192.h:140
void Axp192_SetGPIO2Mode(uint8_t mode)
Sets the mode of GPIO 2 on the AXP192.
Definition: axp192.c:231
Axp192_ChargeVolt_t
List of available charging voltages.
Definition: axp192.h:75
@ CHARGE_VOLT_4200mV
Charge at 4.20v.
Definition: axp192.h:78
@ CHARGE_VOLT_4100mV
Charge at 4.10v.
Definition: axp192.h:76
@ CHARGE_VOLT_4150mV
Charge at 4.15v.
Definition: axp192.h:77
@ CHARGE_VOLT_4360mV
Charge at 4.36v.
Definition: axp192.h:79
float Axp192_GetVbusCurrent()
Gets VBUS current flowing through the AXP192.
Definition: axp192.c:121
void Axp192_SetGPIO1Mode(uint8_t mode)
Sets the mode of GPIO 1 on the AXP192.
Definition: axp192.c:222
float Axp192_GetVbusVolt()
Gets VBUS voltage on the AXP192.
Definition: axp192.c:106
void Axp192_SetGPIO1Level(uint8_t level)
Sets the average voltage level of GPIO 1 on the AXP192 if the mode is set to PWM.
Definition: axp192.c:226
void Axp192_EnableExten(uint8_t state)
Enables or disables extending the Low-Dropout (LDO) voltage on the AXP192.
Definition: axp192.c:21
void Axp192_EnableLDO3(uint8_t state)
Enables or disables Low-Dropout (LDO) 3 on the AXP192.
Definition: axp192.c:31
void Axp192_SetGPIO4Mode(uint8_t mode)
Sets the mode of GPIO 4 on the AXP192 for charging control.
Definition: axp192.c:240
void Axp192_EnablePWRONShortWake()
Enable sleep and short wake mode on AXP192.
Definition: axp192.c:102
void Axp192_SetVoffVolt(uint16_t voltage)
Set the battery low-voltage to cut-off on the AXP192.
Definition: axp192.c:95
void Axp192_SetGPIO2Level(uint8_t level)
Sets the average voltage level of GPIO 2 on the AXP192 if the mode is set to PWM.
Definition: axp192.c:235
void Axp192_SetAdc2Enable()
Definition: axp192.c:171
void Axp192_Init()
Initializes the AXP192 over I2C.
Definition: axp192.c:9
void Axp192_EnableDCDC1(uint8_t state)
Enables or disables DC/DC 1 Buck Boost converter on the AXP192.
Definition: axp192.c:36
void Axp192_EnableLDO2(uint8_t state)
Enables or disables Low-Dropout (LDO) 2 on the AXP192.
Definition: axp192.c:26
void Axp192_SetDCDC2Volt(uint16_t voltage)
Set the DC/DC 2 Buck Boost converter voltage on the AXP192.
Definition: axp192.c:81
float Axp192_GetAcinCurrent()
Gets ACIN current flowing through the AXP192.
Definition: axp192.c:126
Axp192_SpareChargeVolt_t
Definition: axp192.h:107
@ SPARE_CHARGE_VOLT_3000mV
Definition: axp192.h:109
@ SPARE_CHARGE_VOLT_3100mV
Definition: axp192.h:108
@ SPARE_CHARGE_VOLT_2500mV
Definition: axp192.h:110
void Axp192_WriteDataStash()
Definition: axp192.c:195
void Axp192_SetPressPoweroffTime(Axp192_PoweroffTime_t time)
Sets how long the power button needs to be held to power off all components connected to the AXP192.
Definition: axp192.c:187
void Axp192_SetAdc1Enable(uint8_t value)
Enables or disables the ADC on the AXP192.
Definition: axp192.c:167
void Axp192_EnableDCDC2(uint8_t state)
Enables or disables DC/DC 2 Buck Boost converter on the AXP192.
Definition: axp192.c:41
void Axp192_GetApsVoltage()
Definition: axp192.c:159