![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
LED screen driver build for hackspace.
main.cpp@0:f16a1d69a386, 2012-02-29 (annotated)
- Committer:
- madcowswe
- Date:
- Wed Feb 29 17:01:43 2012 +0000
- Revision:
- 0:f16a1d69a386
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
madcowswe | 0:f16a1d69a386 | 1 | #include "mbed.h" |
madcowswe | 0:f16a1d69a386 | 2 | #include "ledScreen.h" |
madcowswe | 0:f16a1d69a386 | 3 | |
madcowswe | 0:f16a1d69a386 | 4 | LocalFileSystem local("local"); |
madcowswe | 0:f16a1d69a386 | 5 | |
madcowswe | 0:f16a1d69a386 | 6 | // screen instance |
madcowswe | 0:f16a1d69a386 | 7 | ledScreen screen; |
madcowswe | 0:f16a1d69a386 | 8 | |
madcowswe | 0:f16a1d69a386 | 9 | // sin lookup table and related functions |
madcowswe | 0:f16a1d69a386 | 10 | unsigned char sinlut[256]; |
madcowswe | 0:f16a1d69a386 | 11 | |
madcowswe | 0:f16a1d69a386 | 12 | void initSinLut() { |
madcowswe | 0:f16a1d69a386 | 13 | for (int i=0; i<256; i++) |
madcowswe | 0:f16a1d69a386 | 14 | sinlut[i] = cos((float)i / 256.0 * (3.14159265 * 2))*127 + 128; |
madcowswe | 0:f16a1d69a386 | 15 | } |
madcowswe | 0:f16a1d69a386 | 16 | |
madcowswe | 0:f16a1d69a386 | 17 | inline unsigned char lut_sin(int x) { |
madcowswe | 0:f16a1d69a386 | 18 | |
madcowswe | 0:f16a1d69a386 | 19 | return (x>0)?sinlut[x%256]:sinlut[(-x)%256]; |
madcowswe | 0:f16a1d69a386 | 20 | } |
madcowswe | 0:f16a1d69a386 | 21 | |
madcowswe | 0:f16a1d69a386 | 22 | |
madcowswe | 0:f16a1d69a386 | 23 | // Example frame makes: |
madcowswe | 0:f16a1d69a386 | 24 | |
madcowswe | 0:f16a1d69a386 | 25 | |
madcowswe | 0:f16a1d69a386 | 26 | //rainbow |
madcowswe | 0:f16a1d69a386 | 27 | void makeFrame1(unsigned char* data) { |
madcowswe | 0:f16a1d69a386 | 28 | |
madcowswe | 0:f16a1d69a386 | 29 | static int time=0; |
madcowswe | 0:f16a1d69a386 | 30 | time++; |
madcowswe | 0:f16a1d69a386 | 31 | |
madcowswe | 0:f16a1d69a386 | 32 | // override data with a intensity gradient test pattern |
madcowswe | 0:f16a1d69a386 | 33 | for (int x=0; x<3*16; x++) { |
madcowswe | 0:f16a1d69a386 | 34 | for (int y=0; y<16; y++) { |
madcowswe | 0:f16a1d69a386 | 35 | |
madcowswe | 0:f16a1d69a386 | 36 | int i = (x + y*(16*3)) * 3; // figure out the memory location |
madcowswe | 0:f16a1d69a386 | 37 | |
madcowswe | 0:f16a1d69a386 | 38 | data[i] = lut_sin(x*255/48+(time/2)%256+y); //(sin((float)(x+time)/15.0)+1.0)*128 ; // red |
madcowswe | 0:f16a1d69a386 | 39 | data[i+1] = lut_sin(x*255/48+(time/2)%256 + 85+y); //(sin((float)(x+time)/15.0)+1.0)*128 ; // red |
madcowswe | 0:f16a1d69a386 | 40 | data[i+2] = lut_sin(x*255/48+(time/2)%256 +170+y); //(sin((float)(x+time)/15.0)+1.0)*128 ; // red |
madcowswe | 0:f16a1d69a386 | 41 | } |
madcowswe | 0:f16a1d69a386 | 42 | } |
madcowswe | 0:f16a1d69a386 | 43 | |
madcowswe | 0:f16a1d69a386 | 44 | } |
madcowswe | 0:f16a1d69a386 | 45 | |
madcowswe | 0:f16a1d69a386 | 46 | // static gradients |
madcowswe | 0:f16a1d69a386 | 47 | void makeFrame3(unsigned char* data) { |
madcowswe | 0:f16a1d69a386 | 48 | |
madcowswe | 0:f16a1d69a386 | 49 | static int time=0; |
madcowswe | 0:f16a1d69a386 | 50 | time++; |
madcowswe | 0:f16a1d69a386 | 51 | |
madcowswe | 0:f16a1d69a386 | 52 | // override data with a intensity gradient test pattern |
madcowswe | 0:f16a1d69a386 | 53 | for (int x=0; x<3*16; x++) { |
madcowswe | 0:f16a1d69a386 | 54 | for (int y=0; y<16; y++) { |
madcowswe | 0:f16a1d69a386 | 55 | |
madcowswe | 0:f16a1d69a386 | 56 | int i = (x + y*(16*3)) * 3; // figure out the memory location |
madcowswe | 0:f16a1d69a386 | 57 | |
madcowswe | 0:f16a1d69a386 | 58 | data[i] = x*256/48; //(sin((float)(x+time)/15.0)+1.0)*128 ; // red |
madcowswe | 0:f16a1d69a386 | 59 | data[i+1] = 0; // green |
madcowswe | 0:f16a1d69a386 | 60 | data[i+2] = y*256/16; //(i/3)%256 ; // blue |
madcowswe | 0:f16a1d69a386 | 61 | } |
madcowswe | 0:f16a1d69a386 | 62 | } |
madcowswe | 0:f16a1d69a386 | 63 | |
madcowswe | 0:f16a1d69a386 | 64 | } |
madcowswe | 0:f16a1d69a386 | 65 | |
madcowswe | 0:f16a1d69a386 | 66 | // wavy animation |
madcowswe | 0:f16a1d69a386 | 67 | void makeFrame4(unsigned char* data) { |
madcowswe | 0:f16a1d69a386 | 68 | |
madcowswe | 0:f16a1d69a386 | 69 | static int time=0; |
madcowswe | 0:f16a1d69a386 | 70 | time++; |
madcowswe | 0:f16a1d69a386 | 71 | |
madcowswe | 0:f16a1d69a386 | 72 | // override data with a intensity gradient test pattern |
madcowswe | 0:f16a1d69a386 | 73 | for (int x=0; x<3*16; x++) { |
madcowswe | 0:f16a1d69a386 | 74 | for (int y=0; y<16; y++) { |
madcowswe | 0:f16a1d69a386 | 75 | |
madcowswe | 0:f16a1d69a386 | 76 | int i = (x%16 + y*16 + (x/16)*256) * 3; // figure out the memory location |
madcowswe | 0:f16a1d69a386 | 77 | |
madcowswe | 0:f16a1d69a386 | 78 | data[i] = lut_sin(time*15/16 - x*32 + y*32); |
madcowswe | 0:f16a1d69a386 | 79 | data[i+1] = 0; |
madcowswe | 0:f16a1d69a386 | 80 | data[i+2] = lut_sin((((x-24)*(x-24) + (y-8)*(y-8)) - time/1)); |
madcowswe | 0:f16a1d69a386 | 81 | } |
madcowswe | 0:f16a1d69a386 | 82 | } |
madcowswe | 0:f16a1d69a386 | 83 | |
madcowswe | 0:f16a1d69a386 | 84 | } |
madcowswe | 0:f16a1d69a386 | 85 | |
madcowswe | 0:f16a1d69a386 | 86 | // stars + smoothed (convolved) travelling comet |
madcowswe | 0:f16a1d69a386 | 87 | void makeFrame7(unsigned char* data) { |
madcowswe | 0:f16a1d69a386 | 88 | |
madcowswe | 0:f16a1d69a386 | 89 | static int time=0; |
madcowswe | 0:f16a1d69a386 | 90 | |
madcowswe | 0:f16a1d69a386 | 91 | //stars |
madcowswe | 0:f16a1d69a386 | 92 | data[rand()%(3*16*16*3)] = 255; |
madcowswe | 0:f16a1d69a386 | 93 | |
madcowswe | 0:f16a1d69a386 | 94 | //increment time |
madcowswe | 0:f16a1d69a386 | 95 | time++; |
madcowswe | 0:f16a1d69a386 | 96 | |
madcowswe | 0:f16a1d69a386 | 97 | //Do convolution |
madcowswe | 0:f16a1d69a386 | 98 | for (int x=1; x<47; x++) { // ignore first and last column |
madcowswe | 0:f16a1d69a386 | 99 | for (int y=1; y<15; y++) { |
madcowswe | 0:f16a1d69a386 | 100 | if (time%2) { |
madcowswe | 0:f16a1d69a386 | 101 | data[x*3+y*3*48] = ((data[x*3+y*3*48]*30)/32 + (data[(x+1)*3+y*3*48]*1)/32 + (data[(x-1)*3+y*3*48]*1)/32); |
madcowswe | 0:f16a1d69a386 | 102 | data[x*3+y*3*48 +1] = ((data[x*3+y*3*48 +1]*30)/32 + (data[(x+1)*3+y*3*48 +1]*1)/32 + (data[(x-1)*3+y*3*48 +1]*1)/32); |
madcowswe | 0:f16a1d69a386 | 103 | data[x*3+y*3*48 +2] = ((data[x*3+y*3*48 +2]*30)/32 + (data[(x+1)*3+y*3*48 +2]*1)/32 + (data[(x-1)*3+y*3*48 +2]*1)/32); |
madcowswe | 0:f16a1d69a386 | 104 | } else { |
madcowswe | 0:f16a1d69a386 | 105 | data[x*3+y*3*48] = ((data[x*3+y*3*48]*30)/32 + (data[(x)*3+(y+1)*3*48]*1)/32 + (data[(x)*3+(y-1)*3*48]*1)/32); |
madcowswe | 0:f16a1d69a386 | 106 | data[x*3+y*3*48 +1] = ((data[x*3+y*3*48 +1]*30)/32 + (data[(x)*3+(y+1)*3*48 +1]*1)/32 + (data[(x)*3+(y-1)*3*48 +1]*1)/32); |
madcowswe | 0:f16a1d69a386 | 107 | data[x*3+y*3*48 +2] = ((data[x*3+y*3*48 +2]*30)/32 + (data[(x)*3+(y+1)*3*48 +2]*1)/32 + (data[(x)*3+(y-1)*3*48 +2]*1)/32); |
madcowswe | 0:f16a1d69a386 | 108 | } |
madcowswe | 0:f16a1d69a386 | 109 | |
madcowswe | 0:f16a1d69a386 | 110 | } |
madcowswe | 0:f16a1d69a386 | 111 | } |
madcowswe | 0:f16a1d69a386 | 112 | |
madcowswe | 0:f16a1d69a386 | 113 | // handle the border |
madcowswe | 0:f16a1d69a386 | 114 | for (int y=0; y<16; y++) { |
madcowswe | 0:f16a1d69a386 | 115 | if (time%2) { |
madcowswe | 0:f16a1d69a386 | 116 | int x=0; |
madcowswe | 0:f16a1d69a386 | 117 | data[x*3+y*3*48] = (data[x*3+y*3*48]*30)/32 + (data[(x+1)*3+y*3*48]*1)/32 ; |
madcowswe | 0:f16a1d69a386 | 118 | data[x*3+y*3*48 +1] = (data[x*3+y*3*48 +1]*30)/32 + (data[(x+1)*3+y*3*48 +1]*1)/32 ; |
madcowswe | 0:f16a1d69a386 | 119 | data[x*3+y*3*48 +2] = (data[x*3+y*3*48 +2]*30)/32 + (data[(x+1)*3+y*3*48 +2]*1)/32 ; |
madcowswe | 0:f16a1d69a386 | 120 | |
madcowswe | 0:f16a1d69a386 | 121 | x=47; |
madcowswe | 0:f16a1d69a386 | 122 | data[x*3+y*3*48] = ((data[x*3+y*3*48]*30)/32 + (data[(x-1)*3+y*3*48]*1)/32); |
madcowswe | 0:f16a1d69a386 | 123 | data[x*3+y*3*48 +1] = ((data[x*3+y*3*48 +1]*30)/32 + (data[(x-1)*3+y*3*48 +1]*1)/32); |
madcowswe | 0:f16a1d69a386 | 124 | data[x*3+y*3*48 +2] = ((data[x*3+y*3*48 +2]*30)/32 + (data[(x-1)*3+y*3*48 +2]*1)/32); |
madcowswe | 0:f16a1d69a386 | 125 | } |
madcowswe | 0:f16a1d69a386 | 126 | } |
madcowswe | 0:f16a1d69a386 | 127 | |
madcowswe | 0:f16a1d69a386 | 128 | for (int x=0; x<48; x++) { |
madcowswe | 0:f16a1d69a386 | 129 | if (!(time%2)) { |
madcowswe | 0:f16a1d69a386 | 130 | int y=0; |
madcowswe | 0:f16a1d69a386 | 131 | data[x*3+y*3*48] = ((data[x*3+y*3*48]*30)/32 + (data[(x)*3+(y+1)*3*48]*1)/32); |
madcowswe | 0:f16a1d69a386 | 132 | data[x*3+y*3*48 +1] = ((data[x*3+y*3*48 +1]*30)/32 + (data[(x)*3+(y+1)*3*48 +1]*1)/32); |
madcowswe | 0:f16a1d69a386 | 133 | data[x*3+y*3*48 +2] = ((data[x*3+y*3*48 +2]*30)/32 + (data[(x)*3+(y+1)*3*48 +2]*1)/32); |
madcowswe | 0:f16a1d69a386 | 134 | |
madcowswe | 0:f16a1d69a386 | 135 | y=15; |
madcowswe | 0:f16a1d69a386 | 136 | data[x*3+y*3*48] = ((data[x*3+y*3*48]*30)/32 + (data[(x)*3+(y-1)*3*48]*1)/32); |
madcowswe | 0:f16a1d69a386 | 137 | data[x*3+y*3*48 +1] = ((data[x*3+y*3*48 +1]*30)/32 + (data[(x)*3+(y-1)*3*48 +1]*1)/32); |
madcowswe | 0:f16a1d69a386 | 138 | data[x*3+y*3*48 +2] = ((data[x*3+y*3*48 +2]*30)/32 + (data[(x)*3+(y-1)*3*48 +2]*1)/32); |
madcowswe | 0:f16a1d69a386 | 139 | |
madcowswe | 0:f16a1d69a386 | 140 | } |
madcowswe | 0:f16a1d69a386 | 141 | } |
madcowswe | 0:f16a1d69a386 | 142 | |
madcowswe | 0:f16a1d69a386 | 143 | // determine current comet location |
madcowswe | 0:f16a1d69a386 | 144 | int ballx = (8 + sin((float)time/25)*4+sin((float)time/17)*3+sin((float)time/13)*2)*3; |
madcowswe | 0:f16a1d69a386 | 145 | int bally = 8 + sin((float)time/12)*4+sin((float)time/15)*3+sin((float)time/14)*2; |
madcowswe | 0:f16a1d69a386 | 146 | |
madcowswe | 0:f16a1d69a386 | 147 | unsigned char r = lut_sin(time); |
madcowswe | 0:f16a1d69a386 | 148 | unsigned char g = lut_sin(time*15/16); |
madcowswe | 0:f16a1d69a386 | 149 | unsigned char b = lut_sin(time*17/16); |
madcowswe | 0:f16a1d69a386 | 150 | |
madcowswe | 0:f16a1d69a386 | 151 | // saturate brightness to a certain level |
madcowswe | 0:f16a1d69a386 | 152 | while ((int)r+g+b<255) { |
madcowswe | 0:f16a1d69a386 | 153 | r++; |
madcowswe | 0:f16a1d69a386 | 154 | g++; |
madcowswe | 0:f16a1d69a386 | 155 | b++; |
madcowswe | 0:f16a1d69a386 | 156 | }; |
madcowswe | 0:f16a1d69a386 | 157 | |
madcowswe | 0:f16a1d69a386 | 158 | // write the circle of the comet to the buffer |
madcowswe | 0:f16a1d69a386 | 159 | for (int x=-2; x<=2; x++) { |
madcowswe | 0:f16a1d69a386 | 160 | for (int y=-2; y<=2; y++) { |
madcowswe | 0:f16a1d69a386 | 161 | if (x*x + y*y<1.5 ) { |
madcowswe | 0:f16a1d69a386 | 162 | if (x+ballx<16*3 && x+ballx>=0 && y+bally<16 && y+bally>=0) { |
madcowswe | 0:f16a1d69a386 | 163 | int i = (x+ballx)*3 + (y+bally)*3*48; |
madcowswe | 0:f16a1d69a386 | 164 | |
madcowswe | 0:f16a1d69a386 | 165 | data[i] = r; |
madcowswe | 0:f16a1d69a386 | 166 | data[i+1] = g; |
madcowswe | 0:f16a1d69a386 | 167 | data[i+2] = b; |
madcowswe | 0:f16a1d69a386 | 168 | } |
madcowswe | 0:f16a1d69a386 | 169 | } |
madcowswe | 0:f16a1d69a386 | 170 | } |
madcowswe | 0:f16a1d69a386 | 171 | } |
madcowswe | 0:f16a1d69a386 | 172 | } |
madcowswe | 0:f16a1d69a386 | 173 | |
madcowswe | 0:f16a1d69a386 | 174 | struct charsz{ |
madcowswe | 0:f16a1d69a386 | 175 | unsigned char width; |
madcowswe | 0:f16a1d69a386 | 176 | unsigned int data; |
madcowswe | 0:f16a1d69a386 | 177 | |
madcowswe | 0:f16a1d69a386 | 178 | charsz() { |
madcowswe | 0:f16a1d69a386 | 179 | width=0; |
madcowswe | 0:f16a1d69a386 | 180 | } |
madcowswe | 0:f16a1d69a386 | 181 | |
madcowswe | 0:f16a1d69a386 | 182 | charsz(char c) { |
madcowswe | 0:f16a1d69a386 | 183 | width=0; |
madcowswe | 0:f16a1d69a386 | 184 | |
madcowswe | 0:f16a1d69a386 | 185 | } |
madcowswe | 0:f16a1d69a386 | 186 | bool get(int x, int y) |
madcowswe | 0:f16a1d69a386 | 187 | { |
madcowswe | 0:f16a1d69a386 | 188 | return data & (1 << (y * 5 + x)); |
madcowswe | 0:f16a1d69a386 | 189 | } |
madcowswe | 0:f16a1d69a386 | 190 | }; |
madcowswe | 0:f16a1d69a386 | 191 | |
madcowswe | 0:f16a1d69a386 | 192 | |
madcowswe | 0:f16a1d69a386 | 193 | #define _C(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) \ |
madcowswe | 0:f16a1d69a386 | 194 | ((a) | (b << 1) | (c << 2) | (d << 3) | (e << 4) | \ |
madcowswe | 0:f16a1d69a386 | 195 | (f << 5) | (g << 6) | (h << 7) | (i << 8) | (j << 9) | \ |
madcowswe | 0:f16a1d69a386 | 196 | (k << 10) | (l << 11) | (m << 12) | (n << 13) | (o << 14) | \ |
madcowswe | 0:f16a1d69a386 | 197 | (p << 15) | (q << 16) | (r << 17) | (s << 18) | (t << 19) | \ |
madcowswe | 0:f16a1d69a386 | 198 | (u << 20) | (v << 21) | (w << 22) | (x << 23) | (y << 24)) |
madcowswe | 0:f16a1d69a386 | 199 | |
madcowswe | 0:f16a1d69a386 | 200 | |
madcowswe | 0:f16a1d69a386 | 201 | |
madcowswe | 0:f16a1d69a386 | 202 | static charsz numbers[128]; |
madcowswe | 0:f16a1d69a386 | 203 | |
madcowswe | 0:f16a1d69a386 | 204 | |
madcowswe | 0:f16a1d69a386 | 205 | int charToScreen(int xco,int yco, char d, unsigned char *data, unsigned int colour) |
madcowswe | 0:f16a1d69a386 | 206 | { |
madcowswe | 0:f16a1d69a386 | 207 | |
madcowswe | 0:f16a1d69a386 | 208 | for(int x=0; x<numbers[d].width; x++) |
madcowswe | 0:f16a1d69a386 | 209 | for(int y=0; y<5; y++) |
madcowswe | 0:f16a1d69a386 | 210 | for(unsigned int col = 0; col < 3; ++col) |
madcowswe | 0:f16a1d69a386 | 211 | //data[3 * ((x+xco) + (y+yco) * 48) + col] = numbers[d].get(x,y) ? ((colour & (0xFF << ((2-col)*8))) >> ((2-col)*8) ) : 0; |
madcowswe | 0:f16a1d69a386 | 212 | if (numbers[d].get(x,y) && xco+x<48 && x+xco >= 0) |
madcowswe | 0:f16a1d69a386 | 213 | data[3 * ((x+xco) + (y+yco) * 48) + col] = ((colour & (0xFF << ((2-col)*8))) >> ((2-col)*8) ); |
madcowswe | 0:f16a1d69a386 | 214 | |
madcowswe | 0:f16a1d69a386 | 215 | return numbers[d].width; |
madcowswe | 0:f16a1d69a386 | 216 | |
madcowswe | 0:f16a1d69a386 | 217 | |
madcowswe | 0:f16a1d69a386 | 218 | |
madcowswe | 0:f16a1d69a386 | 219 | } |
madcowswe | 0:f16a1d69a386 | 220 | |
madcowswe | 0:f16a1d69a386 | 221 | void printString(const char *s, float xco, int yco, unsigned char *data, unsigned int col) |
madcowswe | 0:f16a1d69a386 | 222 | { |
madcowswe | 0:f16a1d69a386 | 223 | unsigned int len = strlen(s); |
madcowswe | 0:f16a1d69a386 | 224 | for (int d=0; d < len; ++d) |
madcowswe | 0:f16a1d69a386 | 225 | { |
madcowswe | 0:f16a1d69a386 | 226 | if(xco >= -numbers[s[d]].width && xco < 48) |
madcowswe | 0:f16a1d69a386 | 227 | charToScreen(xco,yco,s[d],data,col); |
madcowswe | 0:f16a1d69a386 | 228 | |
madcowswe | 0:f16a1d69a386 | 229 | xco += numbers[s[d]].width + 1; |
madcowswe | 0:f16a1d69a386 | 230 | } |
madcowswe | 0:f16a1d69a386 | 231 | } |
madcowswe | 0:f16a1d69a386 | 232 | |
madcowswe | 0:f16a1d69a386 | 233 | void fadeFrame(unsigned char* data, float amount) |
madcowswe | 0:f16a1d69a386 | 234 | { |
madcowswe | 0:f16a1d69a386 | 235 | for (int x = 0; x < 48; x++) |
madcowswe | 0:f16a1d69a386 | 236 | for (int y = 0; y < 16; y++) |
madcowswe | 0:f16a1d69a386 | 237 | { |
madcowswe | 0:f16a1d69a386 | 238 | data[x*3+y*3*48]-=amount; |
madcowswe | 0:f16a1d69a386 | 239 | data[x*3+y*3*48+1]-=amount; |
madcowswe | 0:f16a1d69a386 | 240 | data[x*3+y*3*48+2]-=amount; |
madcowswe | 0:f16a1d69a386 | 241 | } |
madcowswe | 0:f16a1d69a386 | 242 | } |
madcowswe | 0:f16a1d69a386 | 243 | |
madcowswe | 0:f16a1d69a386 | 244 | // Scroll text |
madcowswe | 0:f16a1d69a386 | 245 | class scrollingText { |
madcowswe | 0:f16a1d69a386 | 246 | public: |
madcowswe | 0:f16a1d69a386 | 247 | const char *s; |
madcowswe | 0:f16a1d69a386 | 248 | int xco; |
madcowswe | 0:f16a1d69a386 | 249 | int yco; |
madcowswe | 0:f16a1d69a386 | 250 | unsigned char *data; |
madcowswe | 0:f16a1d69a386 | 251 | unsigned int col; |
madcowswe | 0:f16a1d69a386 | 252 | float scroller; |
madcowswe | 0:f16a1d69a386 | 253 | float scrollspeed; |
madcowswe | 0:f16a1d69a386 | 254 | |
madcowswe | 0:f16a1d69a386 | 255 | scrollingText(const char *sp, int xcop, int ycop, unsigned char *datap, unsigned int colp, float scrollspeedp) |
madcowswe | 0:f16a1d69a386 | 256 | : s(sp), xco(xcop), yco(ycop), data(datap), col(colp), scroller(0), scrollspeed(scrollspeedp) {} |
madcowswe | 0:f16a1d69a386 | 257 | |
madcowswe | 0:f16a1d69a386 | 258 | void update() |
madcowswe | 0:f16a1d69a386 | 259 | { |
madcowswe | 0:f16a1d69a386 | 260 | //printString(s, xco+(int)scroller, yco, data, col); |
madcowswe | 0:f16a1d69a386 | 261 | printString(s, xco+scroller, yco, data, col); |
madcowswe | 0:f16a1d69a386 | 262 | unsigned int len = strlen(s); |
madcowswe | 0:f16a1d69a386 | 263 | int actualStringLength = len+1; |
madcowswe | 0:f16a1d69a386 | 264 | for (int d=0; d < len; ++d) { actualStringLength += numbers[d].width; } |
madcowswe | 0:f16a1d69a386 | 265 | if ((int)scroller+xco < -actualStringLength) { scroller=48-xco; } |
madcowswe | 0:f16a1d69a386 | 266 | |
madcowswe | 0:f16a1d69a386 | 267 | scroller-=scrollspeed; |
madcowswe | 0:f16a1d69a386 | 268 | } |
madcowswe | 0:f16a1d69a386 | 269 | }; |
madcowswe | 0:f16a1d69a386 | 270 | |
madcowswe | 0:f16a1d69a386 | 271 | // Binary counter timer |
madcowswe | 0:f16a1d69a386 | 272 | Timer t; |
madcowswe | 0:f16a1d69a386 | 273 | // Read file counter |
madcowswe | 0:f16a1d69a386 | 274 | Timer s; |
madcowswe | 0:f16a1d69a386 | 275 | |
madcowswe | 0:f16a1d69a386 | 276 | char *txt = NULL; |
madcowswe | 0:f16a1d69a386 | 277 | |
madcowswe | 0:f16a1d69a386 | 278 | void makeFrame9(unsigned char* data) { |
madcowswe | 0:f16a1d69a386 | 279 | fadeFrame(data, 255); |
madcowswe | 0:f16a1d69a386 | 280 | |
madcowswe | 0:f16a1d69a386 | 281 | /* |
madcowswe | 0:f16a1d69a386 | 282 | //0 screen |
madcowswe | 0:f16a1d69a386 | 283 | for(unsigned int x = 0; x < 48; ++x) |
madcowswe | 0:f16a1d69a386 | 284 | for(unsigned int y = 0; y < 16; ++y) |
madcowswe | 0:f16a1d69a386 | 285 | for(unsigned int col = 0; col < 3; ++col) |
madcowswe | 0:f16a1d69a386 | 286 | data[3 * ((x) + y * 48) + col] = 0; |
madcowswe | 0:f16a1d69a386 | 287 | */ |
madcowswe | 0:f16a1d69a386 | 288 | |
madcowswe | 0:f16a1d69a386 | 289 | time_t seconds = time(NULL); |
madcowswe | 0:f16a1d69a386 | 290 | |
madcowswe | 0:f16a1d69a386 | 291 | //uptime! |
madcowswe | 0:f16a1d69a386 | 292 | static scrollingText uptimeText(txt, 4, 1, data, 0xFF0000, 0.1); |
madcowswe | 0:f16a1d69a386 | 293 | |
madcowswe | 0:f16a1d69a386 | 294 | uptimeText.update(); |
madcowswe | 0:f16a1d69a386 | 295 | |
madcowswe | 0:f16a1d69a386 | 296 | |
madcowswe | 0:f16a1d69a386 | 297 | |
madcowswe | 0:f16a1d69a386 | 298 | int yoff=6; |
madcowswe | 0:f16a1d69a386 | 299 | unsigned int startX = 7; |
madcowswe | 0:f16a1d69a386 | 300 | for(unsigned int x = 0; x < 32; ++x) |
madcowswe | 0:f16a1d69a386 | 301 | for(unsigned int y = 0; y < 4; ++y) |
madcowswe | 0:f16a1d69a386 | 302 | for(unsigned int col = 0; col < 3; ++col) |
madcowswe | 0:f16a1d69a386 | 303 | //data[3 * ((x+startX) + (y+yoff) * 48) + col] = (col == 0 ? ((seconds & (1 << (31-x))) ? 255 : 0) : 0); |
madcowswe | 0:f16a1d69a386 | 304 | if(((int)(t.read()*50) & (1 << (31-x))) && col == 0) |
madcowswe | 0:f16a1d69a386 | 305 | data[3 * ((x+startX) + (y+yoff) * 48) + col] = 255; |
madcowswe | 0:f16a1d69a386 | 306 | |
madcowswe | 0:f16a1d69a386 | 307 | int day = (seconds/(3600*24))%10; |
madcowswe | 0:f16a1d69a386 | 308 | int hour = (seconds/3600)%24; |
madcowswe | 0:f16a1d69a386 | 309 | int min = (seconds/60)%60; |
madcowswe | 0:f16a1d69a386 | 310 | int sec = (seconds)%60; |
madcowswe | 0:f16a1d69a386 | 311 | |
madcowswe | 0:f16a1d69a386 | 312 | |
madcowswe | 0:f16a1d69a386 | 313 | char digits[11] = {day+'0',':', (hour/10)+'0', hour%10+'0', ':', min/10+'0', min%10+'0', ':', sec/10+'0', sec%10+'0', 0}; |
madcowswe | 0:f16a1d69a386 | 314 | |
madcowswe | 0:f16a1d69a386 | 315 | |
madcowswe | 0:f16a1d69a386 | 316 | printString(digits, 4, 10, data, 0x0000FF); |
madcowswe | 0:f16a1d69a386 | 317 | |
madcowswe | 0:f16a1d69a386 | 318 | } |
madcowswe | 0:f16a1d69a386 | 319 | |
madcowswe | 0:f16a1d69a386 | 320 | |
madcowswe | 0:f16a1d69a386 | 321 | void readTextFromMBed() |
madcowswe | 0:f16a1d69a386 | 322 | { |
madcowswe | 0:f16a1d69a386 | 323 | //txt = "test"; |
madcowswe | 0:f16a1d69a386 | 324 | |
madcowswe | 0:f16a1d69a386 | 325 | |
madcowswe | 0:f16a1d69a386 | 326 | //stringy |
madcowswe | 0:f16a1d69a386 | 327 | FILE *set = fopen("/local/scroller.txt", "r"); // Open "scroller.txt" on the local file system for read |
madcowswe | 0:f16a1d69a386 | 328 | if(set) |
madcowswe | 0:f16a1d69a386 | 329 | { |
madcowswe | 0:f16a1d69a386 | 330 | fseek(set, 0L, SEEK_END); |
madcowswe | 0:f16a1d69a386 | 331 | int sz = ftell(set); |
madcowswe | 0:f16a1d69a386 | 332 | fseek(set, 0L, SEEK_SET); |
madcowswe | 0:f16a1d69a386 | 333 | |
madcowswe | 0:f16a1d69a386 | 334 | if(txt) |
madcowswe | 0:f16a1d69a386 | 335 | free(txt); |
madcowswe | 0:f16a1d69a386 | 336 | |
madcowswe | 0:f16a1d69a386 | 337 | txt = (char *) malloc(sz); |
madcowswe | 0:f16a1d69a386 | 338 | |
madcowswe | 0:f16a1d69a386 | 339 | fread(txt, sz, sz, set); |
madcowswe | 0:f16a1d69a386 | 340 | |
madcowswe | 0:f16a1d69a386 | 341 | fclose(set); |
madcowswe | 0:f16a1d69a386 | 342 | } |
madcowswe | 0:f16a1d69a386 | 343 | else |
madcowswe | 0:f16a1d69a386 | 344 | { |
madcowswe | 0:f16a1d69a386 | 345 | txt = "File not found"; |
madcowswe | 0:f16a1d69a386 | 346 | } |
madcowswe | 0:f16a1d69a386 | 347 | } |
madcowswe | 0:f16a1d69a386 | 348 | |
madcowswe | 0:f16a1d69a386 | 349 | |
madcowswe | 0:f16a1d69a386 | 350 | |
madcowswe | 0:f16a1d69a386 | 351 | void initCharArray(); |
madcowswe | 0:f16a1d69a386 | 352 | |
madcowswe | 0:f16a1d69a386 | 353 | |
madcowswe | 0:f16a1d69a386 | 354 | int main() |
madcowswe | 0:f16a1d69a386 | 355 | { |
madcowswe | 0:f16a1d69a386 | 356 | |
madcowswe | 0:f16a1d69a386 | 357 | initCharArray(); |
madcowswe | 0:f16a1d69a386 | 358 | readTextFromMBed(); |
madcowswe | 0:f16a1d69a386 | 359 | set_time(0); |
madcowswe | 0:f16a1d69a386 | 360 | |
madcowswe | 0:f16a1d69a386 | 361 | s.reset(); |
madcowswe | 0:f16a1d69a386 | 362 | t.start(); |
madcowswe | 0:f16a1d69a386 | 363 | |
madcowswe | 0:f16a1d69a386 | 364 | int time=0; // optional |
madcowswe | 0:f16a1d69a386 | 365 | int frametype=1; // optional |
madcowswe | 0:f16a1d69a386 | 366 | |
madcowswe | 0:f16a1d69a386 | 367 | // framebuffer on client side |
madcowswe | 0:f16a1d69a386 | 368 | unsigned char imageSource[256*3*3] = { 0 }; |
madcowswe | 0:f16a1d69a386 | 369 | |
madcowswe | 0:f16a1d69a386 | 370 | // prepare sin lookup table (optional) |
madcowswe | 0:f16a1d69a386 | 371 | initSinLut(); |
madcowswe | 0:f16a1d69a386 | 372 | |
madcowswe | 0:f16a1d69a386 | 373 | // start the screen output, which will keep outputting the frames that are in its internal buffer (updated via .transformFrame) |
madcowswe | 0:f16a1d69a386 | 374 | screen.start(); |
madcowswe | 0:f16a1d69a386 | 375 | |
madcowswe | 0:f16a1d69a386 | 376 | while (1) { |
madcowswe | 0:f16a1d69a386 | 377 | // Reload the file every 60 seconds |
madcowswe | 0:f16a1d69a386 | 378 | if(s.read()>60) |
madcowswe | 0:f16a1d69a386 | 379 | { |
madcowswe | 0:f16a1d69a386 | 380 | //readTextFromMBed(); |
madcowswe | 0:f16a1d69a386 | 381 | //s.reset(); |
madcowswe | 0:f16a1d69a386 | 382 | } |
madcowswe | 0:f16a1d69a386 | 383 | |
madcowswe | 0:f16a1d69a386 | 384 | time++; //optional |
madcowswe | 0:f16a1d69a386 | 385 | if(time%5000 == 0){ |
madcowswe | 0:f16a1d69a386 | 386 | frametype = (frametype+1)%5; |
madcowswe | 0:f16a1d69a386 | 387 | if (frametype == 0) |
madcowswe | 0:f16a1d69a386 | 388 | time = 4500; |
madcowswe | 0:f16a1d69a386 | 389 | } |
madcowswe | 0:f16a1d69a386 | 390 | |
madcowswe | 0:f16a1d69a386 | 391 | switch (frametype) |
madcowswe | 0:f16a1d69a386 | 392 | { |
madcowswe | 0:f16a1d69a386 | 393 | case 0: |
madcowswe | 0:f16a1d69a386 | 394 | makeFrame9(imageSource); |
madcowswe | 0:f16a1d69a386 | 395 | break; |
madcowswe | 0:f16a1d69a386 | 396 | case 1: |
madcowswe | 0:f16a1d69a386 | 397 | makeFrame4(imageSource); |
madcowswe | 0:f16a1d69a386 | 398 | break; |
madcowswe | 0:f16a1d69a386 | 399 | case 2: |
madcowswe | 0:f16a1d69a386 | 400 | makeFrame7(imageSource); |
madcowswe | 0:f16a1d69a386 | 401 | break; |
madcowswe | 0:f16a1d69a386 | 402 | case 3: |
madcowswe | 0:f16a1d69a386 | 403 | makeFrame7(imageSource); |
madcowswe | 0:f16a1d69a386 | 404 | break; |
madcowswe | 0:f16a1d69a386 | 405 | case 4: |
madcowswe | 0:f16a1d69a386 | 406 | makeFrame1(imageSource); |
madcowswe | 0:f16a1d69a386 | 407 | break; |
madcowswe | 0:f16a1d69a386 | 408 | } |
madcowswe | 0:f16a1d69a386 | 409 | |
madcowswe | 0:f16a1d69a386 | 410 | //makeFrame2(imageSource); // prepare framebuffer with current frame |
madcowswe | 0:f16a1d69a386 | 411 | screen.transformFrame(imageSource); // write framebuffer to output framebuffer |
madcowswe | 0:f16a1d69a386 | 412 | wait_ms(1); // slow down the framerate (optional) |
madcowswe | 0:f16a1d69a386 | 413 | } |
madcowswe | 0:f16a1d69a386 | 414 | |
madcowswe | 0:f16a1d69a386 | 415 | } |
madcowswe | 0:f16a1d69a386 | 416 | |
madcowswe | 0:f16a1d69a386 | 417 | |
madcowswe | 0:f16a1d69a386 | 418 | |
madcowswe | 0:f16a1d69a386 | 419 | |
madcowswe | 0:f16a1d69a386 | 420 | |
madcowswe | 0:f16a1d69a386 | 421 | //////////////////////////////// |
madcowswe | 0:f16a1d69a386 | 422 | ///////STOPPP!!!!!!! |
madcowswe | 0:f16a1d69a386 | 423 | //////////GO BACK!!!!!!! |
madcowswe | 0:f16a1d69a386 | 424 | /////////////////////////////// |
madcowswe | 0:f16a1d69a386 | 425 | |
madcowswe | 0:f16a1d69a386 | 426 | |
madcowswe | 0:f16a1d69a386 | 427 | |
madcowswe | 0:f16a1d69a386 | 428 | |
madcowswe | 0:f16a1d69a386 | 429 | |
madcowswe | 0:f16a1d69a386 | 430 | |
madcowswe | 0:f16a1d69a386 | 431 | |
madcowswe | 0:f16a1d69a386 | 432 | |
madcowswe | 0:f16a1d69a386 | 433 | |
madcowswe | 0:f16a1d69a386 | 434 | void initCharArray() |
madcowswe | 0:f16a1d69a386 | 435 | { |
madcowswe | 0:f16a1d69a386 | 436 | for(int i=0; i<128; i++){ |
madcowswe | 0:f16a1d69a386 | 437 | numbers[i].width=3; |
madcowswe | 0:f16a1d69a386 | 438 | numbers[i].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 439 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 440 | 0,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 441 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 442 | 0,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 443 | } |
madcowswe | 0:f16a1d69a386 | 444 | |
madcowswe | 0:f16a1d69a386 | 445 | numbers['A'].width=3; |
madcowswe | 0:f16a1d69a386 | 446 | numbers['A'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 447 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 448 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 449 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 450 | 1,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 451 | numbers['B'].width=3; |
madcowswe | 0:f16a1d69a386 | 452 | numbers['B'].data=_C(1,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 453 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 454 | 1,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 455 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 456 | 1,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 457 | numbers['C'].width=3; |
madcowswe | 0:f16a1d69a386 | 458 | numbers['C'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 459 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 460 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 461 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 462 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 463 | numbers['D'].width=3; |
madcowswe | 0:f16a1d69a386 | 464 | numbers['D'].data=_C(1,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 465 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 466 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 467 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 468 | 1,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 469 | numbers['E'].width=3; |
madcowswe | 0:f16a1d69a386 | 470 | numbers['E'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 471 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 472 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 473 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 474 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 475 | numbers['F'].width=3; |
madcowswe | 0:f16a1d69a386 | 476 | numbers['F'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 477 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 478 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 479 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 480 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 481 | numbers['G'].width=3; |
madcowswe | 0:f16a1d69a386 | 482 | numbers['G'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 483 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 484 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 485 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 486 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 487 | numbers['H'].width=3; |
madcowswe | 0:f16a1d69a386 | 488 | numbers['H'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 489 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 490 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 491 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 492 | 1,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 493 | numbers['I'].width=3; |
madcowswe | 0:f16a1d69a386 | 494 | numbers['I'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 495 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 496 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 497 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 498 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 499 | numbers['J'].width=4; |
madcowswe | 0:f16a1d69a386 | 500 | numbers['J'].data=_C(0,1,1,1,0, |
madcowswe | 0:f16a1d69a386 | 501 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 502 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 503 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 504 | 0,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 505 | numbers['K'].width=4; |
madcowswe | 0:f16a1d69a386 | 506 | numbers['K'].data=_C(1,0,0,1,0, |
madcowswe | 0:f16a1d69a386 | 507 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 508 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 509 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 510 | 1,0,0,1,0); |
madcowswe | 0:f16a1d69a386 | 511 | numbers['L'].width=3; |
madcowswe | 0:f16a1d69a386 | 512 | numbers['L'].data=_C(1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 513 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 514 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 515 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 516 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 517 | numbers['M'].width=5; |
madcowswe | 0:f16a1d69a386 | 518 | numbers['M'].data=_C(1,1,0,1,1, |
madcowswe | 0:f16a1d69a386 | 519 | 1,1,1,1,1, |
madcowswe | 0:f16a1d69a386 | 520 | 1,0,1,0,1, |
madcowswe | 0:f16a1d69a386 | 521 | 1,0,0,0,1, |
madcowswe | 0:f16a1d69a386 | 522 | 1,0,0,0,1); |
madcowswe | 0:f16a1d69a386 | 523 | numbers['N'].width=4; |
madcowswe | 0:f16a1d69a386 | 524 | numbers['N'].data=_C(1,0,0,1,0, |
madcowswe | 0:f16a1d69a386 | 525 | 1,1,0,1,0, |
madcowswe | 0:f16a1d69a386 | 526 | 1,1,1,1,0, |
madcowswe | 0:f16a1d69a386 | 527 | 1,0,1,1,0, |
madcowswe | 0:f16a1d69a386 | 528 | 1,0,0,1,0); |
madcowswe | 0:f16a1d69a386 | 529 | numbers['O'].width=3; |
madcowswe | 0:f16a1d69a386 | 530 | numbers['O'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 531 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 532 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 533 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 534 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 535 | numbers['P'].width=3; |
madcowswe | 0:f16a1d69a386 | 536 | numbers['P'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 537 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 538 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 539 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 540 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 541 | numbers['Q'].width=3; |
madcowswe | 0:f16a1d69a386 | 542 | numbers['Q'].data=_C(0,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 543 | 1,0,0,1,0, |
madcowswe | 0:f16a1d69a386 | 544 | 1,0,0,1,0, |
madcowswe | 0:f16a1d69a386 | 545 | 1,0,1,1,0, |
madcowswe | 0:f16a1d69a386 | 546 | 0,1,1,1,0); |
madcowswe | 0:f16a1d69a386 | 547 | numbers['R'].width=3; |
madcowswe | 0:f16a1d69a386 | 548 | numbers['R'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 549 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 550 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 551 | 1,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 552 | 1,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 553 | numbers['S'].width=3; |
madcowswe | 0:f16a1d69a386 | 554 | numbers['S'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 555 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 556 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 557 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 558 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 559 | numbers['T'].width=3; |
madcowswe | 0:f16a1d69a386 | 560 | numbers['T'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 561 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 562 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 563 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 564 | 0,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 565 | numbers['U'].width=3; |
madcowswe | 0:f16a1d69a386 | 566 | numbers['U'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 567 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 568 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 569 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 570 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 571 | numbers['V'].width=3; |
madcowswe | 0:f16a1d69a386 | 572 | numbers['V'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 573 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 574 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 575 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 576 | 0,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 577 | numbers['W'].width=5; |
madcowswe | 0:f16a1d69a386 | 578 | numbers['W'].data=_C(1,0,0,0,1, |
madcowswe | 0:f16a1d69a386 | 579 | 1,0,0,0,1, |
madcowswe | 0:f16a1d69a386 | 580 | 1,0,1,0,1, |
madcowswe | 0:f16a1d69a386 | 581 | 1,1,1,1,1, |
madcowswe | 0:f16a1d69a386 | 582 | 0,1,0,1,0); |
madcowswe | 0:f16a1d69a386 | 583 | numbers['X'].width=3; |
madcowswe | 0:f16a1d69a386 | 584 | numbers['X'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 585 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 586 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 587 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 588 | 1,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 589 | numbers['Y'].width=3; |
madcowswe | 0:f16a1d69a386 | 590 | numbers['Y'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 591 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 592 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 593 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 594 | 0,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 595 | numbers['Z'].width=3; |
madcowswe | 0:f16a1d69a386 | 596 | numbers['Z'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 597 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 598 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 599 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 600 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 601 | numbers['\''].width=1; |
madcowswe | 0:f16a1d69a386 | 602 | numbers['\''].data=_C(1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 603 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 604 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 605 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 606 | 0,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 607 | numbers['"'].width=3; |
madcowswe | 0:f16a1d69a386 | 608 | numbers['"'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 609 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 610 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 611 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 612 | 0,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 613 | numbers[' '].width=1; |
madcowswe | 0:f16a1d69a386 | 614 | numbers[' '].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 615 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 616 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 617 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 618 | 0,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 619 | numbers[':'].width=1; |
madcowswe | 0:f16a1d69a386 | 620 | numbers[':'].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 621 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 622 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 623 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 624 | 0,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 625 | |
madcowswe | 0:f16a1d69a386 | 626 | numbers['0'].width=3; |
madcowswe | 0:f16a1d69a386 | 627 | numbers['0'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 628 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 629 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 630 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 631 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 632 | numbers['1'].width=1; |
madcowswe | 0:f16a1d69a386 | 633 | numbers['1'].data=_C(1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 634 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 635 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 636 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 637 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 638 | numbers['2'].width=3; |
madcowswe | 0:f16a1d69a386 | 639 | numbers['2'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 640 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 641 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 642 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 643 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 644 | numbers['3'].width=3; |
madcowswe | 0:f16a1d69a386 | 645 | numbers['3'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 646 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 647 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 648 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 649 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 650 | numbers['4'].width=3; |
madcowswe | 0:f16a1d69a386 | 651 | numbers['4'].data=_C(1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 652 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 653 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 654 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 655 | 0,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 656 | numbers['5'].width=3; |
madcowswe | 0:f16a1d69a386 | 657 | numbers['5'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 658 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 659 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 660 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 661 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 662 | numbers['6'].width=3; |
madcowswe | 0:f16a1d69a386 | 663 | numbers['6'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 664 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 665 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 666 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 667 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 668 | numbers['7'].width=3; |
madcowswe | 0:f16a1d69a386 | 669 | numbers['7'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 670 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 671 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 672 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 673 | 0,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 674 | numbers['8'].width=3; |
madcowswe | 0:f16a1d69a386 | 675 | numbers['8'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 676 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 677 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 678 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 679 | 1,1,1,0,0); |
madcowswe | 0:f16a1d69a386 | 680 | numbers['9'].width=3; |
madcowswe | 0:f16a1d69a386 | 681 | numbers['9'].data=_C(1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 682 | 1,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 683 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 684 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 685 | 0,0,1,0,0); |
madcowswe | 0:f16a1d69a386 | 686 | |
madcowswe | 0:f16a1d69a386 | 687 | numbers['.'].width=1; |
madcowswe | 0:f16a1d69a386 | 688 | numbers['.'].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 689 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 690 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 691 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 692 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 693 | |
madcowswe | 0:f16a1d69a386 | 694 | numbers['|'].width=1; |
madcowswe | 0:f16a1d69a386 | 695 | numbers['|'].data=_C(1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 696 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 697 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 698 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 699 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 700 | |
madcowswe | 0:f16a1d69a386 | 701 | numbers[')'].width=2; |
madcowswe | 0:f16a1d69a386 | 702 | numbers[')'].data=_C(1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 703 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 704 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 705 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 706 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 707 | |
madcowswe | 0:f16a1d69a386 | 708 | numbers['('].width=2; |
madcowswe | 0:f16a1d69a386 | 709 | numbers['('].data=_C(0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 710 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 711 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 712 | 1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 713 | 0,1,0,0,0); |
madcowswe | 0:f16a1d69a386 | 714 | |
madcowswe | 0:f16a1d69a386 | 715 | numbers['+'].width=3; |
madcowswe | 0:f16a1d69a386 | 716 | numbers['+'].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 717 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 718 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 719 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 720 | 0,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 721 | |
madcowswe | 0:f16a1d69a386 | 722 | numbers['-'].width=3; |
madcowswe | 0:f16a1d69a386 | 723 | numbers['-'].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 724 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 725 | 1,1,1,0,0, |
madcowswe | 0:f16a1d69a386 | 726 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 727 | 0,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 728 | |
madcowswe | 0:f16a1d69a386 | 729 | numbers[';'].width=2; |
madcowswe | 0:f16a1d69a386 | 730 | numbers[';'].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 731 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 732 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 733 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 734 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 735 | |
madcowswe | 0:f16a1d69a386 | 736 | numbers['>'].width=3; |
madcowswe | 0:f16a1d69a386 | 737 | numbers['>'].data=_C(1,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 738 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 739 | 0,0,1,0,0, |
madcowswe | 0:f16a1d69a386 | 740 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 741 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 742 | |
madcowswe | 0:f16a1d69a386 | 743 | numbers[','].width=2; |
madcowswe | 0:f16a1d69a386 | 744 | numbers[','].data=_C(0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 745 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 746 | 0,0,0,0,0, |
madcowswe | 0:f16a1d69a386 | 747 | 0,1,0,0,0, |
madcowswe | 0:f16a1d69a386 | 748 | 1,0,0,0,0); |
madcowswe | 0:f16a1d69a386 | 749 | |
madcowswe | 0:f16a1d69a386 | 750 | numbers['_'] = numbers[' ']; |
madcowswe | 0:f16a1d69a386 | 751 | numbers['a'] = numbers['A']; |
madcowswe | 0:f16a1d69a386 | 752 | numbers['b'] = numbers['B']; |
madcowswe | 0:f16a1d69a386 | 753 | numbers['c'] = numbers['C']; |
madcowswe | 0:f16a1d69a386 | 754 | numbers['d'] = numbers['D']; |
madcowswe | 0:f16a1d69a386 | 755 | numbers['e'] = numbers['E']; |
madcowswe | 0:f16a1d69a386 | 756 | numbers['f'] = numbers['F']; |
madcowswe | 0:f16a1d69a386 | 757 | numbers['g'] = numbers['G']; |
madcowswe | 0:f16a1d69a386 | 758 | numbers['h'] = numbers['H']; |
madcowswe | 0:f16a1d69a386 | 759 | numbers['i'] = numbers['I']; |
madcowswe | 0:f16a1d69a386 | 760 | numbers['j'] = numbers['J']; |
madcowswe | 0:f16a1d69a386 | 761 | numbers['k'] = numbers['K']; |
madcowswe | 0:f16a1d69a386 | 762 | numbers['l'] = numbers['L']; |
madcowswe | 0:f16a1d69a386 | 763 | numbers['m'] = numbers['M']; |
madcowswe | 0:f16a1d69a386 | 764 | numbers['n'] = numbers['N']; |
madcowswe | 0:f16a1d69a386 | 765 | numbers['o'] = numbers['O']; |
madcowswe | 0:f16a1d69a386 | 766 | numbers['p'] = numbers['P']; |
madcowswe | 0:f16a1d69a386 | 767 | numbers['q'] = numbers['Q']; |
madcowswe | 0:f16a1d69a386 | 768 | numbers['r'] = numbers['R']; |
madcowswe | 0:f16a1d69a386 | 769 | numbers['s'] = numbers['S']; |
madcowswe | 0:f16a1d69a386 | 770 | numbers['t'] = numbers['T']; |
madcowswe | 0:f16a1d69a386 | 771 | numbers['u'] = numbers['U']; |
madcowswe | 0:f16a1d69a386 | 772 | numbers['v'] = numbers['V']; |
madcowswe | 0:f16a1d69a386 | 773 | numbers['w'] = numbers['W']; |
madcowswe | 0:f16a1d69a386 | 774 | numbers['x'] = numbers['X']; |
madcowswe | 0:f16a1d69a386 | 775 | numbers['y'] = numbers['Y']; |
madcowswe | 0:f16a1d69a386 | 776 | numbers['z'] = numbers['Z']; |
madcowswe | 0:f16a1d69a386 | 777 | |
madcowswe | 0:f16a1d69a386 | 778 | } |