objc

Data Structures | Typedefs | Functions
i2c.h File Reference

I2C (Inter-Integrated Circuit) interface. More...

#include "gpio.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.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  hw_i2c_t
 I2C adapter. More...
 

Typedefs

typedef struct hw_i2c_t hw_i2c_t
 I2C adapter.
 

Functions

hw_i2c_t hw_i2c_init_default (uint32_t baudrate)
 Initialize an I2C interface using default pins and adapter. More...
 
hw_i2c_t hw_i2c_init (uint8_t adapter, uint8_t sda, uint8_t scl, uint32_t baudrate)
 Initialize an I2C interface with specific adapter and pins. More...
 
void hw_i2c_finalize (hw_i2c_t *i2c)
 Finalize and release an I2C interface. More...
 
uint8_t hw_i2c_count (void)
 Get the total number of available I2C adapters. More...
 
static bool hw_i2c_valid (hw_i2c_t *i2c)
 Get true if the I2C interface is valid. More...
 
bool hw_i2c_detect (hw_i2c_t *i2c, uint8_t addr)
 Detect if an I2C device is present at the specified address. More...
 
size_t hw_i2c_xfr (hw_i2c_t *i2c, uint8_t addr, void *data, size_t tx, size_t rx, uint32_t timeout_ms)
 Perform an I2C transfer operation (read, write, or combined). More...
 
size_t hw_i2c_read (hw_i2c_t *i2c, uint8_t addr, uint8_t reg, void *data, size_t len, uint32_t timeout_ms)
 Read data from a specific register of an I2C device. More...
 
size_t hw_i2c_write (hw_i2c_t *i2c, uint8_t addr, uint8_t reg, const void *data, size_t len, uint32_t timeout_ms)
 Write data to a specific register of an I2C device. More...
 

Detailed Description

I2C (Inter-Integrated Circuit) interface.

Definition in file i2c.h.