| NUC472_NUC442_BSP V3.04.000 The Board Support Package for NUC472/NUC442

Macros | Enumerator | Functions | Variables
CAN Exported Functions
NUC472/NUC442 Device Driver » CAN Driver » CAN Exported Type Defines
Collaboration diagram for CAN Exported Functions:

## Macros
#define | CAN_GET_INT_STATUS(can)
| Get interrupt status. More...
#define | CAN_GET_INT_PENDING_STATUS(can)
| Get specified interrupt pending status. More...
#define | CAN_DISABLE_WAKEUP(can)
| Disable Wakeup function. More...
#define | CAN_ENABLE_WAKEUP(can)
| Enable Wakeup function. More...
#define | CAN_GET_NEW_DATA_IN_BIT(can, u32MsgNum)
| Get specified Message Object new data into bit value. More...

## Functions
uint32_t | CAN_SetBaudRate (CAN_T *tCAN, uint32_t u32BaudRate)
| The function is used to set bus timing parameter according current clock and target baud-rate. More...
uint32_t | CAN_Open (CAN_T *tCAN, uint32_t u32BaudRate, uint32_t u32Mode)
| The function is sets bus timing parameter according current clock and target baud-rate. And set CAN operation mode. More...
int32_t | CAN_Transmit (CAN_T *tCAN, uint32_t u32MsgNum, STR_CANMSG_T *pCanMsg)
| Send CAN message. More...
int32_t | CAN_Receive (CAN_T *tCAN, uint32_t u32MsgNum, STR_CANMSG_T *pCanMsg)
| Gets the message, if received. More...
void | CAN_CLR_INT_PENDING_BIT (CAN_T *tCAN, uint8_t u32MsgNum)
| Clear interrupt pending bit. More...
void | CAN_EnableInt (CAN_T *tCAN, uint32_t u32Mask)
| Enable CAN interrupt. More...
void | CAN_DisableInt (CAN_T *tCAN, uint32_t u32Mask)
| Disable CAN interrupt. More...
int32_t | CAN_SetMultiRxMsg (CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32MsgCount, uint32_t u32IDType, uint32_t u32ID)
| The function is used to configure several receive message objects. More...
int32_t | CAN_SetRxMsg (CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID)
| The function is used to configure a receive message object. More...
int32_t | CAN_SetTxMsg (CAN_T *tCAN, uint32_t u32MsgNum, STR_CANMSG_T *pCanMsg)
| The function is used to configure a transmit object. More...
int32_t | CAN_TriggerTxMsg (CAN_T *tCAN, uint32_t u32MsgNum)
| Set transmit request bit. More...
void | CAN_Close (CAN_T *tCAN)
| The function is used to disable all CAN interrupt. More...

## Variables
uint32_t | STR_CANMSG_T::IdType
uint32_t | STR_CANMSG_T::FrameType
uint32_t | STR_CANMSG_T::Id
uint8_t | STR_CANMSG_T::DLC
uint8_t | STR_CANMSG_T::Data [8]
uint8_t | STR_CANMASK_T::u8Xtd
uint8_t | STR_CANMASK_T::u8Dir
uint32_t | STR_CANMASK_T::u32Id
uint8_t | STR_CANMASK_T::u8IdType

## Detailed Description

## Macro Definition Documentation

## ◆ CAN_DISABLE_WAKEUP

#define CAN_DISABLE_WAKEUP | ( |  | can | ) |

Disable Wakeup function.

Parameters

  [in] | can | The base address of can module

Returns
  None

Definition at line 121 of file can.h.

## ◆ CAN_ENABLE_WAKEUP

#define CAN_ENABLE_WAKEUP | ( |  | can | ) |

Enable Wakeup function.

Parameters

  [in] | can | The base address of can module

Returns
  None

Definition at line 131 of file can.h.

## ◆ CAN_GET_INT_PENDING_STATUS

#define CAN_GET_INT_PENDING_STATUS | ( |  | can | ) |

Get specified interrupt pending status.

Parameters

  [in] | can | The base address of can module

Returns
  The source of the interrupt.

Definition at line 111 of file can.h.

## ◆ CAN_GET_INT_STATUS

