bf0_hal_i2c.h
Header file of I2C HAL module.
- Author
Sifli software development team
- Attention
Defines
-
HAL_I2C_ERROR_NONE
No error
-
HAL_I2C_ERROR_BERR
BERR error
-
HAL_I2C_ERROR_ARLO
ARLO error
-
HAL_I2C_ERROR_AF
ACKF error
-
HAL_I2C_ERROR_OVR
OVR error
-
HAL_I2C_ERROR_DMA
DMA transfer error
-
HAL_I2C_ERROR_TIMEOUT
Timeout error
-
HAL_I2C_ERROR_SIZE
Size Management error
-
HAL_I2C_ERROR_DMA_PARAM
DMA Parameter Error
-
HAL_I2C_ERROR_INVALID_PARAM
Invalid Parameters error
-
I2C_MODE_STD
-
I2C_MODE_FS
-
I2C_MODE_HS_STD
-
I2C_MODE_HS_FS
-
I2C_FIRST_FRAME
-
I2C_FIRST_AND_NEXT_FRAME
-
I2C_NEXT_FRAME
-
I2C_FIRST_AND_LAST_FRAME
-
I2C_LAST_FRAME
-
I2C_LAST_FRAME_NO_STOP
-
I2C_OTHER_FRAME
-
I2C_OTHER_AND_LAST_FRAME
-
I2C_ADDRESSINGMODE_7BIT
-
I2C_ADDRESSINGMODE_10BIT
-
I2C_GENERALCALL_DISABLE
-
I2C_GENERALCALL_ENABLE
-
I2C_MEMADD_SIZE_0BIT
-
I2C_MEMADD_SIZE_8BIT
-
I2C_MEMADD_SIZE_16BIT
-
I2C_DIRECTION_TRANSMIT
-
I2C_DIRECTION_RECEIVE
-
I2C_RELOAD_MODE
I2C_RELOAD_MODE Enable Reload mode .
-
I2C_AUTOEND_MODE
I2C_AUTOEND_MODE Enable Automatic end mode.
-
I2C_SOFTEND_MODE
I2C_SOFTEND_MODE Enable Software end mode.
-
I2C_NO_STARTSTOP
I2C_NO_STARTSTOP Don’t Generate stop and start condition.
-
I2C_GENERATE_STOP
I2C_GENERATE_STOP Generate stop condition (Size should be set to 0).
-
I2C_GENERATE_START_READ
I2C_GENERATE_START_READ Generate Restart for read request.
-
I2C_GENERATE_START_WRITE
I2C_GENERATE_START_WRITE Generate Restart for write request.
-
I2C_IT_ERRI
Errors interrupt enable
-
I2C_IT_TCI
Transfer complete interrupt enable
-
I2C_IT_STOPI
STOP detection interrupt enable
-
I2C_IT_NACKI
NACK received interrupt enable
-
I2C_IT_ADDRI
Address match interrupt enable
-
I2C_IT_RXI
RX interrupt enable
-
I2C_IT_TXI
TX interrupt enable
-
I2C_FLAG_TXE
Transmit data register empty
-
I2C_FLAG_TXIS
Transmit interrupt status
-
I2C_FLAG_RXNE
-
I2C_FLAG_AF
Acknowledge failure received flag
-
I2C_FLAG_STOPF
STOP detection flag
-
I2C_FLAG_TC
Transfer complete (master mode)
-
I2C_FLAG_TCR
Transfer complete reload
-
I2C_FLAG_BUSY
Bus busy
-
I2C_FLAG_XFER_ERR
-
I2C_FLAG_TX_ERR
-
I2C_FLAG_TXE_ERR
-
I2C_FLAG_RX_ERR
-
I2C_FLAG_RXE_ERR
-
__HAL_I2C_RESET_HANDLE_STATE(__HANDLE__)
Reset I2C handle state.
- 参数:
__HANDLE__ – specifies the I2C Handle.
- 返回值:
None –
-
__HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the specified I2C interrupt.
- 参数:
__HANDLE__ – specifies the I2C Handle.
__INTERRUPT__ – specifies the interrupt source to enable. This parameter can be one of the following values:
I2C_IT_ERRI Errors interrupt enable
I2C_IT_TCI Transfer complete interrupt enable
I2C_IT_STOPI STOP detection interrupt enable
I2C_IT_NACKI NACK received interrupt enable
I2C_IT_ADDRI Address match interrupt enable
I2C_IT_RXI RX interrupt enable
I2C_IT_TXI TX interrupt enable
- 返回值:
None –
-
__HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the specified I2C interrupt.
- 参数:
__HANDLE__ – specifies the I2C Handle.
__INTERRUPT__ – specifies the interrupt source to disable. This parameter can be one of the following values:
I2C_IT_ERRI Errors interrupt enable
I2C_IT_TCI Transfer complete interrupt enable
I2C_IT_STOPI STOP detection interrupt enable
I2C_IT_NACKI NACK received interrupt enable
I2C_IT_ADDRI Address match interrupt enable
I2C_IT_RXI RX interrupt enable
I2C_IT_TXI TX interrupt enable
- 返回值:
None –
-
__HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check whether the specified I2C interrupt source is enabled or not.
- 参数:
__HANDLE__ – specifies the I2C Handle.
__INTERRUPT__ – specifies the I2C interrupt source to check. This parameter can be one of the following values:
I2C_IT_ERRI Errors interrupt enable
I2C_IT_TCI Transfer complete interrupt enable
I2C_IT_STOPI STOP detection interrupt enable
I2C_IT_NACKI NACK received interrupt enable
I2C_IT_ADDRI Address match interrupt enable
I2C_IT_RXI RX interrupt enable
I2C_IT_TXI TX interrupt enable
- 返回值:
The – new state of INTERRUPT (SET or RESET).
-
I2C_FLAG_MASK
Check whether the specified I2C flag is set or not.
- 参数:
__HANDLE__ – specifies the I2C Handle.
__FLAG__ – specifies the flag to check. This parameter can be one of the following values:
I2C_FLAG_TXE Transmit data register empty
I2C_FLAG_TXIS Transmit interrupt status
I2C_FLAG_AF Acknowledge failure received flag
I2C_FLAG_STOPF STOP detection flag
I2C_FLAG_TC Transfer complete (master mode)
I2C_FLAG_TCR Transfer complete reload
I2C_FLAG_BUSY Bus busy
- 返回值:
The – new state of FLAG (SET or RESET).
-
__HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__)
-
__HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the I2C pending flags which are cleared by writing 1 in a specific bit.
- 参数:
__HANDLE__ – specifies the I2C Handle.
__FLAG__ – specifies the flag to clear. This parameter can be any combination of the following values:
I2C_FLAG_TXE Transmit data register empty
I2C_FLAG_AF Acknowledge failure received flag
I2C_FLAG_STOPF STOP detection flag
- 返回值:
None –
-
__HAL_I2C_ENABLE(__HANDLE__)
Enable the specified I2C peripheral.
- 参数:
__HANDLE__ – specifies the I2C Handle.
- 返回值:
None –
-
__HAL_I2C_DISABLE(__HANDLE__)
Disable the specified I2C peripheral.
- 参数:
__HANDLE__ – specifies the I2C Handle.
- 返回值:
None –
-
__HAL_I2C_GENERATE_NACK(__HANDLE__)
Generate a Non-Acknowledge I2C peripheral in Slave mode.
- 参数:
__HANDLE__ – specifies the I2C Handle.
- 返回值:
None –
-
IS_I2C_ADDRESSING_MODE(MODE)
-
IS_I2C_GENERAL_CALL(CALL)
-
IS_I2C_MEMADD_SIZE(SIZE)
-
IS_TRANSFER_MODE(MODE)
-
IS_TRANSFER_REQUEST(REQUEST)
-
IS_I2C_TRANSFER_OPTIONS_REQUEST(REQUEST)
-
IS_I2C_TRANSFER_OTHER_OPTIONS_REQUEST(REQUEST)
-
I2C_RESET_CR2(__HANDLE__)
-
I2C_GET_ADDR_MATCH(__HANDLE__)
-
I2C_GET_DIR(__HANDLE__)
-
I2C_GET_STOP_MODE(__HANDLE__)
-
I2C_GET_OWN_ADDRESS1(__HANDLE__)
-
I2C_GET_OWN_ADDRESS2(__HANDLE__)
-
IS_I2C_OWN_ADDRESS1(ADDRESS1)
-
I2C_MEM_ADD_MSB(__ADDRESS__)
-
I2C_MEM_ADD_LSB(__ADDRESS__)
-
I2C_GENERATE_START(__ADDMODE__, __ADDRESS__)
-
I2C_CHECK_FLAG(__ISR__, __FLAG__)
-
I2C_CHECK_IT_SOURCE(__CR1__, __IT__)
-
IS_I2C_ALL_INSTANCE(__INSTANCE__)
Typedefs
-
typedef struct __I2C_HandleTypeDef I2C_HandleTypeDef
Enums
-
enum HAL_I2C_StateTypeDef
Values:
-
enumerator HAL_I2C_STATE_RESET
Peripheral is not yet Initialized
-
enumerator HAL_I2C_STATE_READY
Peripheral Initialized and ready for use
-
enumerator HAL_I2C_STATE_BUSY
An internal process is ongoing
-
enumerator HAL_I2C_STATE_BUSY_TX
Data Transmission process is ongoing
-
enumerator HAL_I2C_STATE_BUSY_RX
Data Reception process is ongoing
-
enumerator HAL_I2C_STATE_LISTEN
Address Listen Mode is ongoing
-
enumerator HAL_I2C_STATE_BUSY_TX_LISTEN
Address Listen Mode and Data Transmission process is ongoing
-
enumerator HAL_I2C_STATE_BUSY_RX_LISTEN
Address Listen Mode and Data Reception process is ongoing
-
enumerator HAL_I2C_STATE_ABORT
Abort user request ongoing
-
enumerator HAL_I2C_STATE_TIMEOUT
Timeout state
-
enumerator HAL_I2C_STATE_ERROR
Error
-
enumerator HAL_I2C_STATE_RESET
Functions
-
HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c)
Initializes the I2C according to the specified parameters in the I2C_InitTypeDef and initialize the associated handle.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_DMA_Init(I2C_HandleTypeDef *hi2c, struct dma_config *dma_rx, struct dma_config *dma_tx)
Initializes the I2C according to the specified parameters with dma mode in the I2C_InitTypeDef and initialize the associated handle.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
dma_rx – I2C received DMA configure
dma_tx – I2C transmit DMA configure
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_DeInit(I2C_HandleTypeDef *hi2c)
DeInitialize the I2C peripheral.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
HAL – status
-
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
-
HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
Transmits in master mode an amount of data in blocking mode.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pData – Pointer to data buffer
Size – Amount of data to be sent
Timeout – Timeout duration
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
Receives in master mode an amount of data in blocking mode.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pData – Pointer to data buffer
Size – Amount of data to be sent
Timeout – Timeout duration
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout)
-
HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout)
-
HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
Write an amount of data in blocking mode to a specific memory address.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
MemAddress – Internal memory address
MemAddSize – Size of internal memory address
pData – Pointer to data buffer
Size – Amount of data to be sent
Timeout – Timeout duration
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
Read an amount of data in blocking mode from a specific memory address.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
MemAddress – Internal memory address
MemAddSize – Size of internal memory address
pData – Pointer to data buffer
Size – Amount of data to be sent
Timeout – Timeout duration
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
-
HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
Transmit in master mode an amount of data in non-blocking mode with Interrupt.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
Receive in master mode an amount of data in non-blocking mode with Interrupt.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
-
HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
-
HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
Write an amount of data in non-blocking mode with Interrupt to a specific memory address.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
MemAddress – Internal memory address
MemAddSize – Size of internal memory address
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
Read an amount of data in non-blocking mode with Interrupt from a specific memory address.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
MemAddress – Internal memory address
MemAddSize – Size of internal memory address
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_EnableListen_IT(I2C_HandleTypeDef *hi2c)
-
HAL_StatusTypeDef HAL_I2C_DisableListen_IT(I2C_HandleTypeDef *hi2c)
-
HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress)
-
HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
Transmit in master mode an amount of data in non-blocking mode with DMA.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
Receive in master mode an amount of data in non-blocking mode with DMA.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
-
HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
-
HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
Write an amount of data in non-blocking mode with DMA to a specific memory address.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
MemAddress – Internal memory address
MemAddSize – Size of internal memory address
pData – Pointer to data buffer
Size – Amount of data to be sent
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
Reads an amount of data in non-blocking mode with DMA from a specific memory address.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddress – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
MemAddress – Internal memory address
MemAddSize – Size of internal memory address
pData – Pointer to data buffer
Size – Amount of data to be read
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
-
void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_ER_IRQHandler(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c)
Master Tx Transfer completed callback.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
None –
-
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)
Master Rx Transfer completed callback.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
None –
-
void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
-
void HAL_I2C_ListenCpltCallback(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)
-
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c)
-
HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c)
Return the I2C handle state.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
HAL – state
-
HAL_I2C_ModeTypeDef HAL_I2C_GetMode(I2C_HandleTypeDef *hi2c)
Returns the I2C Master, Slave, Memory or no mode.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for I2C module
- 返回值:
HAL – mode
-
uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c)
Return the I2C error code.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
I2C – Error Code
-
uint32_t HAL_I2C_Reset(I2C_HandleTypeDef *hi2c)
Send I2C bus reset and reset I2C controller.
- 参数:
hi2c – Pointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
- 返回值:
I2C – Error Code
-
struct I2C_InitTypeDef
Public Members
-
uint32_t ClockSpeed
Specifies the clock frequency. This parameter must be set to a value lower than 400kHz
-
uint32_t Timing
Specifies the I2C_TIMINGR_register value. This parameter calculated by referring to I2C initialization section in Reference manual
-
uint32_t OwnAddress1
Specifies the first device own address. This parameter can be a 7-bit or 10-bit address.
-
uint32_t AddressingMode
Specifies if 7-bit or 10-bit addressing mode is selected. This parameter can be a value of I2C Addressing Mode
-
uint32_t GeneralCallMode
Specifies if general call mode is selected. This parameter can be a value of I2C General Call Addressing Mode
-
uint32_t ClockSpeed
-
struct __I2C_HandleTypeDef
Public Members
-
I2C_TypeDef *Instance
I2C registers base address
-
I2C_InitTypeDef Init
I2C communication parameters
-
uint8_t *pBuffPtr
Pointer to I2C transfer buffer
-
uint16_t XferSize
I2C transfer size, partial xfer size
-
uint16_t XferCount
I2C transfer counter, total xfer size
-
uint32_t XferOptions
I2C sequantial transfer options, this parameter can be a value of I2C Sequential Transfer Options
-
uint32_t PreviousState
I2C communication Previous state
-
HAL_StatusTypeDef (*XferISR)(struct __I2C_HandleTypeDef *hi2c, uint32_t ITFlags, uint32_t ITSources)
I2C transfer IRQ handler function pointer
-
DMA_HandleTypeDef *hdmatx
I2C Tx DMA handle parameters
-
DMA_HandleTypeDef *hdmarx
I2C Rx DMA handle parameters
-
HAL_LockTypeDef Lock
I2C locking object
-
uint8_t core
I2C Clock core source
-
uint8_t dnf
I2C Clock Digital noise filter
-
HAL_I2C_StateTypeDef State
I2C communication state
-
HAL_I2C_ModeTypeDef Mode
I2C communication mode
-
uint32_t ErrorCode
I2C Error code
-
uint32_t AddrEventCount
I2C Address Event counter
-
I2C_TypeDef *Instance