IJFW - IchigoJamのBASICプログラムをメモリカード(MMCまたは互換カード)に保存したり読み出したりできるプログラム。メモリカードにファームウェアのファイルを置くだけで、電源ON時に自動的に書き換える機能も搭載(一応こちらがメイン)。LPC1114FN28専用。

Dependencies:   mbed

参考URL http://www.cyberchabudai.org/index.php/entry?tag=IJFW

Files at this revision

API Documentation at this revision

Comitter:
oks486
Date:
Sun Aug 21 07:51:01 2016 +0000
Parent:
1:11f73f269fdc
Commit message:
Modified I2c2mem for "FILES" command

Changed in this revision

I2c2mem/I2c2mem.cpp Show annotated file Show diff for this revision Revisions of this file
I2c2mem/I2c2mem.h Show annotated file Show diff for this revision Revisions of this file
diff -r 11f73f269fdc -r daf6c4719496 I2c2mem/I2c2mem.cpp
--- a/I2c2mem/I2c2mem.cpp	Wed Aug 17 07:19:20 2016 +0000
+++ b/I2c2mem/I2c2mem.cpp	Sun Aug 21 07:51:01 2016 +0000
@@ -17,6 +17,7 @@
     : i2cs(_i2cs), fs(_fs), ledcard(_ledcard) {
     buffer = new char[PROGRAM_BYTES_MAX];
     address = 0;    
+    address_old = 0;    
     count = 0;
     dataBytesCount = 0;
     dataFileNum = 0;
@@ -37,11 +38,18 @@
     int length = i2cs->read(bufi2c, 36) - 1;
 
     if (length == 2 || length == 34) {
+        // Calculate memory address in EEPROM
+        address = 0x10000 * flag;       // This flag expresses 64-127 block
+        address |= (bufi2c[0] << 8) | bufi2c[1];
+
+        // if command is "FILES"
+        if (address != address_old + 32) {
+            count = 0;
+        }
+        address_old = address;
+
+        // BAS file name
         if (count == 0) {
-            // Calculate memory address in EEPROM
-            address = 0x10000 * flag;   // This flag expresses 64-127 block
-            address |= (bufi2c[0] << 8) | bufi2c[1];
-            // BAS file
             int filenum = ((address / PROGRAM_BYTES_MAX) % PROGRAM_NUM_MAX) + 100;
             sprintf(filename, "ij%03d.bas", filenum);
         }
@@ -295,6 +303,7 @@
     }
 
     address = 0;    
+    address_old = 0;    
     count = 0;
     dataBytesCount = 0;
     dataFileNum = 0;
diff -r 11f73f269fdc -r daf6c4719496 I2c2mem/I2c2mem.h
--- a/I2c2mem/I2c2mem.h	Wed Aug 17 07:19:20 2016 +0000
+++ b/I2c2mem/I2c2mem.h	Sun Aug 21 07:51:01 2016 +0000
@@ -24,6 +24,7 @@
     DigitalOut* ledcard;
 
     int address;
+    int address_old;
     int count;
     char filename[16];
     char* buffer;