LTC4150 coulomb counter. More...

Detailed Description

LTC4150 coulomb counter.

Author
Marian Buschsieweke maria.nosp@m.n.bu.nosp@m.schsi.nosp@m.ewek.nosp@m.e@ovg.nosp@m.u.de

Definition in file ltc4150.h.

#include <stdint.h>
#include "mutex.h"
#include "periph/gpio.h"
#include "xtimer.h"
+ Include dependency graph for ltc4150.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ltc4150_recorder_t
 Interface to allow recording of the drawn current in a user defined resolution. More...
 
struct  ltc4150_params_t
 Parameters required to set up the LTC4150 coulomb counter. More...
 
struct  ltc4150_dev
 LTC4150 coulomb counter. More...
 
struct  ltc4150_last_minute_data_t
 Data structure used by ltc4150_last_minute. More...
 

Typedefs

typedef struct ltc4150_dev ltc4150_dev_t
 LTC4150 coulomb counter.
 

Enumerations

enum  { LTC4150_INT_EXT_PULL_UP = 0x01, LTC4150_POL_EXT_PULL_UP = 0x02, LTC4150_EXT_PULL_UP = LTC4150_INT_EXT_PULL_UP | LTC4150_POL_EXT_PULL_UP }
 Configuration flags of the LTC4150 coulomb counter. More...
 
enum  ltc4150_dir_t { LTC4150_CHARGE, LTC4150_DISCHARGE }
 Enumeration of directions in which the charge can be transferred. More...
 

Functions

int ltc4150_init (ltc4150_dev_t *dev, const ltc4150_params_t *params)
 Initialize the LTC4150 driver. More...
 
int ltc4150_reset_counters (ltc4150_dev_t *dev)
 Clear current counters of the given LTC4150 device. More...
 
int ltc4150_shutdown (ltc4150_dev_t *dev)
 Disable the interrupt handler and turn the chip off. More...
 
int ltc4150_charge (ltc4150_dev_t *dev, uint32_t *charged, uint32_t *discharged)
 Get the measured charge since boot or last reset in millicoulomb. More...
 
int ltc4150_avg_current (ltc4150_dev_t *dev, int16_t *dest)
 Get the average current drawn in E-01 milliampere. More...
 
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. More...
 
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. More...
 

Variables

const ltc4150_recorder_t ltc4150_last_minute
 Records the charge transferred within the last minute using.