Code to run on the charger board (used to charge the car from the mains).

Dependencies:   mbed CUER_CAN

Committer:
DasSidG
Date:
Thu Jul 27 21:21:32 2017 +0000
Revision:
4:f6459580c312
Parent:
3:a7626dffb64a
Child:
5:756fae795d37
Tidied up code a bit, replaced 'waits' for CAN sending with callbacks

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DasSidG 3:a7626dffb64a 1 #ifndef CANParserCharger_H
DasSidG 3:a7626dffb64a 2 #define CANParserCharger_H
DasSidG 3:a7626dffb64a 3
DasSidG 1:0c77e20b4d4c 4 #include "CAN_Data.h"
DasSidG 1:0c77e20b4d4c 5 #include "CAN_IDs.h"
DasSidG 1:0c77e20b4d4c 6
DasSidG 3:a7626dffb64a 7
DasSidG 1:0c77e20b4d4c 8
DasSidG 1:0c77e20b4d4c 9 #define CHARGER_CAN_BIT_RATE 250000 //note this is different to the car CAN bit rate
DasSidG 3:a7626dffb64a 10 #define CHARGER_VI_CONTROL_ID 0x1806E5F4
DasSidG 3:a7626dffb64a 11 #define CHARGER_VI_INFO_ID 0x18FF50E5
DasSidG 3:a7626dffb64a 12
DasSidG 4:f6459580c312 13 #define CAN_TIMEOUT_MS 100
DasSidG 4:f6459580c312 14
DasSidG 3:a7626dffb64a 15
DasSidG 1:0c77e20b4d4c 16
DasSidG 1:0c77e20b4d4c 17 //@TODO add some comments
DasSidG 1:0c77e20b4d4c 18
DasSidG 1:0c77e20b4d4c 19 void get_charger_control_info(CANMessage msg, float &_voltage_error, float &_temp_margin, float &_discharge_error, float &_pack_capacity);
DasSidG 1:0c77e20b4d4c 20 void get_max_min_voltage(CANMessage msg, float &_min_cell_voltage, float &_max_cell_voltage);
DasSidG 1:0c77e20b4d4c 21 void get_battery_status(CANMessage msg, bool &error);
DasSidG 1:0c77e20b4d4c 22 void get_charger_VI_info(CANMessage msg, float &_charger_voltage, float &_charger_current, uint8_t &_charger_status);
DasSidG 1:0c77e20b4d4c 23 CANMessage generate_charger_control_msg(float _desired_voltage, float _desired_current, uint8_t _charger_control);
DasSidG 1:0c77e20b4d4c 24 CANMessage generate_charger_info_msg(float _charger_voltage, float _charger_current, uint8_t _charger_status);
DasSidG 3:a7626dffb64a 25 CANMessage generate_charging_finished_msg(); //When this packet is received by the BMU, it causes the BMU to reset its SoC value to 100%
DasSidG 1:0c77e20b4d4c 26 #endif