Used with eeprom_flash to write network configuration to STM32F103 flash
Fork of my_eeprom_funcs by
Diff: my_eeprom_funcs.cpp
- Revision:
- 8:4fc4b1b5509b
- Parent:
- 7:60f87ff3da60
- Child:
- 9:b5fbb35bbc02
diff -r 60f87ff3da60 -r 4fc4b1b5509b my_eeprom_funcs.cpp --- a/my_eeprom_funcs.cpp Sat Dec 06 17:28:30 2014 +0000 +++ b/my_eeprom_funcs.cpp Sun Dec 07 00:17:32 2014 +0000 @@ -34,7 +34,7 @@ EE_Init(); // erase first_run flag - EE_WriteVariable(VirtAddVarTab[FIRST_RUN_FLAG_POS], DEFAULT_ENABLE_FLAG_VALUE); + EE_WriteVariable(VirtAddVarTab[CONFIGURED_IP_FLAG_POS], DEFAULT_ENABLE_FLAG_VALUE); // IP address EE_WriteVariable(VirtAddVarTab[IP_ADDRESS_POS+0], *buf++); @@ -76,9 +76,9 @@ EE_Init(); // check if 1st run - EE_ReadVariable(VirtAddVarTab[FIRST_RUN_FLAG_POS], &first_run); + EE_ReadVariable(VirtAddVarTab[CONFIGURED_IP_FLAG_POS], &configured_ip); // if not first run, load network config - if (first_run == DEFAULT_ENABLE_FLAG_VALUE) { + if (configured_ip == DEFAULT_ENABLE_FLAG_VALUE) { DBG("User settings"); // IP address @@ -122,7 +122,7 @@ sprintf(str_ip_subnet, "%d.%d.%d.%d", (uint8_t)u16ip_subnet[0], (uint8_t)u16ip_subnet[1], (uint8_t)u16ip_subnet[2], (uint8_t)u16ip_subnet[3]); sprintf(str_ip_gateway, "%d.%d.%d.%d", (uint8_t)u16ip_gateway[0], (uint8_t)u16ip_gateway[1], (uint8_t)u16ip_gateway[2], (uint8_t)u16ip_gateway[3]); } - // if 1st run, use default addresses + // if ip is not configured, use default addresses else { DBG("No user settings, load defaults"); u8mac[0] = DEFAULT_MAC0; u8mac[1] = DEFAULT_MAC1; u8mac[2] = DEFAULT_MAC2;