summaryrefslogtreecommitdiff
path: root/firmware/export/axp173.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/axp173.h')
-rw-r--r--firmware/export/axp173.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/firmware/export/axp173.h b/firmware/export/axp173.h
index 60519138e1..34f0c2ec19 100644
--- a/firmware/export/axp173.h
+++ b/firmware/export/axp173.h
@@ -25,6 +25,7 @@
25#include <stdbool.h> 25#include <stdbool.h>
26#include <stdint.h> 26#include <stdint.h>
27 27
28/* ADC channels */
28#define ADC_ACIN_VOLTAGE 0 29#define ADC_ACIN_VOLTAGE 0
29#define ADC_ACIN_CURRENT 1 30#define ADC_ACIN_CURRENT 1
30#define ADC_VBUS_VOLTAGE 2 31#define ADC_VBUS_VOLTAGE 2
@@ -55,6 +56,25 @@
55#define AXP173_INPUT_BATTERY (1 << 2) 56#define AXP173_INPUT_BATTERY (1 << 2)
56#define AXP173_INPUT_EXTERNAL (AXP173_INPUT_AC|AXP173_INPUT_USB) 57#define AXP173_INPUT_EXTERNAL (AXP173_INPUT_AC|AXP173_INPUT_USB)
57 58
59/* Registers -- common to AXP173 and AXP192 (incomplete listing) */
60#define AXP173_REG_POWERSTATUS 0x00
61#define AXP173_REG_CHARGESTATUS 0x01
62#define AXP173_REG_PWROUTPUTCTRL 0x12
63#define AXP173_REG_SHUTDOWNLEDCTRL 0x32
64#define AXP173_REG_CHARGECONTROL1 0x33
65#define AXP173_REG_DCDCWORKINGMODE 0x80
66#define AXP173_REG_ADCENABLE1 0x82
67#define AXP173_REG_ADCENABLE2 0x83
68#define AXP173_REG_ADCSAMPLERATE 0x84
69#define AXP173_REG_COULOMBCOUNTERBASE 0xb0
70#define AXP173_REG_COULOMBCOUNTERCTRL 0xb8
71
72/* AXP192-only registers (incomplete listing) */
73#define AXP192_REG_GPIO0FUNCTION 0x90
74#define AXP192_REG_GPIO1FUNCTION 0x92
75#define AXP192_REG_GPIO2FUNCTION 0x93
76#define AXP192_REG_GPIOSTATE1 0x94
77
58/* Must be called from power_init() to initialize the driver state */ 78/* Must be called from power_init() to initialize the driver state */
59extern void axp173_init(void); 79extern void axp173_init(void);
60 80
@@ -88,6 +108,10 @@ extern void axp173_cc_read(uint32_t* charge, uint32_t* discharge);
88extern void axp173_cc_clear(void); 108extern void axp173_cc_clear(void);
89extern void axp173_cc_enable(bool en); 109extern void axp173_cc_enable(bool en);
90 110
111/* Set/get maximum charging current in milliamps */
112extern void axp173_set_charge_current(int maxcurrent);
113extern int axp173_get_charge_current(void);
114
91/* Debug menu */ 115/* Debug menu */
92extern bool axp173_debug_menu(void); 116extern bool axp173_debug_menu(void);
93 117