altos: Move common storage code to ao_storage.c. Add M25P80 driver
[fw/altos] / src / ao_config.c
index 2153b84152fdacdd645677f0375865870312bf16..38b72798bab00b346b82f498adaa660f9a9ee762 100644 (file)
@@ -33,9 +33,19 @@ static void
 _ao_config_put(void)
 {
        ao_storage_setup();
+       ao_storage_erase(ao_storage_config);
        ao_storage_write(ao_storage_config, &ao_config, sizeof (ao_config));
+       ao_log_write_erase(0);
        ao_storage_flush();
 }
+
+void
+ao_config_put(void)
+{
+       ao_mutex_get(&ao_config_mutex);
+       _ao_config_put();
+       ao_mutex_put(&ao_config_mutex);
+}
 #endif
 
 static void
@@ -288,13 +298,13 @@ struct ao_config_var {
        const char      *help;
 };
 
-void
+static void
 ao_config_help(void) __reentrant;
 
-void
+static void
 ao_config_show(void) __reentrant;
 
-void
+static void
 ao_config_write(void) __reentrant;
 
 __code struct ao_config_var ao_config_vars[] = {
@@ -348,7 +358,7 @@ ao_config_set(void)
                ao_cmd_status = ao_cmd_syntax_error;
 }
 
-void
+static void
 ao_config_help(void) __reentrant
 {
        uint8_t cmd;
@@ -356,7 +366,7 @@ ao_config_help(void) __reentrant
                puts (ao_config_vars[cmd].help);
 }
 
-void
+static void
 ao_config_show(void) __reentrant
 {
        uint8_t cmd;
@@ -368,7 +378,7 @@ ao_config_show(void) __reentrant
 }
 
 #if HAS_EEPROM
-void
+static void
 ao_config_write(void) __reentrant
 {
        uint8_t saved = 0;