Made MD* libraries (Parola, MAX72XX) project specific, to be able to use the newest software version from github.

This commit is contained in:
2019-02-01 15:21:58 +01:00
parent fe9f25c856
commit c7547144d2
761 changed files with 108577 additions and 2 deletions

View File

@@ -0,0 +1,265 @@
// Data file for user example user defined fonts
#ifndef FONTS_DATA_H
#define FONTS_DATA_H
MD_MAX72XX::fontType_t _fontVertical[] PROGMEM = {
0, // 0 - 'Empty Cell'
7, 28, 34, 54, 62, 42, 62, 28, // 1 - 'Sad Smiley'
7, 28, 54, 34, 62, 42, 62, 28, // 2 - 'Happy Smiley'
6, 8, 28, 62, 62, 62, 20, // 3 - 'Heart'
6, 8, 28, 62, 62, 28, 8, // 4 - 'Diamond'
7, 28, 8, 62, 42, 62, 20, 28, // 5 - 'Clubs'
7, 28, 8, 62, 62, 62, 28, 8, // 6 - 'Spades'
4, 8, 28, 28, 8, // 7 - 'Bullet Point'
8, 62, 62, 54, 34, 34, 54, 62, 62, // 8 - 'Rev Bullet Point'
4, 8, 20, 20, 8, // 9 - 'Hollow Bullet Point'
8, 62, 62, 54, 42, 42, 54, 62, 62, // 10 - 'Rev Hollow BP'
6, 4, 10, 10, 44, 48, 56, // 11 - 'Male'
7, 8, 62, 8, 28, 34, 34, 28, // 12 - 'Female'
7, 6, 4, 4, 4, 60, 36, 60, // 13 - 'Music Note 1'
7, 6, 52, 36, 36, 60, 36, 60, // 14 - 'Music Note 2'
8, 8, 42, 28, 54, 54, 28, 42, 8, // 15 - 'Snowflake'
7, 2, 6, 30, 62, 30, 6, 2, // 16 - 'Right Pointer'
7, 32, 48, 60, 62, 60, 48, 32, // 17 - 'Left Pointer'
7, 8, 28, 42, 8, 42, 28, 8, // 18 - 'UpDown Arrows'
7, 54, 0, 54, 54, 54, 54, 54, // 19 - 'Double Exclamation'
7, 40, 40, 40, 44, 42, 42, 60, // 20 - 'Paragraph Mark'
8, 12, 18, 18, 8, 20, 10, 18, 12, // 21 - 'Section Mark'
2, 62, 62, // 22 - 'Double Underline'
8, 62, 8, 28, 42, 8, 42, 28, 8, // 23 - 'UpDown Underlined'
6, 8, 8, 8, 42, 28, 8, // 24 - 'Up Arrow'
6, 8, 28, 42, 8, 8, 8, // 25 - 'Down Arrow'
5, 8, 16, 62, 16, 8, // 26 - 'Right Arrow'
5, 8, 4, 62, 4, 8, // 27 - 'Left Arrow'
5, 0, 62, 2, 2, 2, // 28 - 'Angled'
4, 20, 62, 62, 20, // 29 - 'Squashed #'
5, 62, 62, 28, 8, 8, // 30 - 'Up Pointer'
5, 8, 8, 28, 62, 62, // 31 - 'Down Pointer'
2, 0, 0, // 32 - 'Space'
7, 8, 0, 8, 8, 8, 8, 8, // 33 - '!'
4, 0, 20, 20, 20, // 34 - '"'
7, 20, 20, 62, 20, 62, 20, 20, // 35 - '#'
7, 8, 30, 40, 28, 10, 60, 8, // 36 - '$'
7, 48, 50, 4, 8, 16, 38, 6, // 37 - '%'
7, 44, 18, 42, 4, 10, 10, 4, // 38 - '&'
4, 4, 8, 24, 24, // 39 - '''
8, 0, 16, 8, 4, 4, 4, 8, 16, // 40 - '('
8, 0, 4, 8, 16, 16, 16, 8, 4, // 41 - ')'
8, 0, 8, 42, 28, 62, 28, 42, 8, // 42 - '*'
5, 8, 8, 62, 8, 8, // 43 - '+'
4, 4, 8, 24, 24, // 44 - ','
1, 62, // 45 - '-'
2, 12, 12, // 46 - '.'
5, 2, 4, 8, 16, 32, // 47 - '/'
7, 28, 34, 38, 42, 50, 34, 28, // 48 - '0'
7, 28, 8, 8, 8, 8, 12, 8, // 49 - '1'
7, 62, 2, 2, 28, 32, 34, 28, // 50 - '2'
7, 28, 34, 32, 24, 16, 32, 62, // 51 - '3'
7, 16, 16, 62, 18, 20, 24, 16, // 52 - '4'
7, 28, 34, 32, 32, 30, 2, 62, // 53 - '5'
7, 28, 34, 34, 30, 2, 4, 56, // 54 - '6'
7, 2, 4, 8, 16, 32, 32, 62, // 55 - '7'
7, 28, 34, 34, 28, 34, 34, 28, // 56 - '8'
7, 14, 16, 32, 60, 34, 34, 28, // 57 - '9'
3, 8, 0, 8, // 58 - ':'
5, 4, 8, 8, 0, 8, // 59 - ';'
7, 32, 16, 8, 4, 8, 16, 32, // 60 - '<'
3, 62, 0, 62, // 61 - '='
7, 4, 8, 16, 32, 16, 8, 4, // 62 - '>'
7, 8, 0, 8, 24, 32, 34, 28, // 63 - '?'
7, 60, 2, 26, 58, 42, 34, 28, // 64 - '@'
7, 34, 34, 62, 34, 34, 20, 8, // 65 - 'A'
7, 30, 34, 34, 30, 34, 34, 30, // 66 - 'B'
7, 28, 34, 2, 2, 2, 34, 28, // 67 - 'C'
7, 30, 34, 34, 34, 34, 34, 30, // 68 - 'D'
7, 62, 2, 2, 30, 2, 2, 62, // 69 - 'E'
7, 2, 2, 2, 30, 2, 2, 62, // 70 - 'F'
7, 60, 34, 50, 2, 2, 34, 60, // 71 - 'G'
7, 34, 34, 34, 62, 34, 34, 34, // 72 - 'H'
7, 28, 8, 8, 8, 8, 8, 28, // 73 - 'I'
7, 12, 18, 16, 16, 16, 16, 56, // 74 - 'J'
7, 34, 18, 10, 6, 10, 18, 34, // 75 - 'K'
7, 62, 2, 2, 2, 2, 2, 2, // 76 - 'L'
7, 34, 34, 42, 42, 42, 54, 34, // 77 - 'M'
7, 34, 34, 50, 42, 38, 34, 34, // 78 - 'N'
7, 28, 34, 34, 34, 34, 34, 28, // 79 - 'O'
7, 2, 2, 2, 30, 34, 34, 30, // 80 - 'P'
7, 44, 18, 42, 34, 34, 34, 28, // 81 - 'Q'
7, 34, 18, 10, 30, 34, 34, 30, // 82 - 'R'
7, 28, 34, 32, 28, 2, 34, 28, // 83 - 'S'
7, 8, 8, 8, 8, 8, 42, 62, // 84 - 'T'
7, 28, 34, 34, 34, 34, 34, 34, // 85 - 'U'
7, 8, 20, 34, 34, 34, 34, 34, // 86 - 'V'
7, 20, 42, 42, 42, 34, 34, 34, // 87 - 'W'
7, 34, 34, 20, 8, 20, 34, 34, // 88 - 'X'
7, 8, 8, 8, 8, 20, 34, 34, // 89 - 'Y'
7, 62, 2, 4, 28, 16, 32, 62, // 90 - 'Z'
7, 28, 4, 4, 4, 4, 4, 28, // 91 - '['
5, 32, 16, 8, 4, 2, // 92 - '\'
7, 28, 16, 16, 16, 16, 16, 28, // 93 - ']'
5, 0, 0, 34, 20, 8, // 94 - '^'
1, 62, // 95 - '_'
6, 0, 0, 16, 8, 12, 12, // 96 - '`'
5, 60, 18, 28, 16, 12, // 97 - 'a'
7, 26, 38, 34, 38, 26, 2, 2, // 98 - 'b'
5, 28, 34, 2, 34, 28, // 99 - 'c'
7, 44, 50, 34, 50, 44, 32, 32, // 100 - 'd'
5, 28, 2, 62, 34, 28, // 101 - 'e'
7, 8, 8, 8, 28, 8, 40, 16, // 102 - 'f'
7, 28, 34, 32, 44, 50, 50, 28, // 103 - 'g'
7, 34, 34, 34, 38, 26, 2, 2, // 104 - 'h'
8, 28, 8, 8, 8, 8, 12, 0, 8, // 105 - 'i'
8, 12, 18, 18, 16, 16, 16, 0, 16, // 106 - 'j'
7, 18, 10, 6, 10, 18, 2, 2, // 107 - 'k'
7, 28, 8, 8, 8, 8, 8, 12, // 108 - 'l'
5, 42, 42, 42, 42, 22, // 109 - 'm'
5, 34, 34, 34, 38, 26, // 110 - 'n'
5, 28, 34, 34, 34, 28, // 111 - 'o'
7, 2, 2, 2, 26, 38, 38, 26, // 112 - 'p'
7, 32, 32, 32, 44, 50, 50, 44, // 113 - 'q'
5, 2, 2, 2, 38, 26, // 114 - 'r'
5, 30, 32, 28, 2, 60, // 115 - 's'
7, 8, 20, 4, 4, 30, 4, 4, // 116 - 't'
5, 44, 50, 34, 34, 34, // 117 - 'u'
5, 8, 20, 34, 34, 34, // 118 - 'v'
5, 20, 42, 42, 34, 34, // 119 - 'w'
5, 34, 20, 8, 20, 34, // 120 - 'x'
7, 28, 34, 32, 60, 34, 34, 34, // 121 - 'y'
5, 62, 4, 8, 16, 62, // 122 - 'z'
7, 16, 8, 8, 4, 8, 8, 16, // 123 - '{'
7, 8, 8, 8, 0, 8, 8, 8, // 124 - '|'
7, 4, 8, 8, 16, 8, 8, 4, // 125 - '}'
3, 16, 42, 4, // 126 - '~'
6, 62, 34, 34, 54, 28, 8, // 127 - 'Hollow Up Arrow'
8, 12, 16, 28, 34, 2, 2, 34, 28, // 128 - 'C sedilla'
6, 44, 50, 34, 34, 0, 20, // 129 - 'u umlaut'
7, 60, 2, 62, 34, 28, 0, 48, // 130 - 'e acute'
7, 60, 18, 28, 16, 12, 0, 62, // 131 - 'a accent'
7, 60, 18, 28, 16, 12, 0, 34, // 132 - 'a umlaut'
7, 60, 18, 28, 16, 12, 0, 6, // 133 - 'a grave'
7, 60, 18, 28, 16, 12, 0, 24, // 134 - 'a acute'
6, 24, 16, 60, 6, 6, 60, // 135 - 'c sedilla'
7, 60, 2, 62, 34, 28, 0, 62, // 136 - 'e accent'
7, 60, 2, 62, 34, 28, 0, 20, // 137 - 'e umlaut'
7, 60, 2, 62, 34, 28, 0, 6, // 138 - 'e grave'
7, 28, 8, 8, 8, 12, 0, 20, // 139 - 'i umlaut'
7, 28, 8, 8, 8, 12, 18, 12, // 140 - 'i hat'
7, 28, 8, 8, 8, 12, 0, 6, // 141 - 'i grave'
9, 34, 34, 62, 34, 34, 20, 8, 0, 20, // 142 - 'A umlaut'
9, 34, 34, 62, 34, 34, 20, 8, 0, 8, // 143 - 'A dot'
9, 30, 2, 2, 14, 2, 2, 30, 0, 24, // 144 - 'E grave'
5, 124, 18, 124, 144, 124, // 145 - 'ae'
7, 242, 18, 18, 254, 18, 20, 248, // 146 - 'AE'
7, 28, 34, 34, 28, 0, 34, 28, // 147 - 'o hat'
6, 28, 34, 34, 28, 0, 20, // 148 - 'o umlaut'
6, 28, 34, 34, 28, 0, 6, // 149 - 'o grave'
7, 44, 50, 34, 34, 0, 34, 28, // 150 - 'u hat'
6, 44, 50, 34, 34, 0, 6, // 151 - 'u grave'
8, 14, 16, 28, 18, 18, 18, 0, 18, // 152 - 'y umlaut'
9, 28, 34, 34, 34, 34, 34, 28, 0, 20, // 153 - 'O umlaut'
9, 28, 34, 34, 34, 34, 34, 34, 0, 20, // 154 - 'U umlaut'
8, 8, 8, 62, 10, 10, 62, 8, 8, // 155 - 'Cents'
7, 62, 36, 4, 14, 36, 52, 24, // 156 - 'Pounds'
8, 8, 8, 62, 8, 62, 28, 54, 54, // 157 - 'Yen'
8, 18, 18, 58, 18, 14, 18, 18, 14, // 158 - 'R +'
8, 6, 10, 8, 8, 28, 8, 40, 48, // 159 - 'f notation'
7, 60, 18, 28, 16, 12, 0, 48, // 160 - 'a acute'
7, 28, 8, 8, 8, 12, 0, 24, // 161 - 'i acute'
6, 28, 34, 34, 28, 0, 48, // 162 - 'o acute'
6, 44, 50, 34, 34, 0, 48, // 163 - 'u acute'
7, 18, 18, 18, 18, 14, 0, 30, // 164 - 'n accent'
9, 34, 50, 50, 42, 42, 38, 38, 0, 62, // 165 - 'N accent'
6, 62, 0, 60, 18, 18, 28, // 166
6, 62, 0, 28, 34, 34, 28, // 167
7, 28, 34, 2, 12, 8, 0, 8, // 168 - 'Inverted ?'
3, 2, 2, 62, // 169
3, 32, 32, 62, // 170
8, 56, 8, 50, 36, 58, 18, 34, 2, // 171 - '1/2'
8, 32, 32, 58, 52, 42, 18, 34, 2, // 172 - '1/4'
7, 8, 8, 8, 8, 0, 8, 8, // 173 - '| split'
5, 40, 20, 10, 20, 40, // 174 - '<<'
5, 10, 20, 40, 20, 10, // 175 - '>>'
8, 17, 68, 17, 68, 17, 68, 17, 68, // 176 - '30% shading'
8, 170, 85, 170, 85, 170, 85, 170, 85, // 177 - '50% shading'
8, 16, 16, 16, 16, 16, 16, 16, 16, // 178 - 'Right side'
8, 16, 16, 16, 31, 16, 16, 16, 16, // 179 - 'Right T'
8, 16, 16, 16, 31, 16, 31, 16, 16, // 180 - 'Right T double H'
8, 20, 20, 20, 23, 20, 20, 20, 20, // 181 - 'Right T double V'
4, 20, 20, 20, 31, // 182 - 'Top Right double V'
6, 16, 16, 16, 31, 16, 31, // 183 - 'Top Right double H'
8, 20, 20, 20, 23, 16, 23, 20, 20, // 184 - 'Right T double all'
8, 20, 20, 20, 20, 20, 20, 20, 20, // 185 - 'Right side double'
6, 20, 20, 20, 23, 16, 31, // 186 - 'Top Right double'
8, 0, 0, 0, 31, 16, 23, 20, 20, // 187 - 'Bot Right double'
8, 0, 0, 0, 31, 20, 20, 20, 20, // 188 - 'Bot Right double V'
8, 0, 0, 0, 31, 16, 31, 16, 16, // 189 - 'Bot Right double H'
4, 16, 16, 16, 31, // 190 - 'Top Right'
8, 0, 0, 0, 24, 8, 8, 8, 8, // 191 - 'Bot Left'
8, 0, 0, 0, 31, 8, 8, 8, 8, // 192 - 'Bot T'
4, 8, 8, 8, 31, // 193 - 'Top T'
8, 8, 8, 8, 24, 8, 8, 8, 8, // 194 - 'Left T'
4, 0, 0, 0, 31, // 195 - 'Top side'
8, 8, 8, 8, 31, 8, 8, 8, 8, // 196 - 'Center +'
8, 8, 8, 8, 24, 8, 24, 8, 8, // 197 - 'Left side double H'
8, 20, 20, 20, 20, 20, 20, 20, 20, // 198 - 'Left side double'
6, 0, 0, 0, 232, 8, 248, // 199 - 'Bot Left double V'
6, 20, 20, 20, 20, 4, 28, // 200 - 'Top Left double V'
8, 0, 0, 0, 31, 0, 23, 20, 20, // 201 - 'Bot T double'
6, 20, 20, 20, 23, 0, 31, // 202 - 'Top T double'
8, 20, 20, 20, 20, 4, 20, 20, 20, // 203 - 'Left Side double spl'
6, 0, 0, 0, 31, 0, 31, // 204 - 'Center double'
8, 20, 20, 20, 23, 0, 23, 20, 20, // 205 - 'Center + double'
8, 0, 0, 0, 31, 0, 31, 8, 8, // 206 - 'Bot T double H'
8, 0, 0, 0, 31, 20, 20, 20, 20, // 207 - 'Bot Right double V'
6, 8, 8, 8, 31, 0, 31, // 208 - 'Top T double H'
4, 20, 20, 20, 31, // 209 - 'Top Right double V'
8, 0, 0, 0, 28, 20, 20, 20, 20, // 210 - 'Bot Left double V'
8, 0, 0, 0, 24, 8, 24, 8, 8, // 211 - 'Bot Right double H'
6, 8, 8, 8, 24, 8, 24, // 212 - 'Top Right double H'
4, 20, 20, 20, 28, // 213 - 'Top Right double V'
8, 20, 20, 20, 31, 20, 20, 20, 20, // 214 - 'Center + double V'
8, 8, 8, 8, 31, 8, 31, 8, 8, // 215 - 'Center + double H'
8, 0, 0, 0, 31, 16, 16, 16, 16, // 216 - 'Bot Right'
5, 0, 0, 0, 240, 16, // 217 - 'Top Left'
8, 255, 255, 255, 255, 255, 255, 255, 255, // 218 - 'Full Block'
5, 255, 255, 255, 255, 255, // 219 - 'Half Block Bottom'
8, 15, 15, 15, 15, 15, 15, 15, 15, // 220 - 'Half Block LHS'
8, 240, 240, 240, 240, 240, 240, 240, 240, // 221 - 'Half Block RHS'
8, 0, 0, 0, 0, 255, 255, 255, 255, // 222 - 'Half Block Top'
5, 44, 18, 18, 18, 44, // 223 - 'Alpha'
8, 2, 30, 34, 34, 30, 34, 34, 28, // 224 - 'Beta'
7, 2, 2, 2, 2, 2, 50, 62, // 225 - 'Gamma'
6, 20, 20, 20, 20, 20, 62, // 226 - 'Pi'
7, 62, 34, 4, 8, 4, 34, 62, // 227 - 'Sigma'
5, 12, 18, 18, 18, 60, // 228 - 'Theta'
6, 6, 44, 20, 20, 20, 20, // 229 - 'mu'
6, 8, 8, 8, 8, 10, 62, // 230 - 'Tau'
8, 62, 8, 28, 34, 34, 28, 8, 62, // 231
7, 8, 20, 34, 62, 34, 20, 8, // 232
7, 54, 20, 20, 34, 34, 20, 8, // 233
7, 28, 34, 34, 28, 24, 4, 24, // 234
4, 28, 42, 42, 28, // 235
8, 2, 28, 38, 42, 42, 50, 28, 32, // 236 - 'Zero Slashed'
7, 28, 2, 2, 30, 2, 2, 28, // 237
7, 34, 34, 34, 34, 34, 34, 28, // 238
5, 62, 0, 62, 0, 62, // 239 - '3 Bar Equals'
7, 62, 0, 8, 8, 62, 8, 8, // 240 - '+/-'
7, 62, 0, 4, 8, 16, 8, 4, // 241 - '>='
7, 62, 0, 16, 8, 4, 8, 16, // 242 - '<='
8, 8, 8, 8, 8, 8, 8, 40, 56, // 243 - 'Top of Integral'
8, 14, 10, 10, 8, 8, 8, 8, 8, // 244 - 'Bot of Integral'
7, 24, 24, 0, 126, 0, 24, 24, // 245 - 'Divide'
5, 58, 46, 0, 58, 46, // 246 - 'Wavy ='
4, 28, 54, 54, 28, // 247 - 'Degree'
2, 24, 24, // 248 - 'Math Product'
1, 24, // 249 - 'Short Dash'
8, 8, 12, 10, 10, 8, 8, 8, 56, // 250 - 'Square Root'
5, 36, 36, 36, 36, 28, // 251 - 'Superscript n'
5, 60, 12, 24, 48, 28, // 252 - 'Superscript 2'
4, 60, 60, 60, 60, // 253 - 'Centered Square'
8, 255, 129, 129, 129, 129, 129, 129, 255, // 254 - 'Full Frame'
8, 255, 255, 255, 255, 255, 255, 255, 255, // 255 - 'Full Block'
};
#endif

