diff src/cs/drivers/drv_app/fchg/fchg_struct.h @ 61:75067af48bfd

FCHG updates for Tourmaline UI integration
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 22 Oct 2020 22:30:49 +0000
parents 4e78acac3d88
children 769cf6273fe4
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/fchg/fchg_struct.h	Wed Oct 21 03:31:04 2020 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_struct.h	Thu Oct 22 22:30:49 2020 +0000
@@ -38,7 +38,14 @@
 	T_PWR_PERCENT	remain_capa;
 } T_PWR_THRESHOLDS;
 
-#define	MAX_THRESHOLDS	101
+#define	MIN_PERCENT_THRESH	5
+#define	MAX_PERCENT_THRESH	21	/* allowing 5% steps */
+#define	NB_BARS_THRESH		4
+
+struct battery_config {
+	UINT8			bars_thresh[NB_BARS_THRESH];
+	T_PWR_THRESHOLDS	percent_thresh[MAX_PERCENT_THRESH];
+};
 
 #define	ICHG_AVG_WINDOW	6
 
@@ -46,17 +53,20 @@
 	/* RiViera boilerplate */
 	T_RVF_ADDR_ID		addr_id;
 	T_RVF_MB_ID		prim_id;
+	/* interface to upper layers */
+	T_FCHG_EVENT_HANDLER	event_handler;
 	/* configuration */
 	struct charging_config	config;
 	BOOL			config_present;
-	T_PWR_THRESHOLDS	batt_thresholds[MAX_THRESHOLDS];
-	UINT16			nb_thresholds;
+	struct battery_config	batt;
+	UINT16			nb_percent_thresh;
 	/* state */
 	enum fchg_state		state;
 	UINT16			batt_mv;
 	UINT16			curr_disch_thresh;
 	/* valid only during a charging cycle */
 	UINT16			i2v_offset;
+	UINT16			ci_ichg;
 	UINT16			cv_dac_init;
 	UINT16			cv_dac_curr;
 	UINT16			cv_high_vbat_count;