...
Taking design capacity as an example. First we need to determine the value of the LSB. If the sense resistor (a resistor used for calculating current) has a value of 2 ohms then our LSB would have a value of 5/2 = 2.5. The units for the LSB is micro volts hours / ohms which is just micro amp hours. If we have a battery that has a capacity of 1000000 micro amp hours, the value of the design_capacity field will be (1000000 / 2.5) = 400000.
Using Driver
The drivers functions follow the same format.
Code Block |
---|
StatusCode max17261_characteristic(Max17261Storage* storage, uint16_t* return_value_units) |
You supply a reference to an already initialized Max17261Storage struct and a reference to a variable that will be used to store the given characteristic of the battery and a status code is returned by the function indicating success or failure. The units of the return variable are indicated by the name of the variable but a table summary is shown below.
Function | Units | Description |
---|---|---|
max17261_state_of_charge | percentage (0-100) | current state of charge in percentage |
max17261_remaining_capacity | micro amp hours | current remaining capacity of the battery |
max17261_full_capacity | micro amp hours | capacity of the battery at full charge |
max17261_time_to_empty | milliseconds | Time until battery becomes empty (only valid when battery is discharging) |
max17261_time_to_full | milliseconds | Time until battery becomes full (only valid when battery is charging) |