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:
- 15:e09aaaccf134
- Parent:
- 7:a46a1dee4497
- Child:
- 17:fc782f7548c6
- Child:
- 28:5f0f2a3f3e8d
- Child:
- 37:8a8024c45dc0
diff -r a9588f443f1a -r e09aaaccf134 EPS.cpp
--- a/EPS.cpp Thu Apr 14 09:34:06 2016 +0000
+++ b/EPS.cpp Tue Apr 19 21:27:07 2016 +0000
@@ -8,7 +8,7 @@
extern char BAE_chardata[74];
//m_I2C.frequency(10000)
-const char RCOMP0= 0x97;
+const char RCOMP0= 0x97;// don't know what it is now
BAE_HK_actual actual_data;
BAE_HK_quant quant_data;
BAE_HK_min_max bae_HK_minmax;
@@ -27,8 +27,8 @@
//AnalogIn Vbatt_ang(VBATT);
AnalogIn Batt_voltage(PIN20); //Battery voltage
-SPI spi_bt(PIN99,PIN100,PIN98); //MOSI,MISO,SLK
-DigitalOut ssn1(PIN19); //Slave select1
+SPI spi_bt(PIN99,PIN100,PIN98); //MOSI,MISO,SLK // battery temp something 3
+DigitalOut ssn1(PIN19); //Slave select1 // low line master talks
DigitalOut ssn2(PIN21);//Slave select2
//DigitalOut PS(PTB0);
//DigitalOut HS(PTB1);
@@ -37,6 +37,7 @@
AnalogIn VoltageInput(PIN53); // Input from Voltage Multiplexer //PIN53
AnalogIn BAE_temp_sensor(PIN55); //Input from BAE temp sensor
+/*mux for reading value one by one*/
DigitalOut SelectLinea3 (PIN46); // MSB of Select Lines
DigitalOut SelectLinea2 (PIN45);
DigitalOut SelectLinea1 (PIN44);
@@ -66,7 +67,7 @@
FCTN_BATTERYGAUGE_INIT();
FCTN_BATTTEMP_INIT();
EN3V3A = 1; //enable dc dc converter A
- char value=alertFlags();
+ char value=alertFlags(); // initialization part of battery gauge
unsigned short value_u= (short int )value;
value_u &=0x0001;
if(value_u ==0x0001) // battery gauge not initialised
@@ -77,7 +78,7 @@
else
{
actual_data.Batt_gauge_actual[1] = soc();
- actual_data.Batt_voltage_actual = Batt_voltage.read()*3.3;
+ 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
}
@@ -87,6 +88,8 @@
}
//----------------------------------------------------Power algo code--------------------------------------------------------------------//
+/*update the power modes*/
+
void FCTN_EPS_POWERMODE(float soc) //dummy algo
{
if(soc >= 80)
@@ -100,7 +103,7 @@
}
//...................................................HK...........................................//
-
+/*reading values*/
void FCTN_HK_MAIN()
{
@@ -452,7 +455,7 @@
{
//Read the current 16-bit register value
unsigned short value = read(REG_MODE);
-
+
//Set the QuickStart bit
value |= (1 << 14);
