comparison 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
comparison
equal deleted inserted replaced
60:48f280c19e16 61:75067af48bfd
36 typedef struct { 36 typedef struct {
37 UINT16 bat_voltage; 37 UINT16 bat_voltage;
38 T_PWR_PERCENT remain_capa; 38 T_PWR_PERCENT remain_capa;
39 } T_PWR_THRESHOLDS; 39 } T_PWR_THRESHOLDS;
40 40
41 #define MAX_THRESHOLDS 101 41 #define MIN_PERCENT_THRESH 5
42 #define MAX_PERCENT_THRESH 21 /* allowing 5% steps */
43 #define NB_BARS_THRESH 4
44
45 struct battery_config {
46 UINT8 bars_thresh[NB_BARS_THRESH];
47 T_PWR_THRESHOLDS percent_thresh[MAX_PERCENT_THRESH];
48 };
42 49
43 #define ICHG_AVG_WINDOW 6 50 #define ICHG_AVG_WINDOW 6
44 51
45 typedef struct { 52 typedef struct {
46 /* RiViera boilerplate */ 53 /* RiViera boilerplate */
47 T_RVF_ADDR_ID addr_id; 54 T_RVF_ADDR_ID addr_id;
48 T_RVF_MB_ID prim_id; 55 T_RVF_MB_ID prim_id;
56 /* interface to upper layers */
57 T_FCHG_EVENT_HANDLER event_handler;
49 /* configuration */ 58 /* configuration */
50 struct charging_config config; 59 struct charging_config config;
51 BOOL config_present; 60 BOOL config_present;
52 T_PWR_THRESHOLDS batt_thresholds[MAX_THRESHOLDS]; 61 struct battery_config batt;
53 UINT16 nb_thresholds; 62 UINT16 nb_percent_thresh;
54 /* state */ 63 /* state */
55 enum fchg_state state; 64 enum fchg_state state;
56 UINT16 batt_mv; 65 UINT16 batt_mv;
57 UINT16 curr_disch_thresh; 66 UINT16 curr_disch_thresh;
58 /* valid only during a charging cycle */ 67 /* valid only during a charging cycle */
59 UINT16 i2v_offset; 68 UINT16 i2v_offset;
69 UINT16 ci_ichg;
60 UINT16 cv_dac_init; 70 UINT16 cv_dac_init;
61 UINT16 cv_dac_curr; 71 UINT16 cv_dac_curr;
62 UINT16 cv_high_vbat_count; 72 UINT16 cv_high_vbat_count;
63 UINT16 cv_low_vbat_count; 73 UINT16 cv_low_vbat_count;
64 UINT16 ichg_avg_buf[ICHG_AVG_WINDOW]; 74 UINT16 ichg_avg_buf[ICHG_AVG_WINDOW];