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

HAL USART Generic Driver

 

UM1725

Function Name

void HAL_USART_ErrorCallback (USART_HandleTypeDef *

 

husart)

Function Description

USART error callbacks.

Parameters

 

husart: pointer to a USART_HandleTypeDef structure that

 

 

contains the configuration information for the specified

 

 

USART module.

Return values

 

None

61.2.28HAL_USART_GetState

Function Name

HAL_USART_StateTypeDef HAL_USART_GetState

 

(USART_HandleTypeDef * husart)

Function Description

Returns the USART state.

Parameters

 

husart: pointer to a USART_HandleTypeDef structure that

 

 

contains the configuration information for the specified

 

 

USART module.

Return values

 

HAL state

61.2.29HAL_USART_GetError

Function Name

uint32_t HAL_USART_GetError (USART_HandleTypeDef *

 

husart)

Function Description

Return the USART error code.

Parameters

 

husart: : pointer to a USART_HandleTypeDef structure that

 

 

contains the configuration information for the specified

 

 

USART.

Return values

 

USART Error Code

61.3USART Firmware driver defines

61.3.1USART

USART Clock

USART_CLOCK_DISABLE

USART_CLOCK_ENABLE

USART Clock Phase

USART_PHASE_1EDGE

USART_PHASE_2EDGE

USART Clock Polarity

USART_POLARITY_LOW

USART_POLARITY_HIGH

USART Error Code

HAL_USART_ERROR_NONE No error

878/900

DOCID025834 Rev 2

UM1725

HAL USART Generic Driver

HAL_USART_ERROR_PE

Parity error

HAL_USART_ERROR_NE

Noise error

HAL_USART_ERROR_FE

Frame error

HAL_USART_ERROR_ORE

Overrun error

HAL_USART_ERROR_DMA

DMA transfer error

USART Exported Macros

 

 

__HAL_USART_RESET_HANDLE_STATE

Description:

 

Reset USART handle state.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. This parameter

 

 

can be USARTx where x: 1, 2, 3 or

 

 

6 to select the USART peripheral.

 

Return value:

 

 

None

__HAL_USART_GET_FLAG

Description:

 

Checks whether the specified

 

 

Smartcard flag is set or not.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. This parameter

 

 

can be USARTx where x: 1, 2, 3 or

 

 

6 to select the USART peripheral.

 

__FLAG__: specifies the flag to

 

 

check. This parameter can be one

 

 

of the following values:

 

 

USART_FLAG_TXE: Transmit

 

 

data register empty flag

 

 

USART_FLAG_TC:

 

 

Transmission Complete flag

 

 

USART_FLAG_RXNE:

 

 

Receive data register not

 

 

empty flag

 

 

USART_FLAG_IDLE: Idle Line

 

 

detection flag

 

 

USART_FLAG_ORE: Overrun

 

 

Error flag

 

 

USART_FLAG_NE: Noise

 

 

Error flag

 

 

USART_FLAG_FE: Framing

 

 

Error flag

 

 

USART_FLAG_PE: Parity

 

 

Error flag

 

Return value:

 

The: new state of __FLAG__

DOCID025834 Rev 2

 

879/900

HAL USART Generic Driver

 

UM1725

 

 

 

(TRUE or FALSE).

 

__HAL_USART_CLEAR_FLAG

Description:

 

 

Clears the specified Smartcard

 

 

 

pending flags.

 

 

Parameters:

 

 

 

__HANDLE__: specifies the

 

 

 

USART Handle. This parameter

 

 

 

can be USARTx where x: 1, 2, 3 or

 

 

 

6 to select the USART peripheral.

 

 

__FLAG__: specifies the flag to

 

 

 

check. This parameter can be any

 

 

 

combination of the following values:

 

 

 

USART_FLAG_TC:

 

 

 

Transmission Complete flag.

 

 

 

USART_FLAG_RXNE:

 

 

 

Receive data register not

 

 

 

empty flag.

 

 

Return value:

 

 

 

None

 

 

Notes:

 

 

PE (Parity error), FE (Framing

 

 

 

error), NE (Noise error), ORE

 

 

 

(Overrun error) and IDLE (Idle line

 

 

 

detected) flags are cleared by

 

 

 

software sequence: a read

 

 

 

operation to USART_SR register

 

 

 

followed by a read operation to

 

 

 

USART_DR register. RXNE flag

 

 

 

can be also cleared by a read to the

 

 

 

USART_DR register. TC flag can

 

 

 

be also cleared by software

 

 

 

sequence: a read operation to

 

 

 

USART_SR register followed by a

 

 

 

write operation to USART_DR

 

 

 

register. TXE flag is cleared only by

 

 

 

a write to the USART_DR register.

 

__HAL_USART_CLEAR_PEFLAG

Description:

 

 

Clear the USART PE pending flag.

 

 

Parameters:

 

 

 

__HANDLE__: specifies the

 

 

 

USART Handle. This parameter

 

 

 

can be USARTx where x: 1, 2, 3 or

 

 

 

6 to select the USART peripheral.

 

 

Return value:

 

 

 

None

 

__HAL_USART_CLEAR_FEFLAG

Description:

880/900

DOCID025834 Rev 2

 

 

UM1725

 

HAL USART Generic Driver

 

Clear the USART FE pending flag.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. This parameter

 

 

can be USARTx where x: 1, 2, 3 or

 

 

6 to select the USART peripheral.

 

Return value:

 

 

None

__HAL_USART_CLEAR_NEFLAG

Description:

 

Clear the USART NE pending flag.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. This parameter

 

 

can be USARTx where x: 1, 2, 3 or

 

 

6 to select the USART peripheral.

 

Return value:

 

 

None

__HAL_USART_CLEAR_OREFLAG

Description:

 