#define CAN_GET_INT_STATUS | ( |  | can | ) |

Get interrupt status.

Parameters

  [in] | can | The base address of can module

Returns
  CAN module status register value

Definition at line 101 of file can.h.

## ◆ CAN_GET_NEW_DATA_IN_BIT

#define CAN_GET_NEW_DATA_IN_BIT | ( |  | can,
|  |  | u32MsgNum
| ) |  |

Get specified Message Object new data into bit value.

Parameters

  [in] | can | The base address of can module
  [in] | u32MsgNum | Specified Message Object number. (0 ~ 31)

Returns
  Specified Message Object new data into bit value.

Definition at line 142 of file can.h.

## Function Documentation

## ◆ CAN_Close()

void CAN_Close | ( | CAN_T * | tCAN | ) |

The function is used to disable all CAN interrupt.

Parameters

  [in] | tCAN | The base address of can module

Returns
  None

Definition at line 575 of file can.c.

Here is the call graph for this function:

## ◆ CAN_CLR_INT_PENDING_BIT()

void CAN_CLR_INT_PENDING_BIT | ( | CAN_T * | tCAN,
|  | uint8_t | u32MsgNum
| ) |  |

Clear interrupt pending bit.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | Specifies the Message object number, from 0 to 31

Returns
  None

Definition at line 839 of file can.c.

## ◆ CAN_DisableInt()

void CAN_DisableInt | ( | CAN_T * | tCAN,
|  | uint32_t | u32Mask
| ) |  |

Disable CAN interrupt.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32Mask | Interrupt Mask. ( CAN_CON_IE_Msk / CAN_CON_SIE_Msk / CAN_CON_EIE_Msk)

Returns
  None

Definition at line 707 of file can.c.

Here is the caller graph for this function:

## ◆ CAN_EnableInt()

void CAN_EnableInt | ( | CAN_T * | tCAN,
|  | uint32_t | u32Mask
| ) |  |

Enable CAN interrupt.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32Mask | Interrupt Mask. ( CAN_CON_IE_Msk / CAN_CON_SIE_Msk / CAN_CON_EIE_Msk)

Returns
  None

Definition at line 688 of file can.c.

## ◆ CAN_Open()

uint32_t CAN_Open | ( | CAN_T * | tCAN,
|  | uint32_t | u32BaudRate,
|  | uint32_t | u32Mode
| ) |  |

The function is sets bus timing parameter according current clock and target baud-rate. And set CAN operation mode.

Parameters

  [in] | tCAN | The base address of can module
  [in] | u32BaudRate | The target CAN baud-rate. The range of u32BaudRate is 1~1000KHz
  [in] | u32Mode | The CAN operation mode. ( CAN_NORMAL_MODE / CAN_BASIC_MODE)

Returns
  u32CurrentBitRate Real baud-rate value

Definition at line 589 of file can.c.

Here is the call graph for this function:

## ◆ CAN_Receive()

int32_t CAN_Receive | ( | CAN_T * | tCAN,
|  | uint32_t | u32MsgNum,
|  | STR_CANMSG_T * | pCanMsg
| ) |  |

Gets the message, if received.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | Specifies the Message object number, from 0 to 31
  [out] | pCanMsg | Pointer to the message structure where received data is copied.

Returns
  FALSE: No any message received.
  TRUE : Receive Message success.

Definition at line 819 of file can.c.

## ◆ CAN_SetBaudRate()

HIDDEN_SYMBOLS uint32_t CAN_SetBaudRate | ( | CAN_T * | tCAN,
|  | uint32_t | u32BaudRate
| ) |  |

The function is used to set bus timing parameter according current clock and target baud-rate.

Parameters

  [in] | tCAN | The base address of can module
  [in] | u32BaudRate | The target CAN baud-rate. The range of u32BaudRate is 1~1000KHz

Returns
  u32CurrentBitRate Real baud-rate value

Definition at line 479 of file can.c.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ CAN_SetMultiRxMsg()

int32_t CAN_SetMultiRxMsg | ( | CAN_T * | tCAN,
|  | uint32_t | u32MsgNum,
|  | uint32_t | u32MsgCount,
|  | uint32_t | u32IDType,
|  | uint32_t | u32ID
| ) |  |

