1 /* vim:ts=4 sts=4 et tw=80
5 * for additional information please
6 * see http://lochraster.org/fnordlichtmini
8 * (c) by Alexander Neumann <alexander@bumpern.de>
10 * This program is free software: you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 3 as published by
12 * the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
27 #include "remote-proto.h"
28 #include <avr/eeprom.h>
32 /* store a color configuration in EEPROM
35 * use union color_t here, check rgb_marker! */
36 struct storage_color_t
44 #define EEPROM_MAGIC_BYTE 0x23
46 /* store the startup configuration in EEPROM
48 struct storage_config_t
50 /* magic byte, must match EEPROM_MAGIC_BYTE to mark a valid configuration */
52 /* startup parameters, defined in remote_proto.h, size: 12 byte */
53 struct startup_parameters_t params
;
56 /* storage structure for EEPROM
58 * (means: 18 byte left) */
61 /* startup configuration, size: 12 byte */
62 struct storage_config_t config
;
64 /* color storage, size: 60*8 == 480 byte */
65 struct storage_color_t color
[CONFIG_EEPROM_COLORS
];
67 /* crc16 checksum over config and color[], size: 2 byte */
71 /* global structures */
72 extern struct storage_config_t startup_config
;
73 extern EEMEM
struct storage_t eeprom_storage
;
75 /* initialize storage */
76 void storage_init(void);
78 void storage_poll(void);
80 /* save storage config cfg to eeprom */
81 void storage_save_config(void);
82 /* load storage config cfg from eeprom */
83 void storage_load_config(void);
85 void storage_save_color(uint8_t position
, struct storage_color_t
*color
);
86 void storage_load_color(uint8_t position
, struct storage_color_t
*color
);
88 /* return true if configuration has been loaded and is valid */
89 bool storage_valid_config(void);