超乗合馬車電光掲示板用制御ソフトです。

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
nameless129
Date:
Sat Apr 26 08:26:29 2014 +0000
Parent:
0:23cd1be2a1c2
Commit message:
????v1.01

Changed in this revision

LEDMatrix_MasterforBasya_codered_lpc1768/15x16fontsLib.cpp Show annotated file Show diff for this revision Revisions of this file
LEDMatrix_MasterforBasya_codered_lpc1768/15x16fontsLib.h Show annotated file Show diff for this revision Revisions of this file
LEDMatrix_MasterforBasya_codered_lpc1768/displayCom.h Show annotated file Show diff for this revision Revisions of this file
LEDMatrix_MasterforBasya_codered_lpc1768/main.cpp Show annotated file Show diff for this revision Revisions of this file
LEDMatrix_MasterforBasya_codered_lpc1768/unicode2SJIS.h Show annotated file Show diff for this revision Revisions of this file
--- a/LEDMatrix_MasterforBasya_codered_lpc1768/15x16fontsLib.cpp	Tue Apr 08 15:08:30 2014 +0000
+++ b/LEDMatrix_MasterforBasya_codered_lpc1768/15x16fontsLib.cpp	Sat Apr 26 08:26:29 2014 +0000
@@ -5,10 +5,9 @@
 SPI FontROM(p11, p12, p13); // mosi, miso, sclk
 DigitalOut FontROM_CS(p14);
 
+static unsigned char matrixdata[32];
 
