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