keil_examples/CANACT/can.c
/******************************************************************************
** Function name:		CAN_SetACCF_Lookup
**
** Descriptions:		Initialize CAN, install CAN interrupt handler
**
** parameters:			bitrate
** Returned value:		true or false, false if initialization failed.
** 
******************************************************************************/
Function name:         CAN_SetACCF_Lookup
Descriptions:          Initialize CAN, install CAN interrupt handler

bitrate
Returned value:                true or false, false if initialization failed.
Function name : CAN_SetACCF_Lookup Descriptions : Initialize CAN install CAN interrupt handler bitrate Returned value : true or false false if initialization failed .
void CAN_SetACCF_Lookup( void )
{
  uint32_t address = 0;
  uint32_t i;
  uint32_t ID_high, ID_low;
  LPC_CANAF->SFF_sa = address;
  for ( i = 0; i < ACCF_IDEN_NUM; i += 2 )
  {
	ID_low = (i << 29) | (EXP_STD_ID << 16);
	ID_high = ((i+1) << 13) | (EXP_STD_ID << 0);
	*((volatile uint32_t *)(LPC_CANAF_RAM_BASE + address)) = ID_low | ID_high;
	address += 4; 
  }
  LPC_CANAF->SFF_GRP_sa = address;
  for ( i = 0; i < ACCF_IDEN_NUM; i += 2 )
  {
	ID_low = (i << 29) | (GRP_STD_ID << 16);
	ID_high = ((i+1) << 13) | (GRP_STD_ID << 0);
	*((volatile uint32_t *)(LPC_CANAF_RAM_BASE + address)) = ID_low | ID_high;
	address += 4; 
  }
  LPC_CANAF->EFF_sa = address;
  for ( i = 0; i < ACCF_IDEN_NUM; i++  )
  {
	ID_low = (i << 29) | (EXP_EXT_ID << 0);
	*((volatile uint32_t *)(LPC_CANAF_RAM_BASE + address)) = ID_low;
	address += 4; 
  }
  LPC_CANAF->EFF_GRP_sa = address;
  for ( i = 0; i < ACCF_IDEN_NUM; i++  )
  {
	ID_low = (i << 29) | (GRP_EXT_ID << 0);
	*((volatile uint32_t *)(LPC_CANAF_RAM_BASE + address)) = ID_low;
	address += 4; 
  }
  LPC_CANAF->ENDofTable = address;
  return;
}
void CAN_SetACCF_Lookup ( void ) { uint32_t address = 0 ; uint32_t i ; uint32_t ID_high , ID_low ; LPC_CANAF -> SFF_sa = address ; for ( i = 0 ; i < ACCF_IDEN_NUM ; i += 2 ) { ID_low = ( i << 29 ) | ( EXP_STD_ID << 16 ) ; ID_high = ( ( i + 1 ) << 13 ) | ( EXP_STD_ID << 0 ) ; * ( ( volatile uint32_t * ) ( LPC_CANAF_RAM_BASE + address ) ) = ID_low | ID_high ; address += 4 ; } LPC_CANAF -> SFF_GRP_sa = address ; for ( i = 0 ; i < ACCF_IDEN_NUM ; i += 2 ) { ID_low = ( i << 29 ) | ( GRP_STD_ID << 16 ) ; ID_high = ( ( i + 1 ) << 13 ) | ( GRP_STD_ID << 0 ) ; * ( ( volatile uint32_t * ) ( LPC_CANAF_RAM_BASE + address ) ) = ID_low | ID_high ; address += 4 ; } LPC_CANAF -> EFF_sa = address ; for ( i = 0 ; i < ACCF_IDEN_NUM ; i ++ ) { ID_low = ( i << 29 ) | ( EXP_EXT_ID << 0 ) ; * ( ( volatile uint32_t * ) ( LPC_CANAF_RAM_BASE + address ) ) = ID_low ; address += 4 ; } LPC_CANAF -> EFF_GRP_sa = address ; for ( i = 0 ; i < ACCF_IDEN_NUM ; i ++ ) { ID_low = ( i << 29 ) | ( GRP_EXT_ID << 0 ) ; * ( ( volatile uint32_t * ) ( LPC_CANAF_RAM_BASE + address ) ) = ID_low ; address += 4 ; } LPC_CANAF -> ENDofTable = address ; return ; }
Function name:         CAN_SetACCF_Lookup
Descriptions:          Initialize CAN, install CAN interrupt handler
Function name : CAN_SetACCF_Lookup Descriptions : Initialize CAN install CAN interrupt handler
/* Set explicit standard Frame */ /* Set group standard Frame */ /* Set explicit extended Frame */ /* Set group extended Frame */ /* Set End of Table */