Aliexpressなどで販売されている64x32のフルカラードットマトリクスLED2枚とNucleo F401REを利用して、 E233系の駅停車時、路線名表示ありのLED側面行先表示を再現するプログラムです。 3秒間隔、3段階切替で、路線名、種別、行先、次停車駅を個別に指定することが可能です。
Dependencies: SDFileSystem mbed
Revision 6:e6cb4a476422, committed 2014-10-20
- Comitter:
- chirashi
- Date:
- Mon Oct 20 15:56:34 2014 +0000
- Parent:
- 5:532937f20397
- Child:
- 7:79dfe71beb88
- Commit message:
- keihine233
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 20 13:07:52 2014 +0000
+++ b/main.cpp Mon Oct 20 15:56:34 2014 +0000
@@ -21,6 +21,24 @@
#define LOW 0
#define HIGH 1
+#define R_Debug1 0
+#define R_Debug2 0
+#define R_Debug3 0
+#define R_Debug4 0
+
+#define G_Debug1 0
+#define G_Debug2 0
+#define G_Debug3 0
+#define G_Debug4 0
+
+#define B_Debug1 0
+#define B_Debug2 0
+#define B_Debug3 0
+#define B_Debug4 0
+
+
+#define LED_Width 128
+
BusOut ABC(D8,D9,D10); // Row address.
DigitalOut CLK(D11); // Data clock - rising edge
DigitalOut LAT(D12); // Data latch - active low (pulse up after data load)
@@ -35,23 +53,42 @@
unsigned char gm[32][6]; // Buffer with 32x6 bytes. Graphics memory if you like.
unsigned long CT; // Counter for demo code
-const int LEDBuffer [16][32] = {
- {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},
- {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},
- {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},
- {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},
- {0,2,2,0,0,0,2,0,0,2,2,2,2,0,2,0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,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,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}
+
+
+
};
@@ -117,7 +154,7 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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.
//R1 = gm[col][0] & (1<<Row); // Red bit, upper half
//G1 = gm[col][1] & (1<<Row); // Green bit, upper half
//B1 = gm[col][2] & (1<<Row); // Blue bit, upper half
@@ -125,25 +162,115 @@
//G2 = gm[col][4] & (1<<Row); // Green bit, lower half
//B2 = gm[col][5] & (1<<Row); // Blue bit, lower half
- if (LEDBuffer [(7-Row)][col] == 2){
+ if (LEDBuffer [(7-Row)][col] == 0){
+ R1 = R_Debug1;
+ G1 = G_Debug1;
+ B1 = B_Debug1;
+ }else if (LEDBuffer [(7-Row)][col] == 1){
+ //Red
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 2){
+ //Green
+ R1 = 0;
+ G1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 3){
+ //Blue
+ R1 = 0;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 4){
+ //RG
R1 = 1;
G1 = 1;
- B1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 5){
+ //GB
+ R1 = 0;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 6){
+ //RB
+ R1 = 1;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 7){
+ //White
+ R1 = 1;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED Local)
+ R1 = 0;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R1 = 1;
+ G1 = 0;
+ B1 = 1;
}else{
R1 = 0;
- G1 = 1;
+ G1 = 0;
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 0){
+ R2 = R_Debug1;
+ G2 = G_Debug1;
+ B2 = B_Debug1;
+ }else if (LEDBuffer [(15-Row)][col] == 1){
+ //Red
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 2){
+ //Green
+ R2 = 0;
+ G2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 3){
+ //Blue
+ R2 = 0;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 4){
+ //RG
R2 = 1;
G2 = 1;
- B2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 5){
+ //GB
+ R2 = 0;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 6){
+ //RB
+ R2 = 1;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 7){
+ //White
+ R2 = 1;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
+ R2 = 0;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R2 = 1;
+ G2 = 0;
+ B2 = 1;
}else{
R2 = 0;
- G2 = 1;
- B2 = 1;
- }
+ G2 = 0;
+ B2 = 0;
+ }
CLK = HIGH; // tick (clock bit in)
CLK = LOW; // tock
@@ -156,27 +283,117 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 0){
+ R1 = R_Debug2;
+ G1 = G_Debug2;
+ B1 = B_Debug2;
+ }else if (LEDBuffer [(7-Row)][col] == 1){
+ //Red
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 2){
+ //Green
+ R1 = 0;
+ G1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 3){
+ //Blue
+ R1 = 0;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 4){
+ //RG
R1 = 1;
G1 = 1;
- B1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 5){
+ //GB
+ R1 = 0;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 6){
+ //RB
+ R1 = 1;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 7){
+ //White
+ R1 = 1;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
+ R1 = 0;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
}else{
R1 = 0;
- G1 = 1;
+ G1 = 0;
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 0){
+ R2 = R_Debug2;
+ G2 = G_Debug2;
+ B2 = B_Debug2;
+ }else if (LEDBuffer [(15-Row)][col] == 1){
+ //Red
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 2){
+ //Green
+ R2 = 0;
+ G2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 3){
+ //Blue
+ R2 = 0;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 4){
+ //RG
R2 = 1;
G2 = 1;
- B2 = 1;
- }else{
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 5){
+ //GB
+ R2 = 0;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 6){
+ //RB
+ R2 = 1;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 7){
+ //White
+ R2 = 1;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
R2 = 0;
G2 = 1;
B2 = 1;
- }
+ }else if (LEDBuffer [(15-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
+ }else{
+ R2 = 0;
+ G2 = 0;
+ B2 = 0;
+ }
CLK = HIGH; // tick (clock bit in)
CLK = LOW; // tock
@@ -189,27 +406,117 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 0){
+ R1 = R_Debug3;
+ G1 = G_Debug3;
+ B1 = B_Debug3;
+ }else if (LEDBuffer [(7-Row)][col] == 1){
+ //Red
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 2){
+ //Green
+ R1 = 0;
+ G1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 3){
+ //Blue
+ R1 = 0;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 4){
+ //RG
R1 = 1;
G1 = 1;
- B1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 5){
+ //GB
+ R1 = 0;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 6){
+ //RB
+ R1 = 1;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 7){
+ //White
+ R1 = 1;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
+ R1 = 0;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
}else{
R1 = 0;
G1 = 0;
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 0){
+ R2 = R_Debug3;
+ G2 = G_Debug3;
+ B2 = B_Debug3;
+ }else if (LEDBuffer [(15-Row)][col] == 1){
+ //Red
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 2){
+ //Green
+ R2 = 0;
+ G2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 3){
+ //Blue
+ R2 = 0;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 4){
+ //RG
R2 = 1;
G2 = 1;
- B2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 5){
+ //GB
+ R2 = 0;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 6){
+ //RB
+ R2 = 1;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 7){
+ //White
+ R2 = 1;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
+ R2 = 0;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
}else{
R2 = 0;
G2 = 0;
- B2 = 1;
- }
+ B2 = 0;
+ }
CLK = HIGH; // tick (clock bit in)
CLK = LOW; // tock
@@ -222,27 +529,117 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 0){
+ R1 = R_Debug4;
+ G1 = G_Debug4;
+ B1 = B_Debug4;
+ }else if (LEDBuffer [(7-Row)][col] == 1){
+ //Red
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 2){
+ //Green
+ R1 = 0;
+ G1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 3){
+ //Blue
+ R1 = 0;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 4){
+ //RG
R1 = 1;
G1 = 1;
- B1 = 1;
+ B1 = 0;
+ }else if (LEDBuffer [(7-Row)][col] == 5){
+ //GB
+ R1 = 0;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 6){
+ //RB
+ R1 = 1;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 7){
+ //White
+ R1 = 1;
+ G1 = 1;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
+ R1 = 0;
+ G1 = 0;
+ B1 = 1;
+ }else if (LEDBuffer [(7-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R1 = 1;
+ G1 = 0;
+ B1 = 0;
}else{
R1 = 0;
G1 = 0;
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 0){
+ R2 = R_Debug4;
+ G2 = G_Debug4;
+ B2 = B_Debug4;
+ }else if (LEDBuffer [(15-Row)][col] == 1){
+ //Red
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 2){
+ //Green
+ R2 = 0;
+ G2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 3){
+ //Blue
+ R2 = 0;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 4){
+ //RG
R2 = 1;
G2 = 1;
- B2 = 1;
+ B2 = 0;
+ }else if (LEDBuffer [(15-Row)][col] == 5){
+ //GB
+ R2 = 0;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 6){
+ //RB
+ R2 = 1;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 7){
+ //White
+ R2 = 1;
+ G2 = 1;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 8){
+ //Blue(Keihin-Tohoku E233 LED)
+ R2 = 0;
+ G2 = 0;
+ B2 = 1;
+ }else if (LEDBuffer [(15-Row)][col] == 9){
+ //Pink-Red(Keihin-Tohoku E233 LED Rapid)
+ R2 = 1;
+ G2 = 0;
+ B2 = 0;
}else{
R2 = 0;
G2 = 0;
B2 = 0;
- }
+ }
CLK = HIGH; // tick (clock bit in)
CLK = LOW; // tock
@@ -255,9 +652,9 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 7){
R1 = 1;
G1 = 1;
B1 = 1;
@@ -267,7 +664,7 @@
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 7){
R2 = 1;
G2 = 1;
B2 = 1;
@@ -288,9 +685,9 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 7){
R1 = 1;
G1 = 1;
B1 = 1;
@@ -300,7 +697,7 @@
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 7){
R2 = 1;
G2 = 1;
B2 = 1;
@@ -321,9 +718,9 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 7){
R1 = 1;
G1 = 1;
B1 = 1;
@@ -333,7 +730,7 @@
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 7){
R2 = 1;
G2 = 1;
B2 = 1;
@@ -354,9 +751,9 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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] == 2){
+ if (LEDBuffer [(7-Row)][col] == 7){
R1 = 1;
G1 = 1;
B1 = 1;
@@ -366,7 +763,7 @@
B1 = 0;
}
- if (LEDBuffer [(15-Row)][col] == 2){
+ if (LEDBuffer [(15-Row)][col] == 7){
R2 = 1;
G2 = 1;
B2 = 1;
@@ -386,7 +783,7 @@
{
// Write specified row (and row+8) to display. Valid input: 0 to 7.
ABC = 7-Row; // Set row address
- 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.
+ 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.
R1 = 0; // Red bit, upper half
G1 = 0; // Green bit, upper half
B1 = 0; // Blue bit, upper half
@@ -427,7 +824,7 @@
//wait_us(10);
OE = LOW; // Enable output
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+ wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
}
//2
for(int Row=0; Row<8; Row++) {
@@ -437,7 +834,7 @@
//wait_us(10);
OE = LOW; // Enable output
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+ wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
}
//3
for(int Row=0; Row<8; Row++) {
@@ -446,7 +843,7 @@
//wait_us(10);
OE = LOW; // Enable output
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+ wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
}
//4
for(int Row=0; Row<8; Row++) {
@@ -455,44 +852,44 @@
//wait_us(10);
OE = LOW; // Enable output
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+ wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
}
//5
- for(int Row=0; Row<8; Row++) {
- OE = HIGH; // Disable output
- WrRow5(Row);
- //wait_us(10);
- OE = LOW; // Enable output
-
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
- }
+// for(int Row=0; Row<8; Row++) {
+// OE = HIGH; // Disable output
+// WrRow5(Row);
+// //wait_us(10);
+// OE = LOW; // Enable output
+//
+// wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+// }
//6
- for(int Row=0; Row<8; Row++) {
- OE = HIGH; // Disable output
- WrRow6(Row);
- //wait_us(10);
- OE = LOW; // Enable output
-
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
- }
+// for(int Row=0; Row<8; Row++) {
+// OE = HIGH; // Disable output
+// WrRow6(Row);
+// //wait_us(10);
+// OE = LOW; // Enable output
+//
+// wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+// }
//7
- for(int Row=0; Row<8; Row++) {
- OE = HIGH; // Disable output
- WrRow7(Row);
- //wait_us(10);
- OE = LOW; // Enable output
-
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
- }
+// for(int Row=0; Row<8; Row++) {
+// OE = HIGH; // Disable output
+// WrRow7(Row);
+// //wait_us(10);
+// OE = LOW; // Enable output
+//
+// wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+// }
//8
- for(int Row=0; Row<8; Row++) {
- OE = HIGH; // Disable output
- WrRow8(Row);
- //wait_us(10);
- OE = LOW; // Enable output
-
- wait_us(5); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
- }
+// for(int Row=0; Row<8; Row++) {
+// OE = HIGH; // Disable output
+// WrRow8(Row);
+// //wait_us(10);
+// OE = LOW; // Enable output
+//
+// wait_us(10); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+// }
}
@@ -564,7 +961,7 @@
}
//PaintOFF();
- wait_us(10);
+ //wait_us(10);
}
}