-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcustom-flash-content.c
320 lines (313 loc) · 7.9 KB
/
custom-flash-content.c
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/*
* custom-flash-content.c
*
* This file contains the definition of the various images, animations
* & texts for the Blinken Button
*
* http://interactive-matter.eu/
*
* This file is part of Blinken Button.
*
* Blinken Button is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Blinken Button is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Blinken Button. If not, see <http://www.gnu.org/licenses/>.
*
*
* Created on: 26.01.2010
*/
//since we define stuff for the flash memory we need the routines and definitions
//for the flash
#include <avr/pgmspace.h>
#include "custom-flash-content.h"
//how often should we display messages - bigger values mean
//less probability to display a message
const uint8_t message_probability = 10;
//how many chars has the longest message
#define MAX_MESSAGE_LENGTH 40
//a buffer for loading messages from flash
char message[MAX_MESSAGE_LENGTH];
/*
* Here you can define the messages. If you want to have more than three
* messages just add another message_0x. But remember to also increase the
* total number of messages in max_messages and add it to the array messages.
*/
const prog_char message_00[] = "INTERACTIVE-MATTER.ORG";
const prog_char message_01[] = "SPACE INVADERS BUTTON";
const prog_char message_02[] = "SPACE INVADERS AGAINST RACISM";
//how much messages do we have in total (see message_00 _01 ...)
const uint8_t max_messages = 3;
//if you define new messages remember to add it here
const PGM_P PROGMEM messages[] =
{ message_00, message_01, message_02 };
//our animations
//first number is # sprites
const prog_uint8_t sprite_0[] =
{ 2, 0, 1 };
const prog_uint8_t sprite_1[] =
{ 2, 2, 3 };
const prog_uint8_t sprite_2[] =
{ 2, 4, 5 };
const prog_uint8_t sprite_3[] =
{ 8, 14, 15, 16, 11, 11, 16, 15, 14 };
const prog_uint8_t sprite_4[] =
{ 7, 8, 9, 10, 11, 10, 9, 8 };
//how many sequences do we have?
const uint8_t max_sequence = 6;
/*the definition of the sequences as array of _sequence_struct (see above):
* First the display speed (lower numbers are faster since it is more a wait timer.
* Second the length, how long the animation is shown.
* Third the animation.
*/
const _sequence_struct sequences[] PROGMEM =
{
//the first two sprites are defined twice - to ensure that they are shown more often
{ 14, 20, sprite_0 },
{ 14, 20, sprite_1 },
{ 14, 20, sprite_0 },
{ 14, 20, sprite_1 },
{ 3, 5, sprite_3 },
{ 3, 5, sprite_4 } };
/*
* This is the definition of sprites that are usable. The bit pattern on the
* display is directly converted to a number and here defined as a number (hex)
*/
const prog_uint8_t predefined_sprites[][8] = {
{
0x18, // ___XX___ 0
0x3C, // __XXXX__
0x7E, // _XXXXXX_
0xDB, // X_XXXX_X
0xFF, // XXXXXXXX
0x24, // __X__X__
0x5A, // _X_XX_X_
0xA5 // X_X__X_X
},
{
0x18, // ___XX___ 1
0x3C, // __XXXX__
0x7E, // _XXXXXX_
0xDB, // X_XXXX_X
0xFF, // XXXXXXXX
0x24, // __X__X__
0x42, // _X____X_
0x24 // __X__X__
},
{
0x24, // __X__X__ 2
0x7E, // _XXXXXX_
0xDB, // XX_XX_XX
0xFF, // XXXXXXXX
0xA5, // X_X__X_X
0x99, // X__XX__X
0x81, // X______X
0xC3 // XX____XX
},
{
0x24, // __X__X__ 3
0x18, // ___XX___
0x7E, // X_XXXX_X
0xDB, // XX_XX_XX
0xFF, // XXXXXXXX
0xDB, // X_XXXX_X
0x99, // X__XX__X
0xC3 // XX____XX
},
{
0x00, // ________ 4
0x00, // ________
0x14, // ___X_X__
0x3E, // __XXXXX_
0x3E, // __XXXXX_
0x1C, // ___XXX__
0x08, // ____X___
0x00 // ________
},
{
0x00, // ________ 5
0x66, // _XX__XX_
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0x7E, // _XXXXXX_
0x3C, // __XXXX__
0x18 // ___XX___
},
{
0xCC, // XX__XX__ 6
0xCC, // XX__XX__
0x33, // __XX__XX
0x33, // __XX__XX
0xCC, // XX__XX__
0xCC, // XX__XX__
0x33, // __XX__XX
0x33 // __XX__XX
},
{
0x33, // __XX__XX 7
0x33, // __XX__XX
0xCC, // XX__XX__
0xCC, // XX__XX__
0x33, // __XX__XX
0x33, // __XX__XX
0xCC, // XX__XX__
0xCC // XX__XX__
},
{
0x00, // ________ 8
0x00, // ________
0x00, // ________
0x18, // ___XX___
0x18, // ___XX___
0x00, // ________
0x00, // ________
0x00 // ________
},
{
0x00, // ________ 9
0x00, // ________
0x3C, // __XXXX__
0x3C, // __XXXX__
0x3C, // __XXXX__
0x3C, // __XXXX__
0x00, // ________
0x00 // ________
},
{
0x00, // ________ 10
0x7E, // _XXXXXX_
0x7E, // _XXXXXX_
0x7E, // _XXXXXX_
0x7E, // _XXXXXX_
0x7E, // _XXXXXX_
0x7E, // _XXXXXX_
0x00 // ________
},
{
0xFF, // XXXXXXXX 11
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF // XXXXXXXX
},
{
0x0F, // ____XXXX 12
0x0F, // ____XXXX
0x0F, // ____XXXX
0x0F, // ____XXXX
0xF0, // XXXX____
0xF0, // XXXX____
0xF0, // XXXX____
0xF0, // XXXX____
},
{
0xF0, // XXXX____ 13
0xF0, // XXXX____
0xF0, // XXXX____
0xF0, // XXXX____
0x0F, // ____XXXX
0x0F, // ____XXXX
0x0F, // ____XXXX
0x0F, // ____XXXX
},
{
0xFF, // XXXXXXXX 14
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0xFF, // XXXXXXXX
},
{
0xFF, // XXXXXXXX 15
0xFF, // XXXXXXXX
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
},
{
0xFF, // XXXXXXXX 16
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0x00, // ________
0x00, // ________
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
0xFF, // XXXXXXXX
},
{
0x10, // ___X____ 17
0x10, // ___X____
0x10, // ___X____
0x1F, // ___XXXXX
0xF8, // XXXXX___
0x08, // ____X___
0x08, // ____X___
0x08, // ____X___
},
{
0x70, // _XXX____ 18
0x31, // __XX___X
0x13, // ___X__XX
0x1F, // ___XXXXX
0xF8, // XXXXX___
0xC8, // XX__X___
0x8C, // X___XX__
0x0E, // ____XXX_
},
{
0xF1, // XXXX___X 19
0x73, // _XXX__XX
0x37, // __XX_XXX
0x1F, // ___XXXXX
0xF8, // XXXXX___
0xEC, // XXX_XX__
0xCE, // XX__XXX_
0x8F, // X___XXXX
},
{
0x04, // _____X__ 20
0x00, // ________
0x80, // X_______
0x00, // ________
0x00, // ________
0x01, // _______X
0x00, // ________
0x20, // __X_____
},
{
0x0E, // ____XXX_ 21
0x84, // X____X__
0xC0, // XX______
0x80, // X_______
0x01, // _______X
0x03, // ______XX
0x21, // __X____X
0x70, // _XXX____
},
{
0x9F, // X__XXXXX 22
0xCE, // XX__XXX_
0xE4, // XXX__X__
0xC1, // XX_____X
0x83, // X_____XX
0x27, // __X__XXX
0x73, // _XXX__XX
0xF9, // XXXXX__X
}
};