Functions
Initialization and de-initialization functions
Peripheral Driver » HAL Driver » I2C » Functions

Initialization and de-initialization functions. More...

## Functions
hal_status_t | hal_i2c_init (i2c_handle_t *p_i2c)
| Initializes the I2C according to the specified parameters in the i2c_init_t and initialize the associated handle. More...
hal_status_t | hal_i2c_deinit (i2c_handle_t *p_i2c)
| De-initialize the I2C peripheral. More...
void | hal_i2c_msp_init (i2c_handle_t *p_i2c)
| Initialize the I2C MSP. More...
void | hal_i2c_msp_deinit (i2c_handle_t *p_i2c)
| De-initialize the I2C MSP. More...

## Detailed Description

Initialization and de-initialization functions.

     ===============================================================================
                  ##### Initialization and de-initialization functions #####
     ===============================================================================
        [..]  This subsection provides a set of functions allowing to initialize and
              de-initialize the I2Cx peripheral:

          (+) User must Implement hal_i2c_msp_init() function in which he configures
              all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ).

          (+) Call the function hal_i2c_init() to configure the selected device with
              the selected configuration:
            (++) Speed
            (++) Own Address
            (++) Addressing mode (Master, Slave)
            (++) General call mode

          (+) Call the function hal_i2c_deinit() to restore the default configuration
              of the selected I2Cx peripheral.

## Function Documentation

## ◆ hal_i2c_deinit()

hal_status_t hal_i2c_deinit | ( | i2c_handle_t * | p_i2c | ) |

De-initialize the I2C peripheral.

Parameters

  [in] | p_i2c | Pointer to an I2C handle which contains the configuration information for the specified I2C.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_i2c_init()

hal_status_t hal_i2c_init | ( | i2c_handle_t * | p_i2c | ) |

Initializes the I2C according to the specified parameters in the i2c_init_t and initialize the associated handle.

Parameters

  [in] | p_i2c | Pointer to an I2C handle which contains the configuration information for the specified I2C.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_i2c_msp_deinit()

void hal_i2c_msp_deinit | ( | i2c_handle_t * | p_i2c | ) |

De-initialize the I2C MSP.

Note
  This function should not be modified. When the callback is needed, the hal_i2c_msp_deinit could be implemented in the user file.

Parameters

  [in] | p_i2c | Pointer to an I2C handle which contains the configuration information for the specified I2C.

## ◆ hal_i2c_msp_init()

void hal_i2c_msp_init | ( | i2c_handle_t * | p_i2c | ) |

Initialize the I2C MSP.

Note
  This function should not be modified. When the callback is needed, the hal_i2c_msp_init could be implemented in the user file.

Parameters

  [in] | p_i2c | Pointer to an I2C handle which contains the configuration information for the specified I2C.