-unsigned char matrixdata[32];
-
-void read_font(unsigned short code) {
+static void read_font(unsigned short code) {
     unsigned char  c1, c2, MSB,LSB;
     uint32_t Address, seq;
 
@@ -65,7 +64,7 @@
     FontROM_CS = 1;
 }
 
-void draw_kanji_15x16(int pos_x, int font_width)
+static void draw_kanji_15x16(int pos_x, int font_width)
 {
     for(int i=0; i<font_width; i++)
     {
@@ -77,7 +76,7 @@
     }
 }
 
-void drawStr15x16(char *str ,long pos_x,unsigned char color)
+void drawStr15x16(char *str ,unsigned int pos_x)
 {
     unsigned char   f_SJISChar = 0;
     unsigned char   c = 0;
--- a/LEDMatrix_MasterforBasya_codered_lpc1768/15x16fontsLib.h	Tue Apr 08 15:08:30 2014 +0000
+++ b/LEDMatrix_MasterforBasya_codered_lpc1768/15x16fontsLib.h	Sat Apr 26 08:26:29 2014 +0000
@@ -1,6 +1,6 @@
 #ifndef __15X16FONTSLIB_H_
 #define __15X16FONTSLIB_H_
 
-extern void drawStr15x16(char *str ,long pos_x,unsigned char color);
+extern void drawStr15x16(char *str ,unsigned int pos_x);
 
 #endif
\ No newline at end of file
--- a/LEDMatrix_MasterforBasya_codered_lpc1768/displayCom.h	Tue Apr 08 15:08:30 2014 +0000
+++ b/LEDMatrix_MasterforBasya_codered_lpc1768/displayCom.h	Sat Apr 26 08:26:29 2014 +0000
@@ -2,13 +2,6 @@
 #define __DISPLAYCOM_H_
 
 #define DISPLAY_XSIZE   (128u)
-#define COLOR_R 0
-#define COLOR_G 1
-#define COLOR_B 2
-#define COLOR_Y 3
-#define COLOR_M 4
-#define COLOR_C 5
-#define COLOR_W 6
 
 extern unsigned int ImageBuf[DISPLAY_XSIZE];
 
--- a/LEDMatrix_MasterforBasya_codered_lpc1768/main.cpp	Tue Apr 08 15:08:30 2014 +0000
+++ b/LEDMatrix_MasterforBasya_codered_lpc1768/main.cpp	Sat Apr 26 08:26:29 2014 +0000
@@ -5,15 +5,20 @@
 #include "displayCom.h"
 #include "15x16fontsLib.h"
 
-#define StrsBuf (2056)
+#define StrsBufSize (1024)
 
 DigitalOut PowerLED(LED1);
 DigitalOut RunLED(LED2);
 
 SPI spi(p5, NC, p7);        //mosi, miso, sclk
 BusOut buffer_CS(p23,p22,p21);
+
 Serial pc(USBTX, USBRX);    // tx, rx
+
+//#define _USE_LocalFileRead
+#ifdef _USE_LocalFileRead
 LocalFileSystem local("local");
+#endif
 
 unsigned int ImageBuf[DISPLAY_XSIZE];//16*6
 unsigned int ColerMap[DISPLAY_XSIZE];
@@ -111,18 +116,21 @@
 /********************************************************/
 //Special Function
 /********************************************************/
-char PC_RcevStrs[StrsBuf];
+char PC_RcevStrs[StrsBufSize];
 char f_PCInput = 0;
 unsigned int c_PC_RcevStrs = 0;
+unsigned char func_mode = 0;
 
 void callback() {
+	PC_RcevStrs[c_PC_RcevStrs] = pc.getc();
 
-    // Note: you need to actually read from the serial to clear the RX interrupt
-	PC_RcevStrs[c_PC_RcevStrs] = pc.getc();
-	if(PC_RcevStrs[c_PC_RcevStrs] == 0x1b)
+	func_mode = 0;
+
+	if(PC_RcevStrs[c_PC_RcevStrs] == 0x1b)	//Esc key
 	{
         memset(PC_RcevStrs,0,sizeof(PC_RcevStrs));
 		c_PC_RcevStrs = 0;
+		pc.printf("All Strs Clear!\r\n");
 	}
 	else if(PC_RcevStrs[c_PC_RcevStrs] == '\r')
 	{
@@ -131,7 +139,7 @@
 		f_PCInput = 1;
 		c_PC_RcevStrs = 0;
 	}
-	else if( PC_RcevStrs[c_PC_RcevStrs] == 0x08 )
+	else if( PC_RcevStrs[c_PC_RcevStrs] == 0x08 )	//BackSpace key
 	{
 		if(c_PC_RcevStrs >= 1)
 		{
@@ -140,32 +148,46 @@
 			c_PC_RcevStrs--;
 		}
 	}
+	else if(PC_RcevStrs[c_PC_RcevStrs] == 0x10) //DLE ^P
+	{
+		pc.printf("All LED ON Mode!\r\n");
+		func_mode = 1;
+		c_PC_RcevStrs = 0;
+	}
 	else
 	{
-		c_PC_RcevStrs++;
+		if( !(c_PC_RcevStrs >= StrsBufSize) )
+		{
+			c_PC_RcevStrs++;
+		}
+		else
+		{
+			pc.printf("Buf Over Size!!!\r\n");		
+		}
 	}
-	if( PC_RcevStrs[c_PC_RcevStrs] != '\r' )
+
+	if(c_PC_RcevStrs >= 1 )		//char入力処理結果表示
 	{
-		pc.printf("rcevStrs=%s\r\n",PC_RcevStrs);
-		pc.printf("rcevCnt=%d\r\n",c_PC_RcevStrs);
+		if( PC_RcevStrs[c_PC_RcevStrs-1] != '\r' )
+		{
+			pc.printf("rcevStrs=%s\r\n",PC_RcevStrs);
+			pc.printf("rcevCnt=%d\r\n",c_PC_RcevStrs);
+		}
 	}
 }
 
 void TestMode_FullON(void)
 {
     memset(ImageBuf,0xffff,sizeof(ImageBuf));
-    while(1)
-    {
-        wait(0.1);
-        outBordData();
-    }
+    wait(0.1);
+    outBordData();
 }
 
 int main()
 {
     unsigned int i = 0;
-    unsigned long StrsDotSize = 0;
-    char strs[StrsBuf]={0x48,0x65,0x6c,0x6c,0x6f,0x57,0x6f,0x72,0x6c,0x64,0x21,0x20,0x83,0x6a,0x83,0x52,
+    unsigned int StrsDotSize = 0;
+    char strs[StrsBufSize]={0x48,0x65,0x6c,0x6c,0x6f,0x57,0x6f,0x72,0x6c,0x64,0x21,0x20,0x83,0x6a,0x83,0x52,
     				0x83,0x6a,0x83,0x52,0x8b,0x5a,0x8f,0x70,0x95,0x94,0x00};
 	PowerLED = 1;
 
@@ -175,36 +197,52 @@
     spi.format(16,1);
     spi.frequency(500000);
 
+//************************USE Local File Sys************************************//
+#ifdef _USE_LocalFileRead
+    memset(strs,' ',sizeof(strs));
+    // Read text file for display message, if exist.
+    FILE *fp;
+    fp = fopen("/local/message.txt", "r"); 
+    if (fp != NULL) {
+        fgets(strs, sizeof(strs), fp);
+        fclose(fp);
+#if defined(__MICROLIB) && defined(__ARMCC_VERSION) // with microlib and ARM compiler
+        free(fp);
+#endif
+
+#endif
+//************************USE Local File Sys end********************************//
+
     memset(ImageBuf,0,sizeof(ImageBuf));
 
-    pc.printf("Init...\n");
-    wait(3);
+    wait(1);
     RunLED = 1;
-    pc.printf("Start\n\r");
-    pc.printf("Text=%s\n\r",strs);
 
     //TestMode();
-	//TestMode_FullON();
+
     while(1)
     {
         memset(ImageBuf,0,sizeof(ImageBuf));
 
-		if(f_PCInput == 1)
+		if(f_PCInput == 1)	//char proccses
 		{
-			memcpy(strs, PC_RcevStrs, sizeof(strs));
-	        memset(PC_RcevStrs,0,sizeof(PC_RcevStrs));
+			memcpy(strs, PC_RcevStrs, sizeof(strs));	//Set Strs
+	        memset(PC_RcevStrs,0,sizeof(PC_RcevStrs));	//Clear PC Rcev Buff
 			c_PC_RcevStrs = 0;
 			f_PCInput = 0;
 		}
-
+		while(func_mode == 1)
+		{
+			TestMode_FullON();
+		}
 		StrsDotSize = 8*strlen(strs);
 
         for(i=0;i<(DISPLAY_XSIZE+StrsDotSize);i++)
         {
-            drawStr15x16(strs ,i, COLOR_W);
+            drawStr15x16(strs ,i);
             outBordData();
-            wait_ms(40);
-            if(f_PCInput == 1)
+            wait_ms(20);
+            if(f_PCInput == 1)	//break to char proccses
             {
             	f_PCInput = 1;
             	break;
--- a/LEDMatrix_MasterforBasya_codered_lpc1768/unicode2SJIS.h	Tue Apr 08 15:08:30 2014 +0000
+++ b/LEDMatrix_MasterforBasya_codered_lpc1768/unicode2SJIS.h	Sat Apr 26 08:26:29 2014 +0000
@@ -1,4 +1,4 @@
-const unsigned short unicode2SJIS_Table[256] = {
+const static unsigned short unicode2SJIS_Table[256] = {
 0,//NL
 0,//SH
 0,//SX