void InitCAN(void)
{
uint32_t CanApiClkInitTable[2] = { 0, 0 };
/* Publish CAN Callback Functions */
CCAN_CALLBACKS_T callbacks = {
CAN_rx,
CAN_tx,
CAN_error,
NULL,
NULL,
NULL,
NULL,
NULL,
};
baudrateCalculate(CANSERVO_DEV_BAUD_RATE, CanApiClkInitTable);
LPC_CCAN_API->init_can(&CanApiClkInitTable[0], TRUE);
/* Configure the CAN callback functions */
LPC_CCAN_API->config_calb(&callbacks);
/* Enable the CAN Interrupt */
NVIC_EnableIRQ(CAN_IRQn);
/* Configure message object 1 to receive all 29-bit messages for servo outputs */
gCANRxObj.msgobj = 1;
gCANRxObj.mode_id = 0x00000EE4UL;
gCANRxObj.mask = 0x00027FFFUL;
gCANRxObj.dlc = 8;
LPC_CCAN_API->config_rxmsgobj(&gCANRxObj);
}
|