This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.id
108 lines (89 loc) · 2.69 KB
/
demo.id
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* demo.id
*
* This demo displays the current ID address.
*
*/
#ifndef DEMO_H_
#define DEMO_H_
#define DEMO
#define HOLD_FRAMES 5
int numFrames;
unsigned char final[8];
const unsigned char slash[8] =
{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
const unsigned char dashes[8] =
{ 0x00, 0x00, 0x07, 0x00, 0x00, 0xE0, 0x00, 0x00 };
const unsigned char y[10][8] =
{
{ 0x02, 0x05, 0x05, 0x05, 0x02, 0x00, 0x00, 0x00 }, // '0'
{ 0x02, 0x03, 0x02, 0x02, 0x07, 0x00, 0x00, 0x00 }, // '1'
{ 0x03, 0x04, 0x02, 0x01, 0x07, 0x00, 0x00, 0x00 }, // '2'
{ 0x03, 0x04, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00 }, // '3'
{ 0x05, 0x05, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00 }, // '4'
{ 0x07, 0x01, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00 }, // '5'
{ 0x02, 0x01, 0x03, 0x05, 0x02, 0x00, 0x00, 0x00 }, // '6'
{ 0x07, 0x04, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00 }, // '7'
{ 0x02, 0x05, 0x02, 0x05, 0x02, 0x00, 0x00, 0x00 }, // '8'
{ 0x02, 0x05, 0x06, 0x04, 0x02, 0x00, 0x00, 0x00 } // '9'
};
const unsigned char x[10][8] =
{
{ 0x00, 0x00, 0x00, 0x40, 0xA0, 0xA0, 0xA0, 0x40 }, // '0'
{ 0x00, 0x00, 0x00, 0x40, 0x60, 0x40, 0x40, 0xE0 }, // '1'
{ 0x00, 0x00, 0x00, 0x60, 0x80, 0x40, 0x20, 0xE0 }, // '2'
{ 0x00, 0x00, 0x00, 0x60, 0x80, 0x60, 0x80, 0x60 }, // '3'
{ 0x00, 0x00, 0x00, 0xA0, 0xA0, 0xE0, 0x80, 0x80 }, // '4'
{ 0x00, 0x00, 0x00, 0xE0, 0x20, 0x60, 0x80, 0x60 }, // '5'
{ 0x00, 0x00, 0x00, 0x40, 0x20, 0x60, 0xA0, 0x60 }, // '6'
{ 0x00, 0x00, 0x00, 0xE0, 0x80, 0x40, 0x40, 0x40 }, // '7'
{ 0x00, 0x00, 0x00, 0x40, 0xA0, 0x40, 0xA0, 0x40 }, // '8'
{ 0x00, 0x00, 0x00, 0x40, 0xA0, 0xC0, 0x80, 0x40 } // '9'
};
void setup(void)
{
// This code is invoked once to initialize the demo...
bg_red = 0;
bg_green = 0;
bg_blue = 0;
}
void loop(void)
{
// This code is invoked once each time the LEDs are scanned...
if (numFrames > 0)
{
// Hold current image for some frames
numFrames--;
return;
}
numFrames = HOLD_FRAMES;
// Clear the display
fillRect(display_buffer, 0, 0, 8, 8, 0, 0, 0);
// Render slash
txt_red = EIGHTH_INTENSITY;
txt_green = EIGHTH_INTENSITY;
txt_blue = EIGHTH_INTENSITY;
bltChar(display_buffer, slash, 0, 0);
// Implant X and Y addresses
if (Marinara.flags & ID_ASSIGNED)
{
// Show ID in green
txt_red = 0;
txt_green = FULL_INTENSITY;
txt_blue = 0;
bltChar(display_buffer, x[Marinara.x_address], 0, 1);
bltChar(display_buffer, y[Marinara.y_address], 0, 1);
}
else
{
// Show unassigned state in yellow
txt_red = FULL_INTENSITY;
txt_green = FULL_INTENSITY;
txt_blue = 0;
bltChar(display_buffer, dashes, 0, 1);
}
txt_red = FULL_INTENSITY;
txt_green = FULL_INTENSITY;
txt_blue = FULL_INTENSITY;
}
#endif /* DEMO_H_ */