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

HAL CEC Generic Driver

UM1725

7.2CEC Firmware driver API description

7.2.1Initialization and Configuration functions

This subsection provides a set of functions allowing to initialize the CEC

The following parameters need to be configured:

SignalFreeTime

Tolerance

BRERxStop (RX stopped or not upon Bit Rising Error)

BREErrorBitGen (Error-Bit generation in case of Bit Rising Error)

LBPEErrorBitGen (Error-Bit generation in case of Long Bit Period Error)

BroadcastMsgNoErrorBitGen (Error-bit generation in case of broadcast message error)

SignalFreeTimeOption (SFT Timer start definition)

OwnAddress (CEC device address)

ListenMode

This section contains the following APIs:

HAL_CEC_Init()

HAL_CEC_DeInit()

HAL_CEC_MspInit()

HAL_CEC_MspDeInit()

7.2.2IO operation functions

This section contains the following APIs:

HAL_CEC_Transmit()

HAL_CEC_Receive()

HAL_CEC_Transmit_IT()

HAL_CEC_Receive_IT()

HAL_CEC_GetReceivedFrameSize()

HAL_CEC_IRQHandler()

HAL_CEC_TxCpltCallback()

HAL_CEC_RxCpltCallback()

HAL_CEC_ErrorCallback()

7.2.3Peripheral Control function

This subsection provides a set of functions allowing to control the CEC.

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

This section contains the following APIs:

HAL_CEC_GetState()

HAL_CEC_GetError()

7.2.4HAL_CEC_Init

Function Name

HAL_StatusTypeDef HAL_CEC_Init (CEC_HandleTypeDef *

 

hcec)

Function Description

Initializes the CEC mode according to the specified parameters in

 

the CEC_InitTypeDef and creates the associated handle .

148/900

DOCID025834 Rev 2

UM1725

 

HAL CEC Generic Driver

Parameters

 

hcec: CEC handle

Return values

 

HAL status

7.2.5HAL_CEC_DeInit

Function Name

HAL_StatusTypeDef HAL_CEC_DeInit (CEC_HandleTypeDef *

 

hcec)

Function Description

DeInitializes the CEC peripheral.

Parameters

 

hcec: CEC handle

Return values

 

HAL status

7.2.6HAL_CEC_MspInit

Function Name

void HAL_CEC_MspInit (CEC_HandleTypeDef * hcec)

Function Description

CEC MSP Init.

Parameters

 

hcec: CEC handle

Return values

 

None

7.2.7HAL_CEC_MspDeInit

Function Name

void HAL_CEC_MspDeInit (CEC_HandleTypeDef * hcec)

Function Description

CEC MSP DeInit.

Parameters

 

hcec: CEC handle

Return values

 

None

7.2.8HAL_CEC_Transmit

Function Name

HAL_StatusTypeDef HAL_CEC_Transmit

 

(CEC_HandleTypeDef * hcec, uint8_t DestinationAddress,

 

uint8_t * pData, uint32_t Size, uint32_t Timeout)

Function Description

Send data in blocking mode.

Parameters

 

hcec: CEC handle

 

 

DestinationAddress: destination logical address

 

 

pData: pointer to input byte data buffer

 

 

Size: amount of data to be sent in bytes (without counting the

 

 

header). 0 means only the header is sent (ping operation).

 

 

Maximum TX size is 15 bytes (1 opcode and up to 14

 

 

operands).

 

 

Timeout: Timeout duration.

Return values

 

HAL status

7.2.9HAL_CEC_Receive

Function Name

HAL_StatusTypeDef HAL_CEC_Receive (CEC_HandleTypeDef

 

* hcec, uint8_t * pData, uint32_t Timeout)

 

Function Description

Receive data in blocking mode.

 

 

DOCID025834 Rev 2

149/900

HAL CEC Generic Driver

 

UM1725

Parameters

 

hcec: CEC handle

 

