Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 2:daf6c4719496, committed 2016-08-21
- 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;