Used with eeprom_flash to write network configuration to STM32F103 flash

Dependents:   F103-Web-Server

Fork of my_eeprom_funcs by Chau Vo

Committer:
olympux
Date:
Sun Aug 14 11:05:20 2016 +0000
Revision:
16:700377cd9d29
Parent:
my_eeprom_funcs.h@12:613ab276bf37
Child:
18:d88314ae7979
Tested on STM32F103 with new mbed revision 6xx

Who changed what in which revision?

UserRevisionLine numberNew contents of line
olympux 16:700377cd9d29 1 #ifndef __DEVICE_CONFIGURATION_H
olympux 16:700377cd9d29 2 #define __DEVICE_CONFIGURATION_H
olympux 0:aa07a25a9005 3
olympux 16:700377cd9d29 4 #include "mbed.h"
olympux 16:700377cd9d29 5 #include "eeprom_flash.h"
olympux 0:aa07a25a9005 6
olympux 3:69e1c4ed69e1 7
olympux 16:700377cd9d29 8 // Default device network configuration
olympux 16:700377cd9d29 9 #define DEFAULT_IP_ADDRESS "192.168.0.239"
olympux 0:aa07a25a9005 10 #define DEFAULT_IP_SUBNET "255.255.255.0"
olympux 0:aa07a25a9005 11 #define DEFAULT_IP_GATEWAY "192.168.0.1"
olympux 16:700377cd9d29 12 #define DEFAULT_REMOTE_TCP_SERVER_IP "0.0.0.0"
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 16:700377cd9d29 19 #define DEFAULT_LOCAL_TCP_SERVER_PORT 10000 // change to 7000 if internet required
olympux 16:700377cd9d29 20 #define DEFAULT_LOCAL_UDP_PORT 11000
olympux 16:700377cd9d29 21 #define DEFAULT_TRANSMIT_PERIOD 1000
olympux 0:aa07a25a9005 22
olympux 6:241d1539914a 23 #define DEFAULT_ENABLE_FLAG_VALUE 0xA5A5
olympux 6:241d1539914a 24 #define DEFAULT_DISABLE_FLAG_VALUE 0xAAAA
olympux 0:aa07a25a9005 25
olympux 16:700377cd9d29 26 // Positions of variables in EEPROM array
olympux 16:700377cd9d29 27 #define IP_ADDRESS_POS 0 // 4x16-bit
olympux 16:700377cd9d29 28 #define IP_SUBNET_POS 8 // 4x16-bit
olympux 16:700377cd9d29 29 #define IP_GATEWAY_POS 16 // 4x16-bit
olympux 16:700377cd9d29 30 #define MAC_ADDRESS_POS 24 // 3x16-bit
olympux 16:700377cd9d29 31 #define DEVICE_CONFIGURED_FLAG_POS 30 // 16-bit
olympux 16:700377cd9d29 32 #define LOCAL_TCP_SERVER_PORT_POS 32 // 16-bit
olympux 16:700377cd9d29 33 #define LOCAL_UDP_PORT_POS 34 // 16-bit
olympux 16:700377cd9d29 34 // if TCP client is enabled, use parameters below to set parameters for the remote TCP server
olympux 16:700377cd9d29 35 #define REMOTE_TCP_SERVER_IP_ADDR_POS 36 // 4x16-bit
olympux 16:700377cd9d29 36 #define REMOTE_TCP_SERVER_PORT_POS 44 // 16-bit
olympux 16:700377cd9d29 37 #define AUTO_TRANSMIT_FLAG_POS 46 // 16-bit
olympux 16:700377cd9d29 38 #define AUTO_TRANSMIT_TIME_PERIOD_POS 48 // 16-bit
olympux 16:700377cd9d29 39 // enable modes
olympux 16:700377cd9d29 40 #define ENABLE_TCP_SERVER_POS 50 // 16-bit
olympux 16:700377cd9d29 41 #define ENABLE_TCP_CLIENT_POS 52 // 16-bit
olympux 16:700377cd9d29 42 #define ENABLE_UDP_MODE_POS 54 // 16-bit
olympux 0:aa07a25a9005 43
olympux 0:aa07a25a9005 44
olympux 16:700377cd9d29 45 // prototypes
olympux 16:700377cd9d29 46 void write_device_configuration(uint16_t* ip, uint16_t* subnet, uint16_t* gateway,
olympux 16:700377cd9d29 47 uint16_t* mac, uint16_t tcp_port, uint16_t udp_port,
olympux 16:700377cd9d29 48 uint16_t* remote_ip, uint16_t remote_port, uint16_t auto_transmit, uint16_t transmit_period,
olympux 16:700377cd9d29 49 uint16_t enable_tcp_server, uint16_t enable_tcp_client, uint16_t enable_udp);
olympux 16:700377cd9d29 50 void reset_device_configuration();
olympux 16:700377cd9d29 51 void read_device_configuration();
olympux 1:6bdc99dd8e0a 52
olympux 0:aa07a25a9005 53 #endif