pData: pointer to received data buffer.

 

Timeout: Timeout duration. Note that the received data size

 

 

is not known beforehand, the latter is known when the

 

 

reception is complete and is stored in hcec->RxXferSize.

 

 

hcec->RxXferSize is the sum of opcodes + operands (0 to 14

 

 

operands max). If only a header is received, hcec-

 

 

>RxXferSize = 0

Return values

 

HAL status

7.2.10HAL_CEC_Transmit_IT

Function Name

HAL_StatusTypeDef HAL_CEC_Transmit_IT

 

(CEC_HandleTypeDef * hcec, uint8_t DestinationAddress,

 

uint8_t * pData, uint32_t Size)

Function Description

Send data in interrupt mode.

Parameters

 

hcec: CEC handle

 

 

DestinationAddress: destination logical address

 

 

pData: pointer to input byte data buffer

 

 

Size: amount of data to be sent in bytes (without counting the

 

 

header). 0 means only the header is sent (ping operation).

 

 

Maximum TX size is 15 bytes (1 opcode and up to 14

 

 

operands).

Return values

 

HAL status

7.2.11HAL_CEC_Receive_IT

Function Name

HAL_StatusTypeDef HAL_CEC_Receive_IT

 

(CEC_HandleTypeDef * hcec, uint8_t * pData)

Function Description

Receive data in interrupt mode.

Parameters

 

hcec: CEC handle

 

 

pData: pointer to received data buffer. Note that the received

 

 

data size is not known beforehand, the latter is known when

 

 

the reception is complete and is stored in hcec->RxXferSize.

 

 

hcec->RxXferSize is the sum of opcodes + operands (0 to 14

 

 

operands max). If only a header is received, hcec-

 

 

>RxXferSize = 0

Return values

 

HAL status

7.2.12HAL_CEC_GetReceivedFrameSize

Function Name

uint32_t HAL_CEC_GetReceivedFrameSize

 

(CEC_HandleTypeDef * hcec)

Function Description

Get size of the received frame.

Parameters

 

hcec: CEC handle

Return values

 

Frame size

7.2.13HAL_CEC_IRQHandler

150/900

DOCID025834 Rev 2

UM1725

 

HAL CEC Generic Driver

Function Name

void HAL_CEC_IRQHandler (CEC_HandleTypeDef * hcec)

Function Description

This function handles CEC interrupt requests.

Parameters

 

hcec: CEC handle

Return values

 

None

7.2.14HAL_CEC_TxCpltCallback

Function Name

void HAL_CEC_TxCpltCallback (CEC_HandleTypeDef * hcec)

Function Description

Tx Transfer completed callback.

Parameters

 

hcec: CEC handle

Return values

 

None

7.2.15HAL_CEC_RxCpltCallback

Function Name

void HAL_CEC_RxCpltCallback (CEC_HandleTypeDef * hcec)

Function Description

Rx Transfer completed callback.

Parameters

 

hcec: CEC handle

Return values

 

None

7.2.16HAL_CEC_ErrorCallback

Function Name

void HAL_CEC_ErrorCallback (CEC_HandleTypeDef * hcec)

Function Description

CEC error callbacks.

Parameters

 

hcec: CEC handle

Return values

 

None

7.2.17HAL_CEC_GetState

Function Name

HAL_CEC_StateTypeDef HAL_CEC_GetState

 

(CEC_HandleTypeDef * hcec)

Function Description

return the CEC state

Parameters

 

hcec: CEC handle

Return values

 

HAL state

7.2.18HAL_CEC_GetError

Function Name

uint32_t HAL_CEC_GetError (CEC_HandleTypeDef * hcec)

Function Description

Return the CEC error code.

Parameters

 

hcec: : pointer to a CEC_HandleTypeDef structure that

 

 

contains the configuration information for the specified CEC.

Return values

 

CEC Error Code

DOCID025834 Rev 2

151/900

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