STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches

Control functions. More...

Collaboration diagram for Control functions:

Functions

uint32_t HAL_CAN_GetError (CAN_HandleTypeDef *hcan)
 
HAL_CAN_StateTypeDef HAL_CAN_GetState (CAN_HandleTypeDef *hcan)
 
HAL_StatusTypeDef HAL_CAN_Start (CAN_HandleTypeDef *hcan)
 Start the CAN module.
 
HAL_StatusTypeDef HAL_CAN_Stop (CAN_HandleTypeDef *hcan)
 Stop the CAN module and enable access to configuration registers.
 
HAL_StatusTypeDef HAL_CAN_RequestSleep (CAN_HandleTypeDef *hcan)
 Request the sleep mode (low power) entry. When returning from this function, Sleep mode will be entered as soon as the current CAN activity (transmission or reception of a CAN frame) has been completed.
 
HAL_StatusTypeDef HAL_CAN_WakeUp (CAN_HandleTypeDef *hcan)
 Wake up from sleep mode. When returning with HAL_OK status from this function, Sleep mode is exited.
 
uint32_t HAL_CAN_IsSleepActive (const CAN_HandleTypeDef *hcan)
 Check is sleep mode is active.
 
HAL_StatusTypeDef HAL_CAN_AddTxMessage (CAN_HandleTypeDef *hcan, const CAN_TxHeaderTypeDef *pHeader, const uint8_t aData[], uint32_t *pTxMailbox)
 Add a message to the first free Tx mailbox and activate the corresponding transmission request.
 
HAL_StatusTypeDef HAL_CAN_AbortTxRequest (CAN_HandleTypeDef *hcan, uint32_t TxMailboxes)
 Abort transmission requests.
 
uint32_t HAL_CAN_GetTxMailboxesFreeLevel (const CAN_HandleTypeDef *hcan)
 Return Tx Mailboxes free level: number of free Tx Mailboxes.
 
uint32_t HAL_CAN_IsTxMessagePending (const CAN_HandleTypeDef *hcan, uint32_t TxMailboxes)
 Check if a transmission request is pending on the selected Tx Mailboxes.
 
uint32_t HAL_CAN_GetTxTimestamp (const CAN_HandleTypeDef *hcan, uint32_t TxMailbox)
 Return timestamp of Tx message sent, if time triggered communication mode is enabled.
 
HAL_StatusTypeDef HAL_CAN_GetRxMessage (CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[])
 Get an CAN frame from the Rx FIFO zone into the message RAM.
 
uint32_t HAL_CAN_GetRxFifoFillLevel (const CAN_HandleTypeDef *hcan, uint32_t RxFifo)
 Return Rx FIFO fill level.
 

Detailed Description

Control functions.

  ==============================================================================
                      ##### Control functions #####
  ==============================================================================
    [..]  This section provides functions allowing to:
      (+) HAL_CAN_Start                    : Start the CAN module
      (+) HAL_CAN_Stop                     : Stop the CAN module
      (+) HAL_CAN_RequestSleep             : Request sleep mode entry.
      (+) HAL_CAN_WakeUp                   : Wake up from sleep mode.
      (+) HAL_CAN_IsSleepActive            : Check is sleep mode is active.
      (+) HAL_CAN_AddTxMessage             : Add a message to the Tx mailboxes
                                             and activate the corresponding
                                             transmission request
      (+) HAL_CAN_AbortTxRequest           : Abort transmission request
      (+) HAL_CAN_GetTxMailboxesFreeLevel  : Return Tx mailboxes free level
      (+) HAL_CAN_IsTxMessagePending       : Check if a transmission request is
                                             pending on the selected Tx mailbox
      (+) HAL_CAN_GetRxMessage             : Get a CAN frame from the Rx FIFO
      (+) HAL_CAN_GetRxFifoFillLevel       : Return Rx FIFO fill level

Function Documentation

◆ HAL_CAN_GetError()

uint32_t HAL_CAN_GetError ( CAN_HandleTypeDef * hcan)

◆ HAL_CAN_GetState()

HAL_CAN_StateTypeDef HAL_CAN_GetState ( CAN_HandleTypeDef * hcan)

◆ HAL_CAN_Start()

HAL_StatusTypeDef HAL_CAN_Start ( CAN_HandleTypeDef * hcan)

#include <stm32f4xx_hal_can.h>

Start the CAN module.

Parameters
hcanpointer to an CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
Return values
HALstatus

Definition at line 1034 of file stm32f4xx_hal_can.c.

References CAN_TIMEOUT_VALUE, CAN_HandleTypeDef::ErrorCode, HAL_CAN_ERROR_NONE, HAL_CAN_ERROR_NOT_READY, HAL_CAN_ERROR_TIMEOUT, HAL_CAN_STATE_ERROR, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_GetTick(), HAL_OK, CAN_HandleTypeDef::Instance, and CAN_HandleTypeDef::State.

◆ HAL_CAN_Stop()

