Numworks Epsilon  1.4.1
Graphing Calculator Operating System
command.cpp
Go to the documentation of this file.
1 #include "command.h"
2 #include <ion.h>
3 
4 namespace Ion {
5 namespace Device {
6 namespace Bench {
7 namespace Command {
8 
9 const char * const sOK = "OK";
10 const char * const sKO = "KO";
11 const char * const sSyntaxError = "SYNTAX_ERROR";
12 const char * const sON = "ON";
13 const char * const sOFF = "OFF";
14 
15 void reply(const char * s) {
17 }
18 
19 int8_t hexChar(char c) {
20  if (c >= '0' && c <= '9') {
21  return (c - '0');
22  }
23  if (c >= 'A' && c <= 'F') {
24  return (c - 'A') + 0xA;
25  }
26  return -1;
27 }
28 
29 bool isHex(char c) {
30  return hexChar(c) >= 0;
31 }
32 
33 uint32_t hexNumber(const char * s, int maxLength) {
34  uint32_t result = 0;
35  int index = 0;
36  while ((maxLength < 0 || index < maxLength) && s[index] != NULL) {
37  result = (result << 4) | hexChar(s[index]);
38  index++;
39  }
40  return result;
41 }
42 
43 
44 }
45 }
46 }
47 }
const char *const sOK
Definition: command.cpp:9
const char *const sSyntaxError
Definition: command.cpp:11
const char *const sON
Definition: command.cpp:12
void writeLine(const char *line)
Definition: console_line.cpp:9
const char *const sOFF
Definition: command.cpp:13
c(generic_all_nodes)
unsigned int uint32_t
Definition: stdint.h:6
#define NULL
Definition: stddef.h:4
const char *const sKO
Definition: command.cpp:10
uint32_t hexNumber(const char *s, int maxLength)
Definition: command.cpp:33
signed char int8_t
Definition: stdint.h:9
void reply(const char *s)
Definition: command.cpp:15
Definition: backlight.h:6
int8_t hexChar(char c)
Definition: command.cpp:19