Made MD* libraries (Parola, MAX72XX) project specific, to be able to use the newest software version from github.
This commit is contained in:
264
lib/MD_Parola/examples/Parola_Double_Height_Test/Font_Data.h
Normal file
264
lib/MD_Parola/examples/Parola_Double_Height_Test/Font_Data.h
Normal file
@@ -0,0 +1,264 @@
|
||||
// Data file for user example user defined fonts
|
||||
#ifndef FONTDATA_H
|
||||
#define FONTDATA_H
|
||||
|
||||
MD_MAX72XX::fontType_t BigFont[] PROGMEM = {
|
||||
0, // 0
|
||||
0, // 1
|
||||
0, // 2
|
||||
0, // 3
|
||||
0, // 4
|
||||
0, // 5
|
||||
0, // 6
|
||||
0, // 7
|
||||
0, // 8
|
||||
0, // 9
|
||||
0, // 10
|
||||
0, // 11
|
||||
0, // 12
|
||||
0, // 13
|
||||
0, // 14
|
||||
0, // 15
|
||||
0, // 16
|
||||
0, // 17
|
||||
0, // 18
|
||||
0, // 19
|
||||
0, // 20
|
||||
0, // 21
|
||||
0, // 22
|
||||
0, // 23
|
||||
0, // 24
|
||||
0, // 25
|
||||
0, // 26
|
||||
0, // 27
|
||||
0, // 28
|
||||
0, // 29
|
||||
0, // 30
|
||||
0, // 31
|
||||
4, 0, 0, 0, 0, // 32 - 'Space lower'
|
||||
2, 51, 51, // 33 - '! lower'
|
||||
6, 0, 0, 0, 0, 0, 0, // 34 - '" lower'
|
||||
10, 3, 3, 63, 63, 3, 3, 63, 63, 3, 3, // 35 - '# lower'
|
||||
10, 24, 56, 48, 48, 127, 127, 48, 57, 31, 15, // 36 - '$ lower'
|
||||
8, 48, 60, 15, 3, 24, 36, 36, 24, // 37 - '% lower'
|
||||
10, 15, 31, 57, 48, 48, 59, 31, 14, 63, 51, // 38 - '& lower'
|
||||
2, 0, 0, // 39 - ' lower'
|
||||
5, 3, 15, 28, 56, 48, // 40 - '( lower'
|
||||
5, 48, 56, 28, 15, 3, // 41 - ') lower'
|
||||
10, 6, 7, 7, 1, 31, 31, 1, 3, 7, 6, // 42 - '* lower'
|
||||
10, 0, 0, 0, 0, 15, 15, 0, 0, 0, 0, // 43 - '+ lower'
|
||||
2, 176, 112, // 44 - ', lower'
|
||||
9, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 45 - '- lower'
|
||||
2, 48, 48, // 46 - '. lower'
|
||||
8, 48, 60, 15, 3, 0, 0, 0, 0, // 47 - '/ lower'
|
||||
10, 15, 31, 57, 48, 48, 48, 48, 56, 31, 15, // 48 - '0 lower'
|
||||
5, 0, 48, 63, 63, 48, // 49 - '1 lower'
|
||||
10, 63, 63, 49, 48, 48, 48, 48, 48, 48, 48, // 50 - '2 lower'
|
||||
10, 12, 28, 56, 48, 48, 48, 48, 56, 31, 15, // 51 - '3 lower'
|
||||
10, 3, 3, 3, 3, 3, 3, 3, 63, 63, 3, // 52 - '4 lower'
|
||||
10, 12, 28, 56, 48, 48, 48, 48, 56, 31, 15, // 53 - '5 lower'
|
||||
10, 15, 31, 56, 48, 48, 48, 48, 56, 31, 15, // 54 - '6 lower'
|
||||
10, 0, 0, 0, 63, 63, 0, 0, 0, 0, 0, // 55 - '7 lower'
|
||||
10, 15, 31, 57, 48, 48, 48, 48, 57, 31, 15, // 56 - '8 lower'
|
||||
10, 0, 0, 0, 0, 0, 0, 0, 0, 63, 63, // 57 - '9 lower'
|
||||
2, 24, 24, // 58 - ': lower'
|
||||
2, 88, 56, // 59 - '; lower'
|
||||
8, 0, 1, 3, 7, 14, 28, 56, 48, // 60 - '< lower'
|
||||
9, 6, 6, 6, 6, 6, 6, 6, 6, 6, // 61 - '= lower'
|
||||
8, 48, 56, 28, 14, 7, 3, 1, 0, // 62 - '> lower'
|
||||
10, 0, 0, 0, 0, 55, 55, 1, 0, 0, 0, // 63 - '? lower'
|
||||
10, 15, 31, 56, 51, 54, 54, 51, 54, 55, 19, // 64 - '@ lower'
|
||||
10, 63, 63, 1, 1, 1, 1, 1, 1, 63, 63, // 65 - 'A lower'
|
||||
10, 63, 63, 48, 48, 48, 48, 48, 57, 31, 15, // 66 - 'B lower'
|
||||
10, 15, 31, 56, 48, 48, 48, 48, 56, 28, 12, // 67 - 'C lower'
|
||||
10, 63, 63, 48, 48, 48, 48, 48, 56, 31, 15, // 68 - 'D lower'
|
||||
9, 63, 63, 48, 48, 48, 48, 48, 48, 48, // 69 - 'E lower'
|
||||
9, 63, 63, 0, 0, 0, 0, 0, 0, 0, // 70 - 'F lower'
|
||||
10, 15, 31, 56, 48, 48, 48, 49, 57, 31, 15, // 71 - 'G lower'
|
||||
10, 63, 63, 0, 0, 0, 0, 0, 0, 63, 63, // 72 - 'H lower'
|
||||
4, 48, 63, 63, 48, // 73 - 'I lower'
|
||||
8, 12, 28, 56, 48, 48, 56, 31, 15, // 74 - 'J lower'
|
||||
9, 63, 63, 1, 3, 7, 14, 28, 56, 48, // 75 - 'K lower'
|
||||
9, 63, 63, 48, 48, 48, 48, 48, 48, 48, // 76 - 'L lower'
|
||||
10, 63, 63, 0, 0, 0, 0, 0, 0, 63, 63, // 77 - 'M lower'
|
||||
10, 63, 63, 0, 0, 0, 0, 1, 3, 63, 63, // 78 - 'N lower'
|
||||
10, 15, 31, 56, 48, 48, 48, 48, 56, 31, 15, // 79 - 'O lower'
|
||||
10, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, // 80 - 'P lower'
|
||||
10, 15, 31, 56, 48, 48, 54, 62, 28, 63, 55, // 81 - 'Q lower'
|
||||
10, 63, 63, 0, 1, 3, 7, 14, 28, 56, 48, // 82 - 'R lower'
|
||||
10, 24, 56, 48, 48, 48, 48, 48, 57, 31, 15, // 83 - 'S lower'
|
||||
8, 0, 0, 0, 63, 63, 0, 0, 0, // 84 - 'T lower'
|
||||
10, 15, 31, 56, 48, 48, 48, 48, 56, 31, 15, // 85 - 'U lower'
|
||||
10, 3, 7, 14, 28, 56, 56, 28, 14, 7, 3, // 86 - 'V lower'
|
||||
10, 15, 31, 56, 60, 31, 31, 60, 56, 31, 15, // 87 - 'W lower'
|
||||
10, 60, 62, 7, 3, 1, 1, 3, 7, 62, 60, // 88 - 'X lower'
|
||||
10, 0, 0, 0, 0, 63, 63, 0, 0, 0, 0, // 89 - 'Y lower'
|
||||
10, 60, 62, 55, 51, 49, 48, 48, 48, 48, 48, // 90 - 'Z lower'
|
||||
4, 63, 63, 48, 48, // 91 - '[ lower'
|
||||
8, 0, 0, 0, 0, 3, 15, 60, 48, // 92 - '\ lower'
|
||||
4, 48, 48, 63, 63, // 93 - '] lower'
|
||||
8, 0, 0, 0, 0, 0, 0, 0, 0, // 94 - '^ lower'
|
||||
10, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 95 - '_ lower'
|
||||
3, 0, 0, 0, // 96 - '` lower'
|
||||
10, 12, 30, 51, 51, 51, 51, 51, 51, 63, 31, // 97 - 'a lower'
|
||||
10, 63, 63, 28, 56, 48, 48, 48, 56, 31, 15, // 98 - 'b lower'
|
||||
9, 15, 31, 56, 48, 48, 48, 56, 28, 12, // 99 - 'c lower'
|
||||
10, 15, 31, 56, 48, 48, 48, 56, 28, 63, 63, // 100 - 'd lower'
|
||||
9, 15, 31, 59, 51, 51, 51, 59, 27, 9, // 101 - 'e lower'
|
||||
7, 0, 63, 63, 0, 0, 0, 0, // 102 - 'f lower'
|
||||
9, 49, 115, 231, 198, 198, 198, 230, 127, 63, // 103 - 'g lower'
|
||||
9, 63, 63, 0, 0, 0, 0, 0, 63, 63, // 104 - 'h lower'
|
||||
2, 63, 63, // 105 - 'i lower'
|
||||
8, 48, 112, 224, 192, 192, 224, 127, 63, // 106 - 'j lower'
|
||||
8, 63, 63, 3, 7, 15, 28, 56, 48, // 107 - 'k lower'
|
||||
4, 48, 63, 63, 48, // 108 - 'l lower'
|
||||
10, 63, 63, 0, 0, 63, 63, 0, 0, 63, 63, // 109 - 'm lower'
|
||||
9, 63, 63, 0, 0, 0, 0, 0, 63, 63, // 110 - 'n lower'
|
||||
9, 15, 31, 56, 48, 48, 48, 56, 31, 15, // 111 - 'o lower'
|
||||
9, 255, 255, 7, 14, 12, 12, 14, 7, 3, // 112 - 'p lower'
|
||||
9, 3, 7, 14, 12, 12, 14, 7, 255, 255, // 113 - 'q lower'
|
||||
9, 63, 63, 0, 0, 0, 0, 0, 0, 0, // 114 - 'r lower'
|
||||
9, 24, 57, 51, 51, 51, 51, 51, 30, 12, // 115 - 's lower'
|
||||
6, 0, 31, 63, 48, 56, 24, // 116 - 't lower'
|
||||
9, 15, 31, 56, 48, 48, 56, 28, 63, 63, // 117 - 'u lower'
|
||||
9, 7, 15, 28, 56, 48, 56, 28, 15, 7, // 118 - 'v lower'
|
||||
10, 15, 31, 56, 56, 31, 31, 56, 56, 31, 15, // 119 - 'w lower'
|
||||
10, 48, 56, 28, 15, 7, 7, 15, 28, 56, 48, // 120 - 'x lower'
|
||||
9, 49, 115, 230, 198, 198, 198, 230, 127, 63, // 121 - 'y lower'
|
||||
10, 48, 56, 60, 62, 55, 51, 49, 48, 48, 48, // 122 - 'z lower'
|
||||
6, 0, 1, 15, 31, 56, 48, // 123 - '{ lower'
|
||||
2, 255, 255, // 124 - '| lower'
|
||||
6, 48, 56, 31, 15, 1, 0, // 125 - '} lower'
|
||||
0, // 126
|
||||
0, // 127
|
||||
0, // 128
|
||||
0, // 129
|
||||
0, // 130
|
||||
0, // 131
|
||||
0, // 132
|
||||
0, // 133
|
||||
0, // 134
|
||||
0, // 135
|
||||
0, // 136
|
||||
0, // 137
|
||||
0, // 138
|
||||
0, // 139
|
||||
0, // 140
|
||||
0, // 141
|
||||
0, // 142
|
||||
0, // 143
|
||||
0, // 144
|
||||
0, // 145
|
||||
0, // 146
|
||||
0, // 147
|
||||
0, // 148
|
||||
0, // 149
|
||||
0, // 150
|
||||
0, // 151
|
||||
0, // 152
|
||||
0, // 153
|
||||
0, // 154
|
||||
0, // 155
|
||||
0, // 156
|
||||
0, // 157
|
||||
0, // 158
|
||||
0, // 159
|
||||
4, 0, 0, 0, 0, // 160 - 'Space upper'
|
||||
2, 255, 255, // 161 - '! upper'
|
||||
6, 15, 15, 0, 0, 15, 15, // 162 - '" upper'
|
||||
10, 48, 48, 255, 255, 48, 48, 255, 255, 48, 48, // 163 - '# upper'
|
||||
10, 56, 124, 238, 198, 255, 255, 198, 198, 142, 12, // 164 - '$ upper'
|
||||
8, 6, 9, 9, 198, 240, 60, 15, 3, // 165 - '% upper'
|
||||
10, 0, 128, 204, 254, 243, 243, 158, 12, 0, 0, // 166 - '& upper'
|
||||
2, 15, 15, // 167 - '' upper'
|
||||
5, 240, 252, 14, 7, 3, // 168 - '( upper'
|
||||
5, 3, 7, 14, 252, 240, // 169 - ') upper'
|
||||
10, 48, 112, 224, 192, 252, 252, 192, 224, 112, 48, // 170 - '* upper'
|
||||
10, 192, 192, 192, 192, 252, 252, 192, 192, 192, 192, // 171 - '+ upper'
|
||||
2, 0, 0, // 172 - ', upper'
|
||||
9, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 173 - '- upper'
|
||||
2, 0, 0, // 174 - '. upper'
|
||||
8, 0, 0, 0, 192, 240, 60, 15, 3, // 175 - '/ upper'
|
||||
10, 252, 254, 135, 195, 99, 51, 27, 15, 254, 252, // 176 - '0 upper'
|
||||
5, 4, 6, 255, 255, 0, // 177 - '1 upper'
|
||||
10, 12, 142, 199, 195, 195, 195, 195, 231, 126, 60, // 178 - '2 upper'
|
||||
10, 12, 14, 7, 3, 3, 195, 195, 199, 254, 60, // 179 - '3 upper'
|
||||
10, 128, 192, 224, 112, 56, 28, 14, 255, 255, 0, // 180 - '4 upper'
|
||||
10, 63, 63, 51, 51, 51, 51, 51, 115, 227, 195, // 181 - '5 upper'
|
||||
10, 252, 254, 231, 99, 99, 99, 99, 231, 198, 132, // 182 - '6 upper'
|
||||
10, 3, 3, 3, 131, 195, 227, 115, 59, 31, 15, // 183 - '7 upper'
|
||||
10, 28, 190, 247, 227, 195, 195, 227, 247, 190, 28, // 184 - '8 upper'
|
||||
10, 60, 126, 231, 195, 195, 195, 195, 231, 255, 254, // 185 - '9 upper'
|
||||
2, 48, 48, // 186 - ': upper'
|
||||
2, 48, 48, // 187 - '; upper'
|
||||
8, 192, 224, 240, 56, 28, 14, 7, 3, // 188 - '< upper'
|
||||
9, 96, 96, 96, 96, 96, 96, 96, 96, 96, // 189 - '= upper'
|
||||
8, 3, 7, 14, 28, 56, 240, 224, 192, // 190 - '> upper'
|
||||
10, 12, 14, 7, 3, 3, 131, 195, 231, 126, 60, // 191 - '? upper'
|
||||
10, 252, 254, 7, 243, 27, 27, 243, 7, 254, 252, // 192 - '@ upper'
|
||||
10, 248, 254, 134, 131, 131, 131, 131, 134, 254, 248, // 193 - 'A upper'
|
||||
10, 255, 255, 195, 195, 195, 195, 195, 231, 254, 60, // 194 - 'B upper'
|
||||
10, 252, 254, 7, 3, 3, 3, 3, 7, 14, 12, // 195 - 'C upper'
|
||||
10, 255, 255, 3, 3, 3, 3, 3, 7, 254, 252, // 196 - 'D upper'
|
||||
9, 255, 255, 195, 195, 195, 195, 195, 3, 3, // 197 - 'E upper'
|
||||
9, 255, 255, 195, 195, 195, 195, 195, 3, 3, // 198 - 'F upper'
|
||||
10, 252, 254, 7, 3, 3, 3, 131, 135, 142, 140, // 199 - 'G upper'
|
||||
10, 255, 255, 192, 192, 192, 192, 192, 192, 255, 255, // 200 - 'H upper'
|
||||
4, 3, 255, 255, 3, // 201 - 'I upper'
|
||||
8, 3, 3, 3, 3, 3, 3, 255, 255, // 202 - 'J upper'
|
||||
9, 255, 255, 224, 240, 56, 28, 14, 7, 3, // 203 - 'K upper'
|
||||
9, 255, 255, 0, 0, 0, 0, 0, 0, 0, // 204 - 'L upper'
|
||||
10, 255, 255, 14, 28, 120, 120, 28, 14, 255, 255, // 205 - 'M upper'
|
||||
10, 255, 255, 28, 56, 112, 224, 192, 128, 255, 255, // 206 - 'N upper'
|
||||
10, 252, 254, 7, 3, 3, 3, 3, 7, 254, 252, // 207 - 'O upper'
|
||||
10, 255, 255, 195, 195, 195, 195, 195, 231, 126, 60, // 208 - 'P upper'
|
||||
10, 252, 254, 7, 3, 3, 3, 3, 7, 254, 252, // 209 - 'Q upper'
|
||||
10, 255, 255, 195, 195, 195, 195, 195, 231, 126, 60, // 210 - 'R upper'
|
||||
10, 60, 126, 231, 195, 195, 195, 195, 195, 135, 6, // 211 - 'S upper'
|
||||
8, 3, 3, 3, 255, 255, 3, 3, 3, // 212 - 'T upper'
|
||||
10, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, // 213 - 'U upper'
|
||||
10, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, // 214 - 'V upper'
|
||||
10, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, // 215 - 'W upper'
|
||||
10, 15, 31, 56, 240, 224, 224, 240, 56, 31, 15, // 216 - 'X upper'
|
||||
10, 15, 31, 56, 112, 224, 224, 112, 56, 31, 15, // 217 - 'Y upper'
|
||||
10, 3, 3, 3, 131, 195, 227, 115, 59, 31, 15, // 218 - 'Z upper'
|
||||
4, 255, 255, 3, 3, // 219 - '[ upper'
|
||||
8, 3, 15, 60, 240, 192, 0, 0, 0, // 220 - '\ upper'
|
||||
4, 3, 3, 255, 255, // 221 - '] upper'
|
||||
8, 24, 12, 6, 3, 3, 6, 12, 24, // 222 - '^ upper'
|
||||
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 223 - '_ upper'
|
||||
3, 3, 15, 12, // 224 - '` upper'
|
||||
10, 0, 96, 112, 48, 48, 48, 48, 112, 224, 192, // 225 - 'a upper'
|
||||
10, 255, 255, 224, 112, 48, 48, 48, 112, 224, 192, // 226 - 'b upper'
|
||||
9, 192, 224, 112, 48, 48, 48, 112, 224, 192, // 227 - 'c upper'
|
||||
10, 192, 224, 112, 48, 48, 48, 112, 224, 255, 255, // 228 - 'd upper'
|
||||
9, 192, 224, 112, 48, 48, 48, 112, 224, 192, // 229 - 'e upper'
|
||||
7, 192, 252, 254, 199, 199, 14, 12, // 230 - 'f upper'
|
||||
9, 192, 224, 112, 48, 48, 48, 112, 224, 192, // 231 - 'g upper'
|
||||
9, 255, 255, 224, 112, 48, 48, 112, 224, 192, // 232 - 'h upper'
|
||||
2, 246, 246, // 233 - 'i upper'
|
||||
8, 0, 0, 0, 0, 0, 0, 246, 246, // 234 - 'j upper'
|
||||
8, 254, 254, 0, 128, 192, 224, 112, 48, // 235 - 'k upper'
|
||||
4, 3, 255, 255, 0, // 236 - 'l upper'
|
||||
10, 240, 240, 48, 48, 240, 240, 48, 48, 240, 224, // 237 - 'm upper'
|
||||
9, 240, 240, 224, 112, 48, 48, 112, 224, 192, // 238 - 'n upper'
|
||||
9, 192, 224, 112, 48, 48, 48, 112, 224, 192, // 239 - 'o upper'
|
||||
9, 240, 240, 96, 112, 48, 48, 112, 224, 192, // 240 - 'p upper'
|
||||
9, 192, 224, 112, 48, 48, 112, 96, 240, 240, // 241 - 'q upper'
|
||||
9, 240, 240, 224, 112, 48, 48, 112, 224, 192, // 242 - 'r upper'
|
||||
9, 192, 224, 48, 48, 48, 48, 112, 96, 0, // 243 - 's upper'
|
||||
6, 96, 252, 252, 96, 96, 0, // 244 - 't upper'
|
||||
9, 240, 240, 0, 0, 0, 0, 0, 240, 240, // 245 - 'u upper'
|
||||
9, 240, 240, 0, 0, 0, 0, 0, 240, 240, // 246 - 'v upper'
|
||||
10, 240, 240, 0, 0, 0, 0, 0, 0, 240, 240, // 247 - 'w upper'
|
||||
10, 48, 112, 224, 192, 128, 128, 192, 224, 112, 48, // 248 - 'x upper'
|
||||
9, 240, 240, 0, 0, 0, 0, 0, 240, 240, // 249 - 'y upper'
|
||||
10, 48, 48, 48, 48, 48, 176, 240, 240, 112, 48, // 250 - 'z upper'
|
||||
6, 192, 224, 252, 62, 7, 3, // 251 - '{ upper'
|
||||
2, 255, 255, // 252 - '| upper'
|
||||
6, 3, 7, 62, 252, 224, 192, // 253 - '} upper'
|
||||
0, // 254
|
||||
0, // 255
|
||||
};
|
||||
|
||||
#endif
|
@@ -0,0 +1,285 @@
|
||||
// Demonstrates one double height display using Parola using a single font file
|
||||
// definition created with the MD_MAX72xx font builder.
|
||||
//
|
||||
// Each font file has the lower part of a character as ASCII codes 0-127 and the
|
||||
// upper part of the character in ASCII code 128-255. Adding 128 to each lower
|
||||
// character creates the correct index for the upper character.
|
||||
// The upper and lower portions are managed as 2 zones 'stacked' on top of each other
|
||||
// so that the module numbers are in the sequence shown below:
|
||||
//
|
||||
// * Modules (like FC-16) that can fit over each other with no gap
|
||||
// n n-1 n-2 ... n/2+1 <- this direction top row
|
||||
// n/2 ... 3 2 1 0 <- this direction bottom row
|
||||
//
|
||||
// * Modules (like Generic and Parola) that cannot fit over each other with no gap
|
||||
// n/2+1 ... n-2 n-1 n -> this direction top row
|
||||
// n/2 ... 2 1 0 <- this direction bottom row
|
||||
//
|
||||
// Sending the original string to the lower zone and the modified (+128) string to the
|
||||
// upper zone creates the complete message on the display.
|
||||
//
|
||||
// MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
|
||||
//
|
||||
|
||||
#include <MD_Parola.h>
|
||||
#include <MD_MAX72xx.h>
|
||||
#include <SPI.h>
|
||||
#include "Font_Data.h"
|
||||
|
||||
// Turn debugging on and off
|
||||
#define DEBUG 0
|
||||
|
||||
#if DEBUG
|
||||
#define PRINTS(s) { Serial.print(F(s)); }
|
||||
#define PRINT(s, v) { Serial.print(F(s)); Serial.print(v); }
|
||||
#define PRINTX(s, v) { Serial.print(F(s)); Serial.print(F("0x")); Serial.print(v, HEX); }
|
||||
#else
|
||||
#define PRINTS(s)
|
||||
#define PRINT(s, v)
|
||||
#define PRINTX(s, v)
|
||||
#endif
|
||||
|
||||
// User interface pin and switch definitions
|
||||
#define SPEED_IN A5 // control the speed with an external pot
|
||||
|
||||
// Define the number of devices we have in the chain and the hardware interface
|
||||
// NOTE: These pin numbers may not work with your hardware and may need changing
|
||||
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
|
||||
#define MAX_ZONES 2
|
||||
#define ZONE_SIZE 6
|
||||
#define MAX_DEVICES (MAX_ZONES * ZONE_SIZE)
|
||||
|
||||
bool invertUpperZone = false;
|
||||
|
||||
#define PAUSE_TIME 1000
|
||||
#define SPEED_DEADBAND 5 // in analog units
|
||||
|
||||
#define CLK_PIN 13
|
||||
#define DATA_PIN 11
|
||||
#define CS_PIN 10
|
||||
|
||||
// HARDWARE SPI
|
||||
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
|
||||
// SOFTWARE SPI
|
||||
//MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
#define ZONE_LOWER 0
|
||||
#define ZONE_UPPER 1
|
||||
|
||||
// Alignment of the two zones
|
||||
#ifdef INVERT_UPPER_ZONE
|
||||
// if inverted, alignment should be opposite and
|
||||
// CENTER may not work well depending on message
|
||||
#define ALIGN_LOWER PA_LEFT
|
||||
#define ALIGN_UPPER PA_RIGHT
|
||||
#else
|
||||
// if not inverted, should always be the same
|
||||
#define ALIGN_LOWER PA_CENTER
|
||||
#define ALIGN_UPPER ALIGN_LOWER
|
||||
#endif
|
||||
|
||||
char *msgL[] =
|
||||
{
|
||||
"Abc",
|
||||
"123",
|
||||
"xyz"
|
||||
};
|
||||
char* msgH; // allocated memory in setup()
|
||||
|
||||
typedef struct catalogItem_t
|
||||
{
|
||||
bool fPause;
|
||||
uint8_t zFX[MAX_ZONES];
|
||||
};
|
||||
|
||||
catalogItem_t *catalog;
|
||||
|
||||
const PROGMEM catalogItem_t catalogInvert[] =
|
||||
{
|
||||
{ true, { PA_PRINT, PA_PRINT } },
|
||||
{ false, { PA_SCROLL_LEFT, PA_SCROLL_RIGHT } },
|
||||
{ false, { PA_SCROLL_RIGHT, PA_SCROLL_LEFT } },
|
||||
{ true, { PA_SCROLL_UP, PA_SCROLL_UP } },
|
||||
{ true, { PA_SCROLL_DOWN, PA_SCROLL_DOWN } },
|
||||
#if ENA_MISC
|
||||
// { true, { PA_SLICE, PA_SLICE } }, // looks wrong because of reversal
|
||||
{ true, { PA_FADE, PA_FADE } },
|
||||
{ true, { PA_MESH, PA_MESH } },
|
||||
{ true, { PA_BLINDS, PA_BLINDS } },
|
||||
{ true, { PA_DISSOLVE, PA_DISSOLVE } },
|
||||
#endif
|
||||
#if ENA_WIPE
|
||||
{ true, { PA_WIPE, PA_WIPE } },
|
||||
{ true, { PA_WIPE_CURSOR, PA_WIPE_CURSOR } },
|
||||
#endif
|
||||
#if ENA_OPNCLS
|
||||
{ true, { PA_OPENING, PA_OPENING } },
|
||||
{ true, { PA_OPENING_CURSOR, PA_OPENING_CURSOR } },
|
||||
{ true, { PA_CLOSING, PA_CLOSING } },
|
||||
{ true, { PA_CLOSING_CURSOR, PA_CLOSING_CURSOR } },
|
||||
#endif
|
||||
#if ENA_SCR_DIA
|
||||
{ true, { PA_SCROLL_UP_LEFT, PA_SCROLL_UP_LEFT } },
|
||||
{ true, { PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT } },
|
||||
{ true, { PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_LEFT } },
|
||||
{ true, { PA_SCROLL_DOWN_RIGHT, PA_SCROLL_DOWN_RIGHT } },
|
||||
#endif
|
||||
#if ENA_SCAN
|
||||
{ true, { PA_SCAN_HORIZ, PA_SCAN_HORIZ } },
|
||||
{ true, { PA_SCAN_VERT, PA_SCAN_VERT } },
|
||||
#endif
|
||||
#if ENA_GROW
|
||||
{ true, { PA_GROW_UP, PA_GROW_UP } },
|
||||
{ true, { PA_GROW_DOWN, PA_GROW_DOWN } },
|
||||
#endif
|
||||
};
|
||||
|
||||
const PROGMEM catalogItem_t catalogNoInvert[] =
|
||||
{
|
||||
{ true, { PA_PRINT, PA_PRINT } },
|
||||
{ false, { PA_SCROLL_LEFT, PA_SCROLL_LEFT } },
|
||||
{ false, { PA_SCROLL_RIGHT, PA_SCROLL_RIGHT } },
|
||||
{ true, { PA_SCROLL_UP, PA_SCROLL_DOWN } },
|
||||
{ true, { PA_SCROLL_DOWN, PA_SCROLL_UP } },
|
||||
#if ENA_MISC
|
||||
{ true, { PA_SLICE, PA_SLICE } },
|
||||
{ true, { PA_FADE, PA_FADE } },
|
||||
{ true, { PA_MESH, PA_MESH } },
|
||||
{ true, { PA_BLINDS, PA_BLINDS } },
|
||||
{ true, { PA_DISSOLVE, PA_DISSOLVE } },
|
||||
#endif
|
||||
#if ENA_WIPE
|
||||
{ true, { PA_WIPE, PA_WIPE } },
|
||||
{ true, { PA_WIPE_CURSOR, PA_WIPE_CURSOR } },
|
||||
#endif
|
||||
#if ENA_OPNCLS
|
||||
{ true, { PA_OPENING, PA_OPENING } },
|
||||
{ true, { PA_OPENING_CURSOR, PA_OPENING_CURSOR } },
|
||||
{ true, { PA_CLOSING, PA_CLOSING } },
|
||||
{ true, { PA_CLOSING_CURSOR, PA_CLOSING_CURSOR } },
|
||||
#endif
|
||||
#if ENA_SCR_DIA
|
||||
{ true, { PA_SCROLL_UP_LEFT, PA_SCROLL_DOWN_RIGHT } },
|
||||
{ true, { PA_SCROLL_UP_RIGHT, PA_SCROLL_DOWN_LEFT } },
|
||||
{ true, { PA_SCROLL_DOWN_LEFT, PA_SCROLL_UP_RIGHT } },
|
||||
{ true, { PA_SCROLL_DOWN_RIGHT, PA_SCROLL_UP_LEFT } },
|
||||
#endif
|
||||
#if ENA_SCAN
|
||||
{ true, { PA_SCAN_HORIZ, PA_SCAN_HORIZ } },
|
||||
{ true, { PA_SCAN_VERT, PA_SCAN_VERT } },
|
||||
#endif
|
||||
#if ENA_GROW
|
||||
{ true, { PA_GROW_UP, PA_GROW_DOWN } },
|
||||
{ true, { PA_GROW_DOWN, PA_GROW_UP } },
|
||||
#endif
|
||||
};
|
||||
|
||||
void doUI(void)
|
||||
{
|
||||
// set the speed if it has changed
|
||||
int16_t speed = map(analogRead(SPEED_IN), 0, 1023, 0, 100);
|
||||
|
||||
if ((speed >= ((int16_t)P.getSpeed() + SPEED_DEADBAND)) ||
|
||||
(speed <= ((int16_t)P.getSpeed() - SPEED_DEADBAND)))
|
||||
{
|
||||
P.setSpeed(speed);
|
||||
PRINT("\nChanged speed to ", P.getSpeed());
|
||||
}
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
uint8_t max = 0;
|
||||
|
||||
invertUpperZone = (HARDWARE_TYPE == MD_MAX72XX::PAROLA_HW || HARDWARE_TYPE == MD_MAX72XX::GENERIC_HW);
|
||||
catalog = (invertUpperZone ? catalogInvert : catalogNoInvert);
|
||||
|
||||
#if DEBUG
|
||||
Serial.begin(57600);
|
||||
#endif
|
||||
PRINTS("\n[Double_Height_Test]");
|
||||
PRINT("\nSize of catalogItem_t ", sizeof(catalogItem_t));
|
||||
|
||||
// work out the size of buffer required
|
||||
for (uint8_t i = 0; i<ARRAY_SIZE(msgL); i++)
|
||||
{
|
||||
uint8_t l = strlen(msgL[i]);
|
||||
|
||||
if (l > max) max = l;
|
||||
}
|
||||
|
||||
PRINT("\nAllocating memory: ", max + 2);
|
||||
msgH = (char *)malloc(sizeof(char)*(max + 2));
|
||||
|
||||
// initialise the LED display
|
||||
P.begin(MAX_ZONES);
|
||||
|
||||
// Set up zones for 2 halves of the display
|
||||
P.setZone(ZONE_LOWER, 0, ZONE_SIZE - 1);
|
||||
P.setZone(ZONE_UPPER, ZONE_SIZE, MAX_DEVICES-1);
|
||||
P.setFont(BigFont);
|
||||
P.setCharSpacing(P.getCharSpacing() * 2); // double height --> double spacing
|
||||
if (invertUpperZone)
|
||||
{
|
||||
P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_UD);
|
||||
P.setZoneEffect(ZONE_UPPER, true, PA_FLIP_LR);
|
||||
}
|
||||
}
|
||||
|
||||
void createHString(char *pH, char *pL)
|
||||
{
|
||||
for (; *pL != '\0'; pL++)
|
||||
*pH++ = *pL | 0x80; // offset character
|
||||
|
||||
*pH = '\0'; // terminate the string
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static uint8_t idxMsg = 0; // message string index
|
||||
static uint16_t idxCat = 0; // catalog item index
|
||||
|
||||
doUI();
|
||||
P.displayAnimate();
|
||||
|
||||
if (P.getZoneStatus(ZONE_LOWER) && P.getZoneStatus(ZONE_UPPER))
|
||||
{
|
||||
catalogItem_t ci;
|
||||
|
||||
PRINT("\nC", idxCat);
|
||||
PRINT(": M", idxMsg);
|
||||
PRINT(": A ", (uint16_t)&catalog[idxCat]);
|
||||
PRINT(": ", msgL[idxMsg]);
|
||||
|
||||
// copy the next catalog item into RAM
|
||||
memcpy_P(&ci, &catalog[idxCat], sizeof(catalogItem_t));
|
||||
|
||||
// set up the ZONE_UPPER string
|
||||
createHString(msgH, msgL[idxMsg]);
|
||||
|
||||
// renew and start the display
|
||||
P.displayClear();
|
||||
|
||||
P.displayZoneText(ZONE_LOWER, msgL[idxMsg], ALIGN_LOWER,
|
||||
P.getSpeed(), ci.fPause ? PAUSE_TIME : 0,
|
||||
ci.zFX[ZONE_LOWER], ci.zFX[ZONE_LOWER]);
|
||||
P.displayZoneText(ZONE_UPPER, msgH, ALIGN_UPPER,
|
||||
P.getSpeed(), ci.fPause ? PAUSE_TIME : 0,
|
||||
ci.zFX[ZONE_UPPER], ci.zFX[ZONE_UPPER]);
|
||||
|
||||
// prepare indices for next pass
|
||||
idxMsg++;
|
||||
if (idxMsg == ARRAY_SIZE(msgL))
|
||||
{
|
||||
idxMsg = 0;
|
||||
idxCat++;
|
||||
if (idxCat == ARRAY_SIZE(catalog))
|
||||
idxCat = 0;
|
||||
}
|
||||
|
||||
// synchronise the start and let the display run
|
||||
P.synchZoneStart();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user