Aliexpressなどで販売されている64x32のフルカラードットマトリクスLED2枚とNucleo F401REを利用して、 E233系の駅停車時、路線名表示ありのLED側面行先表示を再現するプログラムです。 3秒間隔、3段階切替で、路線名、種別、行先、次停車駅を個別に指定することが可能です。

Dependencies:   SDFileSystem mbed

Committer:
chirashi
Date:
Sun Oct 19 16:20:02 2014 +0000
Revision:
4:245f17936b1a
Parent:
3:6dbbc0130e96
Child:
5:532937f20397
pwmtest

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RRacer 0:1f58ecec51d6 1 /*
RRacer 0:1f58ecec51d6 2 The goal of this program is to show the basic connections and workings of Adafruits 32x16 RGB LED matrix board (http://www.adafruit.com/products/420),
RRacer 0:1f58ecec51d6 3 also sold on other places, for instance http://www.ebay.com/itm/PH6-RGB-Full-Color-LED-16-32-Dot-Matrix-Display-Module-/310303408628?pt=LH_DefaultDomain_0&hash=item483f8641f4 (no
RRacer 0:1f58ecec51d6 4 affiliation with either of them).
RRacer 0:1f58ecec51d6 5 This program is not intended to be highly optimized or a guideline in C programming in any way (more of the opposite actually).
RRacer 1:dd0dcd303d6d 6 To have more than 7 colors on this thing, you need to implement software PWM of some sort. I have obviously not done that, but if YOU do, please let me know!
RRacer 1:dd0dcd303d6d 7 Adafruit have a wicked demo program for an arduino - www.youtube.com/watch?v=lY-flFEfsHo
RRacer 0:1f58ecec51d6 8 There are probably lots of ways to make this perform better, perhaps by using Neal Hormans port of the Adafruit_GFX library (http://mbed.org/users/nkhorman/code/Adafruit_GFX/).
RRacer 0:1f58ecec51d6 9 No error checking or out-of-bounds checking is done. Use at your own peril.
RRacer 0:1f58ecec51d6 10 For more detailed information on the driver chip, see http://www.bjtopspace.com/ziliao/CYT62726.pdf
RRacer 0:1f58ecec51d6 11 Although the chips on my board says jx15020, I've been informed that they are equvivalent to the CYT62726, and so far it's a match.
RRacer 0:1f58ecec51d6 12 Feel free to use all or parts of this work.
RRacer 0:1f58ecec51d6 13 If you choose to do so, I would appreciate a small mentioning in the scrolling opening credits ;)
RRacer 0:1f58ecec51d6 14
RRacer 0:1f58ecec51d6 15 Best regards,
RRacer 0:1f58ecec51d6 16 Hugo Harming
RRacer 0:1f58ecec51d6 17 upgraded@hotmail.com
RRacer 0:1f58ecec51d6 18 */
RRacer 0:1f58ecec51d6 19
RRacer 0:1f58ecec51d6 20 #include "mbed.h"
RRacer 0:1f58ecec51d6 21 #define LOW 0
RRacer 0:1f58ecec51d6 22 #define HIGH 1
RRacer 0:1f58ecec51d6 23
chirashi 2:c1a9a2a0885d 24 BusOut ABC(D8,D9,D10); // Row address.
chirashi 2:c1a9a2a0885d 25 DigitalOut CLK(D11); // Data clock - rising edge
chirashi 2:c1a9a2a0885d 26 DigitalOut LAT(D12); // Data latch - active low (pulse up after data load)
chirashi 2:c1a9a2a0885d 27 DigitalOut OE(D13); // Output enable - active low (hold high during data load, bring low after LAT pulse)
chirashi 2:c1a9a2a0885d 28 DigitalOut R1(D2); // RED Serial in for upper half
chirashi 2:c1a9a2a0885d 29 DigitalOut R2(D3); // RED Serial in for lower half
chirashi 2:c1a9a2a0885d 30 DigitalOut G1(D4); // GREEN Serial in for upper half
chirashi 2:c1a9a2a0885d 31 DigitalOut G2(D5); // GREEN Serial in for lower half
chirashi 2:c1a9a2a0885d 32 DigitalOut B1(D6); // BLUE Serial in for upper half
chirashi 2:c1a9a2a0885d 33 DigitalOut B2(D7); // BLUE Serial in for lower half
RRacer 0:1f58ecec51d6 34
RRacer 0:1f58ecec51d6 35 unsigned char gm[32][6]; // Buffer with 32x6 bytes. Graphics memory if you like.
RRacer 0:1f58ecec51d6 36 unsigned long CT; // Counter for demo code
RRacer 0:1f58ecec51d6 37
chirashi 4:245f17936b1a 38 const int LEDBuffer [16][32] = {
chirashi 4:245f17936b1a 39 {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,2,0,0},
chirashi 4:245f17936b1a 40 {0,0,0,2,0,0,2,0,0,2,2,2,2,0,2,2,2,0,0,0,2,0,0,2,0,0,0,0,0,2,0,0},
chirashi 4:245f17936b1a 41 {0,0,2,2,2,2,2,0,0,2,0,2,0,0,2,0,2,0,0,0,2,2,2,2,2,2,0,2,2,2,2,2},
chirashi 4:245f17936b1a 42 {0,0,2,0,0,0,2,0,0,2,0,2,0,0,2,0,2,0,0,0,2,0,0,0,0,0,0,0,0,2,0,0},
chirashi 4:245f17936b1a 43 {0,2,2,0,0,0,2,0,0,2,2,2,2,0,2,0,2,0,0,2,0,0,2,2,2,0,0,2,2,2,2,2},
chirashi 4:245f17936b1a 44 {0,0,0,2,0,2,0,0,0,2,0,2,0,0,2,0,2,0,0,2,0,0,2,0,2,0,0,2,0,2,0,2},
chirashi 4:245f17936b1a 45 {0,0,0,0,2,0,0,0,0,2,0,2,0,0,2,2,2,0,2,2,0,0,2,2,2,0,0,2,0,2,0,2},
chirashi 4:245f17936b1a 46 {0,0,0,2,2,0,0,0,0,2,2,2,2,0,2,2,0,0,0,2,0,0,0,0,0,0,0,2,2,2,2,2},
chirashi 4:245f17936b1a 47 {0,0,2,0,0,2,0,0,0,2,0,2,0,0,2,2,0,0,0,2,0,2,2,2,2,2,0,2,0,2,0,2},
chirashi 4:245f17936b1a 48 {0,2,0,0,0,0,2,0,0,2,0,2,0,0,2,2,0,0,0,2,0,2,0,0,0,2,0,2,0,2,0,2},
chirashi 4:245f17936b1a 49 {2,2,2,2,2,2,2,2,0,2,2,2,2,0,2,2,0,0,0,2,0,0,0,0,0,0,0,2,2,2,2,2},
chirashi 4:245f17936b1a 50 {0,2,0,0,0,0,2,0,0,0,0,0,2,0,2,0,2,0,0,2,0,0,2,2,2,0,0,0,0,2,0,0},
chirashi 4:245f17936b1a 51 {0,2,0,0,0,0,2,0,0,0,0,0,2,0,2,0,2,0,0,2,0,0,0,2,0,0,2,2,2,2,2,2},
chirashi 4:245f17936b1a 52 {0,2,0,0,0,0,2,0,2,2,2,0,2,0,2,0,2,0,0,2,0,0,0,2,0,0,0,0,0,2,0,0},
chirashi 4:245f17936b1a 53 {0,2,2,2,2,2,2,0,0,0,0,0,2,0,2,0,2,0,0,2,0,0,0,2,0,0,0,0,0,2,0,0},
chirashi 4:245f17936b1a 54 {0,2,0,0,0,0,2,0,0,0,0,2,2,0,2,0,2,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0}
chirashi 4:245f17936b1a 55 };
chirashi 4:245f17936b1a 56
chirashi 4:245f17936b1a 57
chirashi 4:245f17936b1a 58
RRacer 0:1f58ecec51d6 59 void MkPattern() // Fill graphics buffer with colorful test pattern.
RRacer 0:1f58ecec51d6 60 {
RRacer 0:1f58ecec51d6 61 unsigned int col,r,g,b;
RRacer 0:1f58ecec51d6 62 r=0x0f0f0f0f;
RRacer 0:1f58ecec51d6 63 g=0x33333333;
RRacer 0:1f58ecec51d6 64 b=0x55555555;
RRacer 0:1f58ecec51d6 65 for(col=0; col<32; col++) {
RRacer 0:1f58ecec51d6 66 gm[col][0]=(r>>(col % 8)) & 0xff; // Shift red value and mask out LSB.
RRacer 0:1f58ecec51d6 67 gm[col][1]=(g>>(col % 8)) & 0xff; // Shift green value and mask out LSB.
RRacer 0:1f58ecec51d6 68 gm[col][2]=(b>>(col % 8)) & 0xff; // Shift blue value and mask out LSB.
RRacer 0:1f58ecec51d6 69 gm[col][3]=gm[col][0]; // Copy top red byte to bottom red byte.
RRacer 0:1f58ecec51d6 70 gm[col][4]=gm[col][1]; // Copy top green byte to bottom green byte.
RRacer 0:1f58ecec51d6 71 gm[col][5]=gm[col][2]; // Copy top blue byte to bottom blue byte.
RRacer 0:1f58ecec51d6 72 }
RRacer 0:1f58ecec51d6 73 }
RRacer 0:1f58ecec51d6 74
RRacer 0:1f58ecec51d6 75 void Init()
RRacer 0:1f58ecec51d6 76 {
RRacer 0:1f58ecec51d6 77 // Set up things to a known state
RRacer 0:1f58ecec51d6 78 CLK = LOW;
RRacer 0:1f58ecec51d6 79 LAT = LOW;
RRacer 0:1f58ecec51d6 80 OE = HIGH; //display off
RRacer 0:1f58ecec51d6 81 ABC = 0;
RRacer 0:1f58ecec51d6 82 CT=0;
RRacer 0:1f58ecec51d6 83 MkPattern();
RRacer 0:1f58ecec51d6 84 }
RRacer 0:1f58ecec51d6 85
RRacer 0:1f58ecec51d6 86 void ShiftRight()
RRacer 0:1f58ecec51d6 87 {
RRacer 0:1f58ecec51d6 88 unsigned char i,r,g,b;
RRacer 0:1f58ecec51d6 89 r=gm[31][0]; // Save value of last column (top half)
RRacer 0:1f58ecec51d6 90 g=gm[31][1];
RRacer 0:1f58ecec51d6 91 b=gm[31][2];
RRacer 0:1f58ecec51d6 92
RRacer 0:1f58ecec51d6 93 for(i=31; i>0; i--) { // Copy value of column n to column n-1
RRacer 0:1f58ecec51d6 94 gm[i][0]=gm[i-1][0];
RRacer 0:1f58ecec51d6 95 gm[i][1]=gm[i-1][1];
RRacer 0:1f58ecec51d6 96 gm[i][2]=gm[i-1][2];
RRacer 0:1f58ecec51d6 97 }
RRacer 0:1f58ecec51d6 98 gm[0][0]=r; // Paste saved values from last column to first column
RRacer 0:1f58ecec51d6 99 gm[0][1]=g;
RRacer 0:1f58ecec51d6 100 gm[0][2]=b;
RRacer 0:1f58ecec51d6 101 // Do it again for the lower half
RRacer 0:1f58ecec51d6 102 r=gm[31][3];
RRacer 0:1f58ecec51d6 103 g=gm[31][4];
RRacer 0:1f58ecec51d6 104 b=gm[31][5];
RRacer 0:1f58ecec51d6 105
RRacer 0:1f58ecec51d6 106 for(i=31; i>0; i--) {
RRacer 0:1f58ecec51d6 107 gm[i][3]=gm[i-1][3];
RRacer 0:1f58ecec51d6 108 gm[i][4]=gm[i-1][4];
RRacer 0:1f58ecec51d6 109 gm[i][5]=gm[i-1][5];
RRacer 0:1f58ecec51d6 110 }
RRacer 0:1f58ecec51d6 111 gm[0][3]=r;
RRacer 0:1f58ecec51d6 112 gm[0][4]=g;
RRacer 0:1f58ecec51d6 113 gm[0][5]=b;
RRacer 0:1f58ecec51d6 114 }
RRacer 0:1f58ecec51d6 115
RRacer 0:1f58ecec51d6 116 void WrRow(unsigned char Row)
RRacer 0:1f58ecec51d6 117 {
RRacer 0:1f58ecec51d6 118 // Write specified row (and row+8) to display. Valid input: 0 to 7.
chirashi 2:c1a9a2a0885d 119 ABC = 7-Row; // Set row address
RRacer 0:1f58ecec51d6 120 for(int col=0; col<32; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though.
chirashi 4:245f17936b1a 121 //R1 = gm[col][0] & (1<<Row); // Red bit, upper half
chirashi 4:245f17936b1a 122 //G1 = gm[col][1] & (1<<Row); // Green bit, upper half
chirashi 4:245f17936b1a 123 //B1 = gm[col][2] & (1<<Row); // Blue bit, upper half
chirashi 4:245f17936b1a 124 //R2 = gm[col][3] & (1<<Row); // Red bit, lower half
chirashi 4:245f17936b1a 125 //G2 = gm[col][4] & (1<<Row); // Green bit, lower half
chirashi 4:245f17936b1a 126 //B2 = gm[col][5] & (1<<Row); // Blue bit, lower half
chirashi 4:245f17936b1a 127
chirashi 4:245f17936b1a 128
chirashi 4:245f17936b1a 129 if (LEDBuffer [(7-Row)][col] == 2){
chirashi 4:245f17936b1a 130 R1 = 1;
chirashi 4:245f17936b1a 131 G1 = 1;
chirashi 4:245f17936b1a 132 B1 = 0;
chirashi 4:245f17936b1a 133 }else{
chirashi 4:245f17936b1a 134 R1 = 0;
chirashi 4:245f17936b1a 135 G1 = 0;
chirashi 4:245f17936b1a 136 B1 = 0;
chirashi 4:245f17936b1a 137 }
chirashi 4:245f17936b1a 138
chirashi 4:245f17936b1a 139 if (LEDBuffer [(15-Row)][col] == 2){
chirashi 4:245f17936b1a 140 R2 = 1;
chirashi 4:245f17936b1a 141 G2 = 0;
chirashi 4:245f17936b1a 142 B2 = 0;
chirashi 4:245f17936b1a 143 }else{
chirashi 4:245f17936b1a 144 R2 = 0;
chirashi 4:245f17936b1a 145 G2 = 0;
chirashi 4:245f17936b1a 146 B2 = 0;
chirashi 4:245f17936b1a 147 }
chirashi 4:245f17936b1a 148
chirashi 4:245f17936b1a 149
chirashi 4:245f17936b1a 150
chirashi 4:245f17936b1a 151
chirashi 4:245f17936b1a 152 CLK = HIGH; // tick (clock bit in)
chirashi 4:245f17936b1a 153 CLK = LOW; // tock
chirashi 4:245f17936b1a 154 }
chirashi 4:245f17936b1a 155 LAT = HIGH; // Latch entire row
chirashi 4:245f17936b1a 156 LAT = LOW;
chirashi 4:245f17936b1a 157 }
chirashi 4:245f17936b1a 158
chirashi 4:245f17936b1a 159 void WrRow2(unsigned char Row)
chirashi 4:245f17936b1a 160 {
chirashi 4:245f17936b1a 161 // Write specified row (and row+8) to display. Valid input: 0 to 7.
chirashi 4:245f17936b1a 162 ABC = 7-Row; // Set row address
chirashi 4:245f17936b1a 163 for(int col=0; col<32; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though.
chirashi 4:245f17936b1a 164 //R1 = gm[col][0] & (1<<Row); // Red bit, upper half
chirashi 4:245f17936b1a 165 //G1 = gm[col][1] & (1<<Row); // Green bit, upper half
chirashi 4:245f17936b1a 166 //B1 = gm[col][2] & (1<<Row); // Blue bit, upper half
chirashi 4:245f17936b1a 167 //R2 = gm[col][3] & (1<<Row); // Red bit, lower half
chirashi 4:245f17936b1a 168 //G2 = gm[col][4] & (1<<Row); // Green bit, lower half
chirashi 4:245f17936b1a 169 //B2 = gm[col][5] & (1<<Row); // Blue bit, lower half
chirashi 4:245f17936b1a 170
chirashi 4:245f17936b1a 171
chirashi 4:245f17936b1a 172 if (LEDBuffer [(7-Row)][col] == 2){
chirashi 4:245f17936b1a 173 R1 = 1;
chirashi 4:245f17936b1a 174 G1 = 1;
chirashi 4:245f17936b1a 175 B1 = 1;
chirashi 4:245f17936b1a 176 }else{
chirashi 4:245f17936b1a 177 R1 = 0;
chirashi 4:245f17936b1a 178 G1 = 0;
chirashi 4:245f17936b1a 179 B1 = 0;
chirashi 4:245f17936b1a 180 }
chirashi 4:245f17936b1a 181
chirashi 4:245f17936b1a 182 if (LEDBuffer [(15-Row)][col] == 2){
chirashi 4:245f17936b1a 183 R2 = 1;
chirashi 4:245f17936b1a 184 G2 = 0;
chirashi 4:245f17936b1a 185 B2 = 1;
chirashi 4:245f17936b1a 186 }else{
chirashi 4:245f17936b1a 187 R2 = 0;
chirashi 4:245f17936b1a 188 G2 = 0;
chirashi 4:245f17936b1a 189 B2 = 0;
chirashi 4:245f17936b1a 190 }
chirashi 4:245f17936b1a 191
chirashi 4:245f17936b1a 192
chirashi 4:245f17936b1a 193
chirashi 4:245f17936b1a 194
RRacer 0:1f58ecec51d6 195 CLK = HIGH; // tick (clock bit in)
RRacer 0:1f58ecec51d6 196 CLK = LOW; // tock
RRacer 0:1f58ecec51d6 197 }
RRacer 0:1f58ecec51d6 198 LAT = HIGH; // Latch entire row
RRacer 0:1f58ecec51d6 199 LAT = LOW;
RRacer 0:1f58ecec51d6 200 }
RRacer 0:1f58ecec51d6 201
chirashi 3:6dbbc0130e96 202 void WrRowOFF(unsigned char Row)
chirashi 3:6dbbc0130e96 203 {
chirashi 3:6dbbc0130e96 204 // Write specified row (and row+8) to display. Valid input: 0 to 7.
chirashi 3:6dbbc0130e96 205 ABC = 7-Row; // Set row address
chirashi 3:6dbbc0130e96 206 for(int col=0; col<32; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though.
chirashi 3:6dbbc0130e96 207 R1 = 0; // Red bit, upper half
chirashi 3:6dbbc0130e96 208 G1 = 0; // Green bit, upper half
chirashi 3:6dbbc0130e96 209 B1 = 0; // Blue bit, upper half
chirashi 3:6dbbc0130e96 210 R2 = 0; // Red bit, lower half
chirashi 3:6dbbc0130e96 211 G2 = 0; // Green bit, lower half
chirashi 3:6dbbc0130e96 212 B2 = 0; // Blue bit, lower half
chirashi 3:6dbbc0130e96 213 CLK = HIGH; // tick (clock bit in)
chirashi 3:6dbbc0130e96 214 CLK = LOW; // tock
chirashi 3:6dbbc0130e96 215 }
chirashi 3:6dbbc0130e96 216 LAT = HIGH; // Latch entire row
chirashi 3:6dbbc0130e96 217 LAT = LOW;
chirashi 3:6dbbc0130e96 218 }
chirashi 3:6dbbc0130e96 219
RRacer 0:1f58ecec51d6 220 void Pset(unsigned char x,unsigned char y, unsigned char c)
RRacer 0:1f58ecec51d6 221 {
RRacer 0:1f58ecec51d6 222 // Set pixel (x,y) to color c
RRacer 0:1f58ecec51d6 223 // Manipulates graphics memory, so you won't see any change til you Paint() it.
RRacer 0:1f58ecec51d6 224 unsigned char ud,l,r0,g0,b0;
RRacer 0:1f58ecec51d6 225 ud=(y & 8)>>3; // 0 = upper half, 1 = lower half
RRacer 0:1f58ecec51d6 226 l=y & 7; // Extract row in upper/lower half
RRacer 0:1f58ecec51d6 227 r0=(c & 4) >>2; // Extract red bit from color
RRacer 0:1f58ecec51d6 228 g0=(c & 2) >>1; // Extract green bit from color
RRacer 0:1f58ecec51d6 229 b0=(c & 1); // Extract blue bit from color
RRacer 0:1f58ecec51d6 230 // *******Removes current bit ******* *Adds bit**
RRacer 0:1f58ecec51d6 231 gm[x][0+3*ud]=(gm[x][0+3*ud] & (255-(1<<(7-l))))+(r0<<(7-l)); // Red byte
RRacer 0:1f58ecec51d6 232 gm[x][1+3*ud]=(gm[x][1+3*ud] & (255-(1<<(7-l))))+(g0<<(7-l)); // Green byte
RRacer 0:1f58ecec51d6 233 gm[x][2+3*ud]=(gm[x][2+3*ud] & (255-(1<<(7-l))))+(b0<<(7-l)); // Blue byte
RRacer 0:1f58ecec51d6 234 }
RRacer 0:1f58ecec51d6 235
RRacer 0:1f58ecec51d6 236 void Paint()
RRacer 0:1f58ecec51d6 237 {
RRacer 0:1f58ecec51d6 238 // Write graphics memory to display
RRacer 0:1f58ecec51d6 239 for(int Row=0; Row<8; Row++) {
RRacer 0:1f58ecec51d6 240 OE = HIGH; // Disable output
RRacer 0:1f58ecec51d6 241 WrRow(Row);
chirashi 4:245f17936b1a 242 //WrRow2(Row);
RRacer 0:1f58ecec51d6 243 OE = LOW; // Enable output
chirashi 4:245f17936b1a 244
chirashi 4:245f17936b1a 245 wait_us(25); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
chirashi 4:245f17936b1a 246 }
chirashi 4:245f17936b1a 247
chirashi 4:245f17936b1a 248
chirashi 4:245f17936b1a 249
chirashi 4:245f17936b1a 250
chirashi 4:245f17936b1a 251
chirashi 4:245f17936b1a 252
chirashi 4:245f17936b1a 253 }
chirashi 4:245f17936b1a 254
chirashi 4:245f17936b1a 255 void Paint2()
chirashi 4:245f17936b1a 256 {
chirashi 4:245f17936b1a 257 // Write graphics memory to display
chirashi 4:245f17936b1a 258 for(int Row=0; Row<8; Row++) {
chirashi 4:245f17936b1a 259 OE = HIGH; // Disable output
chirashi 4:245f17936b1a 260 //WrRow(Row);
chirashi 4:245f17936b1a 261 WrRow2(Row);
chirashi 4:245f17936b1a 262 OE = LOW; // Enable output
chirashi 4:245f17936b1a 263
chirashi 4:245f17936b1a 264 wait_us(25); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
RRacer 0:1f58ecec51d6 265 }
RRacer 0:1f58ecec51d6 266 }
RRacer 0:1f58ecec51d6 267
chirashi 3:6dbbc0130e96 268
chirashi 3:6dbbc0130e96 269 void PaintOFF()
chirashi 3:6dbbc0130e96 270 {
chirashi 3:6dbbc0130e96 271 // Write graphics memory to display
chirashi 3:6dbbc0130e96 272 for(int Row=0; Row<8; Row++) {
chirashi 3:6dbbc0130e96 273 OE = HIGH; // Disable output
chirashi 3:6dbbc0130e96 274 WrRowOFF(Row);
chirashi 3:6dbbc0130e96 275 OE = LOW; // Enable output
chirashi 4:245f17936b1a 276 wait_us(50); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
chirashi 3:6dbbc0130e96 277 }
chirashi 3:6dbbc0130e96 278 }
chirashi 3:6dbbc0130e96 279
chirashi 3:6dbbc0130e96 280
chirashi 3:6dbbc0130e96 281
RRacer 0:1f58ecec51d6 282 int main()
RRacer 0:1f58ecec51d6 283 {
RRacer 0:1f58ecec51d6 284 Init(); // Set things up
RRacer 0:1f58ecec51d6 285 while(1) { // Messy demo loop following...
RRacer 0:1f58ecec51d6 286 CT++;
chirashi 3:6dbbc0130e96 287
chirashi 4:245f17936b1a 288 Paint(); // Refresh display
chirashi 4:245f17936b1a 289 Paint2(); // Refresh display
chirashi 4:245f17936b1a 290
chirashi 4:245f17936b1a 291 //if((CT<=2560)||(CT>=2880 && CT<=4160)) {
chirashi 4:245f17936b1a 292 // Paint(); // Refresh display
chirashi 4:245f17936b1a 293 // if((CT % 20)==0) ShiftRight(); // After every 20 refresh, do a ShiftRight
chirashi 4:245f17936b1a 294 //}
chirashi 3:6dbbc0130e96 295
chirashi 4:245f17936b1a 296 //if(CT==2560) {
chirashi 4:245f17936b1a 297 // for(int c=0; c<8; c++) {
chirashi 4:245f17936b1a 298 // for(int x=c; x<(31-c); x++) {// Top side
chirashi 4:245f17936b1a 299 // Pset(x,c,c);
chirashi 4:245f17936b1a 300 // Paint(); // Display refresh time sets loop duration.
chirashi 4:245f17936b1a 301 // }
chirashi 4:245f17936b1a 302 // for(int y=c; y<(15-c); y++) {// Right side
chirashi 4:245f17936b1a 303 // Pset(31-c,y,c);
chirashi 4:245f17936b1a 304 // Paint();
chirashi 4:245f17936b1a 305 // }
chirashi 4:245f17936b1a 306 // for(int x=(31-c); x>=c; x--) {// Bottom side
chirashi 4:245f17936b1a 307 // Pset(x,(15-c),c);
chirashi 4:245f17936b1a 308 // Paint();
chirashi 4:245f17936b1a 309 // }
chirashi 4:245f17936b1a 310 // for(int y=(15-c); y>=c; y--) { // Left side
chirashi 4:245f17936b1a 311 // Pset(c,y,c);
chirashi 4:245f17936b1a 312 // Paint();
chirashi 4:245f17936b1a 313 // }
chirashi 4:245f17936b1a 314 // }
chirashi 4:245f17936b1a 315 //}
chirashi 3:6dbbc0130e96 316
RRacer 0:1f58ecec51d6 317 if(CT>4160) {
chirashi 4:245f17936b1a 318 //MkPattern(); // Restore original priceless artwork
RRacer 0:1f58ecec51d6 319 CT=0; // Start all over.
RRacer 0:1f58ecec51d6 320 }
chirashi 3:6dbbc0130e96 321
chirashi 4:245f17936b1a 322 //PaintOFF();
chirashi 4:245f17936b1a 323 //wait_us(160);
RRacer 0:1f58ecec51d6 324 }
chirashi 3:6dbbc0130e96 325
RRacer 0:1f58ecec51d6 326 }