A feature complete driver for the MAX17048 lithium fuel gauge from Maxim.
Dependents: MAX17048_HelloWorld ECGAFE_copy MAX17048_HelloWorld Orion_newPCB_test_LV ... more
Now fully tested!
Revision 10:4f695111eb54, committed 2014-05-30
- Comitter:
- neilt6
- Date:
- Fri May 30 19:02:51 2014 +0000
- Parent:
- 9:2c1d82ecd63c
- Commit message:
- Added MBED_OPERATORS check to implementation
Changed in this revision
MAX17048.cpp | Show annotated file Show diff for this revision Revisions of this file |
MAX17048.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2c1d82ecd63c -r 4f695111eb54 MAX17048.cpp --- a/MAX17048.cpp Fri May 02 17:28:52 2014 +0000 +++ b/MAX17048.cpp Fri May 30 19:02:51 2014 +0000 @@ -507,6 +507,7 @@ return value * 0.208; } +#ifdef MBED_OPERATORS MAX17048::operator float() { //Return the current floating point SOC reading @@ -518,6 +519,7 @@ //Return the current integer SOC reading return soc_int(); } +#endif unsigned short MAX17048::read(char reg) {
diff -r 2c1d82ecd63c -r 4f695111eb54 MAX17048.h --- a/MAX17048.h Fri May 02 17:28:52 2014 +0000 +++ b/MAX17048.h Fri May 30 19:02:51 2014 +0000 @@ -94,11 +94,11 @@ void quickStart(); /** Determine whether sleep mode is enabled on the MAX17048 - * - * @returns - * 'true' if sleep mode is enabled, - * 'false' if sleep mode is disabled. - */ + * + * @returns + * 'true' if sleep mode is enabled, + * 'false' if sleep mode is disabled. + */ bool sleepEnabled(); /** Enable or disable sleep mode on the MAX17048 @@ -108,17 +108,17 @@ void sleepEnabled(bool enabled); /** Determine whether or not the MAX17048 is hibernating - * - * @returns - * 'true' if hibernating, - * 'false' if not hibernating. - */ + * + * @returns + * 'true' if hibernating, + * 'false' if not hibernating. + */ bool hibernating(); /** Get the current hibernate threshold of the MAX17048 - * - * @returns The current hibernate threshold in \%/hr. - */ + * + * @returns The current hibernate threshold in \%/hr. + */ float hibernateThreshold(); /** Set the hibernate threshold of the MAX17048 @@ -128,9 +128,9 @@ void hibernateThreshold(float threshold); /** Get the current active threshold of the MAX17048 - * - * @returns The current active threshold in volts. - */ + * + * @returns The current active threshold in volts. + */ float activeThreshold(); /** Set the active threshold of the MAX17048 @@ -140,9 +140,9 @@ void activeThreshold(float threshold); /** Get the production version of the MAX17048 - * - * @returns The 16-bit production version. - */ + * + * @returns The 16-bit production version. + */ unsigned short version(); /** Get the current compensation value of the MAX17048 @@ -164,11 +164,11 @@ void tempCompensation(float temp); /** Determine whether or not the MAX17048 is in sleep mode - * - * @returns - * 'true' if in sleep mode, - * 'false' if not in sleep mode. - */ + * + * @returns + * 'true' if in sleep mode, + * 'false' if not in sleep mode. + */ bool sleeping(); /** Enter or exit sleep mode on the MAX17048 (sleep mode must be enabled first) @@ -178,11 +178,11 @@ void sleep(bool sleep); /** Determine whether or not the SOC 1% change alert is enabled on the MAX17048 - * - * @returns - * 'true' if enabled, - * 'false' if not enabled. - */ + * + * @returns + * 'true' if enabled, + * 'false' if not enabled. + */ bool socChangeAlertEnabled(); /** Enable or disable the SOC 1% change alert on the MAX17048 @@ -192,21 +192,21 @@ void socChangeAlertEnabled(bool enabled); /** Determine whether or not the MAX17048 is asserting the ALRT pin - * - * @returns - * 'true' if alerting, - * 'false' if not alerting. - */ + * + * @returns + * 'true' if alerting, + * 'false' if not alerting. + */ bool alerting(); /** Command the MAX17048 to de-assert the ALRT pin - */ + */ void clearAlert(); /** Get the current SOC empty alert threshold of the MAX17048 - * - * @returns The current SOC empty alert threshold in %. - */ + * + * @returns The current SOC empty alert threshold in %. + */ char emptyAlertThreshold(); /** Set the SOC empty alert threshold of the MAX17048 @@ -216,9 +216,9 @@ void emptyAlertThreshold(char threshold); /** Get the current low voltage alert threshold of the MAX17048 - * - * @returns The current low voltage alert threshold in volts. - */ + * + * @returns The current low voltage alert threshold in volts. + */ float vAlertMinThreshold(); /** Set the low voltage alert threshold of the MAX17048 @@ -228,9 +228,9 @@ void vAlertMinThreshold(float threshold); /** Get the current high voltage alert threshold of the MAX17048 - * - * @returns The current high voltage alert threshold in volts. - */ + * + * @returns The current high voltage alert threshold in volts. + */ float vAlertMaxThreshold(); /** Set the high voltage alert threshold of the MAX17048 @@ -240,9 +240,9 @@ void vAlertMaxThreshold(float threshold); /** Get the current reset voltage threshold of the MAX17048 - * - * @returns The current reset voltage threshold in volts. - */ + * + * @returns The current reset voltage threshold in volts. + */ float vResetThreshold(); /** Set the reset voltage threshold of the MAX17048 @@ -252,11 +252,11 @@ void vResetThreshold(float threshold); /** Determine whether or not the reset voltage comparator is enabled on the MAX17048 - * - * @returns - * 'true' if enabled, - * 'false' if not enabled. - */ + * + * @returns + * 'true' if enabled, + * 'false' if not enabled. + */ bool comparatorEnabled(); /** Enable or disable the reset voltage comparator on the MAX17048 @@ -266,17 +266,17 @@ void comparatorEnabled(bool enabled); /** Get the factory programmed 8-bit ID of the MAX17048 - * - * @returns The 8-bit ID. - */ + * + * @returns The 8-bit ID. + */ char id(); /** Determine whether or not the voltage reset alert is enabled on the MAX17048 - * - * @returns - * 'true' if enabled, - * 'false' if not enabled. - */ + * + * @returns + * 'true' if enabled, + * 'false' if not enabled. + */ bool vResetAlertEnabled(); /** Enable or disable the voltage reset alert on the MAX17048 @@ -286,9 +286,9 @@ void vResetAlertEnabled(bool enabled); /** Get the current alert flags on the MAX17048 - * - * @returns The current alert flags as AlertFlags enum values OR'd together. - */ + * + * @returns The current alert flags as AlertFlags enum values OR'd together. + */ char alertFlags(); /** Clear the specified alert flags on the MAX17048 @@ -298,9 +298,9 @@ void clearAlertFlags(char flags); /** Get the current cell voltage measurement of the MAX17048 - * - * @returns The cell voltage measurement as a float. - */ + * + * @returns The cell voltage measurement as a float. + */ float vcell(); /** Get the current state of charge measurement of the MAX17048 as a float