HAL_StatusTypeDef HAL_CAN_Stop ( CAN_HandleTypeDef * hcan)

#include <stm32f4xx_hal_can.h>

Stop the CAN module and enable access to configuration registers.

Parameters
hcanpointer to an CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
Return values
HALstatus

Definition at line 1086 of file stm32f4xx_hal_can.c.

References CAN_TIMEOUT_VALUE, CAN_HandleTypeDef::ErrorCode, HAL_CAN_ERROR_NOT_STARTED, HAL_CAN_ERROR_TIMEOUT, HAL_CAN_STATE_ERROR, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_GetTick(), HAL_OK, CAN_HandleTypeDef::Instance, and CAN_HandleTypeDef::State.

Referenced by HAL_CAN_DeInit().

◆ HAL_CAN_RequestSleep()

HAL_StatusTypeDef HAL_CAN_RequestSleep ( CAN_HandleTypeDef * hcan)

#include <stm32f4xx_hal_can.h>

Request the sleep mode (low power) entry. When returning from this function, Sleep mode will be entered as soon as the current CAN activity (transmission or reception of a CAN frame) has been completed.

Parameters
hcanpointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
Return values
HALstatus.

Definition at line 1141 of file stm32f4xx_hal_can.c.

References CAN_HandleTypeDef::ErrorCode, HAL_CAN_ERROR_NOT_INITIALIZED, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_OK, CAN_HandleTypeDef::Instance, and CAN_HandleTypeDef::State.

◆ HAL_CAN_WakeUp()

HAL_StatusTypeDef HAL_CAN_WakeUp ( CAN_HandleTypeDef * hcan)

#include <stm32f4xx_hal_can.h>

Wake up from sleep mode. When returning with HAL_OK status from this function, Sleep mode is exited.

Parameters
hcanpointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
Return values
HALstatus.

Definition at line 1172 of file stm32f4xx_hal_can.c.

References CAN_WAKEUP_TIMEOUT_COUNTER, CAN_HandleTypeDef::ErrorCode, HAL_CAN_ERROR_NOT_INITIALIZED, HAL_CAN_ERROR_TIMEOUT, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_OK, CAN_HandleTypeDef::Instance, and CAN_HandleTypeDef::State.

◆ HAL_CAN_IsSleepActive()

uint32_t HAL_CAN_IsSleepActive ( const CAN_HandleTypeDef * hcan)

#include <stm32f4xx_hal_can.h>

Check is sleep mode is active.

Parameters
hcanpointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
Return values
Status
  • 0 : Sleep mode is not active.
  • 1 : Sleep mode is active.

Definition at line 1219 of file stm32f4xx_hal_can.c.

References HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, CAN_HandleTypeDef::Instance, and CAN_HandleTypeDef::State.

◆ HAL_CAN_AddTxMessage()

HAL_StatusTypeDef HAL_CAN_AddTxMessage ( CAN_HandleTypeDef * hcan,
const CAN_TxHeaderTypeDef * pHeader,
const uint8_t aData[],
uint32_t * pTxMailbox )

#include <stm32f4xx_hal_can.h>

Add a message to the first free Tx mailbox and activate the corresponding transmission request.

Parameters
hcanpointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
pHeaderpointer to a CAN_TxHeaderTypeDef structure.
aDataarray containing the payload of the Tx frame.
pTxMailboxpointer to a variable where the function will return the TxMailbox used to store the Tx message. This parameter can be a value of
  • CAN_Tx_Mailboxes.
Return values
HALstatus

Definition at line 1250 of file stm32f4xx_hal_can.c.

References assert_param, CAN_ID_STD, CAN_TxHeaderTypeDef::DLC, CAN_HandleTypeDef::ErrorCode, CAN_TxHeaderTypeDef::ExtId, HAL_CAN_ERROR_NOT_INITIALIZED, HAL_CAN_ERROR_PARAM, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_OK, CAN_TxHeaderTypeDef::IDE, CAN_HandleTypeDef::Instance, IS_CAN_DLC, IS_CAN_EXTID, IS_CAN_IDTYPE, IS_CAN_RTR, IS_CAN_STDID, CAN_TxHeaderTypeDef::RTR, CAN_HandleTypeDef::State, CAN_TxHeaderTypeDef::StdId, and CAN_TxHeaderTypeDef::TransmitGlobalTime.

◆ HAL_CAN_AbortTxRequest()

HAL_StatusTypeDef HAL_CAN_AbortTxRequest ( CAN_HandleTypeDef * hcan,
uint32_t TxMailboxes )

#include <stm32f4xx_hal_can.h>

Abort transmission requests.

Parameters
hcanpointer to an CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
TxMailboxesList of the Tx Mailboxes to abort. This parameter can be any combination of
  • CAN_Tx_Mailboxes.
Return values
HALstatus

Definition at line 1350 of file stm32f4xx_hal_can.c.