Clear the UART ORE pending flag.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. This parameter

 

 

can be USARTx where x: 1, 2, 3 or

 

 

6 to select the USART peripheral.

 

Return value:

 

 

None

__HAL_USART_CLEAR_IDLEFLAG

Description:

 

Clear the USART IDLE pending

 

 

flag.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. This parameter

 

 

can be USARTx where x: 1, 2, 3 or

 

 

6 to select the USART peripheral.

 

Return value:

 

 

None

__HAL_USART_ENABLE_IT

Description:

 

Enables or disables the specified

 

 

USART interrupts.

 

Parameters:

 

 

__HANDLE__: specifies the

DOCID025834 Rev 2

 

881/900

HAL USART Generic Driver

UM1725

 

USART Handle. This parameter

 

can be USARTx where x: 1, 2, 3 or

 

6 to select the USART peripheral.

 

__INTERRUPT__: specifies the

 

USART interrupt source to check.

 

This parameter can be one of the

 

following values:

 

USART_IT_TXE: Transmit

 

Data Register empty interrupt

 

USART_IT_TC: Transmission

 

complete interrupt

 

USART_IT_RXNE: Receive

 

Data register not empty

 

interrupt

 

USART_IT_IDLE: Idle line

 

detection interrupt

 

USART_IT_PE: Parity Error

 

interrupt

 

USART_IT_ERR: Error

 

interrupt(Frame error, noise

 

error, overrun error) This

 

parameter can be: ENABLE or

 

DISABLE.

 

 

Return value:

 

 

 

None

 

__HAL_USART_DISABLE_IT

 

 

 

__HAL_USART_GET_IT_SOURCE

Description:

 

 

Checks whether the specified

 

 

 

USART interrupt has occurred or

 

 

 

not.

 

 

Parameters:

 

 

 

__HANDLE__: specifies the

 

 

 

USART Handle. This parameter

 

 

 

can be USARTx where x: 1, 2, 3 or

 

 

 

6 to select the USART peripheral.

 

 

__IT__: specifies the USART

 

 

 

interrupt source to check. This

 

 

 

parameter can be one of the

 

 

 

following values:

 

 

 

USART_IT_TXE: Transmit

 

 

 

Data Register empty interrupt

 

 

 

USART_IT_TC: Transmission

 

 

 

complete interrupt

 

 

 

USART_IT_RXNE: Receive

 

 

 

Data register not empty

 

 

 

interrupt

 

 

 

USART_IT_IDLE: Idle line

 

 

 

detection interrupt

 

 

 

USART_IT_ERR: Error

 

 

 

interrupt

 

 

 

USART_IT_PE: Parity Error

882/900

DOCID025834 Rev 2

 

 

UM1725

 

HAL USART Generic Driver

 

 

interrupt

 

Return value:

 

The: new state of __IT__ (TRUE or

 

 

FALSE).

__HAL_USART_ONE_BIT_SAMPLE_ENABLE

Description:

 

Macro to enable the USART's one

 

 

bit sample method.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle.

 

Return value:

 

 

None

__HAL_USART_ONE_BIT_SAMPLE_DISABLE

Description:

 

Macro to disable the USART's one

 

 

bit sample method.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle.

 

Return value:

 

 

None

__HAL_USART_ENABLE

Description:

 

 

Enable USART.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. USART Handle

 

 

selects the USARTx peripheral

 

 

(USART availability and x value

 

 

depending on device).

 

Return value:

 

 

None

__HAL_USART_DISABLE

Description:

 

 

Disable USART.

 

Parameters:

 

 

__HANDLE__: specifies the

 

 

USART Handle. USART Handle

 

 

selects the USARTx peripheral

 

 

(USART availability and x value

 

 

depending on device).

 

Return value:

 

 

None

USART Flags

 

 

DOCID025834 Rev 2

 

883/900

HAL USART Generic Driver

UM1725

USART_FLAG_TXE

USART_FLAG_TC

USART_FLAG_RXNE

USART_FLAG_IDLE

USART_FLAG_ORE

USART_FLAG_NE

USART_FLAG_FE

USART_FLAG_PE

USART Interrupts Definition

USART_IT_PE

USART_IT_TXE

USART_IT_TC

USART_IT_RXNE

USART_IT_IDLE

USART_IT_LBD

USART_IT_CTS

USART_IT_ERR

USART Last Bit

USART_LASTBIT_DISABLE

USART_LASTBIT_ENABLE

USART Mode

USART_MODE_RX

USART_MODE_TX

USART_MODE_TX_RX

USART NACK State

USART_NACK_ENABLE

USART_NACK_DISABLE

USART Parity

USART_PARITY_NONE

USART_PARITY_EVEN

USART_PARITY_ODD

USART Private Constants

DUMMY_DATA

USART_TIMEOUT_VALUE

USART_IT_MASK

USART_CR1_REG_INDEX

884/900

DOCID025834 Rev 2

UM1725 HAL USART Generic Driver

USART_CR2_REG_INDEX

USART_CR3_REG_INDEX

USART Private Macros

IS_USART_NACK_STATE

IS_USART_LASTBIT

IS_USART_PHASE

IS_USART_POLARITY

IS_USART_CLOCK

IS_USART_WORD_LENGTH

IS_USART_STOPBITS

IS_USART_PARITY

IS_USART_MODE

IS_USART_BAUDRATE

USART_DIV

USART_DIVMANT

USART_DIVFRAQ

USART_BRR

USART Number of Stop Bits

USART_STOPBITS_1

USART_STOPBITS_0_5

USART_STOPBITS_2

USART_STOPBITS_1_5

USART Word Length

USART_WORDLENGTH_8B

USART_WORDLENGTH_9B

DOCID025834 Rev 2

885/900

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