Chau Vo / device_configuration

Dependents:   F103-Web-Server

Fork of my_eeprom_funcs by Chau Vo

Committer:
olympux
Date:
Sat Oct 04 20:24:46 2014 +0000
Revision:
4:944a4646b825
Parent:
3:69e1c4ed69e1
Child:
5:eea03d0eb95a
Fix bug

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 0:aa07a25a9005 36
olympux 0:aa07a25a9005 37
olympux 0:aa07a25a9005 38 /*
olympux 0:aa07a25a9005 39 * External variables in main.c
olympux 0:aa07a25a9005 40 */
olympux 0:aa07a25a9005 41 extern uint16_t VirtAddVarTab[];
olympux 0:aa07a25a9005 42
olympux 0:aa07a25a9005 43 extern uint8_t u8mac[], u8ip_addr[];// keep mac and ip address in 8-bits
olympux 0:aa07a25a9005 44 extern uint16_t u16mac_addr[], u16ip_addr[], u16ip_subnet[], u16ip_gateway[]; // 16-bits, directly loaded from eeprom
olympux 0:aa07a25a9005 45 extern char str_ip_addr[], str_ip_subnet[], str_ip_gateway[]; // for printf, converted from 16-bits u16ip_xxx
olympux 0:aa07a25a9005 46 extern uint16_t first_run; // first run flag
olympux 0:aa07a25a9005 47
olympux 0:aa07a25a9005 48 extern const uint16_t tcp_server_local_port; // fixed
olympux 0:aa07a25a9005 49 extern const uint16_t udp_server_local_port; // fixed
olympux 0:aa07a25a9005 50
olympux 0:aa07a25a9005 51 // this section is for the TCP server that this device connects to in TCP client mode
olympux 1:6bdc99dd8e0a 52 extern uint16_t auto_transmit_flag, transmit_time_period; // auto transmit status, time period = 1s
olympux 1:6bdc99dd8e0a 53 extern uint16_t u16server_ip_addr[]; // directly loaded from eeprom
olympux 1:6bdc99dd8e0a 54 extern uint16_t u16tcp_server_port; // directly loaded from eeprom
olympux 0:aa07a25a9005 55 extern uint8_t u8server_ip_addr[];
olympux 0:aa07a25a9005 56 extern char * server_ip_addr;
olympux 0:aa07a25a9005 57 extern char str_server_ip_addr[];
olympux 0:aa07a25a9005 58
olympux 0:aa07a25a9005 59
olympux 0:aa07a25a9005 60 /*
olympux 0:aa07a25a9005 61 * My eeprom functions
olympux 0:aa07a25a9005 62 */
olympux 1:6bdc99dd8e0a 63 void write_eeprom_network(char* buf);
olympux 0:aa07a25a9005 64 void load_eeprom_network(void);
olympux 1:6bdc99dd8e0a 65 void write_eeprom_tcpserver(char* buf);
olympux 0:aa07a25a9005 66 void load_eeprom_tcpserver(void);
olympux 1:6bdc99dd8e0a 67
olympux 0:aa07a25a9005 68 #endif