Aliexpressなどで販売されている64x32のフルカラードットマトリクスLED2枚とNucleo F401REを利用して、 E233系の駅停車時、路線名表示ありのLED側面行先表示を再現するプログラムです。 3秒間隔、3段階切替で、路線名、種別、行先、次停車駅を個別に指定することが可能です。
Dependencies: SDFileSystem mbed
Diff: main.cpp
- Revision:
- 8:9d22c9910917
- Parent:
- 7:79dfe71beb88
- Child:
- 9:ab87b0e361aa
--- a/main.cpp Mon Oct 20 17:27:54 2014 +0000 +++ b/main.cpp Mon Oct 20 18:05:34 2014 +0000 @@ -50,6 +50,9 @@ DigitalOut B1(D6); // BLUE Serial in for upper half DigitalOut B2(D7); // BLUE Serial in for lower half +Ticker ChangeTimer; +int ChangeCount = 0; + unsigned char gm[32][6]; // Buffer with 32x6 bytes. Graphics memory if you like. unsigned long CT; // Counter for demo code @@ -86,8 +89,49 @@ {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9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0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,4,4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} + +}; + bool R1Data1[32]={0,1,0,0,1,0,1,1,0,1}; bool R1Data2[32]={0,1,0,0,1,0,1,1,0,1}; @@ -121,30 +165,33 @@ -void WrRow(unsigned char Row) +void WrRow(unsigned char Row, int Buffer[32][128]) { // Write specified row (and row+8) to display. Valid input: 0 to 7. ABC = 7-Row; // Set row address for(int col=0; col<LED_Width; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though. - if (LEDBuffer [(7-Row)][col] == 0){ + if (Buffer [(7-Row)][col] == 0){ R1 = R_Debug1; G1 = G_Debug1; B1 = B_Debug1; }else { - R1 = R1Data1[(LEDBuffer [(7-Row)][col])]; - G1 = G1Data1[(LEDBuffer [(7-Row)][col])]; - B1 = B1Data1[(LEDBuffer [(7-Row)][col])]; + //R1 = R1Data1[(LEDBuffer [(7-Row)][col])]; + //G1 = G1Data1[(LEDBuffer [(7-Row)][col])]; + //B1 = B1Data1[(LEDBuffer [(7-Row)][col])]; + R1 = R1Data1[(Buffer [(7-Row)][col])]; + G1 = G1Data1[(Buffer [(7-Row)][col])]; + B1 = B1Data1[(Buffer [(7-Row)][col])]; } - if (LEDBuffer [(15-Row)][col] == 0){ + if (Buffer [(15-Row)][col] == 0){ R2 = R_Debug1; G2 = G_Debug1; B2 = B_Debug1; }else { - R2 = R1Data1[(LEDBuffer [(15-Row)][col])]; - G2 = G1Data1[(LEDBuffer [(15-Row)][col])]; - B2 = B1Data1[(LEDBuffer [(15-Row)][col])]; + R2 = R1Data1[(Buffer [(15-Row)][col])]; + G2 = G1Data1[(Buffer [(15-Row)][col])]; + B2 = B1Data1[(Buffer [(15-Row)][col])]; } CLK = HIGH; // tick (clock bit in) @@ -154,30 +201,30 @@ LAT = LOW; } -void WrRow2(unsigned char Row) +void WrRow2(unsigned char Row,int Buffer[32][128]) { // Write specified row (and row+8) to display. Valid input: 0 to 7. ABC = 7-Row; // Set row address for(int col=0; col<LED_Width; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though. - if (LEDBuffer [(7-Row)][col] == 0){ + if (Buffer [(7-Row)][col] == 0){ R1 = R_Debug2; G1 = G_Debug2; B1 = B_Debug2; }else{ - R1 = R1Data2[(LEDBuffer [(7-Row)][col])]; - G1 = G1Data2[(LEDBuffer [(7-Row)][col])]; - B1 = B1Data2[(LEDBuffer [(7-Row)][col])]; + R1 = R1Data2[(Buffer [(7-Row)][col])]; + G1 = G1Data2[(Buffer [(7-Row)][col])]; + B1 = B1Data2[(Buffer [(7-Row)][col])]; } - if (LEDBuffer [(15-Row)][col] == 0){ + if (Buffer [(15-Row)][col] == 0){ R2 = R_Debug2; G2 = G_Debug2; B2 = B_Debug2; }else{ - R2 = R1Data2[(LEDBuffer [(15-Row)][col])]; - G2 = G1Data2[(LEDBuffer [(15-Row)][col])]; - B2 = B1Data2[(LEDBuffer [(15-Row)][col])]; + R2 = R1Data2[(Buffer [(15-Row)][col])]; + G2 = G1Data2[(Buffer [(15-Row)][col])]; + B2 = B1Data2[(Buffer [(15-Row)][col])]; } CLK = HIGH; // tick (clock bit in) @@ -187,30 +234,30 @@ LAT = LOW; } -void WrRow3(unsigned char Row) +void WrRow3(unsigned char Row,int Buffer[32][128]) { // Write specified row (and row+8) to display. Valid input: 0 to 7. ABC = 7-Row; // Set row address for(int col=0; col<LED_Width; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though. - if (LEDBuffer [(7-Row)][col] == 0){ + if (Buffer [(7-Row)][col] == 0){ R1 = R_Debug3; G1 = G_Debug3; B1 = B_Debug3; }else{ - R1 = R1Data3[(LEDBuffer [(7-Row)][col])]; - G1 = G1Data3[(LEDBuffer [(7-Row)][col])]; - B1 = B1Data3[(LEDBuffer [(7-Row)][col])]; + R1 = R1Data3[(Buffer [(7-Row)][col])]; + G1 = G1Data3[(Buffer [(7-Row)][col])]; + B1 = B1Data3[(Buffer [(7-Row)][col])]; } - if (LEDBuffer [(15-Row)][col] == 0){ + if (Buffer [(15-Row)][col] == 0){ R2 = R_Debug3; G2 = G_Debug3; B2 = B_Debug3; }else{ - R2 = R1Data3[(LEDBuffer [(15-Row)][col])]; - G2 = G1Data3[(LEDBuffer [(15-Row)][col])]; - B2 = B1Data3[(LEDBuffer [(15-Row)][col])]; + R2 = R1Data3[(Buffer [(15-Row)][col])]; + G2 = G1Data3[(Buffer [(15-Row)][col])]; + B2 = B1Data3[(Buffer [(15-Row)][col])]; } CLK = HIGH; // tick (clock bit in) @@ -220,30 +267,30 @@ LAT = LOW; } -void WrRow4(unsigned char Row) +void WrRow4(unsigned char Row,int Buffer[32][128]) { // Write specified row (and row+8) to display. Valid input: 0 to 7. ABC = 7-Row; // Set row address for(int col=0; col<LED_Width; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though. - if (LEDBuffer [(7-Row)][col] == 0){ + if (Buffer [(7-Row)][col] == 0){ R1 = R_Debug4; G1 = G_Debug4; B1 = B_Debug4; }else{ - R1 = R1Data4[(LEDBuffer [(7-Row)][col])]; - G1 = G1Data4[(LEDBuffer [(7-Row)][col])]; - B1 = B1Data4[(LEDBuffer [(7-Row)][col])]; + R1 = R1Data4[(Buffer [(7-Row)][col])]; + G1 = G1Data4[(Buffer [(7-Row)][col])]; + B1 = B1Data4[(Buffer [(7-Row)][col])]; } - if (LEDBuffer [(15-Row)][col] == 0){ + if (Buffer [(15-Row)][col] == 0){ R2 = R_Debug4; G2 = G_Debug4; B2 = B_Debug4; }else if (LEDBuffer [(15-Row)][col] == 1){ - R2 = R1Data4[(LEDBuffer [(15-Row)][col])]; - G2 = G1Data4[(LEDBuffer [(15-Row)][col])]; - B2 = B1Data4[(LEDBuffer [(15-Row)][col])]; + R2 = R1Data4[(Buffer [(15-Row)][col])]; + G2 = G1Data4[(Buffer [(15-Row)][col])]; + B2 = B1Data4[(Buffer [(15-Row)][col])]; } CLK = HIGH; // tick (clock bit in) @@ -288,13 +335,13 @@ gm[x][2+3*ud]=(gm[x][2+3*ud] & (255-(1<<(7-l))))+(b0<<(7-l)); // Blue byte } -void Paint() +void Paint(int Buffer2[32][128]) { // Write graphics memory to display //1 for(int Row=0; Row<8; Row++) { OE = HIGH; // Disable output - WrRow(Row); + WrRow(Row,Buffer2); //wait_us(10); OE = LOW; // Enable output @@ -304,7 +351,7 @@ for(int Row=0; Row<8; Row++) { OE = HIGH; // Disable output //WrRow(Row); - WrRow2(Row); + WrRow2(Row,Buffer2); //wait_us(10); OE = LOW; // Enable output @@ -313,7 +360,7 @@ //3 for(int Row=0; Row<8; Row++) { OE = HIGH; // Disable output - WrRow3(Row); + WrRow3(Row,Buffer2); //wait_us(10); OE = LOW; // Enable output @@ -322,7 +369,7 @@ //4 for(int Row=0; Row<8; Row++) { OE = HIGH; // Disable output - WrRow4(Row); + WrRow4(Row,Buffer2); //wait_us(10); OE = LOW; // Enable output @@ -332,18 +379,6 @@ } -void Paint2() -{ - // Write graphics memory to display - for(int Row=0; Row<8; Row++) { - OE = HIGH; // Disable output - //WrRow(Row); - WrRow2(Row); - OE = LOW; // Enable output - - wait_us(20); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh. - } -} void PaintOFF() @@ -357,16 +392,43 @@ } } - +void TimerTick(){ + if (ChangeCount == 0){ + + + + + ChangeCount = ChangeCount + 1; + }else if(ChangeCount == 1 ){ + + + ChangeCount = ChangeCount + 1; + //ChangeCount = 0; + }else if(ChangeCount == 2){ + + ChangeCount = 0; + }else{ + + + } + + +} int main() { Init(); // Set things up + ChangeTimer.attach(&TimerTick,5); + while(1) { // Messy demo loop following... CT++; - - Paint(); // Refresh display - //Paint2(); // Refresh display + if (ChangeCount == 0){ + Paint(LEDBuffer); + }else if(ChangeCount == 1){ + Paint(LEDBuffer2); + }else if(ChangeCount == 2){ + Paint(LEDBuffer3); + } //if((CT<=2560)||(CT>=2880 && CT<=4160)) { // Paint(); // Refresh display