Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
cubexHal.pdf
Скачиваний:
110
Добавлен:
10.02.2016
Размер:
16.16 Mб
Скачать

HAL I2C Generic Driver

 

UM1725

Function Name

void HAL_I2C_MemTxCpltCallback (I2C_HandleTypeDef *

 

hi2c)

Function Description

Memory Tx Transfer completed callbacks.

Parameters

 

hi2c: pointer to a I2C_HandleTypeDef structure that contains

 

 

the configuration information for I2C module

Return values

 

None

30.2.35HAL_I2C_MemRxCpltCallback

Function Name

void HAL_I2C_MemRxCpltCallback (I2C_HandleTypeDef *

 

hi2c)

Function Description

Memory Rx Transfer completed callbacks.

Parameters

 

hi2c: pointer to a I2C_HandleTypeDef structure that contains

 

 

the configuration information for I2C module

Return values

 

None

30.2.36HAL_I2C_ErrorCallback

Function Name

void HAL_I2C_ErrorCallback (I2C_HandleTypeDef * hi2c)

Function Description

I2C error callbacks.

Parameters

 

hi2c: pointer to a I2C_HandleTypeDef structure that contains

 

 

the configuration information for I2C module

Return values

 

None

30.2.37HAL_I2C_GetState

Function Name

HAL_I2C_StateTypeDef HAL_I2C_GetState

 

(I2C_HandleTypeDef * hi2c)

Function Description

Returns the I2C state.

Parameters

 

hi2c: pointer to a I2C_HandleTypeDef structure that contains

 

 

the configuration information for I2C module

Return values

 

HAL state

30.2.38HAL_I2C_GetError

Function Name

uint32_t HAL_I2C_GetError (I2C_HandleTypeDef * hi2c)

Function Description

Return the I2C error code.

Parameters

 

hi2c: : pointer to a I2C_HandleTypeDef structure that

 

 

contains the configuration information for the specified I2C.

Return values

 

I2C Error Code

30.3I2C Firmware driver defines

30.3.1I2C

I2C addressing mode

410/900

DOCID025834 Rev 2

UM1725

HAL I2C Generic Driver

I2C_ADDRESSINGMODE_7BIT

 

I2C_ADDRESSINGMODE_10BIT

I2C dual addressing mode

 

I2C_DUALADDRESS_DISABLE

 

I2C_DUALADDRESS_ENABLE

 

I2C duty cycle in fast mode

 

I2C_DUTYCYCLE_2

 

I2C_DUTYCYCLE_16_9

 

I2C Error Code

 

HAL_I2C_ERROR_NONE

No error

HAL_I2C_ERROR_BERR

BERR error

HAL_I2C_ERROR_ARLO

ARLO error

HAL_I2C_ERROR_AF

AF error

HAL_I2C_ERROR_OVR

OVR error

HAL_I2C_ERROR_DMA

DMA transfer error

HAL_I2C_ERROR_TIMEOUT

Timeout Error

I2C Exported Macros

 

 

 

__HAL_I2C_RESET_HANDLE_STATE

Description:

 

 

Reset I2C handle state.

 

 

Parameters:

 

 

__HANDLE__: specifies the I2C Handle.

 

 

This parameter can be I2C where x: 1, 2, or

 

 

3 to select the I2C peripheral.

 

 

Return value:

 

 

 

None

 

__HAL_I2C_ENABLE_IT

Description:

 

 

Enable or disable the specified I2C

 

 

 

interrupts.

 

 

Parameters:

 

 

__HANDLE__: specifies the I2C Handle.

 

 

This parameter can be I2C where x: 1, 2, or

 

 

3 to select the I2C peripheral.

 

 

__INTERRUPT__: specifies the interrupt

 

 

source to enable or disable. This parameter

 

 

can be one of the following values:

 

 

 

I2C_IT_BUF: Buffer interrupt enable

 

 

I2C_IT_EVT: Event interrupt enable

 

 

I2C_IT_ERR: Error interrupt enable

 

Return value:

 

 

 

None

 

DOCID025834 Rev 2

411/900

HAL I2C Generic Driver

 

UM1725

 

__HAL_I2C_DISABLE_IT

 

 

 

__HAL_I2C_GET_IT_SOURCE

Description:

 

 

Checks if the specified I2C interrupt source

 

 

is enabled or disabled.

 

 

Parameters:

 

 

__HANDLE__: specifies the I2C Handle.

 

 

This parameter can be I2C where x: 1, 2, or

 

 

3 to select the I2C peripheral.

 

 

__INTERRUPT__: specifies the I2C

 

 

interrupt source to check. This parameter

 

 

can be one of the following values:

 

 

I2C_IT_BUF: Buffer interrupt enable

 

 

I2C_IT_EVT: Event interrupt enable

 

 

I2C_IT_ERR: Error interrupt enable

 

 

Return value:

 

 

The: new state of __INTERRUPT__ (TRUE

 

 

or FALSE).

 

__HAL_I2C_GET_FLAG

Description:

 

 

Checks whether the specified I2C flag is set

 

 

or not.

 

 

Parameters:

 

 

__HANDLE__: specifies the I2C Handle.

 

 

This parameter can be I2C where x: 1, 2, or

 

 

3 to select the I2C peripheral.

 

 

__FLAG__: specifies the flag to check. This

 

 

parameter can be one of the following

 

 

values:

 

 

I2C_FLAG_SMBALERT: SMBus Alert

 

 

 

flag

 

 

I2C_FLAG_TIMEOUT: Timeout or Tlow

 

 

 

error flag

 

 

I2C_FLAG_PECERR: PEC error in

 

 

 

reception flag

 

 

 

