preferences.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * preferences.h
  3. *
  4. * Created on: Feb 22, 2022
  5. * Author: radioman
  6. */
  7. #ifndef INC_PREFERENCES_H_
  8. #define INC_PREFERENCES_H_
  9. #include <stdint.h>
  10. #include <stdbool.h>
  11. #define PREF_COUNT 12
  12. #define PREF_DEFAULT_VALUES { \
  13. /* PREF_NAME VALUE, STEP, MAX_VAL, UNSAVED */ \
  14. /* Placeholder */ { 0, 0, 0, 0 }, \
  15. /* SOUND_VOLUME */ { 5, 1, 9, 0 }, \
  16. /* SOUND_TONE */ { 5, 1, 9, 0 }, \
  17. /* SOUND_BUTTONS */ { 0, 1, 1, 0 }, \
  18. /* ALARM_DOSERATE */ { 0, 0, 0, 0 }, \
  19. /* ALARM_TOTALDOSE */ { 0, 0, 0, 0 }, \
  20. /* ALARM_SOUNDTYPE */ { 0, 1, 4, 0 }, \
  21. /* ALARM_VOLUME */ { 5, 1, 9, 0 }, \
  22. /* ENERGY_BRIGHT */ { 5, 1, 9, 0 }, \
  23. /* ENERGY_DISPOFF */ { 0, 1, 20, 0 },\
  24. /* ENERGY_SHUTDOWN */ { 0, 5, 60, 0 } }
  25. typedef struct {
  26. int value;
  27. int step;
  28. int max_val;
  29. bool unsaved;
  30. } Pref_td;
  31. typedef enum { PREF_SOUND_VOLUME = 1, PREF_SOUND_TONE, PREF_SOUND_BUTTONS,
  32. PREF_ALARM_DOSERATE, PREF_ALARM_TOTALDOSE, PREF_ALARM_SOUNDTYPE, PREF_ALARM_VOLUME,
  33. PREF_ENERGY_BRIGHT, PREF_ENERGY_DISPOFF, PREF_ENERGY_SHUTDOWN } PrefNames_t;
  34. void PrefIncValue(PrefNames_t PrefName);
  35. void PrefSetValue(PrefNames_t PrefName, int value);
  36. int PrefGetValue(PrefNames_t PrefName);
  37. void PrefSaveToFlash();
  38. void PrefLoadFromFlash();
  39. #endif /* INC_PREFERENCES_H_ */