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 /* initial node address to use at startup */
54 /* startup parameters, defined in remote_proto.h, size: 12 bytes */
55 struct startup_parameters_t params
;
58 /* storage structure for EEPROM
60 * (means: 16 bytes left) */
63 /* startup configuration, size: 14 bytes */
64 struct storage_config_t config
;
66 /* color storage, size: 60*8 == 480 bytes */
67 struct storage_color_t color
[CONFIG_EEPROM_COLORS
];
69 /* crc16 checksum over config and color[], size: 2 bytes */
73 /* global structures */
74 extern struct storage_config_t startup_config
;
75 extern EEMEM
struct storage_t eeprom_storage
;
77 /* initialize storage */
78 void storage_init(void);
80 void storage_poll(void);
82 /* save storage config cfg to eeprom */
83 void storage_save_config(void);
84 /* load storage config cfg from eeprom */
85 void storage_load_config(void);
87 void storage_save_color(uint8_t position
, struct storage_color_t
*color
);
88 void storage_load_color(uint8_t position
, struct storage_color_t
*color
);
90 /* return true if configuration has been loaded and is valid */
91 bool storage_valid_config(void);