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
Committer:
va009039
Date:
Sun May 24 21:29:48 2015 +0900
Revision:
4:b62b40563944
Parent:
2:908338b1151a
fix I2C

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 2:908338b1151a 1 // VideoRAM.h 2015/5/22
va009039 1:e74530ad6b9e 2 #pragma once
va009039 1:e74530ad6b9e 3
va009039 2:908338b1151a 4 template<class SERIAL_T>
va009039 1:e74530ad6b9e 5 class VideoRAM {
va009039 2:908338b1151a 6 SERIAL_T& _pc;
va009039 2:908338b1151a 7 uint16_t x, y;
va009039 2:908338b1151a 8 bool f_init;
va009039 2:908338b1151a 9
va009039 1:e74530ad6b9e 10 public:
va009039 2:908338b1151a 11 VideoRAM(RawSerial& pc):_pc(pc),x(0),y(0),f_init(false) {
va009039 1:e74530ad6b9e 12 }
va009039 1:e74530ad6b9e 13 void vpoke(uint16_t i, uint8_t b) {
va009039 1:e74530ad6b9e 14 if (i < 1024) {
va009039 1:e74530ad6b9e 15 if (x != i%64 || y != i/64) {
va009039 1:e74530ad6b9e 16 x = i%64;
va009039 1:e74530ad6b9e 17 y = i/64;
va009039 1:e74530ad6b9e 18 char buf[16];
va009039 1:e74530ad6b9e 19 snprintf(buf, sizeof(buf), "\x1b[%d;%dH", y+1, x+1) ; // locate
va009039 1:e74530ad6b9e 20 _puts(buf);
va009039 1:e74530ad6b9e 21 }
va009039 1:e74530ad6b9e 22 _putc(b & 0x7f);
va009039 1:e74530ad6b9e 23 x++;
va009039 1:e74530ad6b9e 24 }
va009039 1:e74530ad6b9e 25 }
va009039 1:e74530ad6b9e 26
va009039 1:e74530ad6b9e 27 private:
va009039 2:908338b1151a 28 void init() {
va009039 2:908338b1151a 29 _puts("\x1b[2J"); // erase
va009039 2:908338b1151a 30 }
va009039 1:e74530ad6b9e 31 void _puts(const char* s) {
va009039 1:e74530ad6b9e 32 while(*s) {
va009039 1:e74530ad6b9e 33 _putc(*s++);
va009039 1:e74530ad6b9e 34 }
va009039 1:e74530ad6b9e 35 }
va009039 1:e74530ad6b9e 36 void _putc(int c) {
va009039 2:908338b1151a 37 if (!f_init) {
va009039 2:908338b1151a 38 f_init = true;
va009039 2:908338b1151a 39 init();
va009039 2:908338b1151a 40 }
va009039 1:e74530ad6b9e 41 _pc.putc(c);
va009039 1:e74530ad6b9e 42 }
va009039 1:e74530ad6b9e 43 };
va009039 1:e74530ad6b9e 44