Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of BAE_CODE_MARCH_2017 by
Diff: EPS.cpp
- Revision:
- 29:bb0d64656ba1
- Parent:
- 28:5f0f2a3f3e8d
- Child:
- 30:22b338b027de
diff -r 5f0f2a3f3e8d -r bb0d64656ba1 EPS.cpp
--- a/EPS.cpp Mon Jun 13 10:37:50 2016 +0000
+++ b/EPS.cpp Thu Jun 23 12:14:28 2016 +0000
@@ -49,13 +49,13 @@
DigitalOut SelectLineb0 (PIN59); // LSB of Select Lines
//*********************************************************flags********************************************************//
-extern char EPS_INIT_STATUS ;
-extern char EPS_BATTERY_GAUGE_STATUS ;
-extern char EPS_MAIN_STATUS;
-extern char EPS_BATTERY_TEMP_STATUS ;
-extern char EPS_STATUS ;
+extern uint8_t EPS_INIT_STATUS ;
+extern uint8_t EPS_BATTERY_GAUGE_STATUS ;
+extern uint8_t EPS_MAIN_STATUS;
+extern uint8_t EPS_BATTERY_TEMP_STATUS ;
+extern uint8_t EPS_STATUS ;
-extern char EPS_BATTERY_HEAT_ENABLE ;
+extern uint8_t EPS_BATTERY_HEATER_ENABLE ;
//eps cdms fault
extern uint8_t CDMS_SW_STATUS;
@@ -98,10 +98,9 @@
void FCTN_EPS_INIT()
{
printf("\n\r eps init \n");
- EPS_INIT_STATUS = 's' ; //set EPS_INIT_STATUS flag
+ EPS_INIT_STATUS = 1 ; //set EPS_INIT_STATUS flag
// FLAG();
FCTN_BATTERYGAUGE_INIT();
- FCTN_BATTTEMP_INIT();
EN3V3A = 1; //enable dc dc converter A
char value=alertFlags(); // initialization part of battery gauge
unsigned short value_u= (short int )value;
@@ -109,17 +108,20 @@
if(value_u ==0x0001) // battery gauge not initialised
{
actual_data.power_mode = 1;
- EPS_BATTERY_GAUGE_STATUS = 'c'; //clear EPS_BATTERY_GAUGE_STATUS
+ EPS_BATTERY_GAUGE_STATUS = 0; //clear EPS_BATTERY_GAUGE_STATUS
}
else
{
actual_data.Batt_gauge_actual[1] = soc();
actual_data.Batt_voltage_actual = Batt_voltage.read()*3.3; //1 corresponds to 3.3 scaling factor
FCTN_EPS_POWERMODE(actual_data.Batt_gauge_actual[1]);
- EPS_BATTERY_GAUGE_STATUS = 's'; //set EPS_BATTERY_GAUGE_STATUS
+ EPS_BATTERY_GAUGE_STATUS = 1; //set EPS_BATTERY_GAUGE_STATUS
}
- EPS_INIT_STATUS = 'c' ; //clear EPS_INIT_STATUS flag
+ FCTN_BATTTEMP_INIT();
+ EPS_BATTERY_GAUGE_STATUS = 1;
+
+ EPS_INIT_STATUS = 0 ; //clear EPS_INIT_STATUS flag
}
@@ -267,8 +269,8 @@
SelectLineb3=0;
//collecting data
- for(Iteration=0; Iteration<16; Iteration++){
-
+ for(Iteration=0; Iteration<16; Iteration++)
+ {
actual_data.voltage_actual[Iteration]=VoltageInput.read();
actual_data.current_actual[Iteration]=CurrentInput.read();
@@ -287,8 +289,8 @@
printf("\n\r %d %d %d %d", s0,s1,s2,s3);
}
- for(Iteration=0; Iteration<16; Iteration++){
-
+ for(Iteration=0; Iteration<16; Iteration++)
+ {
if(Iteration==14)
actual_data.voltage_actual[Iteration]= (-90.7*3.3*actual_data.voltage_actual[Iteration])+190.1543;
else
