2020-2021 Sunseeker Telemetry and Lighting System
battbak.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // battbak.h - Driver for the BATTBAK Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_BATTBAK_H__
8 #define __MSP430WARE_BATTBAK_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_BATTERY_CHARGER__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed toThe following are values that
28 // can be returned by the BattBak_unlockBackupSubSystem() function.
29 //
30 //*****************************************************************************
31 #define BATTBAK_UNLOCKFAILURE (LOCKBAK)
32 #define BATTBAK_UNLOCKSUCCESS (0x0)
33 
34 //*****************************************************************************
35 //
36 // The following are values that can be passed to the chargerEndVoltage
37 // parameter for functions: BattBak_initAndEnableCharger().
38 //
39 //*****************************************************************************
40 #define BATTBAK_CHARGERENDVOLTAGE_VCC (BAKCHV0)
41 #define BATTBAK_CHARGERENDVOLTAGE2_7V (BAKCHV1)
42 
43 //*****************************************************************************
44 //
45 // The following are values that can be passed to the chargeCurrent parameter
46 // for functions: BattBak_initAndEnableCharger().
47 //
48 //*****************************************************************************
49 #define BATTBAK_CHARGECURRENT_5KOHM (BAKCHC0)
50 #define BATTBAK_CHARGECURRENT_10KOHM (BAKCHC1)
51 #define BATTBAK_CHARGECURRENT_20KOHM (BAKCHC0 + BAKCHC1)
52 
53 //*****************************************************************************
54 //
55 // The following are values that can be passed to the backupRAMSelect parameter
56 // for functions: BattBak_setBackupRAMData(), and BattBak_getBackupRAMData().
57 //
58 //*****************************************************************************
59 #define BATTBAK_RAMSELECT_0 (0x0000)
60 #define BATTBAK_RAMSELECT_1 (0x0002)
61 #define BATTBAK_RAMSELECT_2 (0x0004)
62 #define BATTBAK_RAMSELECT_3 (0x0006)
63 
64 //*****************************************************************************
65 //
66 // Prototypes for the APIs.
67 //
68 //*****************************************************************************
69 
70 //*****************************************************************************
71 //
88 //
89 //*****************************************************************************
90 extern uint16_t BattBak_unlockBackupSubSystem(uint16_t baseAddress);
91 
92 //*****************************************************************************
93 //
104 //
105 //*****************************************************************************
106 extern void BattBak_enableBackupSupplyToADC(uint16_t baseAddress);
107 
108 //*****************************************************************************
109 //
118 //
119 //*****************************************************************************
120 extern void BattBak_disableBackupSupplyToADC(uint16_t baseAddress);
121 
122 //*****************************************************************************
123 //
133 //
134 //*****************************************************************************
135 extern void BattBak_switchToBackupSupplyManually(uint16_t baseAddress);
136 
137 //*****************************************************************************
138 //
147 //
148 //*****************************************************************************
149 extern void BattBak_disable(uint16_t baseAddress);
150 
151 //*****************************************************************************
152 //
176 //
177 //*****************************************************************************
178 extern void BattBak_initAndEnableCharger(uint16_t baseAddress,
179  uint8_t chargerEndVoltage,
180  uint8_t chargeCurrent);
181 
182 //*****************************************************************************
183 //
193 //
194 //*****************************************************************************
195 extern void BattBak_disableCharger(uint16_t baseAddress);
196 
197 //*****************************************************************************
198 //
214 //
215 //*****************************************************************************
216 extern void BattBak_setBackupRAMData(uint16_t baseAddress,
217  uint8_t backupRAMSelect,
218  uint16_t data);
219 
220 //*****************************************************************************
221 //
236 //
237 //*****************************************************************************
238 extern uint16_t BattBak_getBackupRAMData(uint16_t baseAddress,
239  uint8_t backupRAMSelect);
240 
241 //*****************************************************************************
242 //
243 // Mark the end of the C bindings section for C++ compilers.
244 //
245 //*****************************************************************************
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif
251 #endif // __MSP430WARE_BATTBAK_H__