diff --git a/09_m1284p_WIZNET_simple_webserver/globals.h b/09_m1284p_WIZNET_simple_webserver/globals.h index ddef82a..5196aa5 100644 --- a/09_m1284p_WIZNET_simple_webserver/globals.h +++ b/09_m1284p_WIZNET_simple_webserver/globals.h @@ -21,6 +21,8 @@ #define PRINTF(...) #endif +//#define IP_WORK + extern unsigned long millis(void); extern int freeRam (void); diff --git a/09_m1284p_WIZNET_simple_webserver/main.c b/09_m1284p_WIZNET_simple_webserver/main.c index accea06..32e50f2 100644 --- a/09_m1284p_WIZNET_simple_webserver/main.c +++ b/09_m1284p_WIZNET_simple_webserver/main.c @@ -37,11 +37,22 @@ * https://www.hw-group.com/software/hercules-setup-utility * */ -#define PRINTF_EN 1 -#if PRINTF_EN -#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) +#ifdef IP_WORK +//NIC metrics for WORK PC +wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address + .ip = {192, 168, 0, 199}, // IP address + .sn = {255, 255, 255, 0}, // Subnet mask + .dns = {8,8,8,8}, // DNS address (google dns) + .gw = {192, 168, 0, 1}, // Gateway address + .dhcp = NETINFO_STATIC}; //Dynamic IP configuration from a DHCP sever #else -#define PRINTF(...) +//NIC metrics for another PC (second IP configuration) +wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address + .ip = {192, 168, 1, 199}, // IP address + .sn = {255, 255, 255, 0}, // Subnet mask + .dns = {8,8,8,8}, // DNS address (google dns) + .gw = {192, 168, 1, 1}, // Gateway address + .dhcp = NETINFO_STATIC}; //Dynamic IP configuration from a DHCP sever #endif /* @@ -219,13 +230,6 @@ unsigned char ethBuf0[ETH_MAX_BUF_SIZE]; unsigned char ethBuf1[ETH_MAX_BUF_SIZE]; unsigned char ethBuf2_WEBSRV[WEBSRV_DATA_BUF_SIZE]; -wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address - .ip = {192, 168, 0, 199}, // IP address - .sn = {255, 255, 255, 0}, // Subnet mask - .dns = {8,8,8,8}, // DNS address (google dns) - .gw = {192, 168, 0, 1}, // Gateway address - .dhcp = NETINFO_STATIC}; //Dynamic IP configruation from a DHCP sever - void cs_sel() { SPI_WIZNET_ENABLE(); } @@ -386,8 +390,12 @@ static void avr_init(void) * or * uart1_BAUD_SELECT_DOUBLE_SPEED() ( double speed mode) */ - // Define Output/Input Stream +#if (UART_BAUD_RATE == 115200) + uart_init( UART_BAUD_SELECT_DOUBLE_SPEED(UART_BAUD_RATE,F_CPU) ); // To works without error on 115200 bps/F_CPU=16Mhz +#else uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) ); +#endif + // Define Output/Input Stream stdout = &uart0_stdout; //ADC init