Chau Vo / device_configuration

Dependents:   F103-Web-Server

Fork of my_eeprom_funcs by Chau Vo

Committer:
olympux
Date:
Sat Jan 10 16:19:18 2015 +0000
Revision:
12:613ab276bf37
Parent:
11:250b05a5266d
Child:
13:7ffbbfe999c5
Updated API documentation

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 6:241d1539914a 20 #define DEFAULT_ENABLE_FLAG_VALUE 0xA5A5
olympux 6:241d1539914a 21 #define DEFAULT_DISABLE_FLAG_VALUE 0xAAAA
olympux 0:aa07a25a9005 22
olympux 0:aa07a25a9005 23 /*
olympux 0:aa07a25a9005 24 * Positions of variables in EEPROM array
olympux 0:aa07a25a9005 25 */
olympux 0:aa07a25a9005 26 #define IP_ADDRESS_POS 0
olympux 0:aa07a25a9005 27 #define IP_SUBNET_POS 4
olympux 0:aa07a25a9005 28 #define IP_GATEWAY_POS 8
olympux 10:f37acffddef9 29 #define TCP_SERVER_LOCAL_PORT_POS 12
olympux 10:f37acffddef9 30 #define UDP_SERVER_LOCAL_PORT_POS 13
olympux 10:f37acffddef9 31 #define CONFIGURED_IP_FLAG_POS 14
olympux 0:aa07a25a9005 32 #define MAC_ADDRESS_POS 15
olympux 6:241d1539914a 33 // EEPROM: for setting TCP server where this device connects to in TCP client mode
olympux 0:aa07a25a9005 34 #define AUTO_TRANSMIT_FLAG_POS 18
olympux 1:6bdc99dd8e0a 35 #define AUTO_TRANSMIT_TIME_PERIOD_POS 19
olympux 0:aa07a25a9005 36 #define TCP_SERVER_IP_ADDR_POS 20
olympux 0:aa07a25a9005 37 #define TCP_SERVER_PORT_POS 24
olympux 5:eea03d0eb95a 38 #define ENABLE_TCP_SERVER 25
olympux 5:eea03d0eb95a 39 #define ENABLE_TCP_CLIENT 26
olympux 5:eea03d0eb95a 40 #define ENABLE_UDP_SERVER 27
olympux 0:aa07a25a9005 41
olympux 0:aa07a25a9005 42
olympux 0:aa07a25a9005 43 /*
olympux 0:aa07a25a9005 44 * External variables in main.c
olympux 0:aa07a25a9005 45 */
olympux 0:aa07a25a9005 46 extern uint16_t VirtAddVarTab[];
olympux 0:aa07a25a9005 47
olympux 0:aa07a25a9005 48 extern uint8_t u8mac[], u8ip_addr[];// keep mac and ip address in 8-bits
olympux 0:aa07a25a9005 49 extern uint16_t u16mac_addr[], u16ip_addr[], u16ip_subnet[], u16ip_gateway[]; // 16-bits, directly loaded from eeprom
olympux 0:aa07a25a9005 50 extern char str_ip_addr[], str_ip_subnet[], str_ip_gateway[]; // for printf, converted from 16-bits u16ip_xxx
olympux 8:4fc4b1b5509b 51 extern uint16_t configured_ip; // first run flag
olympux 0:aa07a25a9005 52
olympux 0:aa07a25a9005 53 extern const uint16_t tcp_server_local_port; // fixed
olympux 0:aa07a25a9005 54 extern const uint16_t udp_server_local_port; // fixed
olympux 0:aa07a25a9005 55
olympux 0:aa07a25a9005 56 // this section is for the TCP server that this device connects to in TCP client mode
olympux 1:6bdc99dd8e0a 57 extern uint16_t auto_transmit_flag, transmit_time_period; // auto transmit status, time period = 1s
olympux 6:241d1539914a 58 extern uint8_t u8server_ip_addr[];
olympux 1:6bdc99dd8e0a 59 extern uint16_t u16server_ip_addr[]; // directly loaded from eeprom
olympux 1:6bdc99dd8e0a 60 extern uint16_t u16tcp_server_port; // directly loaded from eeprom
olympux 0:aa07a25a9005 61 extern char * server_ip_addr;
olympux 0:aa07a25a9005 62 extern char str_server_ip_addr[];
olympux 6:241d1539914a 63 extern uint16_t u16enable_tcp_client, u16enable_tcp_server;// flags for enabling TCP client or TCP server
olympux 0:aa07a25a9005 64
olympux 1:6bdc99dd8e0a 65 void write_eeprom_network(char* buf);
olympux 0:aa07a25a9005 66 void load_eeprom_network(void);
olympux 1:6bdc99dd8e0a 67 void write_eeprom_tcpserver(char* buf);
olympux 0:aa07a25a9005 68 void load_eeprom_tcpserver(void);
olympux 1:6bdc99dd8e0a 69
olympux 0:aa07a25a9005 70 #endif