update new protocol and new hardware
This commit is contained in:
@ -226,8 +226,8 @@
|
||||
#ifdef HAL_CAN_MODULE_ENABLED
|
||||
|
||||
#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
|
||||
#error "The CAN driver cannot be used with its legacy, Please enable only one CAN module at once"
|
||||
#endif
|
||||
#error "The CAN driver cannot be used with its legacy, Please enable only one CAN module at once"
|
||||
#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
@ -555,7 +555,8 @@ __weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
|
||||
* @param pCallback pointer to the Callback function
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID, void (* pCallback)(CAN_HandleTypeDef *_hcan))
|
||||
HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_CallbackIDTypeDef CallbackID,
|
||||
void (* pCallback)(CAN_HandleTypeDef *_hcan))
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
|
||||
@ -675,7 +676,7 @@ HAL_StatusTypeDef HAL_CAN_RegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_Call
|
||||
|
||||
/**
|
||||
* @brief Unregister a CAN CallBack.
|
||||
* CAN callabck is redirected to the weak predefined callback
|
||||
* CAN callback is redirected to the weak predefined callback
|
||||
* @param hcan pointer to a CAN_HandleTypeDef structure that contains
|
||||
* the configuration information for CAN module
|
||||
* @param CallbackID ID of the callback to be unregistered
|
||||
@ -835,7 +836,7 @@ HAL_StatusTypeDef HAL_CAN_UnRegisterCallback(CAN_HandleTypeDef *hcan, HAL_CAN_Ca
|
||||
* contains the filter configuration information.
|
||||
* @retval None
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig)
|
||||
HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, const CAN_FilterTypeDef *sFilterConfig)
|
||||
{
|
||||
uint32_t filternbrbitpos;
|
||||
CAN_TypeDef *can_ip = hcan->Instance;
|
||||
@ -1188,7 +1189,7 @@ HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan)
|
||||
* - 0 : Sleep mode is not active.
|
||||
* - 1 : Sleep mode is active.
|
||||
*/
|
||||
uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan)
|
||||
uint32_t HAL_CAN_IsSleepActive(const CAN_HandleTypeDef *hcan)
|
||||
{
|
||||
uint32_t status = 0U;
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
@ -1219,7 +1220,8 @@ uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan)
|
||||
* This parameter can be a value of @arg CAN_Tx_Mailboxes.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox)
|
||||
HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, const CAN_TxHeaderTypeDef *pHeader,
|
||||
const uint8_t aData[], uint32_t *pTxMailbox)
|
||||
{
|
||||
uint32_t transmitmailbox;
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
@ -1250,15 +1252,6 @@ HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderType
|
||||
/* Select an empty transmit mailbox */
|
||||
transmitmailbox = (tsr & CAN_TSR_CODE) >> CAN_TSR_CODE_Pos;
|
||||
|
||||
/* Check transmit mailbox value */
|
||||
if (transmitmailbox > 2U)
|
||||
{
|
||||
/* Update error code */
|
||||
hcan->ErrorCode |= HAL_CAN_ERROR_INTERNAL;
|
||||
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Store the Tx mailbox */
|
||||
*pTxMailbox = (uint32_t)1 << transmitmailbox;
|
||||
|
||||
@ -1376,7 +1369,7 @@ HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMai
|
||||
* the configuration information for the specified CAN.
|
||||
* @retval Number of free Tx Mailboxes.
|
||||
*/
|
||||
uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan)
|
||||
uint32_t HAL_CAN_GetTxMailboxesFreeLevel(const CAN_HandleTypeDef *hcan)
|
||||
{
|
||||
uint32_t freelevel = 0U;
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
@ -1419,7 +1412,7 @@ uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan)
|
||||
* - 1 : Pending transmission request on at least one of the selected
|
||||
* Tx Mailbox.
|
||||
*/
|
||||
uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes)
|
||||
uint32_t HAL_CAN_IsTxMessagePending(const CAN_HandleTypeDef *hcan, uint32_t TxMailboxes)
|
||||
{
|
||||
uint32_t status = 0U;
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
@ -1451,7 +1444,7 @@ uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxe
|
||||
* This parameter can be one value of @arg CAN_Tx_Mailboxes.
|
||||
* @retval Timestamp of message sent from Tx Mailbox.
|
||||
*/
|
||||
uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox)
|
||||
uint32_t HAL_CAN_GetTxTimestamp(const CAN_HandleTypeDef *hcan, uint32_t TxMailbox)
|
||||
{
|
||||
uint32_t timestamp = 0U;
|
||||
uint32_t transmitmailbox;
|
||||
@ -1485,7 +1478,8 @@ uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox)
|
||||
* @param aData array where the payload of the Rx frame will be stored.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[])
|
||||
HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo,
|
||||
CAN_RxHeaderTypeDef *pHeader, uint8_t aData[])
|
||||
{
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
|
||||
@ -1526,7 +1520,8 @@ HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo,
|
||||
}
|
||||
else
|
||||
{
|
||||
pHeader->ExtId = ((CAN_RI0R_EXID | CAN_RI0R_STID) & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_RI0R_EXID_Pos;
|
||||
pHeader->ExtId = ((CAN_RI0R_EXID | CAN_RI0R_STID) &
|
||||
hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_RI0R_EXID_Pos;
|
||||
}
|
||||
pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR);
|
||||
pHeader->DLC = (CAN_RDT0R_DLC & hcan->Instance->sFIFOMailBox[RxFifo].RDTR) >> CAN_RDT0R_DLC_Pos;
|
||||
@ -1575,7 +1570,7 @@ HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo,
|
||||
* This parameter can be a value of @arg CAN_receive_FIFO_number.
|
||||
* @retval Number of messages available in Rx FIFO.
|
||||
*/
|
||||
uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo)
|
||||
uint32_t HAL_CAN_GetRxFifoFillLevel(const CAN_HandleTypeDef *hcan, uint32_t RxFifo)
|
||||
{
|
||||
uint32_t filllevel = 0U;
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
@ -2343,7 +2338,7 @@ __weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan)
|
||||
* the configuration information for the specified CAN.
|
||||
* @retval HAL state
|
||||
*/
|
||||
HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan)
|
||||
HAL_CAN_StateTypeDef HAL_CAN_GetState(const CAN_HandleTypeDef *hcan)
|
||||
{
|
||||
HAL_CAN_StateTypeDef state = hcan->State;
|
||||
|
||||
@ -2378,7 +2373,7 @@ HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan)
|
||||
* the configuration information for the specified CAN.
|
||||
* @retval CAN Error Code
|
||||
*/
|
||||
uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan)
|
||||
uint32_t HAL_CAN_GetError(const CAN_HandleTypeDef *hcan)
|
||||
{
|
||||
/* Return CAN error code */
|
||||
return hcan->ErrorCode;
|
||||
|
Reference in New Issue
Block a user