-
Notifications
You must be signed in to change notification settings - Fork 0
/
WidgetShield.h
41 lines (35 loc) · 994 Bytes
/
WidgetShield.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
*WidgetShield.h
*Created By: Nick Burek
*Date of Creation:
*Date of last edit: 4/25/12
*/
#ifndef WidgetShield_h
#define WidgetShield_h
#include "WProgram.h"
#include "Widget.h"
#define START_SEND_COMMAND (char)0x7C
#define ESCAPE_CHARACTER (char)0x7D
#define ADD_WIDGET_COMMAND (char)0x01
#define REMOVE_WIDGET_COMMAND (char)0x02
#define MOVE_WIDGET_COMMAND (char)0x03
#define SEND_WIDGET_COMMAND (char)0x04
#define RESET_WIDGET_SHIELD (char)0x05
class WidgetShield
{
//class member declarations
public:
WidgetShield();
static WidgetShield* Instance();
void addWidget(Widget* w);
void removeWidget(Widget* w);
void moveWidget(Widget* w, uint16_t x, uint16_t y);
void sendWidgetCommand(char data[], char length);
void uint16ToCharArray(uint16_t i, char* data);
void resetWidgetShield();
private:
static WidgetShield *p_instance;
void sendData(char function, char data[],char length);
char receiveByte();
};
#endif