Kaleidoscope
EEPROM-Settings.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*-
2  * Kaleidoscope-EEPROM-Settings -- Basic EEPROM settings plugin for Kaleidoscope.
3  * Copyright (C) 2017 Gergely Nagy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include <Kaleidoscope.h>
22 #include <EEPROM.h>
23 
24 namespace kaleidoscope {
26  public:
27  EEPROMSettings(void);
28 
29  void begin(void) final;
30 
31  static void update(void);
32  static bool isValid(void);
33  static void invalidate(void);
34  static uint8_t version(void);
35  static void version(uint8_t ver);
36 
37  static uint16_t requestSlice(uint16_t size);
38  static void seal(void);
39  static uint16_t crc(void);
40  static uint16_t used(void);
41 
42  private:
43  static uint16_t next_start_;
44  static bool is_valid_;
45  static bool sealed_;
46 
47  static struct settings {
48  char magic[2];
49  uint8_t version;
50  uint16_t crc;
51  } settings_;
52 };
53 };
54 
static uint16_t used(void)
Definition: EEPROM-Settings.cpp:80
static void invalidate(void)
Definition: EEPROM-Settings.cpp:76
Definition: hid.cpp:4
static uint8_t version(void)
Definition: EEPROM-Settings.cpp:91
EEPROMSettings(void)
Definition: EEPROM-Settings.cpp:29
Definition: EEPROM-Settings.h:25
static uint16_t requestSlice(uint16_t size)
Definition: EEPROM-Settings.cpp:64
void begin(void) final
Definition: EEPROM-Settings.cpp:32
static uint16_t crc(void)
Definition: EEPROM-Settings.cpp:40
static bool isValid(void)
Definition: EEPROM-Settings.cpp:36
Definition: Kaleidoscope.h:40
static void seal(void)
Definition: EEPROM-Settings.cpp:46
static void update(void)
Definition: EEPROM-Settings.cpp:84