annotate src/cs/drivers/drv_app/fchg/fchg_struct.h @ 335:6c0659acf93e

FCHG: implemented functions for user-initiated charge start and stop
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 14 Dec 2017 20:41:18 +0000
parents 8a90038c0173
children ce6d71349af0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
322
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Internal structure definitions for the FCHG SWE reside here.
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * abb_inth.c will also need to include this header in order to
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * get our T_PWR_CTRL_BLOCK definition.
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #ifndef __FCHG_STRUCT_H
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #define __FCHG_STRUCT_H
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "rv/rv_general.h"
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "rvf/rvf_api.h"
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "fchg/fchg_common.h"
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 struct charging_config {
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 UINT16 start_delay;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 UINT16 start_thresh;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 UINT16 restart_thresh;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 UINT16 charge_to_mv;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 UINT16 overvoltage;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 UINT16 ci_current;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 UINT16 end_current;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 UINT16 bciconf;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 };
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 /* from original PWR SWE */
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 typedef struct {
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 UINT16 bat_voltage;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 T_PWR_PERCENT remain_capa;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 } T_PWR_THRESHOLDS;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #define MAX_THRESHOLDS 101
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 typedef struct {
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /* RiViera boilerplate */
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 T_RVF_ADDR_ID addr_id;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 T_RVF_MB_ID prim_id;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /* configuration */
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 struct charging_config config;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 BOOL config_present;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 T_PWR_THRESHOLDS batt_thresholds[MAX_THRESHOLDS];
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 UINT16 nb_thresholds;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 /* state */
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 enum fchg_state state;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 UINT16 batt_mv;
333
8a90038c0173 FCHG: store discharge state as threshold index rather than percentage
Mychaela Falconia <falcon@freecalypso.org>
parents: 331
diff changeset
45 UINT16 curr_disch_thresh;
331
8166b0afcf8c FCHG: main ADC process implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 322
diff changeset
46 /* valid only during a charging cycle */
8166b0afcf8c FCHG: main ADC process implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 322
diff changeset
47 UINT16 i2v_offset;
322
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 } T_PWR_CTRL_BLOCK;
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
c4077830aeeb FCHG implementation code started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #endif /* include guard */