122 uint16_t val = (uint16_t)(slave << 1);
156 uint16_t val = (uint16_t)(slave << 1);
299 I2C_DR(i2c) = (uint8_t)((slave << 1) | readwrite);
309 return I2C_DR(i2c) & 0xff;
411 I2C_CR2(i2c) &= ~I2C_CR2_DMAEN;
434static void i2c_write7_v1(uint32_t i2c,
int addr,
const uint8_t *data,
size_t n)
454 for (
size_t i = 0; i < n; i++) {
460static void i2c_read7_v1(uint32_t i2c,
int addr, uint8_t *res,
size_t n)
477 for (
size_t i = 0; i < n; ++i) {
501void i2c_transfer7(uint32_t i2c, uint8_t addr,
const uint8_t *w,
size_t wn, uint8_t *r,
size_t rn) {
#define I2C_CCR(i2c_base)
#define I2C_CR1(i2c_base)
#define I2C_TRISE(i2c_base)
#define I2C_SR1(i2c_base)
#define I2C_SR2(i2c_base)
i2c_speeds
I2C speed modes.
#define I2C_OAR1(i2c_base)
#define I2C_OAR2(i2c_base)
#define I2C_CR2(i2c_base)
#define I2C_CCR_DUTY_DIV2
void i2c_disable_interrupt(uint32_t i2c, uint32_t interrupt)
I2C Disable Interrupt.
void i2c_enable_interrupt(uint32_t i2c, uint32_t interrupt)
I2C Enable Interrupt.
static void i2c_write7_v1(uint32_t i2c, int addr, const uint8_t *data, size_t n)
void i2c_disable_ack(uint32_t i2c)
I2C Disable ACK.
void i2c_set_dma_last_transfer(uint32_t i2c)
I2C Set DMA last transfer.
void i2c_nack_current(uint32_t i2c)
I2C NACK Next Byte.
void i2c_set_fast_mode(uint32_t i2c)
I2C Set Fast Mode.
void i2c_enable_ack(uint32_t i2c)
I2C Enable ACK.
void i2c_send_start(uint32_t i2c)
I2C Send Start Condition.
void i2c_set_clock_frequency(uint32_t i2c, uint8_t freq)
I2C Set Peripheral Clock Frequency.
void i2c_peripheral_disable(uint32_t i2c)
I2C Peripheral Disable.
void i2c_set_own_7bit_slave_address_two(uint32_t i2c, uint8_t slave)
I2C Set the secondary 7 bit Slave Address for the Peripheral.
void i2c_set_dutycycle(uint32_t i2c, uint32_t dutycycle)
I2C Set clock duty cycle.
void i2c_set_own_7bit_slave_address(uint32_t i2c, uint8_t slave)
I2C Set the 7 bit Slave Address for the Peripheral.
void i2c_disable_dual_addressing_mode(uint32_t i2c)
I2C Disable dual addressing mode for the Peripheral.
void i2c_set_standard_mode(uint32_t i2c)
I2C Set Standard Mode.
void i2c_set_trise(uint32_t i2c, uint16_t trise)
I2C Set the Rise Time.
void i2c_send_stop(uint32_t i2c)
I2C Send Stop Condition.
void i2c_peripheral_enable(uint32_t i2c)
I2C Peripheral Enable.
void i2c_nack_next(uint32_t i2c)
I2C NACK Next Byte.
void i2c_set_own_10bit_slave_address(uint32_t i2c, uint16_t slave)
I2C Set the 10 bit Slave Address for the Peripheral.
void i2c_disable_dma(uint32_t i2c)
I2C Disable DMA.
void i2c_send_data(uint32_t i2c, uint8_t data)
I2C Send Data.
void i2c_clear_dma_last_transfer(uint32_t i2c)
I2C Clear DMA last transfer.
uint8_t i2c_get_data(uint32_t i2c)
I2C Get Data.
static void i2c_read7_v1(uint32_t i2c, int addr, uint8_t *res, size_t n)
void i2c_clear_stop(uint32_t i2c)
I2C Clear Stop Flag.
void i2c_set_ccr(uint32_t i2c, uint16_t freq)
I2C Set Bus Clock Frequency.
void i2c_send_7bit_address(uint32_t i2c, uint8_t slave, uint8_t readwrite)
I2C Send the 7-bit Slave Address.
void i2c_enable_dual_addressing_mode(uint32_t i2c)
I2C Enable dual addressing mode for the Peripheral.
void i2c_transfer7(uint32_t i2c, uint8_t addr, const uint8_t *w, size_t wn, uint8_t *r, size_t rn)
Run a write/read transaction to a given 7bit i2c address If both write & read are provided,...
void i2c_enable_dma(uint32_t i2c)
I2C Enable DMA.
void i2c_set_speed(uint32_t i2c, enum i2c_speeds speed, uint32_t clock_megahz)
Set the i2c communication speed.