Norimasa Okamoto / Mbed 2 deprecated emuISP

Dependencies:   mbed

Revision:
5:e2c275b33bbf
Parent:
4:05f33cc747fd
--- a/BaseEmuISP.h	Wed Mar 23 09:11:05 2016 +0900
+++ b/BaseEmuISP.h	Fri Mar 25 06:08:40 2016 +0900
@@ -1,10 +1,13 @@
-// BaseEmuISP.h 2016/3/23
+// BaseEmuISP.h 2016/3/25
 #pragma once
 #include <stdint.h>
 #include "myvector.h"
+#include "mystring.h"
 
-typedef myvector<int> vint_t;
-typedef myvector<uint8_t> vbyte_t;
+typedef myvector<char*> vec_charPtr_t;
+typedef myvector<int> vec_int_t;
+typedef myvector<uint8_t> vec_byte_t;
+typedef mystring string_t;
 
 enum Mode_t {
     M_RESET = 0,
@@ -64,21 +67,21 @@
 private:
     bool sync();
     ReturnCode_t cmd(const char* s);
-    ReturnCode_t cmd_u(vint_t &param);
-    ReturnCode_t cmd_b(vint_t &param);
-    ReturnCode_t cmd_a(vint_t &param);
-    ReturnCode_t cmd_w(vint_t &param);
-    ReturnCode_t cmd_r(vint_t &param);
-    ReturnCode_t cmd_p(vint_t &param);
-    ReturnCode_t cmd_c(vint_t &param);
-    ReturnCode_t cmd_g(vint_t &param);
-    ReturnCode_t cmd_e(vint_t &param);
-    ReturnCode_t cmd_i(vint_t &param);
-    ReturnCode_t cmd_j(vint_t &param);
-    ReturnCode_t cmd_k(vint_t &param);
-    ReturnCode_t cmd_m(vint_t &param);
-    ReturnCode_t cmd_n(vint_t &param);
-    ReturnCode_t cmd_s(vint_t &param);
+    ReturnCode_t cmd_u(vec_int_t &param);
+    ReturnCode_t cmd_b(vec_int_t &param);
+    ReturnCode_t cmd_a(vec_int_t &param);
+    ReturnCode_t cmd_w(vec_int_t &param);
+    ReturnCode_t cmd_r(vec_int_t &param);
+    ReturnCode_t cmd_p(vec_int_t &param);
+    ReturnCode_t cmd_c(vec_int_t &param);
+    ReturnCode_t cmd_g(vec_int_t &param);
+    ReturnCode_t cmd_e(vec_int_t &param);
+    ReturnCode_t cmd_i(vec_int_t &param);
+    ReturnCode_t cmd_j(vec_int_t &param);
+    ReturnCode_t cmd_k(vec_int_t &param);
+    ReturnCode_t cmd_m(vec_int_t &param);
+    ReturnCode_t cmd_n(vec_int_t &param);
+    ReturnCode_t cmd_s(vec_int_t &param);
     bool cmd_w_data();
     bool cmd_r_data();
     void putln(const char *s);
@@ -87,23 +90,17 @@
     int seq;
     bool echoFlag;
     bool lockFlag;
-    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;
+    string_t line;
+    bool lineProc();
     int freq;
     int addr;
-    int dataLine;
-    int dataCount;
-    int dataCurrent;
-    int dataCksum;
+    struct {
+        vec_byte_t Buf;
+        int Line;
+        int Count;
+        int Current;
+        int Cksum;
+    } data;
     struct {
         uint8_t Major;
         uint8_t Minor;