annotate Small_CPU/Src/batteryGasGauge.c @ 343:c9d217b110cc FlightMode_Improvment

Added compile switch to enable debug view option in system menu Code lines for the option had to be uncommented one by one to get function activated. The compile switch makes life easier
author ideenmodellierer
date Tue, 01 Oct 2019 19:43:30 +0200
parents 2defc8cd93ce
children 2fc08a0d1ec3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file batteryGasGauge.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 09-Dec-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief LTC2942 Battery Gas Gauge
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 ##### stm32f4xx_hal_i2c.c modification #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 The LTC2942 requires an repeated start condition without stop condition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 for data reception.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /* Includes ------------------------------------------------------------------*/
330
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
25 #include <string.h> /* memset */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 #include "batteryGasGauge.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #include "baseCPU2.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #include "i2c.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30
228
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
31 static float battery_f_voltage = 0;
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
32 static float battery_f_charge_percent = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #define BGG_BATTERY_OFFSET (26123) //; 65536-(3,35Ah/0,085mAh)
228
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
35 #define BGG_BATTERY_DIVIDER (394) //; 3,35Ah/0,085mAh/100 [%]
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 float get_voltage(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #ifdef OSTC_ON_DISCOVERY_HARDWARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 return 3.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 return battery_f_voltage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 float get_charge(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 #ifdef OSTC_ON_DISCOVERY_HARDWARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 return 100.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 return battery_f_charge_percent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 void init_battery_gas_gauge(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 #ifdef OSTC_ON_DISCOVERY_HARDWARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 uint8_t buffer[2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 buffer[0] = 0x01;
228
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
65
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
66 // F8 = 11111000:
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
67 // Vbat 3.0V (11)
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
68 // Prescale M = 128 (111)
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
69 // AL/CC pin disable (0)
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
70 // Shutdown (0)
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
71 buffer[1] = 0xF8;
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
72 I2C_Master_Transmit(DEVICE_BATTERYGAUGE, buffer, 2);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74
330
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
75 uint8_t battery_gas_gauge_CheckConfigOK(void)
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
76 {
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
77 #ifdef OSTC_ON_DISCOVERY_HARDWARE
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
78 return;
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
79 #endif
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
80
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
81 uint8_t retval = 0;
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
82 uint8_t bufferReceive[10];
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
83
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
84 memset(bufferReceive,0,sizeof(bufferReceive));
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
85
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
86 I2C_Master_Receive(DEVICE_BATTERYGAUGE, bufferReceive, 10);
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
87 if(bufferReceive[1] == 0xf8)
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
88 {
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
89 retval = 1;
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
90 }
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
91 return retval;
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
92 }
2defc8cd93ce Added check of configuration.
ideenmodellierer
parents: 242
diff changeset
93
242
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
94 static void disable_adc(void)
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
95 {
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
96 uint8_t buffer[2];
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
97 buffer[0] = 0x01;
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
98
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
99 // according to the datasheet of the LTC2942, the adc shall
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
100 // be disabled when writing to the gauge registers
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
101
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
102 // 0xF9 = 11111001:
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
103 // see init_battery_gas_gauge()
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
104 // Shutdown (1)
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
105 buffer[1] = 0xF9;
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
106 I2C_Master_Transmit(DEVICE_BATTERYGAUGE, buffer, 2);
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
107 }
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
108
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 void battery_gas_gauge_get_data(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 #ifdef OSTC_ON_DISCOVERY_HARDWARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 float battery_f_voltage_local;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 float battery_f_charge_percent_local;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 uint8_t bufferReceive[10];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 I2C_Master_Receive( DEVICE_BATTERYGAUGE, bufferReceive, 10);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 battery_f_voltage_local = (float)(bufferReceive[8] * 256);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 battery_f_voltage_local += (float)(bufferReceive[9]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 battery_f_voltage_local *= (float)6 / (float)0xFFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 // max/full: 0.085 mAh * 1 * 65535 = 5570 mAh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 battery_f_charge_percent_local = (float)(bufferReceive[2] * 256);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 battery_f_charge_percent_local += (float)(bufferReceive[3]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 battery_f_charge_percent_local -= BGG_BATTERY_OFFSET;
228
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
130 battery_f_charge_percent_local /= BGG_BATTERY_DIVIDER;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 if(battery_f_charge_percent_local < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 battery_f_charge_percent_local = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 battery_f_voltage = battery_f_voltage_local;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 battery_f_charge_percent = battery_f_charge_percent_local;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 void battery_gas_gauge_set_charge_full(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 {
242
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
142 disable_adc();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 #ifdef OSTC_ON_DISCOVERY_HARDWARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 uint8_t bufferSend[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 bufferSend[0] = 0x02;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 bufferSend[1] = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 bufferSend[2] = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 I2C_Master_Transmit( DEVICE_BATTERYGAUGE, bufferSend, 3);
242
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
152 init_battery_gas_gauge();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 void battery_gas_gauge_set(float percentage)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 {
242
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
158
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
159 disable_adc();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 #ifdef OSTC_ON_DISCOVERY_HARDWARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 uint16_t mAhSend;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 if(percentage >= 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 mAhSend = 0xFFFF;
228
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
168 else {
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
169 mAhSend = (percentage * BGG_BATTERY_DIVIDER) + BGG_BATTERY_OFFSET;
f9ba924d188e Bugfix: set battery percentage correctly after RTE update
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
170 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 uint8_t bufferSend[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 bufferSend[0] = 0x02;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 bufferSend[1] = (uint8_t)(mAhSend / 256);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 bufferSend[2] = (uint8_t)(mAhSend & 0xFF);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 I2C_Master_Transmit( DEVICE_BATTERYGAUGE, bufferSend, 3);
242
b23de15e2861 Comply to datasheet when resetting battery gauge registers
Jan Mulder <jlmulder@xs4all.nl>
parents: 228
diff changeset
177 init_battery_gas_gauge();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/