I2C_FLAG_OVR: Overrun/Underrun

 

 

 

flag

 

 

I2C_FLAG_AF: Acknowledge failure

 

 

 

flag

 

 

I2C_FLAG_ARLO: Arbitration lost flag

 

 

I2C_FLAG_BERR: Bus error flag

 

 

I2C_FLAG_TXE: Data register empty

 

 

 

flag

 

 

I2C_FLAG_RXNE: Data register not

 

 

 

empty flag

 

 

I2C_FLAG_STOPF: Stop detection flag

 

 

 

I2C_FLAG_ADD10: 10-bit header sent

 

 

 

flag

 

 

I2C_FLAG_BTF: Byte transfer finished

 

 

 

flag

 

 

I2C_FLAG_ADDR: Address sent flag

412/900

DOCID025834 Rev 2

 

UM1725

HAL I2C Generic Driver

 

Address matched flag

I2C_FLAG_SB: Start bit flag

I2C_FLAG_DUALF: Dual flag

I2C_FLAG_SMBHOST: SMBus host

 

header

 

I2C_FLAG_SMBDEFAULT: SMBus

 

default header

I2C_FLAG_GENCALL: General call

 

header flag

 

I2C_FLAG_TRA: Transmitter/Receiver

 

flag

I2C_FLAG_BUSY: Bus busy flag

 

I2C_FLAG_MSL: Master/Slave flag

 

Return value:

 

The: new state of __FLAG__ (TRUE or

 

FALSE).

__HAL_I2C_CLEAR_FLAG

Description:

 

Clears the I2C pending flags which are

 

cleared by writing 0 in a specific bit.

 

Parameters:

 

__HANDLE__: specifies the I2C Handle.

 

This parameter can be I2C where x: 1, 2, or

 

3 to select the I2C peripheral.

 

__FLAG__: specifies the flag to clear. This

 

parameter can be any combination of the

 

following values:

 

I2C_FLAG_SMBALERT: SMBus Alert

 

 

flag

 

I2C_FLAG_TIMEOUT: Timeout or Tlow

 

 

error flag

 

I2C_FLAG_PECERR: PEC error in

 

 

reception flag

 

 

I2C_FLAG_OVR: Overrun/Underrun

 

 

flag (Slave mode)

 

I2C_FLAG_AF: Acknowledge failure

 

 

flag

 

I2C_FLAG_ARLO: Arbitration lost flag

 

 

(Master mode)

 

I2C_FLAG_BERR: Bus error flag

 

Return value:

 

None

__HAL_I2C_CLEAR_ADDRFLAG

Description:

 

Clears the I2C ADDR pending flag.

 

Parameters:

 

__HANDLE__: specifies the I2C Handle.

 

This parameter can be I2C where x: 1, 2, or

 

3 to select the I2C peripheral.

DOCID025834 Rev 2

413/900

HAL I2C Generic Driver

UM1725

__HAL_I2C_CLEAR_STOPFLAG

__HAL_I2C_ENABLE __HAL_I2C_DISABLE

I2C Flag definition

I2C_FLAG_SMBALERT I2C_FLAG_TIMEOUT I2C_FLAG_PECERR I2C_FLAG_OVR I2C_FLAG_AF I2C_FLAG_ARLO I2C_FLAG_BERR I2C_FLAG_TXE I2C_FLAG_RXNE I2C_FLAG_STOPF I2C_FLAG_ADD10 I2C_FLAG_BTF I2C_FLAG_ADDR I2C_FLAG_SB I2C_FLAG_DUALF I2C_FLAG_SMBHOST I2C_FLAG_SMBDEFAULT I2C_FLAG_GENCALL I2C_FLAG_TRA I2C_FLAG_BUSY I2C_FLAG_MSL

I2C general call addressing mode

I2C_GENERALCALL_DISABLE I2C_GENERALCALL_ENABLE

Return value:

None

Description:

Clears the I2C STOPF pending flag.

Parameters:

__HANDLE__: specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.

Return value:

None

414/900

DOCID025834 Rev 2

UM1725

HAL I2C Generic Driver

I2C Interrupt configuration definition

I2C_IT_BUF

I2C_IT_EVT

I2C_IT_ERR

I2C Private macros to check input parameters

IS_I2C_DUTY_CYCLE

IS_I2C_ADDRESSING_MODE

IS_I2C_DUAL_ADDRESS

IS_I2C_GENERAL_CALL

IS_I2C_NO_STRETCH

IS_I2C_MEMADD_SIZE

IS_I2C_CLOCK_SPEED

IS_I2C_OWN_ADDRESS1

IS_I2C_OWN_ADDRESS2

I2C Memory Address Size

I2C_MEMADD_SIZE_8BIT

I2C_MEMADD_SIZE_16BIT

I2C nostretch mode

I2C_NOSTRETCH_DISABLE

I2C_NOSTRETCH_ENABLE

I2C Private Constants

I2C_TIMEOUT_FLAG

I2C_TIMEOUT_ADDR_SLAVE

I2C_FLAG_MASK

I2C Private Macros

I2C_FREQRANGE

I2C_RISE_TIME

I2C_SPEED_STANDARD

I2C_SPEED_FAST

I2C_SPEED

I2C_7BIT_ADD_WRITE

I2C_7BIT_ADD_READ

I2C_10BIT_ADDRESS

I2C_10BIT_HEADER_WRITE

I2C_10BIT_HEADER_READ

I2C_MEM_ADD_MSB

DOCID025834 Rev 2

415/900

HAL I2C Generic Driver

UM1725

I2C_MEM_ADD_LSB

 

416/900

DOCID025834 Rev 2

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]