Chau Vo / device_configuration

Dependents:   F103-Web-Server

Fork of my_eeprom_funcs by Chau Vo

Committer:
olympux
Date:
Tue Oct 21 20:38:38 2014 +0000
Revision:
5:eea03d0eb95a
Parent:
4:944a4646b825
Child:
6:241d1539914a
Added flags for tcp server and client into eeprom, but not in used.; Updated debug strings.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
olympux 0:aa07a25a9005 1 #ifndef __MY_EEPROM_FUNCS_H
olympux 0:aa07a25a9005 2 #define __MY_EEPROM_FUNCS_H
olympux 0:aa07a25a9005 3
olympux 0:aa07a25a9005 4 #include "eeprom.h"
olympux 0:aa07a25a9005 5
olympux 3:69e1c4ed69e1 6
olympux 0:aa07a25a9005 7 /*
olympux 0:aa07a25a9005 8 * Default device network configuration
olympux 0:aa07a25a9005 9 */
olympux 0:aa07a25a9005 10 #define DEFAULT_IP_ADDRESS "192.168.0.249"
olympux 0:aa07a25a9005 11 #define DEFAULT_IP_SUBNET "255.255.255.0"
olympux 0:aa07a25a9005 12 #define DEFAULT_IP_GATEWAY "192.168.0.1"
olympux 0:aa07a25a9005 13 #define DEFAULT_MAC0 0x00
olympux 0:aa07a25a9005 14 #define DEFAULT_MAC1 0x08
olympux 0:aa07a25a9005 15 #define DEFAULT_MAC2 0xDC
olympux 0:aa07a25a9005 16 #define DEFAULT_MAC3 0x00
olympux 0:aa07a25a9005 17 #define DEFAULT_MAC4 0x00
olympux 0:aa07a25a9005 18 #define DEFAULT_MAC5 0x01
olympux 0:aa07a25a9005 19
olympux 0:aa07a25a9005 20
olympux 0:aa07a25a9005 21 /*
olympux 0:aa07a25a9005 22 * Positions of variables in EEPROM array
olympux 0:aa07a25a9005 23 */
olympux 0:aa07a25a9005 24 #define IP_ADDRESS_POS 0
olympux 0:aa07a25a9005 25 #define IP_SUBNET_POS 4
olympux 0:aa07a25a9005 26 #define IP_GATEWAY_POS 8
olympux 0:aa07a25a9005 27 #define TCP_SERVER_LOCAL_PORT_POS 12
olympux 0:aa07a25a9005 28 #define UDP_SERVER_LOCAL_PORT_POS 13
olympux 0:aa07a25a9005 29 #define FIRST_RUN_FLAG_POS 14
olympux 0:aa07a25a9005 30 #define MAC_ADDRESS_POS 15
olympux 0:aa07a25a9005 31 // EEPROM: for TCP server this device connects to in TCP client mode
olympux 0:aa07a25a9005 32 #define AUTO_TRANSMIT_FLAG_POS 18
olympux 1:6bdc99dd8e0a 33 #define AUTO_TRANSMIT_TIME_PERIOD_POS 19
olympux 0:aa07a25a9005 34 #define TCP_SERVER_IP_ADDR_POS 20
olympux 0:aa07a25a9005 35 #define TCP_SERVER_PORT_POS 24
olympux 5:eea03d0eb95a 36 #define ENABLE_TCP_SERVER 25
olympux 5:eea03d0eb95a 37 #define ENABLE_TCP_CLIENT 26
olympux 5:eea03d0eb95a 38 #define ENABLE_UDP_SERVER 27
olympux 0:aa07a25a9005 39
olympux 0:aa07a25a9005 40
olympux 0:aa07a25a9005 41 /*
olympux 0:aa07a25a9005 42 * External variables in main.c
olympux 0:aa07a25a9005 43 */
olympux 0:aa07a25a9005 44 extern uint16_t VirtAddVarTab[];
olympux 0:aa07a25a9005 45
olympux 0:aa07a25a9005 46 extern uint8_t u8mac[], u8ip_addr[];// keep mac and ip address in 8-bits
olympux 0:aa07a25a9005 47 extern uint16_t u16mac_addr[], u16ip_addr[], u16ip_subnet[], u16ip_gateway[]; // 16-bits, directly loaded from eeprom
olympux 0:aa07a25a9005 48 extern char str_ip_addr[], str_ip_subnet[], str_ip_gateway[]; // for printf, converted from 16-bits u16ip_xxx
olympux 0:aa07a25a9005 49 extern uint16_t first_run; // first run flag
olympux 0:aa07a25a9005 50
olympux 0:aa07a25a9005 51 extern const uint16_t tcp_server_local_port; // fixed
olympux 0:aa07a25a9005 52 extern const uint16_t udp_server_local_port; // fixed
olympux 0:aa07a25a9005 53
olympux 0:aa07a25a9005 54 // this section is for the TCP server that this device connects to in TCP client mode
olympux 1:6bdc99dd8e0a 55 extern uint16_t auto_transmit_flag, transmit_time_period; // auto transmit status, time period = 1s
olympux 1:6bdc99dd8e0a 56 extern uint16_t u16server_ip_addr[]; // directly loaded from eeprom
olympux 1:6bdc99dd8e0a 57 extern uint16_t u16tcp_server_port; // directly loaded from eeprom
olympux 5:eea03d0eb95a 58 extern uint16_t u16enable_tcp_client, u16enable_tcp_server;// flags for enabling TCP client or TCP server
olympux 0:aa07a25a9005 59 extern uint8_t u8server_ip_addr[];
olympux 0:aa07a25a9005 60 extern char * server_ip_addr;
olympux 0:aa07a25a9005 61 extern char str_server_ip_addr[];
olympux 0:aa07a25a9005 62
olympux 0:aa07a25a9005 63
olympux 0:aa07a25a9005 64 /*
olympux 0:aa07a25a9005 65 * My eeprom functions
olympux 0:aa07a25a9005 66 */
olympux 1:6bdc99dd8e0a 67 void write_eeprom_network(char* buf);
olympux 0:aa07a25a9005 68 void load_eeprom_network(void);
olympux 1:6bdc99dd8e0a 69 void write_eeprom_tcpserver(char* buf);
olympux 0:aa07a25a9005 70 void load_eeprom_tcpserver(void);
olympux 1:6bdc99dd8e0a 71
olympux 0:aa07a25a9005 72 #endif