Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of my_eeprom_funcs by
my_eeprom_funcs.h
- Committer:
- olympux
- Date:
- 2014-09-28
- Revision:
- 0:aa07a25a9005
- Child:
- 1:6bdc99dd8e0a
File content as of revision 0:aa07a25a9005:
#ifndef __MY_EEPROM_FUNCS_H
#define __MY_EEPROM_FUNCS_H
#include "eeprom.h"
/*
* Default device network configuration
*/
#define DEFAULT_IP_ADDRESS "192.168.0.249"
#define DEFAULT_IP_SUBNET "255.255.255.0"
#define DEFAULT_IP_GATEWAY "192.168.0.1"
#define DEFAULT_MAC0 0x00
#define DEFAULT_MAC1 0x08
#define DEFAULT_MAC2 0xDC
#define DEFAULT_MAC3 0x00
#define DEFAULT_MAC4 0x00
#define DEFAULT_MAC5 0x01
/*
* Positions of variables in EEPROM array
*/
#define IP_ADDRESS_POS 0
#define IP_SUBNET_POS 4
#define IP_GATEWAY_POS 8
#define TCP_SERVER_LOCAL_PORT_POS 12
#define UDP_SERVER_LOCAL_PORT_POS 13
#define FIRST_RUN_FLAG_POS 14
#define MAC_ADDRESS_POS 15
// EEPROM: for TCP server this device connects to in TCP client mode
#define AUTO_TRANSMIT_FLAG_POS 18
#define TIME_PERIOD_POS 19
#define TCP_SERVER_IP_ADDR_POS 20
#define TCP_SERVER_PORT_POS 24
/*
* External variables in main.c
*/
extern uint16_t VirtAddVarTab[];
extern uint8_t u8mac[], u8ip_addr[];// keep mac and ip address in 8-bits
extern uint16_t u16mac_addr[], u16ip_addr[], u16ip_subnet[], u16ip_gateway[]; // 16-bits, directly loaded from eeprom
extern char str_ip_addr[], str_ip_subnet[], str_ip_gateway[]; // for printf, converted from 16-bits u16ip_xxx
extern uint16_t first_run; // first run flag
extern const uint16_t tcp_server_local_port; // fixed
extern const uint16_t udp_server_local_port; // fixed
// this section is for the TCP server that this device connects to in TCP client mode
extern uint16_t auto_transmit, time_period; // auto transmit status, time period = 1s
extern uint8_t u8server_ip_addr[];
extern char * server_ip_addr;
extern char str_server_ip_addr[];
extern uint16_t tcp_server_port;
/*
* My eeprom functions
*/
void load_eeprom_network(void);
void write_eeprom_network(char* buf);
void load_eeprom_tcpserver(void);
void write_eeprom_tcpserver(char* buf);
#endif
