Used with eeprom_flash to write network configuration to STM32F103 flash
Fork of my_eeprom_funcs by
device_configuration.h
- Committer:
- olympux
- Date:
- 2016-08-29
- Revision:
- 20:858384cac44a
- Parent:
- 19:5671f3c25342
- Child:
- 21:23ae23754f0b
File content as of revision 20:858384cac44a:
#ifndef __DEVICE_CONFIGURATION_H #define __DEVICE_CONFIGURATION_H #include "mbed.h" #include "eeprom_flash.h" // Default device network configuration #define DEFAULT_IP_ADDRESS "192.168.0.120" #define DEFAULT_IP_SUBNET "255.255.255.0" #define DEFAULT_IP_GATEWAY "192.168.0.1" #define DEFAULT_REMOTE_TCP_SERVER_IP "192.168.0.2" #define DEFAULT_REMOTE_UDP_SERVER_IP "192.168.0.2" #define DEFAULT_MAC0 0x00 #define DEFAULT_MAC1 0x08 #define DEFAULT_MAC2 0xDC #define DEFAULT_MAC3 0x00 #define DEFAULT_MAC4 0x00 #define DEFAULT_MAC5 0x01 #define DEFAULT_LOCAL_TCP_SERVER_PORT 10000 // change to 7000 if internet required #define DEFAULT_LOCAL_UDP_SERVER_PORT 11000 #define DEFAULT_TRANSMIT_PERIOD 1000 #define DEFAULT_REMOTE_TCP_SERVER_PORT 10000 #define DEFAULT_REMOTE_UDP_SERVER_PORT 11000 #define DEFAULT_ENABLE_FLAG_VALUE 0xA5A5 #define DEFAULT_DISABLE_FLAG_VALUE 0xAAAA #define DEFAULT_INTER_DATA_PERIOD 500 // in ms #define DEFAULT_SPECIAL_CHARACTER '\n' // LF // Positions of variables in EEPROM array #define IP_ADDRESS_POS 0 // 4x16-bit #define IP_SUBNET_POS 8 // 4x16-bit #define IP_GATEWAY_POS 16 // 4x16-bit #define MAC_ADDRESS_POS 24 // 3x16-bit #define DEVICE_CONFIGURED_FLAG_POS 30 // 16-bit #define LOCAL_TCP_SERVER_PORT_POS 32 // 16-bit #define LOCAL_UDP_SERVER_PORT_POS 34 // 16-bit // if TCP client is enabled, use parameters below to set parameters for the remote TCP server #define REMOTE_TCP_SERVER_IP_ADDR_POS 36 // 4x16-bit #define REMOTE_TCP_SERVER_PORT_POS 44 // 16-bit #define AUTO_TRANSMIT_FLAG_POS 46 // 16-bit #define AUTO_TRANSMIT_TIME_PERIOD_POS 48 // 16-bit // If UDP client is enabled, use parameters below #define REMOTE_UDP_SERVER_IP_ADDR_POS 50 // 4x16-bit #define REMOTE_UDP_SERVER_PORT_POS 58 // 16-bit // enable modes #define ENABLE_TCP_SERVER_POS 60 // 16-bit #define ENABLE_TCP_CLIENT_POS 62 // 16-bit #define ENABLE_UDP_SERVER_POS 64 // 16-bit #define ENABLE_UDP_CLIENT_POS 66 // 16-bit // serial inter-data period #define INTER_DATA_PERIOD_POS 68 // 16-bit // special character signals sending data #define SPECIAL_CHAR_POS 70 // 16-bit // prototypes void erase_device_configuration(); void write_device_configuration(uint16_t* ip, uint16_t* subnet, uint16_t* gateway, uint16_t* mac, uint16_t tcp_port, uint16_t udp_port, uint16_t* remote_tcp_ip, uint16_t remote_tcp_port, uint16_t auto_transmit, uint16_t transmit_period, uint16_t* remote_udp_ip, uint16_t remote_udp_port, uint16_t enable_tcp_server, uint16_t enable_tcp_client, uint16_t enable_udp_server, uint16_t enable_udp_client, uint16_t inter_data_period, uint16_t special_char); void read_device_configuration(); void reset_default_device_configuration(); #endif