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.
BMS.h
00001 /*************************************************** 00002 This is a library for BMS 00003 00004 Written by Nerea Gómez. 00005 00006 ****************************************************/ 00007 00008 #ifndef MBED_BMS_H 00009 #define MBED_BMS_H 00010 00011 #include "mbed.h" 00012 00013 class BMS { 00014 public: 00015 BMS(PinName rd, PinName td); 00016 void init_bms(); 00017 void data_request(); 00018 void int2bin(int value, char* buffer, int bufferSize); 00019 void read_data(); 00020 float get_min_V(); 00021 float get_max_V(); 00022 float get_voltage(); 00023 int get_T_min(); 00024 int get_T_max(); 00025 char get_precharged_value(); 00026 char get_rely_value(); 00027 char get_alarm(); 00028 00029 00030 private: 00031 CAN _bms; 00032 long frequency; 00033 CANMessage req_msg; 00034 CANMessage read_msg; 00035 /**Voltage attributes**/ 00036 int V_min_l; // 00037 int V_min_h; //Minimum voltage 00038 float V_min; // 00039 int V_max_l; // 00040 int V_max_h; //Maximum voltage 00041 float V_max; // 00042 float voltage; //Battery voltage 00043 00044 /**Temperature atributes**/ 00045 int T_min; //Minimum temperature 00046 int T_max; //Maximum temperature 00047 int offset_T; //Temperature offset 00048 00049 /**Other attributes**/ 00050 int precharged; 00051 char binaryBuffer[9]; // 8 bits plus null terminator 00052 char precharged_c; //Precharged bit 00053 char rely_c; //Rely bit 00054 char alarm_c; //Alarm bit 00055 00056 00057 00058 }; 00059 00060 #endif
Generated on Thu Aug 25 2022 14:00:38 by
1.7.2