BQ27441 battery fuel-gauge interface. Call begin() before other operations. The I2C bus is borrowed and must outlive the driver.
More...
#include <SparkFun_BQ27441.hpp>
|
| enum | current_measure { AVG
, STBY
, MAX
} |
| | Parameters for the current() function, to specify which current to read. More...
|
| enum | capacity_measure {
REMAIN
, FULL
, AVAIL
, AVAIL_FULL
,
REMAIN_F
, REMAIN_UF
, FULL_F
, FULL_UF
,
DESIGN
} |
| | Parameters for the capacity() function, to specify which capacity to read. More...
|
| enum | soc_measure { FILTERED
, UNFILTERED
} |
| | Parameters for the soc() function. More...
|
| enum | soh_measure { PERCENT
, SOH_STAT
} |
| | Parameters for the soh() function. More...
|
| enum | temp_measure { BATTERY
, INTERNAL_TEMP
} |
| | Parameters for the temperature() function. More...
|
| enum | gpout_function { SOC_INT
, BAT_LOW
} |
| | Parameters for the setGPOUTFunction() funciton. More...
|
BQ27441 battery fuel-gauge interface. Call begin() before other operations. The I2C bus is borrowed and must outlive the driver.
◆ capacity_measure
Parameters for the capacity() function, to specify which capacity to read.
71 {
72 REMAIN,
73 FULL,
74 AVAIL,
75 AVAIL_FULL,
76 REMAIN_F,
77 REMAIN_UF,
78 FULL_F,
79 FULL_UF,
80 DESIGN
capacity_measure
Parameters for the capacity() function, to specify which capacity to read.
Definition SparkFun_BQ27441.hpp:71
◆ current_measure
Parameters for the current() function, to specify which current to read.
64 {
65 AVG,
66 STBY,
67 MAX
current_measure
Parameters for the current() function, to specify which current to read.
Definition SparkFun_BQ27441.hpp:64
◆ gpout_function
Parameters for the setGPOUTFunction() funciton.
102 {
103 SOC_INT,
104 BAT_LOW
gpout_function
Parameters for the setGPOUTFunction() funciton.
Definition SparkFun_BQ27441.hpp:102
◆ soc_measure
Parameters for the soc() function.
84 {
85 FILTERED,
86 UNFILTERED
soc_measure
Parameters for the soc() function.
Definition SparkFun_BQ27441.hpp:84
◆ soh_measure
Parameters for the soh() function.
90 {
91 PERCENT,
92 SOH_STAT
soh_measure
Parameters for the soh() function.
Definition SparkFun_BQ27441.hpp:90
◆ temp_measure
Parameters for the temperature() function.
96 {
97 BATTERY,
98 INTERNAL_TEMP
temp_measure
Parameters for the temperature() function.
Definition SparkFun_BQ27441.hpp:96
◆ BQ27441()
| BQ27441::BQ27441 |
( |
TwoWire & | , |
|
|
uint8_t | addr = I2C_ADDRESS ) |
Initializes class variables and binds the I2C bus and 7-bit address.
◆ begin()
| bool BQ27441::begin |
( |
void | | ) |
|
Initializes I2C and verifies communication with the BQ27441. Must be called before using any other functions.
- Returns
- true if communication was successful.
◆ capacity()
Reads and returns the specified capacity measurement
- Parameters
-
| type | Enum specifying capacity value to be read |
- Returns
- specified capacity measurement in mAh.
◆ current()
Reads and returns the specified current measurement
- Parameters
-
| type | Enum specifying current value to be read |
- Returns
- specified current measurement in mA. >0 indicates charging.
◆ deviceType()
| uint16_t BQ27441::deviceType |
( |
void | | ) |
|
Read the device type - should be 0x0421
- Returns
- 16-bit value read from DEVICE_TYPE subcommand
◆ enterConfig()
| bool BQ27441::enterConfig |
( |
bool | userControl = true | ) |
|
Enter configuration mode - set userControl if calling from an Arduino sketch and you want control over when to exitConfig.
- Parameters
-
| userControl | is true if the Arduino sketch is handling entering and exiting config mode (should be false in library calls). |
- Returns
- true on success
◆ exitConfig()
| bool BQ27441::exitConfig |
( |
bool | resim = true | ) |
|
Exit configuration mode with the option to perform a resimulation
- Parameters
-
| resim | is true if resimulation should be performed after exiting |
- Returns
- true on success
◆ flags()
| uint16_t BQ27441::flags |
( |
void | | ) |
|
Read the flags() command
- Returns
- 16-bit representation of flags() command register
◆ GPOUTFunction()
| bool BQ27441::GPOUTFunction |
( |
void | | ) |
|
Get GPOUT function (BAT_LOW or SOC_INT)
- Returns
- true if BAT_LOW or false if SOC_INT
◆ GPOUTPolarity()
| bool BQ27441::GPOUTPolarity |
( |
void | | ) |
|
Get GPOUT polarity setting (active-high or active-low)
- Returns
- true if active-high, false if active-low
◆ power()
| int16_t BQ27441::power |
( |
void | | ) |
|
Reads and returns measured average power
- Returns
- average power in mW. >0 indicates charging.
◆ pulseGPOUT()
| bool BQ27441::pulseGPOUT |
( |
void | | ) |
|
Pulse the GPOUT pin - must be in SOC_INT mode
- Returns
- true on success
◆ setCapacity()
| bool BQ27441::setCapacity |
( |
uint16_t | capacity | ) |
|
Configures the design capacity of the connected battery.
- Parameters
-
| capacity | Design capacity of battery in mAh (unsigned 16-bit value) |
- Returns
- true if capacity successfully set.
◆ setGPOUTFunction()
Set GPOUT function to BAT_LOW or SOC_INT
- Parameters
-
| function | should be either BAT_LOW or SOC_INT |
- Returns
- true on success
◆ setGPOUTPolarity()
| bool BQ27441::setGPOUTPolarity |
( |
bool | activeHigh | ) |
|
Set GPOUT polarity to active-high or active-low
- Parameters
-
| activeHigh | is true if active-high, false if active-low |
- Returns
- true on success
◆ setSOC1Thresholds()
| bool BQ27441::setSOC1Thresholds |
( |
uint8_t | set, |
|
|
uint8_t | clear ) |
Set the SOC1 set and clear thresholds to a percentage
- Parameters
-
| set | Set percentage between 0 and 100. |
| clear | Clear percentage between 0 and 100; must exceed set. |
- Returns
- true on success
◆ setSOCFThresholds()
| bool BQ27441::setSOCFThresholds |
( |
uint8_t | set, |
|
|
uint8_t | clear ) |
Set the SOCF set and clear thresholds to a percentage
- Parameters
-
| set | Set percentage between 0 and 100. |
| clear | Clear percentage between 0 and 100; must exceed set. |
- Returns
- true on success
◆ setSOCIDelta()
| bool BQ27441::setSOCIDelta |
( |
uint8_t | delta | ) |
|
Set the SOC_INT interval delta to a value between 1 and 100
- Parameters
-
| delta | Interval percentage value between 1 and 100 |
- Returns
- true on success
◆ soc()
Reads and returns specified state of charge measurement
- Parameters
-
| type | Enum specifying filtered or unfiltered measurement |
- Returns
- specified state of charge measurement in %
◆ SOC1ClearThreshold()
| uint8_t BQ27441::SOC1ClearThreshold |
( |
void | | ) |
|
Get SOC1_Clear Threshold - threshold to clear the alert flag
- Returns
- state of charge value between 0 and 100%
◆ SOC1SetThreshold()
| uint8_t BQ27441::SOC1SetThreshold |
( |
void | | ) |
|
Get SOC1_Set Threshold - threshold to set the alert flag
- Returns
- state of charge value between 0 and 100%
◆ SOCFClearThreshold()
| uint8_t BQ27441::SOCFClearThreshold |
( |
void | | ) |
|
Get SOCF_Clear Threshold - threshold to clear the alert flag
- Returns
- state of charge value between 0 and 100%
◆ socfFlag()
| bool BQ27441::socfFlag |
( |
void | | ) |
|
Check if the SOCF flag is set in flags()
- Returns
- true if flag is set
◆ socFlag()
| bool BQ27441::socFlag |
( |
void | | ) |
|
Check if the SOC1 flag is set in flags()
- Returns
- true if flag is set
◆ SOCFSetThreshold()
| uint8_t BQ27441::SOCFSetThreshold |
( |
void | | ) |
|
Get SOCF_Set Threshold - threshold to set the alert flag
- Returns
- state of charge value between 0 and 100%
◆ sociDelta()
| uint8_t BQ27441::sociDelta |
( |
void | | ) |
|
Get the SOC_INT interval delta
- Returns
- interval percentage value between 1 and 100
◆ soh()
Reads and returns specified state of health measurement
- Parameters
-
| type | Enum specifying filtered or unfiltered measurement |
- Returns
- specified state of health measurement in %, or status bits
◆ status()
| uint16_t BQ27441::status |
( |
void | | ) |
|
Read the CONTROL_STATUS subcommand of control()
- Returns
- 16-bit representation of CONTROL_STATUS subcommand
◆ temperature()
| uint16_t BQ27441::temperature |
( |
temp_measure | type = BATTERY | ) |
|
Reads and returns specified temperature measurement
- Parameters
-
| type | Enum specifying internal or battery measurement |
- Returns
- Raw temperature register in tenths of kelvin; no Celsius conversion is performed.
◆ voltage()
| uint16_t BQ27441::voltage |
( |
void | | ) |
|
Reads and returns the battery voltage
- Returns
- battery voltage in mV
The documentation for this class was generated from the following file: