v2.0.0
Data Structures | Macros | Typedefs | Functions
i2c.h File Reference
`#include "pico.h"`
`#include "pico/time.h"`
`#include "hardware/structs/i2c.h"`
`#include "hardware/regs/dreq.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 | i2c_inst

## Macros
#define | PARAM_ASSERTIONS_ENABLED_HARDWARE_I2C 0
#define | I2C_NUM(i2c)
| Returns the I2C number for a I2C instance. More...
#define | I2C_INSTANCE(num)
| Returns the I2C instance with the given I2C number. More...
#define | I2C_DREQ_NUM(i2c, is_tx)
| Returns the dreq_num_t used for pacing DMA transfers to or from this I2C instance. If is_tx is true, then it is for transfers to the I2C instance else for transfers from the I2C instance. More...
#define | i2c_hw_index(i2c) i2c_get_index(i2c)

## Typedefs
typedef struct i2c_inst | i2c_inst_t

## Functions
uint | i2c_init (i2c_inst_t *i2c, uint baudrate)
| Initialise the I2C HW block. More...
void | i2c_deinit (i2c_inst_t *i2c)
| Disable the I2C HW block. More...
uint | i2c_set_baudrate (i2c_inst_t *i2c, uint baudrate)
| Set I2C baudrate. More...
void | i2c_set_slave_mode (i2c_inst_t *i2c, bool slave, uint8_t addr)
| Set I2C port to slave mode. More...
static uint | i2c_get_index (i2c_inst_t *i2c)
| Convert I2C instance to hardware instance number. More...
static i2c_hw_t * | i2c_get_hw (i2c_inst_t *i2c)
| Return pointer to structure containing i2c hardware registers. More...
static i2c_inst_t * | i2c_get_instance (uint num)
| Convert I2C hardware instance number to I2C instance. More...
int | i2c_write_blocking_until (i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, absolute_time_t until)
| Attempt to write specified number of bytes to address, blocking until the specified absolute time is reached. More...
int | i2c_read_blocking_until (i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop, absolute_time_t until)
| Attempt to read specified number of bytes from address, blocking until the specified absolute time is reached. More...
static int | i2c_write_timeout_us (i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, uint timeout_us)
| Attempt to write specified number of bytes to address, with timeout. More...
int | i2c_write_timeout_per_char_us (i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, uint timeout_per_char_us)
static int | i2c_read_timeout_us (i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop, uint timeout_us)
| Attempt to read specified number of bytes from address, with timeout. More...
int | i2c_read_timeout_per_char_us (i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop, uint timeout_per_char_us)
int | i2c_write_blocking (i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop)
| Attempt to write specified number of bytes to address, blocking. More...
int | i2c_read_blocking (i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop)
| Attempt to read specified number of bytes from address, blocking. More...
static size_t | i2c_get_write_available (i2c_inst_t *i2c)
| Determine non-blocking write space available. More...
static size_t | i2c_get_read_available (i2c_inst_t *i2c)
| Determine number of bytes received. More...
static void | i2c_write_raw_blocking (i2c_inst_t *i2c, const uint8_t *src, size_t len)
| Write direct to TX FIFO. More...
static void | i2c_read_raw_blocking (i2c_inst_t *i2c, uint8_t *dst, size_t len)
| Read direct from RX FIFO. More...
static uint8_t | i2c_read_byte_raw (i2c_inst_t *i2c)
| Pop a byte from I2C Rx FIFO. More...
static void | i2c_write_byte_raw (i2c_inst_t *i2c, uint8_t value)
| Push a byte into I2C Tx FIFO. More...
static uint | i2c_get_dreq (i2c_inst_t *i2c, bool is_tx)
| Return the DREQ to use for pacing transfers to/from a particular I2C instance. More...
#define | i2c0 (&i2c0_inst)
| Identifier for I2C HW Block 0.
#define | i2c1 (&i2c1_inst)
| Identifier for I2C HW Block 1.
i2c_inst_t | i2c0_inst
i2c_inst_t | i2c1_inst