oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
i2c.h File Reference
#include "ove/types.h"
#include "ove_config.h"
#include "ove/storage.h"
Include dependency graph for i2c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ove_i2c_cfg
 I2C bus configuration descriptor. More...
 

Macros

#define OVE_I2C_REG_WRITE_MAX   32
 

Enumerations

enum  ove_i2c_speed_t { OVE_I2C_SPEED_STANDARD = 0 , OVE_I2C_SPEED_FAST = 1 , OVE_I2C_SPEED_FAST_PLUS = 2 }
 I2C bus speed grade. More...
 

Functions

int ove_i2c_init (ove_i2c_t *i2c, ove_i2c_storage_t *storage, const struct ove_i2c_cfg *cfg)
 Initialise an I2C bus using caller-provided static storage.
 
void ove_i2c_deinit (ove_i2c_t i2c)
 Deinitialise a statically-allocated I2C bus.
 
int ove_i2c_create (ove_i2c_t *i2c, const struct ove_i2c_cfg *cfg)
 Create a heap-allocated I2C bus controller.
 
void ove_i2c_destroy (ove_i2c_t i2c)
 Destroy a heap-allocated I2C bus controller.
 
int ove_i2c_write (ove_i2c_t i2c, uint16_t addr, const void *data, size_t len, uint64_t timeout_ns)
 Write data to an I2C device.
 
int ove_i2c_read (ove_i2c_t i2c, uint16_t addr, void *buf, size_t len, uint64_t timeout_ns)
 Read data from an I2C device.
 
int ove_i2c_write_read (ove_i2c_t i2c, uint16_t addr, const void *tx, size_t tx_len, void *rx, size_t rx_len, uint64_t timeout_ns)
 Combined write-then-read with I2C repeated start.
 
int ove_i2c_reg_write (ove_i2c_t i2c, uint16_t addr, uint8_t reg, const void *data, size_t len, uint64_t timeout_ns)
 Write to a single-byte-addressed register.
 
int ove_i2c_reg_read (ove_i2c_t i2c, uint16_t addr, uint8_t reg, void *buf, size_t len, uint64_t timeout_ns)
 Read from a single-byte-addressed register.
 
int ove_i2c_probe (ove_i2c_t i2c, uint16_t addr, uint64_t timeout_ns)
 Probe for a device at the given address.
 
int ove_i2c_write_read_async (ove_i2c_t i2c, uint16_t addr, const void *tx, size_t tx_len, void *rx, size_t rx_len, ove_dma_complete_cb cb, void *user_data)
 Submit an I2C write-then-read transaction asynchronously.