/* * preferences.h * * Created on: Feb 22, 2022 * Author: radioman */ #ifndef INC_PREFERENCES_H_ #define INC_PREFERENCES_H_ #include #include #define PREF_COUNT 12 #define PREF_DEFAULT_VALUES { \ /* PREF_NAME VALUE, STEP, MAX_VAL, UNSAVED */ \ /* Placeholder */ { 0, 0, 0, 0 }, \ /* SOUND_VOLUME */ { 5, 1, 9, 0 }, \ /* SOUND_TONE */ { 5, 1, 9, 0 }, \ /* SOUND_BUTTONS */ { 0, 1, 1, 0 }, \ /* ALARM_DOSERATE */ { 0, 0, 0, 0 }, \ /* ALARM_TOTALDOSE */ { 0, 0, 0, 0 }, \ /* ALARM_SOUNDTYPE */ { 0, 1, 4, 0 }, \ /* ALARM_VOLUME */ { 5, 1, 9, 0 }, \ /* ENERGY_BRIGHT */ { 5, 1, 9, 0 }, \ /* ENERGY_DISPOFF */ { 0, 1, 20, 0 },\ /* ENERGY_SHUTDOWN */ { 0, 5, 60, 0 } } typedef struct { int value; int step; int max_val; bool unsaved; } Pref_td; typedef enum { PREF_SOUND_VOLUME = 1, PREF_SOUND_TONE, PREF_SOUND_BUTTONS, PREF_ALARM_DOSERATE, PREF_ALARM_TOTALDOSE, PREF_ALARM_SOUNDTYPE, PREF_ALARM_VOLUME, PREF_ENERGY_BRIGHT, PREF_ENERGY_DISPOFF, PREF_ENERGY_SHUTDOWN } PrefNames_t; void PrefIncValue(PrefNames_t PrefName); void PrefSetValue(PrefNames_t PrefName, int value); int PrefGetValue(PrefNames_t PrefName); void PrefSaveToFlash(); void PrefLoadFromFlash(); #endif /* INC_PREFERENCES_H_ */