void AppInit_TCPIP (void) { #if EMAC_CFG_MAC_ADDR_SEL == EMAC_MAC_ADDR_SEL_CFG NetIF_MAC_Addr[0] = 0x00; NetIF_MAC_Addr[1] = 0x50; NetIF_MAC_Addr[2] = 0xC2; NetIF_MAC_Addr[3] = 0x25; NetIF_MAC_Addr[4] = 0x60; NetIF_MAC_Addr[5] = 0x01; #endif #if uC_TTCP_MODULE > 0 BSP_USART_Init(TTCP_COMM_SEL, 38400); #endif err = Net_Init(); ip = NetASCII_Str_to_IP((CPU_CHAR *) ownIPAddress, &err); msk = NetASCII_Str_to_IP((CPU_CHAR *)"255.255.255.0", &err); gateway = NetASCII_Str_to_IP((CPU_CHAR *)"192.168.1.1", &err); err = NetIP_CfgAddrThisHost(ip, msk); err = NetIP_CfgAddrDfltGateway(gateway); #if uC_TTCP_MODULE > 0 TTCP_Init(); #endif info_printf("tcp/ip network initialized ...\n"); }
int main(void) { SystemInit(); SSD1963_Init(); SSD1963_Clear(Red); Delay(100); SSD1963_Clear(Blue); Delay(100); SSD1963_Clear(Red); SSD1963_Fill(0, 0, 50, 50, Blue); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE); GUI_Init(); GUI_SetColor(GUI_RED); GUI_Clear(); BSP_KeyInit( BSP_KEY1, BSP_KEY1_GPIO_PORT ); BSP_USART_Init( ); BSP_SPI_Init( ); BSP_SPI_CS_Init( ); //Debug_ShowRegister( GPIOA_BASE, (DebugPeripheralTypedef *)&DeBugGPIO ); //Debug_ShowRegister( BSP_USARTx_BASE, (DebugPeripheralTypedef *)&DeBugUART ); //Debug_ShowRegister( RCC_BASE, (DebugPeripheralTypedef *)&DeBugRCC ); //Debug_ShowSpecificRegister( RCC_BASE, (DebugPeripheralTypedef *)&DeBugRCC, "APB2ENR" ); /* 初始化LWIP协议栈*/ LwIP_Init(); /*初始化web server 显示网页程序*/ httpd_init(); /* 初始化telnet 远程控制 程序 */ CMD_init(); /* Infinite loop */ while ( 1 ) { /*轮询*/ LwIP_Periodic_Handle(LocalTime); } }
int main() { u8 i = 0; /* 设置NVIC中断分组2:2位抢占优先级,2位响应优先级 */ NVIC_PriorityGroupConfig ( NVIC_PriorityGroup_2 ); BSP_Delay_Init ( 72 ); BSP_USART_Init ( 115200 ); BSP_SERVO_Init ( 1000000 ); while ( true ) { } }
/*..........................................................................*/ void BSP_init(void) { SystemInit(); /* initialize STM32 system (clock, PLL and Flash) */ #ifdef Q_SPY //初始化QS if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } #endif RCC_APBClockEnable(); BSP_USART_Init(); ///使能调试串口,开发板上是USART3 Periph_Lowlevel_Init(); ///所有外设初始化 EXTI_Configuration(); NVIC_Configuration(); }
int main(void) { SystemInit(); SSD1963_Init(); SSD1963_Clear(Red); Delay(100); SSD1963_Clear(Blue); Delay(100); SSD1963_Clear(Red); SSD1963_Fill(0, 0, 50, 50, Blue); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE); GUI_Init(); GUI_SetColor(GUI_RED); GUI_Clear(); BSP_KeyInit( BSP_KEY1, BSP_KEY1_GPIO_PORT ); BSP_USART_Init( ); BSP_SPI_Init( ); BSP_SPI_CS_Init( ); //Debug_ShowRegister( GPIOA_BASE, (DebugPeripheralTypedef *)&DeBugGPIO ); //Debug_ShowRegister( BSP_USARTx_BASE, (DebugPeripheralTypedef *)&DeBugUART ); //Debug_ShowRegister( RCC_BASE, (DebugPeripheralTypedef *)&DeBugRCC ); //Debug_ShowSpecificRegister( RCC_BASE, (DebugPeripheralTypedef *)&DeBugRCC, "APB2ENR" ); /* ³õʼ»¯LWIPÐÒéÕ»*/ //LwIP_Init(); Web_Server(); }
int main(void) { int i_counter = 160; SystemInit(); SSD1963_Init(); SSD1963_Clear(Red); Delay(100); SSD1963_Clear(Blue); Delay(100); SSD1963_Clear(Red); SSD1963_Fill(0, 0, 50, 50, Blue); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE); GUI_Init(); GUI_SetColor(GUI_RED); GUI_Clear(); BSP_KeyInit( BSP_KEY1, BSP_KEY1_GPIO_PORT ); BSP_USART_Init( ); BSP_SPI_Init( ); BSP_SPI_CS_Init( ); //Debug_ShowRegister( GPIOA_BASE, (DebugPeripheralTypedef *)&DeBugGPIO ); //Debug_ShowRegister( BSP_USARTx_BASE, (DebugPeripheralTypedef *)&DeBugUART ); //Debug_ShowRegister( RCC_BASE, (DebugPeripheralTypedef *)&DeBugRCC ); //Debug_ShowSpecificRegister( RCC_BASE, (DebugPeripheralTypedef *)&DeBugRCC, "APB2ENR" ); /* 初始化LWIP协议栈*/ LwIP_Init(); /* 初始化web server 显示网页程序 */ //httpd_init(); /* 初始化telnet 远程控制程序 */ //CMD_init(); /* 初始化web celient远程控制程序 */ //tcp_client_connect(); tcp_client_connect(); /* Infinite loop */ while ( 1 ) { static int i = 0; /*轮询*/ if(i >= 150) { i = 0; i_counter ++; if(Updateflag == 1) { tcp_client_connect(); } printf("******************* tcp_client_connect *************************\r\n"); } LwIP_Periodic_Handle(LocalTime); if(i_counter> 1000) i_counter = 101; wendu[0] = i_counter/100%10 + 0x30; wendu[1] = i_counter/10%10 + 0x30; wendu[3] = i_counter%10 + 0x30; printf(wendu); printf(" i = %d\r\n",i); i++; Delay(10); } }