Used with eeprom_flash to write network configuration to STM32F103 flash
Fork of my_eeprom_funcs by
device_configuration.cpp@16:700377cd9d29, 2016-08-14 (annotated)
- Committer:
- olympux
- Date:
- Sun Aug 14 11:05:20 2016 +0000
- Revision:
- 16:700377cd9d29
- Parent:
- my_eeprom_funcs.cpp@12:613ab276bf37
- Child:
- 17:574f90b11417
Tested on STM32F103 with new mbed revision 6xx
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
olympux | 1:6bdc99dd8e0a | 1 | #include "mbed.h" |
olympux | 16:700377cd9d29 | 2 | #include "device_configuration.h" |
olympux | 1:6bdc99dd8e0a | 3 | |
olympux | 1:6bdc99dd8e0a | 4 | |
olympux | 11:250b05a5266d | 5 | /* |
olympux | 10:f37acffddef9 | 6 | * Debug option |
olympux | 10:f37acffddef9 | 7 | */ |
olympux | 16:700377cd9d29 | 8 | #if 0 |
olympux | 4:944a4646b825 | 9 | //Enable debug |
olympux | 4:944a4646b825 | 10 | #include <cstdio> |
olympux | 16:700377cd9d29 | 11 | #define INFO(x, ...) std::printf(""x"\r\n", ##__VA_ARGS__); |
olympux | 16:700377cd9d29 | 12 | #define DBG(x, ...) std::printf("[dev_conf: DBG]"x"\r\n", ##__VA_ARGS__); |
olympux | 16:700377cd9d29 | 13 | #define WARN(x, ...) std::printf("[dev_conf: WARN]"x"\r\n", ##__VA_ARGS__); |
olympux | 16:700377cd9d29 | 14 | #define ERR(x, ...) std::printf("[dev_conf: ERR]"x"\r\n", ##__VA_ARGS__); |
olympux | 4:944a4646b825 | 15 | #else |
olympux | 4:944a4646b825 | 16 | //Disable debug |
olympux | 16:700377cd9d29 | 17 | #define INFO(x, ...) |
olympux | 4:944a4646b825 | 18 | #define DBG(x, ...) |
olympux | 4:944a4646b825 | 19 | #define WARN(x, ...) |
olympux | 4:944a4646b825 | 20 | #define ERR(x, ...) |
olympux | 16:700377cd9d29 | 21 | #endif |
olympux | 4:944a4646b825 | 22 | |
olympux | 16:700377cd9d29 | 23 | |
olympux | 16:700377cd9d29 | 24 | /* |
olympux | 16:700377cd9d29 | 25 | * Variables for network configuration |
olympux | 16:700377cd9d29 | 26 | */ |
olympux | 16:700377cd9d29 | 27 | // Device configuration |
olympux | 16:700377cd9d29 | 28 | uint16_t u16IpAddr[4], u16IpSubnet[4], u16IpGateway[4], u16MacAddr[3]; // 16-bits variables to be compatible with eeprom functions |
olympux | 16:700377cd9d29 | 29 | char strIpAddr[16], strIpSubnet[16], strIpGateway[16], strMacAddr[20]; // RPC variables, converted from 16-bits u16ip_xxx |
olympux | 16:700377cd9d29 | 30 | uint16_t u16DeviceConfiguredFlag = 0; // flag indicates whether device has been configured (0xA5A5) or not |
olympux | 16:700377cd9d29 | 31 | // TCP server/UDP |
olympux | 16:700377cd9d29 | 32 | uint16_t u16LocalTcpServerPort = DEFAULT_LOCAL_TCP_SERVER_PORT; |
olympux | 16:700377cd9d29 | 33 | uint16_t u16LocalUdpPort = DEFAULT_LOCAL_UDP_PORT; |
olympux | 16:700377cd9d29 | 34 | // TCP client mode, set parameters of the remote TCP server this device connects to. |
olympux | 16:700377cd9d29 | 35 | // When enabled, this device will send its status to the server every transmit_time_period. |
olympux | 16:700377cd9d29 | 36 | uint16_t u16RemoteTcpServerIpAddr[4]; // 16-bit variable to be compatible with eeprom functions |
olympux | 16:700377cd9d29 | 37 | char strRemoteTcpServerIpAddr[16]; // RPC variable, converted from 16-bits u16server_ip_addr |
olympux | 16:700377cd9d29 | 38 | uint16_t u16RemoteTcpServerPort; // 16-bit variable to be compatible with eeprom functions |
olympux | 16:700377cd9d29 | 39 | uint16_t u16AutoTransmitFlag = 0, u16TransmitPeriod = DEFAULT_TRANSMIT_PERIOD; // auto transmit status, time period = 1s |
olympux | 16:700377cd9d29 | 40 | // enable modes |
olympux | 16:700377cd9d29 | 41 | uint16_t u16EnableTcpServer = 0, u16EnableTcpClient = 0, u16EnableUdp = DEFAULT_ENABLE_FLAG_VALUE; // flags for enabling TCP server/client and UDP (UDP is always on for configuration) |
olympux | 16:700377cd9d29 | 42 | // extra |
olympux | 16:700377cd9d29 | 43 | uint8_t u8IpAddr[4]; // keep device ip address in 8-bits |
olympux | 16:700377cd9d29 | 44 | uint8_t u8MacAddr[6]; // keep mac in 8-bits |
olympux | 16:700377cd9d29 | 45 | uint8_t u8RemoteTcpServerIpAddr[4]; // remote TCP server ip address in 8-bits |
olympux | 4:944a4646b825 | 46 | |
olympux | 12:613ab276bf37 | 47 | /*! |
olympux | 12:613ab276bf37 | 48 | * Function to write module network configuration |
olympux | 12:613ab276bf37 | 49 | * @param <char *buf> configuration buffer |
olympux | 16:700377cd9d29 | 50 | * @note 4x16-bit IP address |
olympux | 16:700377cd9d29 | 51 | * @note 4x16-bit subnet |
olympux | 16:700377cd9d29 | 52 | * @note 4x16-bit gateway |
olympux | 16:700377cd9d29 | 53 | * @note 3x16-bit MAC |
olympux | 16:700377cd9d29 | 54 | * @note 16-bit TCP local port |
olympux | 16:700377cd9d29 | 55 | * @note 16-bit UDP local port |
olympux | 12:613ab276bf37 | 56 | */ |
olympux | 16:700377cd9d29 | 57 | void write_device_configuration(uint16_t* ip, uint16_t* subnet, uint16_t* gateway, |
olympux | 16:700377cd9d29 | 58 | uint16_t* mac, uint16_t tcp_port, uint16_t udp_port, |
olympux | 16:700377cd9d29 | 59 | uint16_t* remote_ip, uint16_t remote_port, uint16_t auto_transmit, uint16_t transmit_period, |
olympux | 16:700377cd9d29 | 60 | uint16_t enable_tcp_server, uint16_t enable_tcp_client, uint16_t enable_udp) { |
olympux | 1:6bdc99dd8e0a | 61 | // Write network configuration |
olympux | 1:6bdc99dd8e0a | 62 | // 4-byte IP address + 4-byte subnet + 4-byte gateway + 3-byte MAC |
olympux | 16:700377cd9d29 | 63 | // + local TCP server port + local UDP port |
olympux | 1:6bdc99dd8e0a | 64 | |
olympux | 16:700377cd9d29 | 65 | INFO("Saving network configuration for this device..."); |
olympux | 16:700377cd9d29 | 66 | |
olympux | 16:700377cd9d29 | 67 | enableEEPROMWriting(); |
olympux | 6:241d1539914a | 68 | |
olympux | 6:241d1539914a | 69 | // erase first_run flag |
olympux | 16:700377cd9d29 | 70 | writeEEPROMHalfWord(DEVICE_CONFIGURED_FLAG_POS, DEFAULT_ENABLE_FLAG_VALUE); |
olympux | 6:241d1539914a | 71 | |
olympux | 1:6bdc99dd8e0a | 72 | // IP address |
olympux | 16:700377cd9d29 | 73 | writeEEPROMHalfWord(IP_ADDRESS_POS+2*0, ip[0]); |
olympux | 16:700377cd9d29 | 74 | writeEEPROMHalfWord(IP_ADDRESS_POS+2*1, ip[1]); |
olympux | 16:700377cd9d29 | 75 | writeEEPROMHalfWord(IP_ADDRESS_POS+2*2, ip[2]); |
olympux | 16:700377cd9d29 | 76 | writeEEPROMHalfWord(IP_ADDRESS_POS+2*3, ip[3]); |
olympux | 1:6bdc99dd8e0a | 77 | |
olympux | 1:6bdc99dd8e0a | 78 | // IP subnet |
olympux | 16:700377cd9d29 | 79 | writeEEPROMHalfWord(IP_SUBNET_POS+2*0, subnet[0]); |
olympux | 16:700377cd9d29 | 80 | writeEEPROMHalfWord(IP_SUBNET_POS+2*1, subnet[1]); |
olympux | 16:700377cd9d29 | 81 | writeEEPROMHalfWord(IP_SUBNET_POS+2*2, subnet[2]); |
olympux | 16:700377cd9d29 | 82 | writeEEPROMHalfWord(IP_SUBNET_POS+2*3, subnet[3]); |
olympux | 1:6bdc99dd8e0a | 83 | |
olympux | 1:6bdc99dd8e0a | 84 | // IP gateway |
olympux | 16:700377cd9d29 | 85 | writeEEPROMHalfWord(IP_GATEWAY_POS+2*0, gateway[0]); |
olympux | 16:700377cd9d29 | 86 | writeEEPROMHalfWord(IP_GATEWAY_POS+2*1, gateway[1]); |
olympux | 16:700377cd9d29 | 87 | writeEEPROMHalfWord(IP_GATEWAY_POS+2*2, gateway[2]); |
olympux | 16:700377cd9d29 | 88 | writeEEPROMHalfWord(IP_GATEWAY_POS+2*3, gateway[3]); |
olympux | 1:6bdc99dd8e0a | 89 | |
olympux | 1:6bdc99dd8e0a | 90 | // MAC address |
olympux | 16:700377cd9d29 | 91 | writeEEPROMHalfWord(MAC_ADDRESS_POS+2*0, mac[0]); |
olympux | 16:700377cd9d29 | 92 | writeEEPROMHalfWord(MAC_ADDRESS_POS+2*1, mac[1]); |
olympux | 16:700377cd9d29 | 93 | writeEEPROMHalfWord(MAC_ADDRESS_POS+2*2, mac[2]); |
olympux | 16:700377cd9d29 | 94 | |
olympux | 16:700377cd9d29 | 95 | // Ports |
olympux | 16:700377cd9d29 | 96 | writeEEPROMHalfWord(LOCAL_TCP_SERVER_PORT_POS, tcp_port); |
olympux | 16:700377cd9d29 | 97 | writeEEPROMHalfWord(LOCAL_UDP_PORT_POS, udp_port); |
olympux | 16:700377cd9d29 | 98 | |
olympux | 16:700377cd9d29 | 99 | // Remote TCP server |
olympux | 16:700377cd9d29 | 100 | writeEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*0, remote_ip[0]); |
olympux | 16:700377cd9d29 | 101 | writeEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*1, remote_ip[1]); |
olympux | 16:700377cd9d29 | 102 | writeEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*2, remote_ip[2]); |
olympux | 16:700377cd9d29 | 103 | writeEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*3, remote_ip[3]); |
olympux | 1:6bdc99dd8e0a | 104 | |
olympux | 16:700377cd9d29 | 105 | // Remote port |
olympux | 16:700377cd9d29 | 106 | writeEEPROMHalfWord(REMOTE_TCP_SERVER_PORT_POS, remote_port); |
olympux | 16:700377cd9d29 | 107 | |
olympux | 16:700377cd9d29 | 108 | // Auto transmit |
olympux | 16:700377cd9d29 | 109 | writeEEPROMHalfWord(AUTO_TRANSMIT_FLAG_POS, auto_transmit); |
olympux | 16:700377cd9d29 | 110 | writeEEPROMHalfWord(AUTO_TRANSMIT_TIME_PERIOD_POS, transmit_period); |
olympux | 16:700377cd9d29 | 111 | |
olympux | 16:700377cd9d29 | 112 | // Enable modes |
olympux | 16:700377cd9d29 | 113 | writeEEPROMHalfWord(ENABLE_TCP_SERVER_POS, enable_tcp_server); |
olympux | 16:700377cd9d29 | 114 | writeEEPROMHalfWord(ENABLE_TCP_CLIENT_POS, enable_tcp_client); |
olympux | 16:700377cd9d29 | 115 | writeEEPROMHalfWord(ENABLE_UDP_MODE_POS, enable_udp); |
olympux | 16:700377cd9d29 | 116 | |
olympux | 16:700377cd9d29 | 117 | disableEEPROMWriting(); |
olympux | 16:700377cd9d29 | 118 | |
olympux | 16:700377cd9d29 | 119 | INFO("Successful"); |
olympux | 1:6bdc99dd8e0a | 120 | } |
olympux | 1:6bdc99dd8e0a | 121 | |
olympux | 10:f37acffddef9 | 122 | /*! |
olympux | 10:f37acffddef9 | 123 | * Function to load module network configuration |
olympux | 10:f37acffddef9 | 124 | */ |
olympux | 16:700377cd9d29 | 125 | void read_device_configuration(void) { |
olympux | 16:700377cd9d29 | 126 | mbed_mac_address((char *)u8MacAddr); |
olympux | 1:6bdc99dd8e0a | 127 | |
olympux | 16:700377cd9d29 | 128 | INFO("Loading network configuration..."); |
olympux | 1:6bdc99dd8e0a | 129 | |
olympux | 16:700377cd9d29 | 130 | // check if configured |
olympux | 16:700377cd9d29 | 131 | u16DeviceConfiguredFlag = readEEPROMHalfWord(DEVICE_CONFIGURED_FLAG_POS); |
olympux | 1:6bdc99dd8e0a | 132 | |
olympux | 1:6bdc99dd8e0a | 133 | // if not first run, load network config |
olympux | 16:700377cd9d29 | 134 | if (u16DeviceConfiguredFlag == DEFAULT_ENABLE_FLAG_VALUE) { |
olympux | 16:700377cd9d29 | 135 | INFO("User settings"); |
olympux | 1:6bdc99dd8e0a | 136 | |
olympux | 1:6bdc99dd8e0a | 137 | // IP address |
olympux | 16:700377cd9d29 | 138 | u16IpAddr[0] = readEEPROMHalfWord(IP_ADDRESS_POS+2*0); |
olympux | 16:700377cd9d29 | 139 | u16IpAddr[1] = readEEPROMHalfWord(IP_ADDRESS_POS+2*1); |
olympux | 16:700377cd9d29 | 140 | u16IpAddr[2] = readEEPROMHalfWord(IP_ADDRESS_POS+2*2); |
olympux | 16:700377cd9d29 | 141 | u16IpAddr[3] = readEEPROMHalfWord(IP_ADDRESS_POS+2*3); |
olympux | 16:700377cd9d29 | 142 | u8IpAddr[0] = (uint8_t)(u16IpAddr[0] & 0x00FF); |
olympux | 16:700377cd9d29 | 143 | u8IpAddr[1] = (uint8_t)(u16IpAddr[1] & 0x00FF); |
olympux | 16:700377cd9d29 | 144 | u8IpAddr[2] = (uint8_t)(u16IpAddr[2] & 0x00FF); |
olympux | 16:700377cd9d29 | 145 | u8IpAddr[3] = (uint8_t)(u16IpAddr[3] & 0x00FF); |
olympux | 1:6bdc99dd8e0a | 146 | |
olympux | 1:6bdc99dd8e0a | 147 | // IP subnet |
olympux | 16:700377cd9d29 | 148 | u16IpSubnet[0] = readEEPROMHalfWord(IP_SUBNET_POS+2*0); |
olympux | 16:700377cd9d29 | 149 | u16IpSubnet[1] = readEEPROMHalfWord(IP_SUBNET_POS+2*1); |
olympux | 16:700377cd9d29 | 150 | u16IpSubnet[2] = readEEPROMHalfWord(IP_SUBNET_POS+2*2); |
olympux | 16:700377cd9d29 | 151 | u16IpSubnet[3] = readEEPROMHalfWord(IP_SUBNET_POS+2*3); |
olympux | 1:6bdc99dd8e0a | 152 | |
olympux | 1:6bdc99dd8e0a | 153 | // IP gateway |
olympux | 16:700377cd9d29 | 154 | u16IpGateway[0] = readEEPROMHalfWord(IP_GATEWAY_POS+2*0); |
olympux | 16:700377cd9d29 | 155 | u16IpGateway[1] = readEEPROMHalfWord(IP_GATEWAY_POS+2*1); |
olympux | 16:700377cd9d29 | 156 | u16IpGateway[2] = readEEPROMHalfWord(IP_GATEWAY_POS+2*2); |
olympux | 16:700377cd9d29 | 157 | u16IpGateway[3] = readEEPROMHalfWord(IP_GATEWAY_POS+2*3); |
olympux | 1:6bdc99dd8e0a | 158 | |
olympux | 1:6bdc99dd8e0a | 159 | // MAC address |
olympux | 16:700377cd9d29 | 160 | u16MacAddr[0] = readEEPROMHalfWord(MAC_ADDRESS_POS+2*0); |
olympux | 16:700377cd9d29 | 161 | u16MacAddr[1] = readEEPROMHalfWord(MAC_ADDRESS_POS+2*1); |
olympux | 16:700377cd9d29 | 162 | u16MacAddr[2] = readEEPROMHalfWord(MAC_ADDRESS_POS+2*2); |
olympux | 16:700377cd9d29 | 163 | u8MacAddr[0] = DEFAULT_MAC0; u8MacAddr[1] = DEFAULT_MAC1; u8MacAddr[2] = DEFAULT_MAC2; |
olympux | 16:700377cd9d29 | 164 | u8MacAddr[3] = (uint8_t)(u16MacAddr[0] & 0x00FF); |
olympux | 16:700377cd9d29 | 165 | u8MacAddr[4] = (uint8_t)(u16MacAddr[1] & 0x00FF); |
olympux | 16:700377cd9d29 | 166 | u8MacAddr[5] = (uint8_t)(u16MacAddr[2] & 0x00FF); |
olympux | 16:700377cd9d29 | 167 | |
olympux | 16:700377cd9d29 | 168 | // Ports |
olympux | 16:700377cd9d29 | 169 | u16LocalTcpServerPort = readEEPROMHalfWord(LOCAL_TCP_SERVER_PORT_POS); |
olympux | 16:700377cd9d29 | 170 | u16LocalUdpPort = readEEPROMHalfWord(LOCAL_UDP_PORT_POS); |
olympux | 1:6bdc99dd8e0a | 171 | |
olympux | 16:700377cd9d29 | 172 | // Remote TCP server |
olympux | 16:700377cd9d29 | 173 | u16RemoteTcpServerIpAddr[0] = readEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*0); |
olympux | 16:700377cd9d29 | 174 | u16RemoteTcpServerIpAddr[1] = readEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*1); |
olympux | 16:700377cd9d29 | 175 | u16RemoteTcpServerIpAddr[2] = readEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*2); |
olympux | 16:700377cd9d29 | 176 | u16RemoteTcpServerIpAddr[3] = readEEPROMHalfWord(REMOTE_TCP_SERVER_IP_ADDR_POS+2*3); |
olympux | 16:700377cd9d29 | 177 | u8RemoteTcpServerIpAddr[0] = (uint8_t)(u16RemoteTcpServerIpAddr[0] & 0x00FF); |
olympux | 16:700377cd9d29 | 178 | u8RemoteTcpServerIpAddr[1] = (uint8_t)(u16RemoteTcpServerIpAddr[1] & 0x00FF); |
olympux | 16:700377cd9d29 | 179 | u8RemoteTcpServerIpAddr[2] = (uint8_t)(u16RemoteTcpServerIpAddr[2] & 0x00FF); |
olympux | 16:700377cd9d29 | 180 | u8RemoteTcpServerIpAddr[3] = (uint8_t)(u16RemoteTcpServerIpAddr[3] & 0x00FF); |
olympux | 16:700377cd9d29 | 181 | |
olympux | 16:700377cd9d29 | 182 | // Remote port |
olympux | 16:700377cd9d29 | 183 | u16RemoteTcpServerPort = readEEPROMHalfWord(REMOTE_TCP_SERVER_PORT_POS); |
olympux | 16:700377cd9d29 | 184 | |
olympux | 16:700377cd9d29 | 185 | // Auto transmit |
olympux | 16:700377cd9d29 | 186 | u16AutoTransmitFlag = readEEPROMHalfWord(AUTO_TRANSMIT_FLAG_POS); |
olympux | 16:700377cd9d29 | 187 | u16TransmitPeriod = readEEPROMHalfWord(AUTO_TRANSMIT_TIME_PERIOD_POS); |
olympux | 16:700377cd9d29 | 188 | |
olympux | 16:700377cd9d29 | 189 | // Enable modes |
olympux | 16:700377cd9d29 | 190 | u16EnableTcpServer = readEEPROMHalfWord(ENABLE_TCP_SERVER_POS); |
olympux | 16:700377cd9d29 | 191 | u16EnableTcpClient = readEEPROMHalfWord(ENABLE_TCP_CLIENT_POS); |
olympux | 16:700377cd9d29 | 192 | u16EnableUdp = readEEPROMHalfWord(ENABLE_UDP_MODE_POS); |
olympux | 16:700377cd9d29 | 193 | |
olympux | 16:700377cd9d29 | 194 | sprintf(strIpAddr, "%d.%d.%d.%d", u8IpAddr[0], u8IpAddr[1], u8IpAddr[2], u8IpAddr[3]); |
olympux | 16:700377cd9d29 | 195 | sprintf(strIpSubnet, "%d.%d.%d.%d", (uint8_t)u16IpSubnet[0], (uint8_t)u16IpSubnet[1], (uint8_t)u16IpSubnet[2], (uint8_t)u16IpSubnet[3]); |
olympux | 16:700377cd9d29 | 196 | sprintf(strIpGateway, "%d.%d.%d.%d", (uint8_t)u16IpGateway[0], (uint8_t)u16IpGateway[1], (uint8_t)u16IpGateway[2], (uint8_t)u16IpGateway[3]); |
olympux | 16:700377cd9d29 | 197 | sprintf(strRemoteTcpServerIpAddr, "%d.%d.%d.%d", u8RemoteTcpServerIpAddr[0], u8RemoteTcpServerIpAddr[1], u8RemoteTcpServerIpAddr[2], u8RemoteTcpServerIpAddr[3]); |
olympux | 1:6bdc99dd8e0a | 198 | } |
olympux | 8:4fc4b1b5509b | 199 | // if ip is not configured, use default addresses |
olympux | 1:6bdc99dd8e0a | 200 | else { |
olympux | 16:700377cd9d29 | 201 | INFO("No user settings, load defaults"); |
olympux | 16:700377cd9d29 | 202 | u8MacAddr[0] = DEFAULT_MAC0; u8MacAddr[1] = DEFAULT_MAC1; u8MacAddr[2] = DEFAULT_MAC2; |
olympux | 16:700377cd9d29 | 203 | u8MacAddr[3] = DEFAULT_MAC3; u8MacAddr[4] = DEFAULT_MAC4; u8MacAddr[5] = DEFAULT_MAC5; |
olympux | 16:700377cd9d29 | 204 | sprintf(strIpAddr, DEFAULT_IP_ADDRESS); |
olympux | 16:700377cd9d29 | 205 | sprintf(strIpSubnet, DEFAULT_IP_SUBNET); |
olympux | 16:700377cd9d29 | 206 | sprintf(strIpGateway, DEFAULT_IP_GATEWAY); |
olympux | 16:700377cd9d29 | 207 | sprintf(strRemoteTcpServerIpAddr, DEFAULT_REMOTE_TCP_SERVER_IP); |
olympux | 1:6bdc99dd8e0a | 208 | } |
olympux | 1:6bdc99dd8e0a | 209 | |
olympux | 16:700377cd9d29 | 210 | INFO("Successful"); |
olympux | 16:700377cd9d29 | 211 | INFO("IP: %s", strIpAddr); |
olympux | 16:700377cd9d29 | 212 | INFO("MASK: %s", strIpSubnet); |
olympux | 16:700377cd9d29 | 213 | INFO("GW: %s", strIpGateway); |
olympux | 16:700377cd9d29 | 214 | INFO("TCP server local port: %d", u16LocalTcpServerPort); |
olympux | 16:700377cd9d29 | 215 | INFO("UDP server local port: %d", u16LocalUdpPort); |
olympux | 16:700377cd9d29 | 216 | |
olympux | 16:700377cd9d29 | 217 | INFO("TCP server: %s", (u16EnableTcpServer == DEFAULT_ENABLE_FLAG_VALUE) ? "enabled" : "disable"); |
olympux | 16:700377cd9d29 | 218 | INFO("TCP client: %s", (u16EnableTcpClient == DEFAULT_ENABLE_FLAG_VALUE) ? "enabled" : "disable"); |
olympux | 16:700377cd9d29 | 219 | INFO("UDP: %s", (u16EnableUdp == DEFAULT_ENABLE_FLAG_VALUE) ? "enabled" : "disable"); |
olympux | 16:700377cd9d29 | 220 | |
olympux | 16:700377cd9d29 | 221 | INFO("Remote TCP server: %s", strRemoteTcpServerIpAddr); |
olympux | 16:700377cd9d29 | 222 | INFO("Remote TCP server port: %d", u16RemoteTcpServerPort); |
olympux | 16:700377cd9d29 | 223 | INFO("Auto transmit: %s", (u16AutoTransmitFlag == DEFAULT_ENABLE_FLAG_VALUE) ? "enabled" : "disable"); |
olympux | 16:700377cd9d29 | 224 | INFO("Period: %d", u16TransmitPeriod); |
olympux | 1:6bdc99dd8e0a | 225 | } |
olympux | 1:6bdc99dd8e0a | 226 | |
olympux | 16:700377cd9d29 | 227 | void reset_device_configuration() { |
olympux | 16:700377cd9d29 | 228 | // erase first_run flag |
olympux | 16:700377cd9d29 | 229 | enableEEPROMWriting(); |
olympux | 16:700377cd9d29 | 230 | disableEEPROMWriting(); |
olympux | 1:6bdc99dd8e0a | 231 | } |