mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 16:20:49 +01:00
[ion] Initial add of the f730 folder
This commit is contained in:
committed by
Ruben Dashyan
parent
85e08f500d
commit
b547f8bfd9
47
ion/src/f730/bench/command/command.cpp
Normal file
47
ion/src/f730/bench/command/command.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "command.h"
|
||||
#include <ion.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Device {
|
||||
namespace Bench {
|
||||
namespace Command {
|
||||
|
||||
const char * const sOK = "OK";
|
||||
const char * const sKO = "KO";
|
||||
const char * const sSyntaxError = "SYNTAX_ERROR";
|
||||
const char * const sON = "ON";
|
||||
const char * const sOFF = "OFF";
|
||||
|
||||
void reply(const char * s) {
|
||||
Console::writeLine(s);
|
||||
}
|
||||
|
||||
int8_t hexChar(char c) {
|
||||
if (c >= '0' && c <= '9') {
|
||||
return (c - '0');
|
||||
}
|
||||
if (c >= 'A' && c <= 'F') {
|
||||
return (c - 'A') + 0xA;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool isHex(char c) {
|
||||
return hexChar(c) >= 0;
|
||||
}
|
||||
|
||||
uint32_t hexNumber(const char * s, int maxLength) {
|
||||
uint32_t result = 0;
|
||||
int index = 0;
|
||||
while ((maxLength < 0 || index < maxLength) && s[index] != NULL) {
|
||||
result = (result << 4) | hexChar(s[index]);
|
||||
index++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user