APM:Libraries
|
Go to the source code of this file.
Classes | |
struct | I2C_DMA |
struct | I2c_state |
struct | i2c_dev |
I2C device type. More... | |
Macros | |
#define | I2C_50KHz_SPEED 50000 |
#define | I2C_75KHz_SPEED 75000 |
#define | I2C_100KHz_SPEED 100000 |
#define | I2C_250KHz_SPEED 250000 |
#define | I2C_400KHz_SPEED 400000 |
#define | I2C_BIT_MASK ((uint32_t)0x00FFFFFF) |
#define | I2C_BIT_SMBALERT ((uint32_t)0x0008000) |
#define | I2C_BIT_TIMEOUT ((uint32_t)0x4000) |
#define | I2C_BIT_PECERR ((uint32_t)0x1000) |
#define | I2C_BIT_OVR ((uint32_t)0x0800) |
#define | I2C_BIT_AF ((uint32_t)0x0400) |
#define | I2C_BIT_ARLO ((uint32_t)0x0200) |
#define | I2C_BIT_BERR ((uint32_t)0x0100) |
#define | I2C_BIT_TXE ((uint32_t)0x0080) |
#define | I2C_BIT_RXNE ((uint32_t)0x0040) |
#define | I2C_BIT_STOPF ((uint32_t)0x0010) |
#define | I2C_BIT_ADD10 ((uint32_t)0x0008) |
#define | I2C_BIT_BTF ((uint32_t)0x0004) |
#define | I2C_BIT_ADDR ((uint32_t)0x0002) |
#define | I2C_BIT_SB ((uint32_t)0x0001) |
#define | I2C_IE_BUF ((uint16_t)0x0400) |
#define | I2C_IE_EVT ((uint16_t)0x0200) |
#define | I2C_IE_ERR ((uint16_t)0x0100) |
#define | I2C_BIT_DUALF ((uint32_t)0x0080) |
#define | I2C_BIT_SMBHOST ((uint32_t)0x0040) |
#define | I2C_BIT_SMBDEFAULT ((uint32_t)0x0020) |
#define | I2C_BIT_GENCALL ((uint32_t)0x0010) |
#define | I2C_BIT_TRA ((uint32_t)0x0004) |
#define | I2C_BIT_BUSY ((uint32_t)0x0002) |
#define | I2C_BIT_MSL ((uint32_t)0x0001) |
#define | I2C_NACKPosition_Next ((uint16_t)0x0800) |
#define | I2C_NACKPosition_Current ((uint16_t)0xF7FF) |
#define | I2C_Direction_Transmitter ((uint8_t)0x00) |
#define | I2C_Direction_Receiver ((uint8_t)0x01) |
#define | I2C_TIMEOUT (300) |
#define | I2C_SMALL_TIMEOUT (50) |
#define | I2C_OK 0 |
#define | I2C_NO_DEVICE 1 |
#define | I2C_ERROR 2 |
#define | I2C_BUS_BUSY 2 |
#define | I2C_ERR_WRITE 6 |
#define | I2C_NO_REGISTER 8 |
#define | I2C_BUS_ERR 99 |
#define | I2C_ERR_STOP 98 |
#define | I2C_STOP_BERR 97 |
#define | I2C_STOP_BUSY 96 |
#define | I2C_ERR_TIMEOUT 95 |
#define | I2C_ERR_REGISTER 94 |
#define | I2C_ERR_OVERRUN 93 |
#define | I2C_ERR_STOP_TIMEOUT 92 |
#define | I2C_DMA_BUSY 103 |
#define | I2C_PENDING 255 |
#define | I2C_DMA_ERROR 100 |
#define | DMA_BUFSIZE 8 |
Typedefs | |
typedef struct I2C_DMA | I2C_dma |
typedef struct I2c_state | i2c_state |
typedef struct i2c_dev | i2c_dev |
I2C device type. More... | |
Functions | |
void | i2c_init (const i2c_dev *dev, uint16_t address, uint32_t speed) |
void | i2c_deinit (const i2c_dev *dev) |
DeInitializes peripherals used by the I2C driver. More... | |
uint32_t | i2c_write (const i2c_dev *dev, uint8_t addr, const uint8_t *tx_buff, uint8_t txlen) |
uint32_t | i2c_read (const i2c_dev *dev, uint8_t addr, const uint8_t *tx_buff, uint8_t txlen, uint8_t *rx_buff, uint8_t rxlen) |
void | i2c_lowLevel_deinit (const i2c_dev *dev) |
DeInitializes peripherals used by the I2C driver. More... | |
void | i2c_master_release_bus (const i2c_dev *dev) |
bool | i2c_bus_reset (const i2c_dev *dev) |
static void | i2c_set_isr_handler (const i2c_dev *dev, Handler h) |
static void | i2c_clear_isr_handler (const i2c_dev *dev) |
static void | i2c_send_address (const i2c_dev *dev, uint8_t address, uint8_t direction) |
Variables | |
uint32_t | i2c_bit_time |
const i2c_dev *const | _I2C1 |
const i2c_dev *const | _I2C2 |
const i2c_dev *const | _I2C3 |
#define I2C_250KHz_SPEED 250000 |
Definition at line 11 of file i2c.h.
Referenced by F4Light::I2CDevice::init().
#define I2C_400KHz_SPEED 400000 |
Definition at line 12 of file i2c.h.
Referenced by F4Light::I2CDevice::init().
#define I2C_BIT_ADDR ((uint32_t)0x0002) |
Definition at line 30 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BIT_AF ((uint32_t)0x0400) |
Definition at line 22 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BIT_ARLO ((uint32_t)0x0200) |
Definition at line 23 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), and F4Light::I2CDevice::wait_stop_done().
#define I2C_BIT_BERR ((uint32_t)0x0100) |
Definition at line 24 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), and F4Light::I2CDevice::wait_stop_done().
#define I2C_BIT_BTF ((uint32_t)0x0004) |
Definition at line 29 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BIT_BUSY ((uint32_t)0x0002) |
Definition at line 44 of file i2c.h.
Referenced by F4Light::I2CDevice::wait_stop_done().
#define I2C_BIT_MASK ((uint32_t)0x00FFFFFF) |
Definition at line 15 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), and F4Light::I2CDevice::wait_stop_done().
#define I2C_BIT_RXNE ((uint32_t)0x0040) |
Definition at line 26 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BIT_SB ((uint32_t)0x0001) |
Definition at line 31 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BIT_TIMEOUT ((uint32_t)0x4000) |
Definition at line 19 of file i2c.h.
Referenced by F4Light::I2CDevice::wait_stop_done().
#define I2C_BIT_TRA ((uint32_t)0x0004) |
Definition at line 43 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BIT_TXE ((uint32_t)0x0080) |
Definition at line 25 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_BUS_BUSY 2 |
Definition at line 64 of file i2c.h.
Referenced by F4Light::I2CDevice::transfer().
#define I2C_BUS_ERR 99 |
Definition at line 67 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), and F4Light::I2CDevice::transfer().
#define I2C_Direction_Receiver ((uint8_t)0x01) |
Definition at line 52 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), and Soft_I2C::tick().
#define I2C_Direction_Transmitter ((uint8_t)0x00) |
Definition at line 51 of file i2c.h.
Referenced by Soft_I2C::_start(), i2c_send_address(), and F4Light::I2CDevice::isr_ev().
#define I2C_ERR_REGISTER 94 |
Definition at line 72 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_ERR_STOP 98 |
Definition at line 68 of file i2c.h.
Referenced by F4Light::I2CDevice::transfer(), and F4Light::I2CDevice::wait_stop_done().
#define I2C_ERR_STOP_TIMEOUT 92 |
Definition at line 74 of file i2c.h.
Referenced by F4Light::I2CDevice::wait_stop_done().
#define I2C_ERR_TIMEOUT 95 |
Definition at line 71 of file i2c.h.
Referenced by F4Light::I2CDevice::i2c_read(), F4Light::I2CDevice::i2c_write(), and Soft_I2C::wait_done().
#define I2C_ERR_WRITE 6 |
Definition at line 65 of file i2c.h.
Referenced by Soft_I2C::tick().
#define I2C_ERROR 2 |
Definition at line 63 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), Soft_I2C::read(), Soft_I2C::transfer(), Soft_I2C::wait_done(), and Soft_I2C::writeBuffer().
#define I2C_IE_BUF ((uint16_t)0x0400) |
Definition at line 34 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_IE_ERR ((uint16_t)0x0100) |
Definition at line 36 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_IE_EVT ((uint16_t)0x0200) |
Definition at line 35 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
#define I2C_NACKPosition_Next ((uint16_t)0x0800) |
Definition at line 48 of file i2c.h.
Referenced by F4Light::I2CDevice::i2c_read(), and F4Light::I2CDevice::i2c_write().
#define I2C_NO_DEVICE 1 |
Definition at line 62 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev(), Soft_I2C::tick(), and F4Light::I2CDevice::transfer().
#define I2C_NO_REGISTER 8 |
Definition at line 66 of file i2c.h.
Referenced by Soft_I2C::tick().
#define I2C_OK 0 |
Definition at line 61 of file i2c.h.
Referenced by Soft_I2C::_start(), F4Light::I2CDevice::i2c_read(), F4Light::I2CDevice::i2c_write(), F4Light::I2CDevice::isr_ev(), Soft_I2C::tick(), F4Light::I2CDevice::transfer(), and F4Light::I2CDevice::wait_stop_done().
#define I2C_PENDING 255 |
Definition at line 76 of file i2c.h.
Referenced by F4Light::I2CDevice::i2c_read(), F4Light::I2CDevice::i2c_write(), and F4Light::I2CDevice::transfer().
#define I2C_SMALL_TIMEOUT (50) |
Definition at line 58 of file i2c.h.
Referenced by F4Light::I2CDevice::wait_stop_done().
#define I2C_STOP_BERR 97 |
Definition at line 69 of file i2c.h.
Referenced by F4Light::I2CDevice::transfer(), and F4Light::I2CDevice::wait_stop_done().
#define I2C_STOP_BUSY 96 |
Definition at line 70 of file i2c.h.
Referenced by F4Light::I2CDevice::transfer().
bool i2c_bus_reset | ( | const i2c_dev * | dev | ) |
Definition at line 271 of file i2c.c.
Referenced by F4Light::I2CDevice::_do_bus_reset().
|
inlinestatic |
Definition at line 140 of file i2c.h.
Referenced by F4Light::I2CDevice::finish_transfer().
void i2c_deinit | ( | const i2c_dev * | dev | ) |
DeInitializes peripherals used by the I2C driver.
None |
None |
Definition at line 199 of file i2c.c.
Referenced by F4Light::I2CDevice::_do_bus_reset().
void i2c_init | ( | const i2c_dev * | dev, |
uint16_t | address, | ||
uint32_t | speed | ||
) |
Definition at line 166 of file i2c.c.
Referenced by F4Light::I2CDevice::init(), read_calibration_data(), and setup().
void i2c_lowLevel_deinit | ( | const i2c_dev * | dev | ) |
DeInitializes peripherals used by the I2C driver.
None |
None |
< GPIO configuration
< Configure I2C pins: SCL
< Configure I2C pins: SDA
Definition at line 87 of file i2c.c.
Referenced by i2c_deinit().
void i2c_master_release_bus | ( | const i2c_dev * | dev | ) |
Definition at line 248 of file i2c.c.
Referenced by i2c_bus_reset().
uint32_t i2c_read | ( | const i2c_dev * | dev, |
uint8_t | addr, | ||
const uint8_t * | tx_buff, | ||
uint8_t | txlen, | ||
uint8_t * | rx_buff, | ||
uint8_t | rxlen | ||
) |
|
inlinestatic |
Definition at line 145 of file i2c.h.
Referenced by F4Light::I2CDevice::isr_ev().
Definition at line 128 of file i2c.h.
Referenced by F4Light::I2CDevice::i2c_read(), and F4Light::I2CDevice::i2c_write().
uint32_t i2c_write | ( | const i2c_dev * | dev, |
uint8_t | addr, | ||
const uint8_t * | tx_buff, | ||
uint8_t | txlen | ||
) |
const i2c_dev* const _I2C1 |
Referenced by i2c_send_address(), and F4Light::I2CDevice::init().
const i2c_dev* const _I2C2 |
Referenced by i2c_send_address(), and F4Light::I2CDevice::init().
const i2c_dev* const _I2C3 |
Referenced by i2c_send_address().
uint32_t i2c_bit_time |
Definition at line 80 of file i2c.c.
Referenced by i2c_init(), F4Light::I2CDevice::i2c_read(), and F4Light::I2CDevice::i2c_write().