IPS(Interpreter for Process Structures) for mbed
Dependencies: ConfigFile FATFileSystem mbed
IPS port from linux/unix version.
mbed_blinky.ips
0 VAR led1 " LED1 " DigitalOut led1 ! : main ANFANG 1 JA? 1 led1 @ write 200 wait_ms 0 led1 @ write 200 wait_ms DANN/NOCHMAL ; main
- ips-02.tgz - ips for linux/unix
- ipsdoc.zip - document
- https://bitbucket.org/va009039/ips/
Revision 4:b62b40563944, committed 2015-05-24
- Comitter:
- va009039
- Date:
- Sun May 24 21:29:48 2015 +0900
- Parent:
- 3:9f526f0d9720
- Commit message:
- fix I2C
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbedAPI.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9f526f0d9720 -r b62b40563944 main.cpp --- a/main.cpp Sat May 23 09:14:47 2015 +0000 +++ b/main.cpp Sun May 24 21:29:48 2015 +0900 @@ -7,13 +7,17 @@ #include "IPS-Mmbed_bin.h" #include "mbedAPI.h" #include "ConfigFile.h" +#include "SDFileSystem.h" const char* CFG_FILE = "/local/ips.cfg"; #if defined(TARGET_MBED_LPC1768) -LocalFileSystem local("local"); +#if defined(TOOLCHAIN_GCC)||defined(TOOLCHAIN_GCC_ARM) +SDFileSystem local(MBED_SPI0, "local"); // mosi, miso, sclk, cs, name #else -#include "SDFileSystem.h" +LocalFileSystem local("local"); +#endif +#else SDFileSystem local(D11, D12, D13, D4, "local"); // mosi, miso, sclk, cs, name #endif
diff -r 9f526f0d9720 -r b62b40563944 mbedAPI.cpp --- a/mbedAPI.cpp Sat May 23 09:14:47 2015 +0000 +++ b/mbedAPI.cpp Sun May 24 21:29:48 2015 +0900 @@ -204,23 +204,23 @@ void mbedAPI::code_method_I2C(int f, mbedObj& obj) { if (f == mbed_read) { - uint16_t a3 = ips.pull_ps(); // addr - uint16_t a2 = ips.pull_ps(); // data length - uint16_t a1 = ips.pull_ps(); // data pointer - char buf[a2]; - reinterpret_cast<I2C*>(obj.p)->read(a3, buf, a1); - for(int i = 0; i < a2; i++) { - ips.pokeB(a1 + i, buf[i]); + uint16_t addr = ips.pull_ps(); + uint16_t len = ips.pull_ps(); + uint16_t ptr = ips.pull_ps(); + char buf[len]; + reinterpret_cast<I2C*>(obj.p)->read(addr, buf, len); + for(int i = 0; i < len; i++) { + ips.pokeB(ptr + i, buf[i]); } } else if (f == mbed_write) { - uint16_t a3 = ips.pull_ps(); // addr - uint16_t a2 = ips.pull_ps(); // data length - uint16_t a1 = ips.pull_ps(); // data pointer - char buf[a2]; - for(int i = 0; i < a2; i++) { - buf[i] = ips.peekB(a1 + i); + uint16_t addr = ips.pull_ps(); + uint16_t len = ips.pull_ps(); + uint16_t ptr = ips.pull_ps(); + char buf[len]; + for(int i = 0; i < len; i++) { + buf[i] = ips.peekB(ptr + i); } - reinterpret_cast<I2C*>(obj.p)->write(a3, buf, a1); + reinterpret_cast<I2C*>(obj.p)->write(addr, buf, len); } else { error("%s %d", __LINE__, f); }