summaryrefslogtreecommitdiff
path: root/apps/settings_list.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings_list.h')
-rw-r--r--apps/settings_list.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/apps/settings_list.h b/apps/settings_list.h
index d76d10aea1..d9ad20077a 100644
--- a/apps/settings_list.h
+++ b/apps/settings_list.h
@@ -24,12 +24,15 @@
24#include <limits.h> 24#include <limits.h>
25#include "inttypes.h" 25#include "inttypes.h"
26 26
27typedef int (*_isfunc_type)(void);
28
27union storage_type { 29union storage_type {
28 int int_; 30 int int_;
29 unsigned int uint_; 31 unsigned int uint_;
30 bool bool_; 32 bool bool_;
31 char *charptr; 33 char *charptr;
32 unsigned char *ucharptr; 34 unsigned char *ucharptr;
35 _isfunc_type func;
33}; 36};
34/* the variable type for the setting */ 37/* the variable type for the setting */
35#define F_T_INT 1 38#define F_T_INT 1
@@ -53,12 +56,25 @@ struct bool_setting {
53#define F_BOOL_SETTING F_T_BOOL|0x10 56#define F_BOOL_SETTING F_T_BOOL|0x10
54#define F_RGB 0x20 57#define F_RGB 0x20
55 58
59struct filename_setting {
60 const char* prefix;
61 const char* suffix;
62 int max_len;
63};
64#define F_FILENAME 0x40
65
56struct int_setting { 66struct int_setting {
57 void (*option_callback)(int); 67 void (*option_callback)(int);
58 int min; 68 int min;
59 int max; 69 int max;
60 int step; 70 int step;
61}; 71};
72/* these use the _isfunc_type type for the function */
73/* typedef int (*_isfunc_type)(void); */
74#define F_MIN_ISFUNC 0x100000 /* min(above) is function pointer to above type */
75#define F_MAX_ISFUNC 0x200000 /* max(above) is function pointer to above type */
76#define F_DEF_ISFUNC 0x400000 /* default_val is function pointer to above type */
77
62#define F_NVRAM_BYTES_MASK 0xE00 /*0-4 bytes can be stored */ 78#define F_NVRAM_BYTES_MASK 0xE00 /*0-4 bytes can be stored */
63#define F_NVRAM_MASK_SHIFT 9 79#define F_NVRAM_MASK_SHIFT 9
64#define NVRAM_CONFIG_VERSION 2 80#define NVRAM_CONFIG_VERSION 2
@@ -68,14 +84,9 @@ struct int_setting {
68- a NVRAM setting is removed 84- a NVRAM setting is removed
69*/ 85*/
70 86
71struct filename_setting { 87
72 const char* prefix;
73 const char* suffix;
74 int max_len;
75};
76#define F_FILENAME 0x40
77struct settings_list { 88struct settings_list {
78 uint32_t flags; /* ____ ____ ____ ____ ____ NNN_ _FRB STTT */ 89 uint32_t flags; /* ____ ____ _FFF ____ ____ NNN_ IFRB STTT */
79 void *setting; 90 void *setting;
80 union storage_type default_val; 91 union storage_type default_val;
81 const char *cfg_name; /* this settings name in the cfg file */ 92 const char *cfg_name; /* this settings name in the cfg file */