zhyinch
2018-10-01 96ca4b1952c1c4bf85704208f53c97b45a875b04
源码/核心板/Src/OnChipDevices/Rcc_Nvic_Systick.c
@@ -48,25 +48,52 @@
   NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
   
   /* Enable and set EXTI Interrupt to the lowest priority */
    NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn;
    NVIC_InitStructure.NVIC_IRQChannel = DECAIRQ_EXTI_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
      NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
      NVIC_InitStructure.NVIC_IRQChannelCmd =ENABLE;
    NVIC_Init(&NVIC_InitStructure);
}
int Systick_Init(void)
{
   int time_retry = 500;
   if (SysTick_Config(64000))
   if (SysTick_Config(72000))
   {
        /* Capture error */
        while (time_retry--);
      return 1;
    }
    NVIC_SetPriority (SysTick_IRQn, 5);
    NVIC_SetPriority(SysTick_IRQn, 5);
    return 0;
   
}
void delay_us(uint32_t nTimer)
{
    uint32_t i=0;
    for(i=0;i<nTimer;i++){
        __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
      __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
      __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
        __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
      __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
      __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
        __NOP();__NOP();__NOP();__NOP();
    }
}
void delay_ms(uint32_t nTimer)
{
    uint32_t i=1000*nTimer;
    delay_us(i);
}