示例#1
0
//void SysTick_Handler( void );
//void POWER_CLOCK_IRQHandler( void );
//void RADIO_IRQHandler( void );
//void UART0_IRQHandler( void );
//void SPI0_TWI0_IRQHandler( void );
//void SPI1_TWI1_IRQHandler( void );
//void GPIOTE_IRQHandler( void );
//void ADC_IRQHandler( void );
void TIMER0_IRQHandler( void )
{
  if(TIMER_EvenCheck(TIMERx, TIMERx_CH) == SUCCESS) {
    LED1_Toggle();
    TIMER_EvenClear(TIMERx, TIMERx_CH);
    TIMER_TimerClear(TIMERx);
  }
}
示例#2
0
void TIMER_DelayMS( __IO uint32_t DelayMs )
{
  TIMER_TimeBaseInitTypeDef TIMER_TBInitStruct;

  TIMER_TBInitStruct.TIMER_Mode      = TIMER_MODE_MODE_Timer;
  TIMER_TBInitStruct.TIMER_BitMode   = TIMER_BITMODE_BITMODE_16Bit;
  TIMER_TBInitStruct.TIMER_Prescaler = 9;  // 16Mhz / 2^9 = 16000000Hz / 512 = 31250 Hz
  TIMER_TimeBaseInit(TIMER, &TIMER_TBInitStruct);

  TIMER_CCInit(TIMER, TIMER_CH, DelayMs*31.25f);

  TIMER_Cmd(TIMER, ENABLE);
  while(TIMER_EvenCheck(TIMER, TIMER_CH) != SUCCESS);
  TIMER_EvenClear(NRF_TIMER0, TIMER_CH0);
  TIMER_Cmd(TIMER, DISABLE);
}