コード例 #1
0
ファイル: main.c プロジェクト: Wiznet/W7500
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main()
{
    /*System clock configuration*/
    SystemInit();
//    *(volatile uint32_t *)(0x41001014) = 0x0060100; //clock setting 48MHz
    
    /* CLK OUT Set */
//    PAD_AFConfig(PAD_PA,GPIO_Pin_2, PAD_AF2); // PAD Config - CLKOUT used 3nd Function
    /* NVIC configuration */
    NVIC_Configuration();

    /* CPIO configuration */
    GPIO_Setting();

    /* Dualtimer 0_0 clock enable */
    DUALTIMER_ClockEnable(DUALTIMER0_0);

    /* Dualtimer 0_0 configuration */
    Dualtimer_InitStructure.TimerLoad = 0x4FFFF;
    Dualtimer_InitStructure.TimerControl_Mode = DUALTIMER_TimerControl_Periodic;
    Dualtimer_InitStructure.TimerControl_OneShot = DUALTIMER_TimerControl_Wrapping;
    Dualtimer_InitStructure.TimerControl_Pre = DUALTIMER_TimerControl_Pre_16;
    Dualtimer_InitStructure.TimerControl_Size = DUALTIMER_TimerControl_Size_32;
    
    DUALTIMER_Init(DUALTIMER0_0, &Dualtimer_InitStructure);
    
    /* Dualtimer 0_0 Interrupt enable */
    DUALTIMER_IntConfig(DUALTIMER0_0, ENABLE);
    
    /* Dualtimer 0_0 start */
    DUALTIMER_Start(DUALTIMER0_0);

    while(1);
}
コード例 #2
0
ファイル: main.c プロジェクト: edwin-oetelaar/W7500P
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main()
{
    /*System clock configuration*/
    SystemInit();
    /* NVIC configuration */
    NVIC_Configuration();

    /* CPIO configuration */
    GPIO_Setting();

    /* Dualtimer 0_0 clock enable */
    DUALTIMER_ClockEnable(DUALTIMER0_0);

    /* Dualtimer 0_0 configuration */
    Dualtimer_InitStructure.TimerLoad = 0x4FFFF;
    Dualtimer_InitStructure.TimerControl_Mode = DUALTIMER_TimerControl_Periodic;
    Dualtimer_InitStructure.TimerControl_OneShot = DUALTIMER_TimerControl_Wrapping;
    Dualtimer_InitStructure.TimerControl_Pre = DUALTIMER_TimerControl_Pre_16;
    Dualtimer_InitStructure.TimerControl_Size = DUALTIMER_TimerControl_Size_32;
    
    DUALTIMER_Init(DUALTIMER0_0, &Dualtimer_InitStructure);
    
    /* Dualtimer 0_0 Interrupt enable */
    DUALTIMER_IntConfig(DUALTIMER0_0, ENABLE);
    
    /* Dualtimer 0_0 start */
    DUALTIMER_Start(DUALTIMER0_0);

    while(1);
}
コード例 #3
0
ファイル: us_ticker.c プロジェクト: Babody/mbed
void us_ticker_set_interrupt(timestamp_t timestamp)
{
    int32_t dev = 0;
    
    if (!us_ticker_inited)
    {
        us_ticker_init();
    }
    
    dev = (int32_t)(timestamp - us_ticker_read());
    dev = dev * ((GetSystemClock() / 1000000) / 16);     

    if(dev <= 0)
    {
        us_ticker_irq_handler();
        return;
    }
    
    DUALTIMER_ClockEnable(TIMER_0);
    DUALTIMER_Stop(TIMER_0);
    
    TimerHandler.TimerControl_Mode       = DUALTIMER_TimerControl_Periodic;
    TimerHandler.TimerControl_OneShot    = DUALTIMER_TimerControl_OneShot;
    TimerHandler.TimerControl_Pre        = DUALTIMER_TimerControl_Pre_16;
    TimerHandler.TimerControl_Size       = DUALTIMER_TimerControl_Size_32;
    
    TimerHandler.TimerLoad      = (uint32_t)dev;
    
    DUALTIMER_Init(TIMER_0, &TimerHandler);
    
    DUALTIMER_IntConfig(TIMER_0, ENABLE);
    
    NVIC_EnableIRQ(TIMER_IRQn);
    
    DUALTIMER_Start(TIMER_0);
    

}
コード例 #4
0
/**
 * @brief  Configures the Timer
 * @param  None
 * @return None
 */
void Timer0_Configuration(void)
{
    DUALTIMER_InitTypDef Dualtimer_InitStructure;

    NVIC_EnableIRQ(DUALTIMER0_IRQn);

    /* Dualtimer 0_0 clock enable */
    DUALTIMER_ClockEnable(DUALTIMER0_0);

    /* Dualtimer 0_0 configuration */
    Dualtimer_InitStructure.TimerLoad = 1000;//20000;//0x4FFFF;
    Dualtimer_InitStructure.TimerControl_Mode = DUALTIMER_TimerControl_Periodic;
    Dualtimer_InitStructure.TimerControl_OneShot = DUALTIMER_TimerControl_Wrapping;
    Dualtimer_InitStructure.TimerControl_Pre = DUALTIMER_TimerControl_Pre_16;
    Dualtimer_InitStructure.TimerControl_Size = DUALTIMER_TimerControl_Size_32;

    DUALTIMER_Init(DUALTIMER0_0, &Dualtimer_InitStructure);

    /* Dualtimer 0_0 Interrupt enable */
    DUALTIMER_IntConfig(DUALTIMER0_0, ENABLE);

    /* Dualtimer 0_0 start */
    DUALTIMER_Start(DUALTIMER0_0);
}