42 #define EZCURRENT_ADDR 0xEF
44 #ifndef EZCURRENT_I2C_DEV
45 #define EZCURRENT_I2C_DEV i2c1
66 #define Uint16FromBuf(_buf,_idx) ((uint16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
67 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
int32_t current
current in milliamps
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
transaction successfully finished by I2C driver
#define EZCURRENT_I2C_DEV
void ezcurrent_read_event(void)
#define Int16FromBuf(_buf, _idx)
struct i2c_transaction ezcurrent_i2c_trans
transaction set to done by user level
Interface for electrical status: supply voltage, current, battery status, etc.
void ezcurrent_init(void)
I2C transaction structure.
enum I2CTransactionStatus status
Transaction status.
uint8_t slave_addr
Slave address.
#define Uint16FromBuf(_buf, _idx)
uint16_t vsupply
supply voltage in decivolts
int32_t consumed
consumption in mAh
struct Electrical electrical
void ezcurrent_read_periodic(void)
bool_t i2c_receive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
Submit a read only transaction.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.