The function is used to configure several receive message objects.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | The starting MSG RAM number. (0 ~ 31)
  [in] | u32MsgCount | the number of MSG RAM of the FIFO.
  [in] | u32IDType | Specifies the identifier type of the frames that will be transmitted. ( CAN_STD_ID / CAN_EXT_ID)
  [in] | u32ID | Specifies the identifier used for acceptance filtering.

Returns
  FALSE: No useful interface
  TRUE : Configure receive message objects success.

Definition at line 758 of file can.c.

## ◆ CAN_SetRxMsg()

int32_t CAN_SetRxMsg | ( | CAN_T * | tCAN,
|  | uint32_t | u32MsgNum,
|  | uint32_t | u32IDType,
|  | uint32_t | u32ID
| ) |  |

The function is used to configure a receive message object.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | Specifies the Message object number, from 0 to 31
  [in] | u32IDType | Specifies the identifier type of the frames that will be transmitted. ( CAN_STD_ID / CAN_EXT_ID)
  [in] | u32ID | Specifies the identifier used for acceptance filtering.

Returns
  FALSE: No useful interface
  TRUE : Configure a receive message object success.

Definition at line 729 of file can.c.

## ◆ CAN_SetTxMsg()

int32_t CAN_SetTxMsg | ( | CAN_T * | tCAN,
|  | uint32_t | u32MsgNum,
|  | STR_CANMSG_T * | pCanMsg
| ) |  |

The function is used to configure a transmit object.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | Specifies the Message object number, from 0 to 31
  [in] | pCanMsg | Pointer to the message structure where received data is copied.

Returns
  FALSE: No useful interface.
  TRUE : Config message object success.

Definition at line 614 of file can.c.

Here is the caller graph for this function:

## ◆ CAN_Transmit()

int32_t CAN_Transmit | ( | CAN_T * | tCAN,
|  | uint32_t | u32MsgNum,
|  | STR_CANMSG_T * | pCanMsg
| ) |  |

Send CAN message.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | Specifies the Message object number, from 0 to 31
  [in] | pCanMsg | Pointer to the message structure where received data is copied.

Returns
  FALSE: When operation in basic mode: Transmit message time out, or when operation in normal mode: No useful interface.
  TRUE : Transmit Message success.

Definition at line 793 of file can.c.

Here is the call graph for this function:

## ◆ CAN_TriggerTxMsg()

int32_t CAN_TriggerTxMsg | ( | CAN_T * | tCAN,
|  | uint32_t | u32MsgNum
| ) |  |

Set transmit request bit.

Parameters

  [in] | tCAN | The base address of can module.
  [in] | u32MsgNum | Specifies the Message object number, from 0 to 31.

Returns
  TRUE: Start transmit message.

Definition at line 670 of file can.c.

Here is the caller graph for this function:

## Variable Documentation

## ◆ Data

uint8_t STR_CANMSG_T::Data[8]

Data byte 0 ~ 7

Definition at line 59 of file can.h.

## ◆ DLC

uint8_t STR_CANMSG_T::DLC

Data Length Code

Definition at line 58 of file can.h.

## ◆ FrameType

uint32_t STR_CANMSG_T::FrameType

Frame Type

Definition at line 56 of file can.h.

## ◆ Id

uint32_t STR_CANMSG_T::Id

Message Identifier

Definition at line 57 of file can.h.

## ◆ IdType

uint32_t STR_CANMSG_T::IdType

Identifier Type

Definition at line 55 of file can.h.

## ◆ u32Id

uint32_t STR_CANMASK_T::u32Id

Message Identifier

Definition at line 69 of file can.h.

## ◆ u8Dir

uint8_t STR_CANMASK_T::u8Dir

Message Direction

Definition at line 68 of file can.h.

## ◆ u8IdType

uint8_t STR_CANMASK_T::u8IdType

Identifier Type

Definition at line 70 of file can.h.

## ◆ u8Xtd

uint8_t STR_CANMASK_T::u8Xtd

Extended Identifier

Definition at line 67 of file can.h.