void ipc_init(void) { servermessage_init(); mountpoint_init(); remote_init(); client_init(); server_init(); }
int main (void){ serial_init_b(9600); remote_init(0x00); uint8_t command; //Main program loop while (1){ command = remote_command(); if (command == REMOTE_MENU) UDR0 = 'M'; else if (command == REMOTE_RIGHT) UDR0 = 'R'; else if (command == REMOTE_LEFT) UDR0 = 'L'; else if (command == REMOTE_UP) UDR0 = 'U'; else if (command == REMOTE_DOWN) UDR0 = 'D'; else if (command == REMOTE_CENTER) UDR0 = 'C'; else if (command == REMOTE_A_CENTER) UDR0 = 'C'; else if (command == REMOTE_A_PLAY) UDR0 = 'P'; } }
/** * @brief Main routine for MSC class application * @param None * @retval int */ int main(void) { NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0xC000);//初始化启动项 gpio_init();//初始化所有定义的gpio寄存器 cpu_run(); flash_stop(); // rs485_recv();//使能485接受数据 FLASH_ON(); remote_init(); LOOP_ON();//使能环流 // uart_init(9600);//设置波特率为9600 串口初始化 delay_ms(1);//定时器 SPI_Flash_Init();//初始化spi flash外围驱动 get_cfg_from_flash();//得到配置信息 (获取cfg文件的配置) get_line_from_flash(); message_state |= MESSAGE_LINE_NEW; message_state |= MESSAGE_LEFT_NEW; message_state |= MESSAGE_RIGHT_NEW; message_state |= MESSAGE_BRAKE_NEW; alloc_memory(); //初始化缓存 wwdg_init(0x7F, 0x5F, WWDG_Prescaler_8); //计数器值为7f,窗口寄存器为5f,分频数为8 (使用窗口看门狗的原因是他可以被中断) while (1) { if(uart_get_flag) { uart_get_flag = 0; data_process(); LED_OK = 1; } get_disp_state(); //左转右转还有刹车的判断报站; if(bflag) { LED_DispString(1, 1, disp_buff); //固定显示 } else { LED_ScrollDispHZ(1, 1, disp_buff);//滚动显示 } } }
void start_plugin() { int e; if ((e = regcomp(®ex, "^([^ ]+)( ([^ ]+)( (.*))?)?$", REG_EXTENDED)) != 0) { char *err = get_regerror(e, ®ex); print_debug("%s: regcomp() failed: %s\n", GGadu_PLUGIN_NAME, err); print_debug("%s: plugin disabled\n", GGadu_PLUGIN_NAME); free(err); return; } if (remote_init() == -1) return; register_signal(handler, "update config"); /* perfidnie podpinamy siê pod sygna³ dockleta */ register_signal(handler, "docklet set icon"); register_signal(handler, "docklet set default icon"); menu_remotemenu = remote_menu(); signal_emit(GGadu_PLUGIN_NAME, "gui register menu", menu_remotemenu, "main-gui"); }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { extern void ff_convert_init(); /* init the device filesystem */ dfs_init(); /* init the elm FAT filesystam*/ elm_init(); /* mount spi flash fat as root directory */ if (dfs_mount("spi0", "/", "elm", 0, 0) == 0) { rt_kprintf("SPI File System initialized!\n"); /* mount sd card fat partition 1 as SD directory */ if (dfs_mount("sd0", "/SD", "elm", 0, 0) == 0) rt_kprintf("SD File System initialized!\n"); else rt_kprintf("SD File System init failed!\n"); } else rt_kprintf("SPI File System init failed!\n"); #ifdef RT_DFS_ELM_USE_LFN ff_convert_init(); #endif } #endif load_setup(); /* RTGUI Initialization */ #ifdef RT_USING_RTGUI { extern void rt_hw_key_init(void); extern void remote_init(void); extern void rtgui_touch_hw_init(void); radio_rtgui_init(); rt_hw_key_init(); rtgui_touch_hw_init(); remote_init(); } #endif /* set default setup */ { extern void vol(uint16_t v); extern void brightness_set(unsigned int value); vol(radio_setup.default_volume); brightness_set(radio_setup.lcd_brightness); } /* start RTC */ rt_hw_rtc_init(); /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); extern void rt_hw_dm9000_init(void); eth_system_device_init(); /* register ethernetif device */ rt_hw_dm9000_init(); /* init all device */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #if STM32_EXT_SRAM /* init netbuf worker */ net_buf_init(320 * 1024); #endif }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { extern void ff_convert_init(); /* init the device filesystem */ dfs_init(); /* init the elm FAT filesystam*/ elm_init(); /* mount sd card fat partition 1 as SD directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) rt_kprintf("SD File System initialized!\n"); else rt_kprintf("SD File System init failed!\n"); #ifdef RT_DFS_ELM_USE_LFN ff_convert_init(); #endif } #endif /* load_setup(); */ /* RTGUI Initialization */ #ifdef RT_USING_RTGUI { extern void rt_hw_key_init(void); extern void remote_init(void); extern void rtgui_touch_hw_init(void); radio_rtgui_init(); rt_hw_key_init(); rtgui_touch_hw_init(); remote_init(); brightness_set(radio_setup.lcd_brightness); //PCM1770_VolumeSet(radio_setup.default_volume); } #endif /* start RTC */ rt_hw_rtc_init(); /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); extern void rt_hw_dm9000_init(void); eth_system_device_init(); /* register ethernetif device */ rt_hw_dm9000_init(); /* init all device */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #if STM32_EXT_SRAM /* init netbuf worker */ net_buf_init(320 * 1024); #endif /* TODO(CXF): start ftp and agent */ ftpd_start(); }