PokittoConsole.h
Go to the documentation of this file.
1 /**************************************************************************/
35 /**************************************************************************/
36 
37 #ifndef POKITTO_CONSOLE_H
38 #define POKITTO_CONSOLE_H
39 
40 #include "Pokitto_settings.h"
41 #include "PokittoButtons.h"
42 #include <stdint.h>
43 
44 struct consmsg {
45  uint32_t val;
46  uint8_t valtype;
47  uint8_t msgsource;
48  uint8_t msgtype;
49 };
50 
52 #define V_UINT8 0
53 #define V_INT8 1
54 #define V_UINT16 2
55 #define V_INT16 3
56 #define V_UINT32 4
57 #define V_INT32 5
58 #define V_FLOAT 6
59 #define V_STRING 7
60 #define V_NONE 8
61 
63 #define MSG_NULL 0
64 #define MSG_OK 1
65 #define MSG_WARNING 2
66 #define MSG_FATAL 255
67 #define MSG_INIT_OK 3
68 #define MSG_INIT_FAIL 4
69 #define MSG_NOT_ENOUGH_MEM 5
70 #define MSG_GFX_MODE_CHANGE 6
71 #define MSG_GFX_MODE_INVALID 7
72 #define MSG_UP 8
73 #define MSG_DOWN 9
74 #define MSG_PRINT 10
75 #define MSG_BREAK 11
76 #define MSG_YESNO 12
77 #define MSG_YES 13
78 #define MSG_NO 14
79 #define MSG_OBJECT 15
80 #define MSG_OBJECT2 16
81 
83 #define MSOURCE_NULL 0
84 #define MSOURCE_SD 1
85 #define MSOURCE_LCD 2
86 #define MSOURCE_SOUND 3
87 #define MSOURCE_TIMER 4
88 #define MSOURCE_BTNA 5
89 #define MSOURCE_BTNB 6
90 #define MSOURCE_BTNC 7
91 #define MSOURCE_BTNU 8
92 #define MSOURCE_BTND 9
93 #define MSOURCE_BTNL 10
94 #define MSOURCE_BTNR 11
95 #define MSOURCE_BATT 12
96 #define MSOURCE_APP 13
97 #define MSOURCE_USER 14
98 #define MSOURCE_COLLISION 15
99 
101 #define CONS_OVERLAY 0x1
102 #define CONS_PAUSE 0x2
103 #define CONS_STEP 0x4
104 #define CONS_VISIBLE 0x8
105 
106 
108 #define CONS_TIMEOUT 20
109 extern uint16_t conscounter;
110 
111 
112 
113 namespace Pokitto {
114 
115 class Display;
116 
117 class Console {
118 public:
120  Console();
121 
122  static uint8_t mode;
123  static uint8_t visible;
124  static unsigned char* font;
125  static void Toggle();
126  static void AddMessage(uint8_t, uint8_t, uint8_t, uint32_t);
127  static void AddMessage(uint8_t, uint8_t);
128  static void AddMessage(uint8_t, char*);
129  static void AddMessage(uint8_t, uint8_t, uint32_t);
130  static void Last();
131  static void First();
132  static void RemoveLast();
133  static void Previous();
134  static void Next();
135  static consmsg GetMessage();
136  static void PrintMessage();
137  static void Purge();
138  static void Draw(); // pokConsole
139 
140 private:
142  static consmsg msgbuf[CONSOLEBUFSIZE];
143  static uint8_t conslast;
144  static uint8_t consfirst;
145  static uint8_t conspointer;
146 public:
147  static uint16_t conscounter;
148  static uint16_t color;
149  static Display* _display;
150  static Buttons* _buttons;
151 };
152 
153 
154 } // namespace
155 
156 // this is the console used by the core if POK_USE_CONSOLE is nonzero
157 extern Pokitto::Console console;
158 
159 #endif // POKITTO_CONSOLE_H
160 
Definition: PokittoButtons.h:57
Definition: PokittoConsole.h:44
Definition: PokittoDisplay.h:136
Definition: PokittoBacklight.h:42
Definition: PokittoConsole.h:117