GUIslice  0.16.0
Embedded GUI in C
XKeyPad_Alpha-setup.h
Go to the documentation of this file.
1 #ifndef _GUISLICE_EX_XKEYPAD_ALPHA_SETUP_H_
2 #define _GUISLICE_EX_XKEYPAD_ALPHA_SETUP_H_
3 
4 #include "elem/XKeyPad.h"
5 #include "elem/XKeyPad_Alpha.h"
6 
7 // ============================================================================
8 // This is the setup file associated with the XKeyPad_Alpha
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 18 // Maximum display length (without NULL)
15 
16 // NOTE: XKeyPad_Alpha specifies half-width keys and then
17 // doubles up the width with ColSpan=2. This allows
18 // us to stagger some keys.
19 #define XKEYPAD_KEY_W 12 // Default key width
20 #define XKEYPAD_KEY_H 25 // Default key height
21 
22 #define XKEYPAD_SPACING_X 0 // Default key spacing in X direction
23 #define XKEYPAD_SPACING_Y 0 // Default key spacing in Y direction
24 
25 // Other custom settings / values
26 static const char* XKEYPAD_LABEL_SPACE = " ";
27 
28 // Define the set of available KeyPad layouts
29 typedef enum {
30  // List of keypads
34  // Terminator
37 
38 // Define the startup layout
40 
41 // Define local list of variant-specific button ID types
42 /*
43 enum {
44  // --- Variant-specific special buttons
45  // These are reserved the global ID range 16..31
46  //KEYPAD_IDV_... = 16,
47 };
48 */
49 
50 // Common text for the special buttons
51 // - These should appear in the same order as the
52 // KEYPAD_LAYOUT array
53 // - Only include the special buttons as well
54 // as a single entry for the KEYPAD_ID_TXT
55 // - TODO: Remove dummy entry
56 static const char* KEYPAD_SPECIAL_LABEL[] = {
57  "", // Leave dummy entry for KEYPAD_ID_TXT
58  "BS", " ", "ESC", "ENT", "?123", "<", ">"
59 };
60 
61 // Text for the basic buttons
62 // - For each of the available keypad layouts, provide a
63 // single character per button.
64 // - Each keypad layout should have the same number of characters,
65 // so use a dummy character (eg. space) if a key button
66 // is unused.
67 
68 // The definition of keypad labels depends on whether
69 // support for extended character sets is required.
70 #if (XKEYPAD_EXTEND_CHAR)
71  // Support extended character set
72  static const char* KEYPAD_SET_LABEL[E_XKEYPAD_SET__MAX][26] = {
73  { // Alpha (upper case)
74  "Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M",
75  },
76  { // Alpha (lower case)
77  "q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m",
78  },
79  { // Numeric / symbols
80  "0","1","2","3","4","5","6","7","8","9","+","-","=","%","'","&","(",")",".","@","#","$","/","!","?",",",
81  },
82  };
83 #else
84  // Support ASCII character set
85  static const char* KEYPAD_SET_LABEL[] = {
86  "QWERTYUIOPASDFGHJKLZXCVBNM", // Alpha (upper case)
87  "qwertyuiopasdfghjklzxcvbnm", // Alpha (lower case)
88  "0123456789+-=%'&().@#$/!?,", // Numeric / symbols
89  };
90 #endif // XKEYPAD_EXTEND_CHAR
91 
92 
93 // Keypad selection button
94 // - This is the text used to represent the
95 // keypad select / swap button.
96 // - Entries here should be in the same order as
97 // appear in the gslc_teXKeyPadSel enumeration.
98 static const char* KEYPAD_SPECIAL_SELECT[] = {
99  "ABC",
100  "abc",
101  "123",
102 };
103 
104 // Define a layout of the KeyPad
105 // - { ID, ROW, COL, ROWSPAN, COLSPAN, TYPE }
107  // Text field
108  { KEYPAD_ID_TXT, 0, 2, 1,12, E_XKEYPAD_TYPE_TXT },
109  // Special buttons
111  { KEYPAD_ID_SPACE, 4, 4, 1,12, E_XKEYPAD_TYPE_SPECIAL },
112  { KEYPAD_ID_ESC, 0,16, 1, 4, E_XKEYPAD_TYPE_SPECIAL },
113  { KEYPAD_ID_ENTER, 4,16, 1, 4, E_XKEYPAD_TYPE_SPECIAL },
114  { KEYPAD_ID_SWAP_PAD, 4, 0, 1, 4, E_XKEYPAD_TYPE_SPECIAL },
115  { KEYPAD_ID_SCROLL_LEFT, 0, 0, 1, 2, E_XKEYPAD_TYPE_SPECIAL },
116  { KEYPAD_ID_SCROLL_RIGHT, 0,14, 1, 2, E_XKEYPAD_TYPE_SPECIAL },
117  // Basic buttons
118  { KEYPAD_ID_BASIC_START+0 ,1, 0, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "Q" - "0"
119  { KEYPAD_ID_BASIC_START+1 ,1, 2, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "W" - "1"
120  { KEYPAD_ID_BASIC_START+2 ,1, 4, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "E" - "2"
121  { KEYPAD_ID_BASIC_START+3 ,1, 6, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "R" - "3"
122  { KEYPAD_ID_BASIC_START+4 ,1, 8, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "T" - "4"
123  { KEYPAD_ID_BASIC_START+5 ,1,10, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "Y" - "5"
124  { KEYPAD_ID_BASIC_START+6 ,1,12, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "U" - "6"
125  { KEYPAD_ID_BASIC_START+7 ,1,14, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "I" - "7"
126  { KEYPAD_ID_BASIC_START+8 ,1,16, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "O" - "8"
127  { KEYPAD_ID_BASIC_START+9 ,1,18, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "P" - "9"
128  { KEYPAD_ID_BASIC_START+10,2, 1, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "A" - "+"
129  { KEYPAD_ID_BASIC_START+11,2, 3, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "S" - "-"
130  { KEYPAD_ID_BASIC_START+12,2, 5, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "D" - "="
131  { KEYPAD_ID_BASIC_START+13,2, 7, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "F" - "%"
132  { KEYPAD_ID_BASIC_START+14,2, 9, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "G" - "'"
133  { KEYPAD_ID_BASIC_START+15,2,11, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "H" - "&'
134  { KEYPAD_ID_BASIC_START+16,2,13, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "J" - "("
135  { KEYPAD_ID_BASIC_START+17,2,15, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "K" - ")"
136  { KEYPAD_ID_BASIC_START+18,2,17, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "L" - "."
137  { KEYPAD_ID_BASIC_START+19,3, 2, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "Z" - "@"
138  { KEYPAD_ID_BASIC_START+20,3, 4, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "X" - "#"
139  { KEYPAD_ID_BASIC_START+21,3, 6, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "C" - "$"
140  { KEYPAD_ID_BASIC_START+22,3, 8, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "V" - "/"
141  { KEYPAD_ID_BASIC_START+23,3,10, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "B" - "!"
142  { KEYPAD_ID_BASIC_START+24,3,12, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "N" - "?"
143  { KEYPAD_ID_BASIC_START+25,3,14, 1, 2, E_XKEYPAD_TYPE_BASIC }, // "M" - ","
144  // End of list
146 };
147 
148 // Define a layout to use for each KeyPad page
150  KEYPAD_LAYOUT, // Upper
151  KEYPAD_LAYOUT, // Lower
152  KEYPAD_LAYOUT, // Num
153 };
154 
155 // Define colors
156 // - Default colors
157 #define XKEYPAD_COL_DISABLE_TXT GSLC_COL_GRAY_LT1
158 #define XKEYPAD_COL_DISABLE_FILL GSLC_COL_BLACK
159 #define XKEYPAD_COL_DEF_TXT GSLC_COL_WHITE
160 #define XKEYPAD_COL_DEF_FRAME GSLC_COL_WHITE
161 #define XKEYPAD_COL_DEF_FILL GSLC_COL_GRAY_DK1
162 #define XKEYPAD_COL_DEF_GLOW GSLC_COL_GRAY_LT3
163 // - Color overrides for common keys
164 #define XKEYPAD_COL_BASIC_FILL GSLC_COL_BLUE_LT1
165 #define XKEYPAD_COL_BASIC_GLOW GSLC_COL_BLUE_LT3
166 #define XKEYPAD_COL_TEXT_TXT GSLC_COL_YELLOW
167 #define XKEYPAD_COL_TEXT_FILL GSLC_COL_BLACK
168 #define XKEYPAD_COL_TEXT_GLOW GSLC_COL_GRAY_DK2
169 #define XKEYPAD_COL_SPACE_FILL GSLC_COL_BLUE_LT1
170 #define XKEYPAD_COL_SPACE_GLOW GSLC_COL_BLUE_LT3
171 #define XKEYPAD_COL_ESC_FILL GSLC_COL_RED_LT1
172 #define XKEYPAD_COL_ESC_GLOW GSLC_COL_RED_LT3
173 #define XKEYPAD_COL_ENTER_FILL GSLC_COL_GREEN_LT1
174 #define XKEYPAD_COL_ENTER_GLOW GSLC_COL_GREEN_LT3
175 #define XKEYPAD_COL_SCROLL_L_FILL GSLC_COL_BLUE_LT1
176 #define XKEYPAD_COL_SCROLL_L_GLOW GSLC_COL_BLUE_LT3
177 #define XKEYPAD_COL_SCROLL_R_FILL GSLC_COL_BLUE_LT1
178 #define XKEYPAD_COL_SCROLL_R_GLOW GSLC_COL_BLUE_LT3
179 // - Color overrides for variant-specific keys
180 // ...
181 
182 #endif // _GUISLICE_EX_XKEYPAD_ALPHA_SETUP_H_
static const char * KEYPAD_SET_LABEL[]
Definition: XKeyPad_Alpha-setup.h:85
Key information. Defines everything we need to know about a particular key.
Definition: XKeyPad.h:137
Definition: XKeyPad.h:104
static const char * KEYPAD_SPECIAL_LABEL[]
Definition: XKeyPad_Alpha-setup.h:56
gslc_teXKeyPadSel
Definition: XKeyPad_Alpha-setup.h:29
Definition: XKeyPad_Alpha-setup.h:35
Definition: XKeyPad.h:126
Definition: XKeyPad.h:129
Definition: XKeyPad.h:107
static const char * XKEYPAD_LABEL_SPACE
Definition: XKeyPad_Alpha-setup.h:26
Definition: XKeyPad_Alpha-setup.h:33
static const char * KEYPAD_SPECIAL_SELECT[]
Definition: XKeyPad_Alpha-setup.h:98
Definition: XKeyPad.h:119
Definition: XKeyPad.h:110
Definition: XKeyPad.h:105
Definition: XKeyPad_Alpha-setup.h:31
static gslc_tsKey * KEYPAD_LAYOUTS[E_XKEYPAD_SET__MAX]
Definition: XKeyPad_Alpha-setup.h:149
Definition: XKeyPad.h:117
static const int8_t XKEYPAD_LAYOUT_DEFAULT
Definition: XKeyPad_Alpha-setup.h:39
Definition: XKeyPad.h:106
Definition: XKeyPad.h:121
Definition: XKeyPad_Alpha-setup.h:32
Definition: XKeyPad.h:125
static gslc_tsKey KEYPAD_LAYOUT[]
Definition: XKeyPad_Alpha-setup.h:106
Definition: XKeyPad.h:108
Definition: XKeyPad.h:109
Definition: XKeyPad.h:127