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

Dependencies:   SDFileSystem mbed

Revision:
22:ebab951db9f6
Parent:
21:b536f614ba71
Child:
23:6fb1181345a7
--- a/main.cpp	Thu Nov 27 10:51:40 2014 +0000
+++ b/main.cpp	Thu Nov 27 16:17:01 2014 +0000
@@ -44,7 +44,6 @@
 
 #define DisplayWait 15
 
-
 SDFileSystem sd(D11, D12, D13, D10, "sd");
 Serial pc(USBTX,USBRX );
 BusOut ABC(D8,D9,PB_13,PC_5); // Row address.
@@ -85,6 +84,7 @@
 //BusIn SumSWNum(PA_0,PA_1,PA_4,PB_0);
 
 Ticker ChangeTimer;
+Ticker ScrollTimer;
 
 //Debug
 bool Debug = 0;
@@ -105,6 +105,10 @@
 //4:2段階 LEDBuffer2-LEDBuffer3
 int DisplayMode = 1;
 
+//スクロール有効/無効(テスト用)
+bool Scroll = 1;
+
+
 int ChangeCount = 0;
 int LineNumber = 37;
 int KindNumber = 1;
@@ -113,6 +117,12 @@
 char SerialBuffer[30];
 int count = 0;
 
+
+
+int ScrollCount = 0;
+
+
+
 //SDCardFilePath
 char SDFilePath[80]= "/sd/a.txt";
 
@@ -266,6 +276,26 @@
 
 };
 
+int8_t ScrollBuffer[16][2048] = {
+{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,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,4,0,0,0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,4,4,0,0,4,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,4,4,0,0,4,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,4,4,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,4,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,4,4,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+
+};
+    
 
 //01 Red
 //02 Green
@@ -539,16 +569,45 @@
     }
 }
 
+void CopyBuffer(int8_t ReadBuffer[32][128],int8_t WriteBuffer[32][128]){
+    for(int y = 0; y < LED_Height * 2; y++){
+        if(Scroll != 0 && y > 15 ){
+            for(int x = 0; x < LED_Width - 80;  x++){
+                WriteBuffer[y][x] = ReadBuffer[y][x];    
+            }              
+        }else{
+            for(int x = 0; x < LED_Width;  x++){
+                WriteBuffer[y][x] = ReadBuffer[y][x];    
+            }    
+        }      
+    }
+}
+
+
+
+void CopyScrollBuffer(int8_t ReadBuffer[16][2048],int8_t WriteBuffer[32][128],int Startx){
+    for(int y = 0; y < 16; y++){
+        for(int x = 0; x < 80; x++){
+            LEDMainBuffer[y + 16][x + 48] = ScrollBuffer[y][x + Startx];   
+        }    
+    }     
+} 
+
+
+
 void TimerTick(){
     
     //DisplayMode = 1 3段階表示ならば
     if(DisplayMode == 1){
         if (ChangeCount == 0){
+            CopyBuffer(LEDBuffer,LEDMainBuffer);
             ChangeCount = ChangeCount + 1;
         }else if(ChangeCount == 1 ){
+            CopyBuffer(LEDBuffer2,LEDMainBuffer);
             ChangeCount = ChangeCount + 1;
             //ChangeCount = 0;
-        }else if(ChangeCount == 2){     
+        }else if(ChangeCount == 2){
+            CopyBuffer(LEDBuffer3,LEDMainBuffer);
             ChangeCount = 0;
         }else{
             ChangeCount = 0;
@@ -559,9 +618,11 @@
     else if (DisplayMode == 2){
         
         if(ChangeCount == 0 ){
+            CopyBuffer(LEDBuffer,LEDMainBuffer);
             ChangeCount = ChangeCount + 1;
             //ChangeCount = 0;
-        }else if(ChangeCount == 1){     
+        }else if(ChangeCount == 1){
+            CopyBuffer(LEDBuffer2,LEDMainBuffer);     
             ChangeCount = 0;
         }else{
             ChangeCount = 0;
@@ -569,23 +630,33 @@
     }
     //DisplayMode = 3 ならば LEDBuffer2を固定表示
     else if (DisplayMode == 3){
+        CopyBuffer(LEDBuffer2,LEDMainBuffer);
         ChangeCount = 1;
     }
     
     //2段階表示 次駅表示あり、路線名なしパターンに使用
     else if(DisplayMode == 4){    
         if(ChangeCount == 1 ){
+            CopyBuffer(LEDBuffer2,LEDMainBuffer);
             ChangeCount = ChangeCount + 1;
         }else{
+            CopyBuffer(LEDBuffer3,LEDMainBuffer);
             ChangeCount = 1;
         }  
     }
-    
-    
-    
-    
 }
 
+void ScrollTimerTick(){
+    if(ScrollCount < 560 - 80){    
+        CopyScrollBuffer(ScrollBuffer,LEDMainBuffer,ScrollCount);
+        ScrollCount = ScrollCount + 1;
+    }else{
+        ScrollCount = 0;
+    }
+}
+
+
+
 //書込み対象バッファ,書込み開始位置x,書込み開始位置y,読み出し幅x,読み出し高さy
 void SDBufferWrite(int8_t TargetBuffer[32][128], int Startx, int Starty, int Readx, int Ready){
     FILE *fp = fopen(SDFilePath, "r");
@@ -675,6 +746,8 @@
     //次停車駅(英語)
     sprintf(SDFilePath,"/sd/E233/NextStationE/%d.bin",NextStaNumber);
     SDBufferWrite(LEDBuffer3,48,16,80,16);   
+    
+    
         
     //路線コードが0なら2段階表示に変更
     if(LineNumber == 0){
@@ -746,6 +819,7 @@
 void pc_rx(){
     //pc.putc(pc.getc());
     
+    OE = HIGH;
     
     if (pc.readable() == 1) { // 受信したデータが存在する
         SerialBuffer[count] = pc.getc(); // 受信データを読み込む
@@ -894,6 +968,8 @@
       count++;
     }
     }
+    
+    OE = LOW;
 }
 
 int main(){
@@ -965,23 +1041,42 @@
     //DisplayTimer
     ChangeTimer.attach(&TimerTick,3);
     
-    
+    //スクロールが有効なら
+    //if(Scroll == 1){
+        ////スクロール用タイマ
+    //    ScrollTimer.attach(ScrollTimerTick,0.02);
+    //}
     
     
     while(1) { 
         CT++;
-        if (ChangeCount == 0){
-            Paint(LEDBuffer);
-        }else if(ChangeCount == 1){
-            Paint(LEDBuffer2);
-        }else if(ChangeCount == 2){
-            Paint(LEDBuffer3);
+//        if (ChangeCount == 0){
+//            Paint(LEDBuffer);
+//        }else if(ChangeCount == 1){
+//            Paint(LEDBuffer2);
+//        }else if(ChangeCount == 2){
+//            Paint(LEDBuffer3);
+//        }
+        //表示切替は切り替え時にメインバッファに書き込む
+        Paint(LEDMainBuffer);
+        
+        //スクロール(現状不動作)
+        //スクロールが有効なら
+        if(Scroll == 1){
+            if(CT>0) {
+                //MkPattern(); // Restore original priceless artwork
+                CT=0; // Start all over.
+                OE = HIGH;
+                ScrollTimerTick();
+                OE = LOW;
+            }
+        }else{
+            if(CT>4160){
+                CT=0;
+            }
         }
         
-        if(CT>4160) {
-            //MkPattern(); // Restore original priceless artwork
-            CT=0; // Start all over.
-        }
+        
         
         //PaintOFF();
         //wait_us(10);