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: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Diff: Libs/CoulombCounter/CoulombCounter.cpp
- Revision:
- 34:18bcf276d3bf
- Parent:
- 33:6bc82b6b62e5
- Child:
- 36:0afc0fc8f86b
--- a/Libs/CoulombCounter/CoulombCounter.cpp Tue Jan 06 20:45:26 2015 +0000 +++ b/Libs/CoulombCounter/CoulombCounter.cpp Wed Jan 07 03:25:50 2015 +0000 @@ -5,9 +5,6 @@ const float BAT_ISENSE_OFFSET = -0.5*BAT_ISENSE_MULTIPLIER; // Offset to convert float to amps const float BAT_ISENSE_LIMS = 3.0; // Over-current limit = +/- 3A -const int rtcGPREG_counter = 0; // RTC GPREG offset for the coulomb counter -const int rtcGPREG_capacity = 1; // RTC GPREG offset for the capacity spec - CoulombCounter::CoulombCounter(PinName _pin, int _mSec) : BatISense(_pin) { mSec = _mSec; @@ -54,15 +51,7 @@ tracker++; if (tracker >= CC_FILTER_TAPS) tracker = 0; } -void CoulombCounter::resetToSOC(float SOC) { - store.write(SOC*capacity(), rtcGPREG_counter); -} -void CoulombCounter::resetToAh(float Ah) { - store.write(Ah, rtcGPREG_counter); -} -void CoulombCounter::changeCapacity(float capAh) { - store.write(capAh, rtcGPREG_capacity); -} + float CoulombCounter::current() { float avg = 0; for (int i = 0; i < CC_FILTER_TAPS; i++) { @@ -72,15 +61,7 @@ if (abs(avg) > BAT_ISENSE_LIMS) overCurrent = true; return avg; } -float CoulombCounter::ampHours() { - return store.read(rtcGPREG_counter); -} -float CoulombCounter::capacity() { - return store.read(rtcGPREG_capacity); -} -float CoulombCounter::SOC() { - return ampHours()/capacity(); -} + bool CoulombCounter::overCurrentDetected() { - return overCurrent; + return overCurrent; } \ No newline at end of file