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

HAL UART Generic Driver

UM1725

In the Half duplex communication, it is forbidden to run the transmit and receive process in parallel, the UART state HAL_UART_STATE_BUSY_TX_RX can't be useful.

This section contains the following APIs:

HAL_UART_Transmit()

HAL_UART_Receive()

HAL_UART_Transmit_IT()

HAL_UART_Receive_IT()

HAL_UART_Transmit_DMA()

HAL_UART_Receive_DMA()

HAL_UART_DMAPause()

HAL_UART_DMAResume()

HAL_UART_DMAStop()

HAL_UART_IRQHandler()

HAL_UART_TxCpltCallback()

HAL_UART_TxHalfCpltCallback()

HAL_UART_RxCpltCallback()

HAL_UART_RxHalfCpltCallback()

HAL_UART_ErrorCallback()

60.2.4Peripheral Control functions

This subsection provides a set of functions allowing to control the UART:

HAL_LIN_SendBreak() API can be helpful to transmit the break character.

HAL_MultiProcessor_EnterMuteMode() API can be helpful to enter the UART in mute mode.

HAL_MultiProcessor_ExitMuteMode() API can be helpful to exit the UART mute mode by software.

This section contains the following APIs:

HAL_LIN_SendBreak()

HAL_MultiProcessor_EnterMuteMode()

HAL_MultiProcessor_ExitMuteMode()

HAL_HalfDuplex_EnableTransmitter()

HAL_HalfDuplex_EnableReceiver()

60.2.5Peripheral State and Errors functions

This subsection provides a set of functions allowing to return the State of UART communication process, return Peripheral Errors occurred during communication process

HAL_UART_GetState() API can be helpful to check in run-time the state of the UART peripheral.

HAL_UART_GetError() check in run-time errors that could be occurred during communication.

This section contains the following APIs:

HAL_UART_GetState()

HAL_UART_GetError()

60.2.6HAL_UART_Init

848/900

DOCID025834 Rev 2

UM1725

 

HAL UART Generic Driver

Function Name

HAL_StatusTypeDef HAL_UART_Init (UART_HandleTypeDef *

 

huart)

Function Description

Initializes the UART mode according to the specified parameters in

 

the UART_InitTypeDef and create the associated handle.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

Return values

 

HAL status

60.2.7HAL_HalfDuplex_Init

Function Name

HAL_StatusTypeDef HAL_HalfDuplex_Init

 

(UART_HandleTypeDef * huart)

Function Description

Initializes the half-duplex mode according to the specified

 

parameters in the UART_InitTypeDef and create the associated

 

handle.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

Return values

 

HAL status

60.2.8

HAL_LIN_Init

 

 

 

Function Name

HAL_StatusTypeDef HAL_LIN_Init (UART_HandleTypeDef *

 

 

huart, uint32_t BreakDetectLength)

 

Function Description

Initializes the LIN mode according to the specified parameters in

 

 

the UART_InitTypeDef and create the associated handle.

 

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

 

contains the configuration information for the specified UART

 

 

 

module.

 

 

BreakDetectLength: Specifies the LIN break detection

 

 

 

length. This parameter can be one of the following values:

 

 

 

UART_LINBREAKDETECTLENGTH_10B: 10-bit break

 

 

 

detectionUART_LINBREAKDETECTLENGTH_11B: 11-bit

 

 

 

break detection

 

Return values

 

HAL status

60.2.9HAL_MultiProcessor_Init

Function Name

HAL_StatusTypeDef HAL_MultiProcessor_Init

 

 

(UART_HandleTypeDef * huart, uint8_t Address, uint32_t

 

WakeUpMethod)

 

Function Description

Initializes the Multi-Processor mode according to the specified

 

parameters in the UART_InitTypeDef and create the associated

 

handle.

 

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

 

 

 

Address: USART address

 

 

 

DOCID025834 Rev 2

849/900

HAL UART Generic Driver

UM1725

 

WakeUpMethod: specifies the USART wake-up method.

 

This parameter can be one of the following values:

 

UART_WAKEUPMETHOD_IDLELINE: Wake-up by an idle

 

line detectionUART_WAKEUPMETHOD_ADDRESSMARK:

 

Wake-up by an address mark

Return values

HAL status

60.2.10HAL_UART_DeInit

Function Name

HAL_StatusTypeDef HAL_UART_DeInit

 

(UART_HandleTypeDef * huart)

Function Description

DeInitializes the UART peripheral.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

Return values

 

HAL status

60.2.11HAL_UART_MspInit

Function Name

void HAL_UART_MspInit (UART_HandleTypeDef * huart)

Function Description

UART MSP Init.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

Return values

 

None

60.2.12HAL_UART_MspDeInit

Function Name

void HAL_UART_MspDeInit (UART_HandleTypeDef * huart)

Function Description

UART MSP DeInit.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

Return values

 

None

60.2.13HAL_UART_Transmit

Function Name

HAL_StatusTypeDef HAL_UART_Transmit

 

(UART_HandleTypeDef * huart, uint8_t * pData, uint16_t Size,

 

uint32_t Timeout)

Function Description

Sends an amount of data in blocking mode.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

 

pData: Pointer to data buffer

 

Size: Amount of data to be sent

 

 

Timeout: Timeout duration

850/900

 

DOCID025834 Rev 2

UM1725

HAL UART Generic Driver

Return values

HAL status

60.2.14HAL_UART_Receive

Function Name

HAL_StatusTypeDef HAL_UART_Receive

 

(UART_HandleTypeDef * huart, uint8_t * pData, uint16_t Size,

 

uint32_t Timeout)

Function Description

Receives an amount of data in blocking mode.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

 

 

pData: Pointer to data buffer

 

 

Size: Amount of data to be received

 

 

Timeout: Timeout duration

Return values

 

HAL status

60.2.15HAL_UART_Transmit_IT

Function Name

HAL_StatusTypeDef HAL_UART_Transmit_IT

 

(UART_HandleTypeDef * huart, uint8_t * pData, uint16_t Size)

Function Description

Sends an amount of data in non blocking mode.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

 

pData: Pointer to data buffer

 

Size: Amount of data to be sent

Return values

 

HAL status

60.2.16HAL_UART_Receive_IT

Function Name

HAL_StatusTypeDef HAL_UART_Receive_IT

 

(UART_HandleTypeDef * huart, uint8_t * pData, uint16_t Size)

Function Description

Receives an amount of data in non blocking mode.

Parameters

 

huart: pointer to a UART_HandleTypeDef structure that

 

 

contains the configuration information for the specified UART

 

 

module.

 

pData: Pointer to data buffer

 

Size: Amount of data to be received

Return values

 

HAL status

60.2.17HAL_UART_Transmit_DMA

Function Name

HAL_StatusTypeDef HAL_UART_Transmit_DMA

 

 

(UART_HandleTypeDef * huart, uint8_t * pData, uint16_t Size)

Function Description

Sends an amount of data in non blocking mode.

 

Parameters

huart: pointer to a UART_HandleTypeDef structure that

 

contains the configuration information for the specified UART

 

module.

 

 

DOCID025834 Rev 2

851/900

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