RL-TCPNet on AT32F407 以RL-TCPNet实现的demo code, 自我验证可以ping通,默认的IP地址为192.168.1.100 若要修改该地址,请参考安福来的手册或是Keil官方的RL-ARM相关说明文件。
/* Includes -----------------------------------------------------------------*/ #include <stdio.h> #include <stdbool.h> #include "string.h" #include "stdbool.h" #include "at32f4xx.h" #include "at32_board.h" #include "main.h" #include "eth_config.h" #include "Net_Config.h"
/** @addtogroup AT32F407_StdPeriph_Examples * @{ */
/** @addtogroup ETH_Telnet * @{ */ /* Gloable variables ---------------------------------------------------------*/ __IO uint32_t LocalTime = 0; /* this variable is used to create a time reference incremented by 10ms */ uint32_t timingdelay; unsigned char tcp_rec_flag = 0;
/* Gloable functions ---------------------------------------------------------*/ /** * @param None * @retval None */ int main(void) { /* --------BSP Init ------------------------------------------------*/ AT32_Board_Init(); UART_Print_Init(115200); /* Setup AT32 system (clocks, Ethernet, GPIO, NVIC) */ System_Setup(); Delay_init(); init_TcpNet(); while(1) { timer_tick(); main_TcpNet(); } }
/** * @brief Inserts a delay time. * @param nCount: number of 10ms periods to wait for. * @retval None */ void Delay(uint32_t nCount) { /* Capture the current local time */ timingdelay = LocalTime + nCount;
/* wait until the desired delay finish */ while(timingdelay > LocalTime) { } }
/** * @brief Updates the system local time * @param None * @retval None */ void Time_Update(void) { LocalTime += SYSTEMTICK_PERIOD_MS;
}
|