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.
ChemIDMeasurer.h
00001 // 00002 // Class to collect data needed for measuring the Chem ID of a battery 00003 // 00004 00005 #ifndef PLZDONTEXPLODE_CHEMIDMEASURER_H 00006 #define PLZDONTEXPLODE_CHEMIDMEASURER_H 00007 00008 #include <BQ34Z100.h> 00009 00010 class ChemIDMeasurer 00011 { 00012 BQ34Z100 soc; 00013 00014 Timer totalTimer; 00015 Timer stateTimer; 00016 00017 enum class State 00018 { 00019 INIT, // Initial state. 00020 CHARGE, // First, charge to full power until charge current <= C/100. 00021 RELAX_CHARGED, // Relax for two hours to reach open circuit voltage 00022 DISCHARGE, // Discharge at C/10 until the term voltage is reached 00023 RELAX_DISCHARGED, // Relax for five hours to reach open circuit voltage 00024 DONE // Measurement finished 00025 }; 00026 State state = State::INIT; 00027 00028 // Turn the charger on 00029 void activateCharger(); 00030 00031 // Turn the charger off. 00032 void deactivateCharger(); 00033 00034 void activateLoad(); 00035 00036 void deactivateLoad(); 00037 00038 // Change current state. 00039 void setState(State newState); 00040 00041 public: 00042 ChemIDMeasurer(); 00043 00044 /** 00045 * Loop to run the ID measurement 00046 */ 00047 void runMeasurement(); 00048 }; 00049 00050 00051 #endif //PLZDONTEXPLODE_CHEMIDMEASURER_H
Generated on Wed Jul 13 2022 05:02:13 by
1.7.2