Go to the documentation of this file.
226 uint8_t buf_charged[7];
230 uint8_t buf_discharged[7];
325 uint32_t *charged, uint32_t *discharged);
340 uint32_t *charged, uint32_t *discharged,
341 uint32_t raw_charged,
342 uint32_t raw_discharged);
ltc4150_dir_t
Enumeration of directions in which the charge can be transferred.
int ltc4150_reset_counters(ltc4150_dev_t *dev)
Clear current counters of the given LTC4150 device.
uint16_t charged
Pulses in charging direction recorded in the last minute.
uint16_t pulses_per_ah
Pulse per ampere hour of charge.
int ltc4150_last_minute_charge(ltc4150_dev_t *dev, ltc4150_last_minute_data_t *data, uint32_t *charged, uint32_t *discharged)
Get the measured charge in the last minute.
@ LTC4150_CHARGE
The battery is charged.
Parameters required to set up the LTC4150 coulomb counter.
int ltc4150_shutdown(ltc4150_dev_t *dev)
Disable the interrupt handler and turn the chip off.
void ** recorder_data
NULL or an array of the user defined data for each recorder
int ltc4150_avg_current(ltc4150_dev_t *dev, int16_t *dest)
Get the average current drawn in E-01 milliampere.
@ LTC4150_DISCHARGE
Charge is drawn from the battery.
Data structure used by ltc4150_last_minute.
const ltc4150_recorder_t ltc4150_last_minute
Records the charge transferred within the last minute using.
gpio_t interrupt
Pin going LOW every time a specific charge is drawn, labeled INT.
@ LTC4150_EXT_PULL_UP
External pull on the /INT and the /POL pin is present.
gpio_t shutdown
Pin to power off the LTC4150 coulomb counter, labeled SHDN.
uint32_t last_rotate_sec
Time stamp of the last ring "rotation".
int ltc4150_charge(ltc4150_dev_t *dev, uint32_t *charged, uint32_t *discharged)
Get the measured charge since boot or last reset in millicoulomb.
uint16_t discharged
Pulses in discharging direction recorded in the last minute.
gpio_t polarity
Pin indicating (dis-)charging, labeled POL.
uint32_t last_update_sec
Time stamp of last pulse.
uint16_t flags
Configuration flags controlling if inter pull ups are required.
Mutex for thread synchronization.
Low-level GPIO peripheral driver interface definitions.
@ LTC4150_POL_EXT_PULL_UP
External pull on the /POL pin is present.
ltc4150_params_t params
Parameter of the LTC4150 coulomb counter.
int ltc4150_init(ltc4150_dev_t *dev, const ltc4150_params_t *params)
Initialize the LTC4150 driver.
const ltc4150_recorder_t ** recorders
NULL or a NULL-terminated array of data recorders
@ LTC4150_INT_EXT_PULL_UP
External pull on the /INT pin is present.
void ltc4150_pulses2c(const ltc4150_dev_t *dev, uint32_t *charged, uint32_t *discharged, uint32_t raw_charged, uint32_t raw_discharged)
Convert the raw data (# pulses) acquired by the LTC4150 device to charge information in millicoulomb.
xtimer interface definitions
uint8_t ring_pos
Position in the ring buffer.
uint32_t start_sec
Time stamp when started counting.
Interface to allow recording of the drawn current in a user defined resolution.