CUER
/
charger_code
Code to run on the charger board (used to charge the car from the mains).
CANParserCharger.h@3:a7626dffb64a, 2017-07-27 (annotated)
- Committer:
- DasSidG
- Date:
- Thu Jul 27 21:00:52 2017 +0000
- Revision:
- 3:a7626dffb64a
- Parent:
- 1:0c77e20b4d4c
- Child:
- 4:f6459580c312
Code is now theoretically finished; completely untested however.
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:a7626dffb64a | 13 | |
DasSidG | 1:0c77e20b4d4c | 14 | |
DasSidG | 1:0c77e20b4d4c | 15 | //@TODO add some comments |
DasSidG | 1:0c77e20b4d4c | 16 | |
DasSidG | 1:0c77e20b4d4c | 17 | void get_charger_control_info(CANMessage msg, float &_voltage_error, float &_temp_margin, float &_discharge_error, float &_pack_capacity); |
DasSidG | 1:0c77e20b4d4c | 18 | void get_max_min_voltage(CANMessage msg, float &_min_cell_voltage, float &_max_cell_voltage); |
DasSidG | 1:0c77e20b4d4c | 19 | void get_battery_status(CANMessage msg, bool &error); |
DasSidG | 1:0c77e20b4d4c | 20 | void get_charger_VI_info(CANMessage msg, float &_charger_voltage, float &_charger_current, uint8_t &_charger_status); |
DasSidG | 1:0c77e20b4d4c | 21 | CANMessage generate_charger_control_msg(float _desired_voltage, float _desired_current, uint8_t _charger_control); |
DasSidG | 1:0c77e20b4d4c | 22 | CANMessage generate_charger_info_msg(float _charger_voltage, float _charger_current, uint8_t _charger_status); |
DasSidG | 3:a7626dffb64a | 23 | 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 | 24 | #endif |