Norimasa Okamoto / Mbed 2 deprecated emuISP

Dependencies:   mbed

Revision:
4:05f33cc747fd
Parent:
3:ccc673a10485
Child:
5:e2c275b33bbf
--- a/BaseEmuISP.h	Tue Mar 22 16:25:41 2016 +0900
+++ b/BaseEmuISP.h	Wed Mar 23 09:11:05 2016 +0900
@@ -1,11 +1,10 @@
-// BaseEmuISP.h 2016/3/22
+// BaseEmuISP.h 2016/3/23
 #pragma once
-#include <string>
-#include <vector>
 #include <stdint.h>
+#include "myvector.h"
 
-typedef std::vector<int> vint_t;
-typedef std::vector<uint8_t> vbyte_t;
+typedef myvector<int> vint_t;
+typedef myvector<uint8_t> vbyte_t;
 
 enum Mode_t {
     M_RESET = 0,
@@ -83,13 +82,22 @@
     bool cmd_w_data();
     bool cmd_r_data();
     void putln(const char *s);
-    bool line_proc();
     void debugPrintf(const char *format, ...);
     Mode_t mode;
     int seq;
     bool echoFlag;
     bool lockFlag;
-    std::string line;
+    bool line_proc();
+    struct {
+        void Clear() { pos = 0; }
+        size_t Size() { return pos; }
+        const char *C_str() {return buf; }
+        void operator +=(int c) { if (pos < sizeof(buf)-2) buf[pos++] = c; buf[pos] = '\0'; }
+        bool operator ==(const char* s) { return strcmp(buf, s) == 0; }
+        bool operator ==(int n) { return atoi(buf) == n; }
+        size_t pos;
+        char buf[64];
+    } line;
     int freq;
     int addr;
     int dataLine;
@@ -97,8 +105,8 @@
     int dataCurrent;
     int dataCksum;
     struct {
-        uint8_t major;
-        uint8_t minor;
+        uint8_t Major;
+        uint8_t Minor;
      } version;
 };