APM:Libraries
Macros | Enumerations | Functions | Variables
i2c.c File Reference
#include "i2c.h"
#include "dma.h"
#include "systick.h"
#include "stm32f4xx_i2c.h"
#include "stm32f4xx_dma.h"
#include <boards.h>
Include dependency graph for i2c.c:

Go to the source code of this file.

Macros

#define MAX_I2C_TIME   300
 Reset an I2C bus. More...
 

Enumerations

enum  I2C_Dir { TX = 0, RX = 1, TXREG = 2 }
 

Functions

static void delay_10us ()
 
void i2c_lowLevel_deinit (const i2c_dev *dev)
 DeInitializes peripherals used by the I2C driver. More...
 
static void i2c_lowLevel_init (const i2c_dev *dev)
 Initializes peripherals used by the I2C driver. More...
 
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...
 
static void ev_handler (const i2c_dev *dev, bool err)
 
void I2C1_EV_IRQHandler ()
 
void I2C1_ER_IRQHandler ()
 
void I2C2_EV_IRQHandler ()
 
void I2C2_ER_IRQHandler ()
 
void I2C3_EV_IRQHandler ()
 
void I2C3_ER_IRQHandler ()
 
void i2c_master_release_bus (const i2c_dev *dev)
 
bool i2c_bus_reset (const i2c_dev *dev)
 

Variables

uint32_t i2c_bit_time =4
 

Macro Definition Documentation

◆ MAX_I2C_TIME

#define MAX_I2C_TIME   300

Reset an I2C bus.

Reset is accomplished by clocking out pulses until any hung slaves release SDA and SCL, then generating a START condition, then a STOP condition.

Parameters
devI2C device

Definition at line 269 of file i2c.c.

Referenced by i2c_bus_reset().

Enumeration Type Documentation

◆ I2C_Dir

enum I2C_Dir
Enumerator
TX 
RX 
TXREG 

Definition at line 74 of file i2c.c.

Function Documentation

◆ delay_10us()

static void delay_10us ( )
static

Definition at line 76 of file i2c.c.

Referenced by i2c_bus_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ev_handler()

static void ev_handler ( const i2c_dev dev,
bool  err 
)
static

Definition at line 204 of file i2c.c.

Here is the call graph for this function:

◆ I2C1_ER_IRQHandler()

void I2C1_ER_IRQHandler ( )

Referenced by ev_handler().

Here is the caller graph for this function:

◆ I2C1_EV_IRQHandler()

void I2C1_EV_IRQHandler ( )

Referenced by ev_handler().

Here is the caller graph for this function:

◆ I2C2_ER_IRQHandler()

void I2C2_ER_IRQHandler ( )

Referenced by ev_handler().

Here is the caller graph for this function:

◆ I2C2_EV_IRQHandler()

void I2C2_EV_IRQHandler ( )

Referenced by ev_handler().

Here is the caller graph for this function:

◆ I2C3_ER_IRQHandler()

void I2C3_ER_IRQHandler ( )

Referenced by ev_handler().

Here is the caller graph for this function:

◆ I2C3_EV_IRQHandler()

void I2C3_EV_IRQHandler ( )

Referenced by ev_handler().

Here is the caller graph for this function:

◆ i2c_bus_reset()

bool i2c_bus_reset ( const i2c_dev dev)

Definition at line 271 of file i2c.c.

Referenced by F4Light::I2CDevice::_do_bus_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ i2c_deinit()

void i2c_deinit ( const i2c_dev dev)

DeInitializes peripherals used by the I2C driver.

Parameters
None
Return values
None

Definition at line 199 of file i2c.c.

Referenced by F4Light::I2CDevice::_do_bus_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ i2c_init()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ i2c_lowLevel_deinit()

void i2c_lowLevel_deinit ( const i2c_dev dev)

DeInitializes peripherals used by the I2C driver.

Parameters
None
Return values
None

< GPIO configuration

< Configure I2C pins: SCL

< Configure I2C pins: SDA

Definition at line 87 of file i2c.c.

Referenced by i2c_deinit().

Here is the caller graph for this function:

◆ i2c_lowLevel_init()

static void i2c_lowLevel_init ( const i2c_dev dev)
inlinestatic

Initializes peripherals used by the I2C driver.

Definition at line 121 of file i2c.c.

Referenced by i2c_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ i2c_master_release_bus()

void i2c_master_release_bus ( const i2c_dev dev)

Definition at line 248 of file i2c.c.

Referenced by i2c_bus_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ i2c_bit_time

uint32_t i2c_bit_time =4

Definition at line 80 of file i2c.c.

Referenced by i2c_init(), F4Light::I2CDevice::i2c_read(), and F4Light::I2CDevice::i2c_write().