Peripheral State, Mode and Error functions

Peripheral State, Mode and Error functions. More...

Functions

hal_i2c_state_t hal_i2c_get_state (const i2c_handle_t *p_i2c)
 Return the I2C handle state. More...
 
hal_i2c_mode_t hal_i2c_get_mode (const i2c_handle_t *p_i2c)
 Returns the I2C Master, Slave, Memory or no mode. More...
 
uint32_t hal_i2c_get_error (const i2c_handle_t *p_i2c)
 Return the I2C error code. More...
 
uint32_t hal_i2c_sda_at_low_is_not_recovered (const i2c_handle_t *p_i2c)
 Return i2c sda at low is not recovered flag. More...
 
void hal_i2c_suspend_reg (i2c_handle_t *p_i2c)
 Suspend some registers related to I2C configuration before sleep. More...
 
void hal_i2c_resume_reg (i2c_handle_t *p_i2c)
 Restore some registers related to I2C configuration after sleep. This function must be used in conjunction with the hal_i2c_suspend_reg(). More...
 
hal_pm_status_t hal_pm_i2c_suspend (i2c_handle_t *p_i2c)
 Suspend the specified I2C. More...
 
void hal_pm_i2c_resume (i2c_handle_t *p_i2c)
 Resume the specified I2C. More...
 
hal_status_t hal_i2c_speed_config (i2c_handle_t *p_i2c, uint32_t speed, uint32_t scl_fall_time, uint32_t scl_rise_time)
 Configure the I2C transmit rate for I2C. More...
 

Detailed Description

Peripheral State, Mode and Error functions.

 ===============================================================================
            ##### Peripheral State, Mode and Error functions #####
 ===============================================================================
    [..]
    This subsection permit to get in run-time the status of the peripheral
    and the data flow.

Function Documentation

◆ hal_i2c_get_error()

uint32_t hal_i2c_get_error ( const i2c_handle_t p_i2c)

Return the I2C error code.

Parameters
[in]p_i2cPointer to an I2C handle which contains the configuration information for the specified I2C.
Returns
I2C Error Code

◆ hal_i2c_get_mode()

hal_i2c_mode_t hal_i2c_get_mode ( const i2c_handle_t p_i2c)

Returns the I2C Master, Slave, Memory or no mode.

Parameters
[in]p_i2cPointer to an I2C handle which contains the configuration information for the specified I2C.
Return values
HAL_I2C_MODE_NONENo I2C communication on going.
HAL_I2C_MODE_MASTERI2C communication is in Master Mode.
HAL_I2C_MODE_SLAVEI2C communication is in Slave Mode.
::HAL_I2C_MODE_MEMI2C communication is in Memory Mode.

◆ hal_i2c_get_state()

hal_i2c_state_t hal_i2c_get_state ( const i2c_handle_t p_i2c)

Return the I2C handle state.

Parameters
[in]p_i2cPointer to an I2C handle which contains the configuration information for the specified I2C.
Return values
HAL_I2C_STATE_RESETPeripheral is not yet Initialized.
HAL_I2C_STATE_READYPeripheral Initialized and ready for use.
HAL_I2C_STATE_BUSYAn internal process is ongoing.
HAL_I2C_STATE_BUSY_TXData Transmission process is ongoing.
HAL_I2C_STATE_BUSY_RXData Reception process is ongoing.
::HAL_I2C_STATE_LISTENAddress Listen Mode is ongoing.
::HAL_I2C_STATE_BUSY_TX_LISTENAddress Listen Mode and Data Transmission process is ongoing.
::HAL_I2C_STATE_BUSY_RX_LISTENAddress Listen Mode and Data Reception process is ongoing.
HAL_I2C_STATE_ABORTAbort user request ongoing.
HAL_I2C_STATE_TIMEOUTTimeout state.
HAL_I2C_STATE_ERRORError.

◆ hal_i2c_resume_reg()

void hal_i2c_resume_reg ( i2c_handle_t p_i2c)

Restore some registers related to I2C configuration after sleep. This function must be used in conjunction with the hal_i2c_suspend_reg().

Parameters
[in]p_i2cPointer to a I2C handle which contains the configuration information for the specified I2C module.
Return values
None

◆ hal_i2c_sda_at_low_is_not_recovered()

uint32_t hal_i2c_sda_at_low_is_not_recovered ( const i2c_handle_t p_i2c)

Return i2c sda at low is not recovered flag.

Parameters
[in]p_i2cPointer to an I2C handle which contains the configuration information for the specified I2C.
Return values
1i2c sda at low is not recovered.
0i2c sda at low is recovered.

◆ hal_i2c_speed_config()

hal_status_t hal_i2c_speed_config ( i2c_handle_t p_i2c,
uint32_t  speed,
uint32_t  scl_fall_time,
uint32_t  scl_rise_time 
)

Configure the I2C transmit rate for I2C.

Parameters
[in]p_i2cPointer to a I2C handle which contains the configuration information for the specified I2C module.
[in]speedThe transmit rate of I2C.
[in]scl_fall_timeThe fall time of scl.
[in]scl_rise_timeThe rise time of scl.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.

◆ hal_i2c_suspend_reg()

void hal_i2c_suspend_reg ( i2c_handle_t p_i2c)

Suspend some registers related to I2C configuration before sleep.

Parameters
[in]p_i2cPointer to a I2C handle which contains the configuration information for the specified I2C module.
Return values
None

◆ hal_pm_i2c_resume()

void hal_pm_i2c_resume ( i2c_handle_t p_i2c)

Resume the specified I2C.

Parameters
[in]p_i2cPointer to a I2C handle
Return values
::None

◆ hal_pm_i2c_suspend()

hal_pm_status_t hal_pm_i2c_suspend ( i2c_handle_t p_i2c)

Suspend the specified I2C.

Parameters
[in]p_i2cPointer to a I2C handle
Return values
HAL_PM_ACTIVEDevice is active, not allow sleep.
HAL_PM_SLEEPAllow sleep.