示例#1
0
文件: can_api.c 项目: akselsm/mbed
void can_irq_free(can_t *obj)
{
    CAN_DisableInt((CAN_T *)NU_MODBASE(obj->can), (CAN_CON_IE_Msk|CAN_CON_SIE_Msk|CAN_CON_EIE_Msk));
    
    can_irq_ids[obj->index] = 0;
    
    NVIC_DisableIRQ(CAN0_IRQn);    
}
示例#2
0
void Test_SetMaskFilter()
{
    STR_CANMASK_T MaskMsg;

	CAN_EnableInt(CAN_CON_IE);
 	CAN_InstallCallback(CALLBACK_MSG, (CAN_CALLBACK)CAN_CallbackFn);
	
	/* Set b'0' means don't care*/
	/* Set Messge Object No.0 mask ID */
	MaskMsg.u8Xtd    = 1;
	MaskMsg.u8Dir    = 1;
	MaskMsg.u8IdType = 0;     /* 1:EXT or 0:STD */
	MaskMsg.u32Id 	 = 0x707;
	CAN_SetMsgObjMask(MSG(0),&MaskMsg);
	CAN_SetRxMsgObj(MSG(0), CAN_STD_ID, 0x7FF , TRUE);

    printf("The sample code should be with Item[4]\n\n");

    printf("Set Receive Message Object Contect\n");
    printf("===================================\n");
    printf("Message Object No.0 :Receive STD_ID:0x7FF\n\n\n");
    printf("Set Mask Content\n");
    printf("==========================\n");
    printf("Compare Xtd: %s\n",MaskMsg.u8Xtd?"YES":"NO");
    printf("Compare Dir: %s\n",MaskMsg.u8Dir?"YES":"NO");
    printf("Compare MaskID:%s 0x%x\n\n\n",MaskMsg.u8IdType? "EXT":"STD",MaskMsg.u32Id);
    printf("If there is a message-ID 0x700~0x70F,\n ONLY 0x707/0x70F can pass acceptance filter.\n");

    printf("Waiting Message\n");
	SYS_SysTickDelay(100000);
	GetChar();

	CAN_UninstallCallback(CALLBACK_MSG);
   	CAN_DisableInt(CAN_CON_IE);
	
}