GUIslice  0.16.0
Embedded GUI in C
XKeyPad_Num-setup.h
Go to the documentation of this file.
1 #ifndef _GUISLICE_EX_XKEYPAD_NUM_SETUP_H_
2 #define _GUISLICE_EX_XKEYPAD_NUM_SETUP_H_
3 
4 #include "elem/XKeyPad.h"
5 #include "elem/XKeyPad_Num.h"
6 
7 // ============================================================================
8 // This is the setup file associated with the XKeyPad_Num
9 // ============================================================================
10 
11 #define XKEYPAD_EXTEND_CHAR 0 // 0=Single-char, 1=Multi-char
12 #define XKEYPAD_LABEL_MAX 6 // Max buffer for a key label
13 
14 #define XKEYPAD_DISP_MAX 12 // Maximum display length (without NULL)
15 
16 #define XKEYPAD_KEY_W 25 // Default key width
17 #define XKEYPAD_KEY_H 25 // Default key height
18 
19 #define XKEYPAD_SPACING_X 0 // Default key spacing in X direction
20 #define XKEYPAD_SPACING_Y 0 // Default key spacing in Y direction
21 
22 // Other custom settings / values
23 static const char* KEYPAD_LABEL_NEGATIVE = "-";
24 static const char* KEYPAD_LABEL_DECIMAL_PT = ".";
25 
26 // Define the set of available KeyPad layouts
27 typedef enum {
28  // List of keypad layouts
30  // Terminator
33 
34 // Define the startup layout
36 
37 // Define local list of variant-specific button ID types
38 enum {
39  // --- Variant-specific special buttons
40  // These are reserved the global ID range 16..31
43 };
44 
45 // Common text for the special buttons
46 // - These should appear in the same order as the
47 // KEYPAD_LAYOUT array
48 // - Only include the special buttons as well
49 // as a single entry for the KEYPAD_ID_TXT
50 // - TODO: Remove dummy entry
51 static const char* KEYPAD_SPECIAL_LABEL[] = {
52  "", // Leave dummy entry for KEYPAD_ID_TXT
53  "BS", ".", "-", "ESC", "ENT", "<", ">"
54 };
55 
56 // Text for the basic buttons
57 // - For each of the available keypad layouts, provide a
58 // single character per button.
59 // - Each keypad layout should have the same number of characters,
60 // so use a dummy character (eg. space) if a key button
61 // is unused.
62 
63 // The definition of keypad labels depends on whether
64 // support for extended character sets is required.
65 #if (XKEYPAD_EXTEND_CHAR)
66  // Support extended character set
67  static const char* KEYPAD_SET_LABEL[E_XKEYPAD_SET__MAX][10] = {
68  { // Numeric
69  "0","1","2","3","4","5","6","7","8","9",
70  },
71  };
72 #else
73  // Support ASCII character set
74  static const char* KEYPAD_SET_LABEL[] = {
75  "0123456789", // Num
76 };
77 #endif // XKEYPAD_EXTEND_CHAR
78 
79 
80 // Define a layout of the KeyPad
81 // - { ID, ROW, COL, ROWSPAN< COLSPAN, TYPE }
83  // Text field
84  { KEYPAD_ID_TXT, 0, 1, 1, 4, E_XKEYPAD_TYPE_TXT },
85  // Special buttons
87  { KEYPAD_IDV_DECIMAL, 2, 5, 1, 1, E_XKEYPAD_TYPE_SPECIAL },
88  { KEYPAD_IDV_MINUS, 1, 5, 1, 1, E_XKEYPAD_TYPE_SPECIAL },
89  { KEYPAD_ID_ESC, 0, 6, 1, 2, E_XKEYPAD_TYPE_SPECIAL },
90  { KEYPAD_ID_ENTER, 2, 6, 1, 2, E_XKEYPAD_TYPE_SPECIAL },
91  { KEYPAD_ID_SCROLL_LEFT, 0, 0, 1, 1, E_XKEYPAD_TYPE_SPECIAL },
92  { KEYPAD_ID_SCROLL_RIGHT, 0, 5, 1, 1, E_XKEYPAD_TYPE_SPECIAL },
93  // Basic buttons
94  { KEYPAD_ID_BASIC_START+0 , 1, 0, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "0"
95  { KEYPAD_ID_BASIC_START+1 , 1, 1, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "1",
96  { KEYPAD_ID_BASIC_START+2 , 1, 2, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "2",
97  { KEYPAD_ID_BASIC_START+3 , 1, 3, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "3",
98  { KEYPAD_ID_BASIC_START+4 , 1, 4, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "4",
99  { KEYPAD_ID_BASIC_START+5 , 2, 0, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "5",
100  { KEYPAD_ID_BASIC_START+6 , 2, 1, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "6",
101  { KEYPAD_ID_BASIC_START+7 , 2, 2, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "7" ,
102  { KEYPAD_ID_BASIC_START+8 , 2, 3, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "8",
103  { KEYPAD_ID_BASIC_START+9 , 2, 4, 1, 1, E_XKEYPAD_TYPE_BASIC }, // "9",
104  // End of list
106 };
107 
108 // Define a layout to use for each KeyPad page
110  KEYPAD_LAYOUT, // Num
111 };
112 
113 // Define colors
114 // - Default colors
115 #define XKEYPAD_COL_DISABLE_TXT GSLC_COL_GRAY_LT1
116 #define XKEYPAD_COL_DISABLE_FILL GSLC_COL_BLACK
117 #define XKEYPAD_COL_DEF_TXT GSLC_COL_WHITE
118 #define XKEYPAD_COL_DEF_FRAME GSLC_COL_WHITE
119 #define XKEYPAD_COL_DEF_FILL GSLC_COL_GRAY_DK1
120 #define XKEYPAD_COL_DEF_GLOW GSLC_COL_GRAY_LT3
121 // - Color overrides for common keys
122 #define XKEYPAD_COL_BASIC_FILL GSLC_COL_BLUE_LT1
123 #define XKEYPAD_COL_BASIC_GLOW GSLC_COL_BLUE_LT3
124 #define XKEYPAD_COL_TEXT_TXT GSLC_COL_YELLOW
125 #define XKEYPAD_COL_TEXT_FILL GSLC_COL_BLACK
126 #define XKEYPAD_COL_TEXT_GLOW GSLC_COL_GRAY_DK2
127 #define XKEYPAD_COL_SPACE_FILL GSLC_COL_BLUE_LT1
128 #define XKEYPAD_COL_SPACE_GLOW GSLC_COL_BLUE_LT3
129 #define XKEYPAD_COL_ESC_FILL GSLC_COL_RED_LT1
130 #define XKEYPAD_COL_ESC_GLOW GSLC_COL_RED_LT3
131 #define XKEYPAD_COL_ENTER_FILL GSLC_COL_GREEN_LT1
132 #define XKEYPAD_COL_ENTER_GLOW GSLC_COL_GREEN_LT3
133 #define XKEYPAD_COL_SCROLL_L_FILL GSLC_COL_BLUE_LT1
134 #define XKEYPAD_COL_SCROLL_L_GLOW GSLC_COL_BLUE_LT3
135 #define XKEYPAD_COL_SCROLL_R_FILL GSLC_COL_BLUE_LT1
136 #define XKEYPAD_COL_SCROLL_R_GLOW GSLC_COL_BLUE_LT3
137 // - Color overrides for variant-specific keys
138 #define XKEYPAD_COL_DECIMAL_FILL GSLC_COL_GRAY_DK1
139 #define XKEYPAD_COL_DECIMAL_GLOW GSLC_COL_GRAY_LT3
140 #define XKEYPAD_COL_MINUS_FILL GSLC_COL_GRAY_DK1
141 #define XKEYPAD_COL_MINUS_GLOW GSLC_COL_GRAY_LT3
142 
143 #endif // _GUISLICE_EX_XKEYPAD_NUM_SETUP_H_
Definition: XKeyPad_Num-setup.h:29
static const char * KEYPAD_SPECIAL_LABEL[]
Definition: XKeyPad_Num-setup.h:51
Key information. Defines everything we need to know about a particular key.
Definition: XKeyPad.h:137
Definition: XKeyPad.h:104
Definition: XKeyPad_Num-setup.h:31
static gslc_tsKey KEYPAD_LAYOUT[]
Definition: XKeyPad_Num-setup.h:82
static const int8_t XKEYPAD_LAYOUT_DEFAULT
Definition: XKeyPad_Num-setup.h:35
Definition: XKeyPad_Num-setup.h:41
Definition: XKeyPad.h:126
static gslc_tsKey * KEYPAD_LAYOUTS[E_XKEYPAD_SET__MAX]
Definition: XKeyPad_Num-setup.h:109
Definition: XKeyPad.h:129
Definition: XKeyPad.h:107
static const char * KEYPAD_LABEL_NEGATIVE
Definition: XKeyPad_Num-setup.h:23
Definition: XKeyPad.h:119
Definition: XKeyPad.h:110
static const char * KEYPAD_LABEL_DECIMAL_PT
Definition: XKeyPad_Num-setup.h:24
gslc_teXKeyPadSel
Definition: XKeyPad_Num-setup.h:27
Definition: XKeyPad.h:117
static const char * KEYPAD_SET_LABEL[]
Definition: XKeyPad_Num-setup.h:74
Definition: XKeyPad.h:106
Definition: XKeyPad_Num-setup.h:42
Definition: XKeyPad.h:121
Definition: XKeyPad.h:125
Definition: XKeyPad.h:109
Definition: XKeyPad.h:127