References assert_param, CAN_TX_MAILBOX0, CAN_TX_MAILBOX1, CAN_TX_MAILBOX2, CAN_HandleTypeDef::ErrorCode, HAL_CAN_ERROR_NOT_INITIALIZED, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_OK, CAN_HandleTypeDef::Instance, IS_CAN_TX_MAILBOX_LIST, and CAN_HandleTypeDef::State.

◆ HAL_CAN_GetTxMailboxesFreeLevel()

uint32_t HAL_CAN_GetTxMailboxesFreeLevel ( const CAN_HandleTypeDef * hcan)

#include <stm32f4xx_hal_can.h>

Return Tx Mailboxes free level: number of free Tx Mailboxes.

Parameters
hcanpointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
Return values
Numberof free Tx Mailboxes.

Definition at line 1399 of file stm32f4xx_hal_can.c.

References HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, CAN_HandleTypeDef::Instance, and CAN_HandleTypeDef::State.

◆ HAL_CAN_IsTxMessagePending()

uint32_t HAL_CAN_IsTxMessagePending ( const CAN_HandleTypeDef * hcan,
uint32_t TxMailboxes )

#include <stm32f4xx_hal_can.h>

Check if a transmission request is pending on the selected Tx Mailboxes.

Parameters
hcanpointer to an CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
TxMailboxesList of Tx Mailboxes to check. This parameter can be any combination of
  • CAN_Tx_Mailboxes.
Return values
Status
  • 0 : No pending transmission request on any selected Tx Mailboxes.
  • 1 : Pending transmission request on at least one of the selected Tx Mailbox.

Definition at line 1442 of file stm32f4xx_hal_can.c.

References assert_param, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, CAN_HandleTypeDef::Instance, IS_CAN_TX_MAILBOX_LIST, and CAN_HandleTypeDef::State.

◆ HAL_CAN_GetTxTimestamp()

uint32_t HAL_CAN_GetTxTimestamp ( const CAN_HandleTypeDef * hcan,
uint32_t TxMailbox )

#include <stm32f4xx_hal_can.h>

Return timestamp of Tx message sent, if time triggered communication mode is enabled.

Parameters
hcanpointer to a CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
TxMailboxTx Mailbox where the timestamp of message sent will be read. This parameter can be one value of
  • CAN_Tx_Mailboxes.
Return values
Timestampof message sent from Tx Mailbox.

Definition at line 1474 of file stm32f4xx_hal_can.c.

References assert_param, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, CAN_HandleTypeDef::Instance, IS_CAN_TX_MAILBOX, and CAN_HandleTypeDef::State.

◆ HAL_CAN_GetRxMessage()

HAL_StatusTypeDef HAL_CAN_GetRxMessage ( CAN_HandleTypeDef * hcan,
uint32_t RxFifo,
CAN_RxHeaderTypeDef * pHeader,
uint8_t aData[] )

#include <stm32f4xx_hal_can.h>

Get an CAN frame from the Rx FIFO zone into the message RAM.

Parameters
hcanpointer to an CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
RxFifoFifo number of the received message to be read. This parameter can be a value of
  • CAN_receive_FIFO_number.
pHeaderpointer to a CAN_RxHeaderTypeDef structure where the header of the Rx frame will be stored.
aDataarray where the payload of the Rx frame will be stored.
Return values
HALstatus

Definition at line 1508 of file stm32f4xx_hal_can.c.

References assert_param, CAN_ID_STD, CAN_RX_FIFO0, CAN_RxHeaderTypeDef::DLC, CAN_HandleTypeDef::ErrorCode, CAN_RxHeaderTypeDef::ExtId, CAN_RxHeaderTypeDef::FilterMatchIndex, HAL_CAN_ERROR_NOT_INITIALIZED, HAL_CAN_ERROR_PARAM, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, HAL_ERROR, HAL_OK, CAN_RxHeaderTypeDef::IDE, CAN_HandleTypeDef::Instance, IS_CAN_RX_FIFO, CAN_RxHeaderTypeDef::RTR, CAN_HandleTypeDef::State, CAN_RxHeaderTypeDef::StdId, and CAN_RxHeaderTypeDef::Timestamp.

◆ HAL_CAN_GetRxFifoFillLevel()

uint32_t HAL_CAN_GetRxFifoFillLevel ( const CAN_HandleTypeDef * hcan,
uint32_t RxFifo )

#include <stm32f4xx_hal_can.h>

Return Rx FIFO fill level.

Parameters
hcanpointer to an CAN_HandleTypeDef structure that contains the configuration information for the specified CAN.
RxFifoRx FIFO. This parameter can be a value of
  • CAN_receive_FIFO_number.
Return values
Numberof messages available in Rx FIFO.

Definition at line 1608 of file stm32f4xx_hal_can.c.

References assert_param, CAN_RX_FIFO0, HAL_CAN_STATE_LISTENING, HAL_CAN_STATE_READY, CAN_HandleTypeDef::Instance, IS_CAN_RX_FIFO, and CAN_HandleTypeDef::State.