~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/load-save-config.c

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// load-save-config.c: Load/save/eeprom functions for Anduril.
 
2
// Copyright (C) 2017-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
 
 
5
#pragma once
 
6
 
 
7
#include "load-save-config-fsm.h"
 
8
#include "load-save-config.h"
 
9
 
 
10
void load_config() {
 
11
    eeprom = (uint8_t *)&cfg;
 
12
 
 
13
    if (! load_eeprom()) return;
 
14
 
 
15
    #ifdef START_AT_MEMORIZED_LEVEL
 
16
    if (load_eeprom_wl()) {
 
17
        memorized_level = eeprom_wl[0];
 
18
    }
 
19
    #endif
 
20
}
 
21
 
 
22
void save_config() {
 
23
    eeprom = (uint8_t *)&cfg;
 
24
    save_eeprom();
 
25
}
 
26
 
 
27
#ifdef START_AT_MEMORIZED_LEVEL
 
28
void save_config_wl() {
 
29
    eeprom_wl[0] = memorized_level;
 
30
    save_eeprom_wl();
 
31
}
 
32
#endif
 
33