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.
Diff: BaseEmuISP.cpp
- Revision:
- 4:05f33cc747fd
- Parent:
- 3:ccc673a10485
- Child:
- 5:e2c275b33bbf
--- a/BaseEmuISP.cpp Tue Mar 22 16:25:41 2016 +0900 +++ b/BaseEmuISP.cpp Wed Mar 23 09:11:05 2016 +0900 @@ -1,4 +1,4 @@ -// BaseEmuISP.cpp 2016/3/22 +// BaseEmuISP.cpp 2016/3/23 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -17,8 +17,8 @@ case M_RESET: echoFlag = true; lockFlag = true; - version.major = BootCodeVersion() >>8; - version.minor = BootCodeVersion() & 0xff; + version.Major = BootCodeVersion() >>8; + version.Minor = BootCodeVersion() & 0xff; mode = M_SYNC; break; case M_SYNC: @@ -28,10 +28,10 @@ break; case M_CMD: if (line_proc()) { - result = cmd(line.c_str()); + result = cmd(line.C_str()); snprintf(buf, sizeof(buf), "%d", result); putln(buf); - line.clear(); + line.Clear(); } break; case M_CMD_W_DATA: @@ -50,9 +50,9 @@ mode = M_CMD; break; case M_CMD_K: - snprintf(buf, sizeof(buf), "%d", version.major); + snprintf(buf, sizeof(buf), "%d", version.Major); putln(buf); - snprintf(buf, sizeof(buf), "%d", version.minor); + snprintf(buf, sizeof(buf), "%d", version.Minor); putln(buf); mode = M_CMD; break; @@ -65,7 +65,7 @@ } if (prev_mode != mode) { seq = 0; - line.clear(); + line.Clear(); } } @@ -74,7 +74,7 @@ case 0: if (Getch() == '?') { putln("Synchronized"); - line.clear(); + line.Clear(); echoFlag = true; seq++; } @@ -83,7 +83,7 @@ if (line_proc()) { if (line == "Synchronized") { putln("OK"); - line.clear(); + line.Clear(); seq++; } else { seq = 0; @@ -92,7 +92,7 @@ break; case 2: if (line_proc()) { - freq = atoi(line.c_str()); + freq = atoi(line.C_str()); putln("OK"); return true; } @@ -101,7 +101,7 @@ return false; } -static int split(std::vector<char*> ¶m, char *buf, const char* delimiters = " ") { +static int split(myvector<char*> ¶m, char *buf, const char* delimiters = " ") { param.clear(); char* p = strtok(buf, delimiters); while(p != NULL) { @@ -114,7 +114,7 @@ ReturnCode_t BaseEmuISP::cmd(const char *str) { char buf[strlen(str) + 1]; strcpy(buf, str); - std::vector<char*> p; + myvector<char*> p; if (split(p, buf) == 0) { return INVALID_COMMAND; } @@ -288,7 +288,7 @@ return CMD_SUCCESS; } -void uudecode(std::vector<uint8_t> &dst, const char* src) { +void uudecode(vbyte_t &dst, const char* src) { dst.clear(); int len = strlen(src); if (len > 0) { @@ -340,13 +340,13 @@ case 2: // uuencode mode dataLine = 0; dataCksum = 0; - line.clear(); + line.Clear(); seq++; break; case 3: // uu data start if (line_proc()) { vbyte_t data; - uudecode(data, line.c_str()); + uudecode(data, line.C_str()); for(size_t i = 0; i < data.size(); i++) { int c = data[i]; WriteData(addr++, c); @@ -357,12 +357,12 @@ if (dataLine >= 20 || dataCurrent>= dataCount) { seq++; } - line.clear(); + line.Clear(); } break; case 4: // check sum if (line_proc()) { - if (atoi(line.c_str()) == dataCksum) { + if (line == dataCksum) { putln("OK"); if (dataCurrent >= dataCount) { mode = M_CMD; @@ -387,7 +387,7 @@ if (UuencodeMode()) { dataLine = 0; dataCksum = 0; - line.clear(); + line.Clear(); seq = 2; } else { seq = 1; @@ -421,7 +421,7 @@ int c = Getch(); if (c != (-1)) { if (echoFlag) { - if (version.major >= 4 || c != '\n') { + if (version.Major >= 4 || c != '\n') { Putch(c); } } @@ -431,7 +431,7 @@ } else if (c == '\r') { debugPrintf("<CR>"); } else { - if (line.size() == 0) { + if (line.Size() == 0) { debugPrintf("recv: "); } debugPrintf("%c", c);