Пример #1
0
void rt_hw_rtc_init(void)
{
	rtc.type	= RT_Device_Class_RTC;
	RTC_Init(LPC_RTC);
    if (RTC_ReadGPREG(LPC_RTC,0) != FIRST_DATA)
    {
        rt_kprintf("rtc is not configured\n");
        rt_kprintf("please configure with set_date and set_time\n");
    }
    else
    {
    }
    RTC_Cmd(LPC_RTC,ENABLE);
    /* register rtc device */
    rtc.init 	= RT_NULL;
    rtc.open 	= rt_rtc_open;
    rtc.close	= RT_NULL;
    rtc.read 	= rt_rtc_read;
    rtc.write	= RT_NULL;
    rtc.control = rt_rtc_control;

    /* no private */
    rtc.user_data = RT_NULL;

    rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);

#ifdef RT_USING_FINSH
    {
        extern void list_date(void);
        list_date();
    }
#endif

    return;
}
Пример #2
0
void rt_hw_rtc_init(void)
{
    rtc.type	= RT_Device_Class_RTC;

    if (BKP_ReadBackupRegister(BKP_DR1) != 0xA5A5)
    {
        rt_kprintf("rtc is not configured\n");
        rt_kprintf("please configure with set_date and set_time\n");
        if ( RTC_Configuration() != 0)
        {
            rt_kprintf("rtc configure fail...\r\n");
            return ;
        }
    }
    else
    {
        /* Wait for RTC registers synchronization */
        RTC_WaitForSynchro();
    }

    /* register rtc device */
    rtc.init 	= RT_NULL;
    rtc.open 	= rt_rtc_open;
    rtc.close	= RT_NULL;
    rtc.read 	= rt_rtc_read;
    rtc.write	= RT_NULL;
    rtc.control = rt_rtc_control;

    /* no private */
    rtc.user_data = RT_NULL;

    rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);

#ifdef RT_USING_FINSH
    list_date();
#endif

    return;
}
Пример #3
0
void rt_platform_init(void)
{
#ifdef RT_USING_RTC
    rt_hw_rtc_init();
	#ifdef RT_USING_ALARM	
	rt_alarm_system_init(); 
	#endif		
	  /* 放在finsh中去设置初始时间 
	  set_date(2013,4,28);
	  set_time(10,8,24);
	  */
	  list_date();	
	
#endif /* RT_USING_RTC */	
#ifdef RT_USING_SPI
	{
		extern void rt_hw_spi1_init(void);
		rt_hw_spi1_init();
	}
    

#ifdef RT_USING_DFS
       w25qxx_init("flash0", "spi10");
#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* initilize touch panel */
    //rtgui_touch_hw_init("spi11");
#endif /* RT_USING_RTGUI */
#endif /* RT_USING_SPI */

#ifdef RT_USING_USB_HOST
    /* register stm32 usb host controller driver */
    //rt_hw_susb_init();
#endif

#ifdef RT_USING_DFS
    /* initilize sd card */
#ifdef RT_USING_SDIO
     rt_mmcsd_core_init();
     rt_mmcsd_blk_init();
	{
		extern rt_int32_t stm32f1xx_sdio_init(void);
		stm32f1xx_sdio_init();
	}	
     rt_thread_delay(RT_TICK_PER_SECOND);
#else
     rt_hw_sdcard_init();
#endif
#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* initilize ili9320 lcd controller */
    //lcd_9320_init();

    /* initilize key module */
    //rt_hw_key_init();
#endif /* RT_USING_RTGUI */

    rt_thread_delay(50);
    rt_device_init_all();
}