48#include "px_i2c_cfg.h"
51#if ( !defined(PX_I2C_CFG_I2C1_EN ) \
52 || !defined(PX_I2C_CFG_I2C2_EN ) \
53 || !defined(PX_I2C_CFG_TIMINGR) )
54#error "One or more options not defined in 'px_i2c_cfg.h'"
56#if ( (PX_I2C_CFG_I2C1_EN > 1) \
57 || (PX_I2C_CFG_I2C2_EN > 1) )
58#error "PX_I2C_CFG_I2Cx_EN must be 0 or 1"
62#define PX_I2C_CFG_PER_COUNT ( PX_I2C_CFG_I2C1_EN \
63 + PX_I2C_CFG_I2C2_EN )
64#if (PX_I2C_CFG_PER_COUNT == 0)
65#error "No peripherals enabled"
85#define PX_I2C_FLAG_START (1 << 0)
87#define PX_I2C_FLAG_STOP (1 << 1)
89#define PX_I2C_FLAG_END (1 << 2)
91#define PX_I2C_FLAG_REP_START (1 << 3)
93#define PX_I2C_FLAG_START_AND_STOP (PX_I2C_FLAG_START + PX_I2C_FLAG_STOP)
95#define PX_I2C_FLAG_START_AND_END (PX_I2C_FLAG_START + PX_I2C_FLAG_END)
97#define PX_I2C_FLAG_REP_START_AND_STOP (PX_I2C_FLAG_REP_START + PX_I2C_FLAG_STOP)
99#define PX_I2C_FLAG_REP_START_AND_END (PX_I2C_FLAG_REP_START + PX_I2C_FLAG_END)
uint8_t slave_adr
7-bit I2C slave address
struct px_i2c_per_s * i2c_per
I2C peripheral data.
bool px_i2c_close(px_i2c_handle_t *handle)
Close specified handle.
void px_i2c_init(void)
Initialise I2C driver.
bool px_i2c_open(px_i2c_handle_t *handle, px_i2c_nr_t i2c_nr, uint8_t slave_adr)
Open I2C slave handle.
px_i2c_nr_t
Specify I2C peripheral.
bool px_i2c_rd(px_i2c_handle_t *handle, void *data, size_t nr_of_bytes, uint8_t flags)
Perform an I2C read transaction with an I2C slave.
void px_i2c_change_slave_adr(px_i2c_handle_t *handle, uint8_t slave_adr)
Change I2C slave address.
bool px_i2c_wr(px_i2c_handle_t *handle, const void *data, size_t nr_of_bytes, uint8_t flags)
Perform an I2C write transaction with an I2C slave.
Define I2C handle for a slave.