View File

@@ -0,0 +1,168 @@
// Use the Parola library to scroll text on the display
//
// Demonstrates the use of the scrolling function to display text received
// from the serial interface in a vertical display.
//
// User can enter text on the serial monitor and this will display as a
// scrolling message on the display.
// Speed for the display is controlled by a pot on SPEED_IN analog in.
// Scrolling direction is controlled by a switch on DIRECTION_SET digital in.
// Invert ON/OFF is set by a switch on INVERT_SET digital in.
//
// UISwitch library can be found at https://github.com/MajicDesigns/MD_UISwitch
// 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 "Parola_Fonts_data.h"
// set to 1 if we are implementing the user interface pot, switch, etc
#define USE_UI_CONTROL 0
#if USE_UI_CONTROL
#include <MD_UISwitch.h>
#endif
// Turn on debug statements to the serial output
#define DEBUG 0
#if DEBUG
#define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }
#define PRINTS(x) Serial.print(F(x))
#define PRINTX(x) Serial.println(x, HEX)
#else
#define PRINT(s, x)
#define PRINTS(x)
#define PRINTX(x)
#endif
// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 8
#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);
// Scrolling parameters
#if USE_UI_CONTROL
const uint8_t SPEED_IN = A5;
const uint8_t DIRECTION_SET = 8; // change the effect
const uint8_t INVERT_SET = 9; // change the invert
const uint8_t SPEED_DEADBAND = 5;
#endif // USE_UI_CONTROL
uint8_t scrollSpeed = 25; // default frame delay value
textEffect_t scrollEffect = PA_SCROLL_RIGHT;
textPosition_t scrollAlign = PA_CENTER;
uint16_t scrollPause = 2000; // in milliseconds
// Global message buffers shared by Serial and Scrolling functions
#define BUF_SIZE 75
char curMessage[BUF_SIZE] = { "" };
char newMessage[BUF_SIZE] = { "Hello! Enter new message?" };
bool newMessageAvailable = true;
#if USE_UI_CONTROL
MD_UISwitch_Digital uiDirection(DIRECTION_SET);
MD_UISwitch_Digital uiInvert(INVERT_SET);
void doUI(void)
{
// set the speed if it has changed
{
int16_t speed = map(analogRead(SPEED_IN), 0, 1023, 10, 150);
if ((speed >= ((int16_t)P.getSpeed() + SPEED_DEADBAND)) ||
(speed <= ((int16_t)P.getSpeed() - SPEED_DEADBAND)))
{
P.setSpeed(speed);
scrollSpeed = speed;
PRINT("\nChanged speed to ", P.getSpeed());
}
}
if (uiDirection.read() == MD_UISwitch::KEY_PRESS) // SCROLL DIRECTION
{
PRINTS("\nChanging scroll direction");
scrollEffect = (scrollEffect == PA_SCROLL_LEFT ? PA_SCROLL_RIGHT : PA_SCROLL_LEFT);
P.setTextEffect(scrollEffect, scrollEffect);
P.displayClear();
P.displayReset();
}
if (uiInvert.read() == MD_UISwitch::KEY_PRESS) // INVERT MODE
{
PRINTS("\nChanging invert mode");
P.setInvert(!P.getInvert());
}
}
#endif // USE_UI_CONTROL
void readSerial(void)
{
static char *cp = newMessage;
while (Serial.available())
{
*cp = (char)Serial.read();
if ((*cp == '\n') || (cp - newMessage >= BUF_SIZE-2)) // end of message character or full buffer
{
*cp = '\0'; // end the string
// restart the index for next filling spree and flag we have a message waiting
cp = newMessage;
newMessageAvailable = true;
}
else // move char pointer to next position
cp++;
}
}
void setup()
{
Serial.begin(57600);
Serial.print("\n[Parola Scrolling Display]\nType a message for the scrolling display\nEnd message line with a newline");
#if USE_UI_CONTROL
uiDirection.begin();
uiInvert.begin();
pinMode(SPEED_IN, INPUT);
doUI();
#endif // USE_UI_CONTROL
P.begin();
P.setFont(_fontVertical);
P.displayText(curMessage, scrollAlign, scrollSpeed, scrollPause, scrollEffect, scrollEffect);
}
void loop()
{
#if USE_UI_CONTROL
doUI();
#endif // USE_UI_CONTROL
if (P.displayAnimate())
{
if (newMessageAvailable)
{
strrev(newMessage); // reverse the string for proper display order
strcpy(curMessage, newMessage);
newMessageAvailable = false;
}
P.displayReset();
}
readSerial();
}