47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
#include "user_main.h"
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include "wizchip_conf.h"
|
|
#include "wiz_interface.h"
|
|
#include "loopback.h"
|
|
|
|
/*wizchip->STM32 Hardware Pin define*/
|
|
// wizchip_SCS ---> STM32_GPIOD7
|
|
// wizchip_SCLK ---> STM32_GPIOB13
|
|
// wizchip_MISO ---> STM32_GPIOB14
|
|
// wizchip_MOSI ---> STM32_GPIOB15
|
|
// wizchip_RESET ---> STM32_GPIOD8
|
|
// wizchip_INT ---> STM32_GPIOD9
|
|
|
|
/* Define network information */
|
|
wiz_NetInfo default_net_info = {
|
|
.mac = {0x00, 0x08, 0xdc, 0x12, 0x22, 0x12},
|
|
.ip = {192, 168, 6, 212},
|
|
.gw = {192, 168, 6, 1},
|
|
.sn = {255, 255, 255, 0},
|
|
.dns = {8, 8, 8, 8},
|
|
.dhcp = NETINFO_STATIC
|
|
//.dhcp = NETINFO_STATIC //static ip
|
|
};
|
|
uint16_t local_port = 8000;
|
|
uint8_t ethernet_buf[ETHERNET_BUF_MAX_SIZE] = {0};
|
|
/**
|
|
* @brief User Run Program
|
|
* @param none
|
|
* @return none
|
|
*/
|
|
void user_run(void)
|
|
{
|
|
printf("wizchip UDP example\r\n");
|
|
|
|
/* wizchip init */
|
|
wizchip_initialize();
|
|
|
|
/* set network information */
|
|
network_init(ethernet_buf, &default_net_info);
|
|
while (1)
|
|
{
|
|
loopback_udps(SOCKET_ID, ethernet_buf, local_port);
|
|
}
|
|
}
|