31 while (t < b->hold_time)
109 for (i = 7; i >= 0; i--)
136 for (i = 7; i >= 0; i--)
142 *data |= (sda != 0) << i;
156 tick = 1.0 / b->
clock;
180 for (i = 0; i < msg->
len; i++)
188 for (i = 0; i < msg->
len; i++)
202 u16 length,
u8 * data)
209 start_address[0] = start_addr;
210 msg[0].
addr = i2c_addr;
212 msg[0].
buffer = (
u8 *) & start_address;
215 msg[1].
addr = i2c_addr;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void i2c_stop(i2c_bus_t *b)
static void i2c_start(i2c_bus_t *b)
static void i2c_write_bit(i2c_bus_t *b, int sda)
static void vlib_time_wait(vlib_main_t *vm, f64 wait)
static void i2c_read_bit(i2c_bus_t *b, int *sda)
#define I2C_MSG_FLAG_WRITE
vapi_message_desc_t ** msgs
void vlib_i2c_xfer(i2c_bus_t *bus, i2c_msg_t *msgs)
static void i2c_read_byte(i2c_bus_t *b, u8 *data, int ack)
#define vec_free(V)
Free vector's memory (no header).
void(* get_bits)(struct i2c_bus_t *b, int *scl, int *sda)
void vlib_i2c_init(i2c_bus_t *b)
static void i2c_write_byte(i2c_bus_t *b, u8 data)
static void i2c_wait_for_scl(i2c_bus_t *b)
static vlib_main_t * vlib_get_main(void)
void vlib_i2c_read_eeprom(i2c_bus_t *bus, u8 i2c_addr, u16 start_addr, u16 length, u8 *data)
void(* put_bits)(struct i2c_bus_t *b, int scl, int sda)
static void i2c_delay(i2c_bus_t *b, f64 timeout)
static int vlib_i2c_bus_timed_out(i2c_bus_t *bus)
#define vec_foreach(var, vec)
Vector iterator.
#define I2C_MSG_FLAG_READ