Chau Vo / device_configuration

Dependents:   F103-Web-Server

Fork of my_eeprom_funcs by Chau Vo

Committer:
olympux
Date:
Sun Aug 21 17:46:55 2016 +0000
Revision:
18:d88314ae7979
Parent:
16:700377cd9d29
Child:
19:5671f3c25342
added UDP client

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 18:d88314ae7979 12 #define DEFAULT_REMOTE_TCP_SERVER_IP "0.0.0.0"
olympux 18:d88314ae7979 13 #define DEFAULT_REMOTE_UDP_SERVER_IP "0.0.0.0"
olympux 0:aa07a25a9005 14 #define DEFAULT_MAC0 0x00
olympux 0:aa07a25a9005 15 #define DEFAULT_MAC1 0x08
olympux 0:aa07a25a9005 16 #define DEFAULT_MAC2 0xDC
olympux 0:aa07a25a9005 17 #define DEFAULT_MAC3 0x00
olympux 0:aa07a25a9005 18 #define DEFAULT_MAC4 0x00
olympux 0:aa07a25a9005 19 #define DEFAULT_MAC5 0x01
olympux 16:700377cd9d29 20 #define DEFAULT_LOCAL_TCP_SERVER_PORT 10000 // change to 7000 if internet required
olympux 18:d88314ae7979 21 #define DEFAULT_LOCAL_UDP_SERVER_PORT 11000
olympux 16:700377cd9d29 22 #define DEFAULT_TRANSMIT_PERIOD 1000
olympux 0:aa07a25a9005 23
olympux 6:241d1539914a 24 #define DEFAULT_ENABLE_FLAG_VALUE 0xA5A5
olympux 6:241d1539914a 25 #define DEFAULT_DISABLE_FLAG_VALUE 0xAAAA
olympux 0:aa07a25a9005 26
olympux 16:700377cd9d29 27 // Positions of variables in EEPROM array
olympux 16:700377cd9d29 28 #define IP_ADDRESS_POS 0 // 4x16-bit
olympux 16:700377cd9d29 29 #define IP_SUBNET_POS 8 // 4x16-bit
olympux 16:700377cd9d29 30 #define IP_GATEWAY_POS 16 // 4x16-bit
olympux 16:700377cd9d29 31 #define MAC_ADDRESS_POS 24 // 3x16-bit
olympux 16:700377cd9d29 32 #define DEVICE_CONFIGURED_FLAG_POS 30 // 16-bit
olympux 16:700377cd9d29 33 #define LOCAL_TCP_SERVER_PORT_POS 32 // 16-bit
olympux 18:d88314ae7979 34 #define LOCAL_UDP_SERVER_PORT_POS 34 // 16-bit
olympux 16:700377cd9d29 35 // if TCP client is enabled, use parameters below to set parameters for the remote TCP server
olympux 16:700377cd9d29 36 #define REMOTE_TCP_SERVER_IP_ADDR_POS 36 // 4x16-bit
olympux 16:700377cd9d29 37 #define REMOTE_TCP_SERVER_PORT_POS 44 // 16-bit
olympux 16:700377cd9d29 38 #define AUTO_TRANSMIT_FLAG_POS 46 // 16-bit
olympux 16:700377cd9d29 39 #define AUTO_TRANSMIT_TIME_PERIOD_POS 48 // 16-bit
olympux 18:d88314ae7979 40 // If UDP client is enabled, use parameters below
olympux 18:d88314ae7979 41 #define REMOTE_UDP_SERVER_IP_ADDR_POS 50 // 4x16-bit
olympux 18:d88314ae7979 42 #define REMOTE_UDP_SERVER_PORT_POS 58 // 16-bit
olympux 16:700377cd9d29 43 // enable modes
olympux 18:d88314ae7979 44 #define ENABLE_TCP_SERVER_POS 60 // 16-bit
olympux 18:d88314ae7979 45 #define ENABLE_TCP_CLIENT_POS 62 // 16-bit
olympux 18:d88314ae7979 46 #define ENABLE_UDP_SERVER_POS 64 // 16-bit
olympux 18:d88314ae7979 47 #define ENABLE_UDP_CLIENT_POS 66 // 16-bit
olympux 0:aa07a25a9005 48
olympux 0:aa07a25a9005 49
olympux 16:700377cd9d29 50 // prototypes
olympux 18:d88314ae7979 51 void write_device_configuration(uint16_t* ip, uint16_t* subnet, uint16_t* gateway, uint16_t* mac,
olympux 18:d88314ae7979 52 uint16_t tcp_port, uint16_t udp_port,
olympux 18:d88314ae7979 53 uint16_t* remote_tcp_ip, uint16_t remote_tcp_port, uint16_t auto_transmit, uint16_t transmit_period,
olympux 18:d88314ae7979 54 uint16_t* remote_udp_ip, uint16_t remote_udp_port,
olympux 18:d88314ae7979 55 uint16_t enable_tcp_server, uint16_t enable_tcp_client, uint16_t enable_udp_server, uint16_t enable_udp_client);
olympux 16:700377cd9d29 56 void reset_device_configuration();
olympux 16:700377cd9d29 57 void read_device_configuration();
olympux 1:6bdc99dd8e0a 58
olympux 0:aa07a25a9005 59 #endif