Numworks Epsilon  1.4.1
Graphing Calculator Operating System
print.cpp
Go to the documentation of this file.
1 #include "command.h"
2 #include <ion.h>
3 #include <ion/src/device/led.h>
4 #include <kandinsky.h>
5 
6 namespace Ion {
7 namespace Device {
8 namespace Bench {
9 namespace Command {
10 
11 // Input must be of the form "XX,YY,STRING"
12 void Print(const char * input) {
13  if (input == nullptr || !isHex(input[0]) || !isHex(input[1]) || input[2] != ',' || !isHex(input[3]) || !isHex(input[4]) || input[5] != ',') {
14  reply(sKO);
15  return;
16  }
17 
18  char x = hexNumber(input, 2);
19  char y = hexNumber(input+3, 2);
20 
22  ctx->drawString(input+6, KDPoint(x, y));
23 
24  reply(sOK);
25 }
26 
27 }
28 }
29 }
30 }
const char *const sOK
Definition: command.cpp:9
KDPoint drawString(const char *text, KDPoint p, KDText::FontSize size=KDText::FontSize::Large, KDColor textColor=KDColorBlack, KDColor backgroundColor=KDColorWhite, int maxLength=-1)
Definition: context_text.cpp:9
Definition: point.h:6
static KDIonContext * sharedContext()
Definition: ion_context.cpp:4
const char *const sKO
Definition: command.cpp:10
uint32_t hexNumber(const char *s, int maxLength)
Definition: command.cpp:33
void Print(const char *input)
Definition: print.cpp:12
void reply(const char *s)
Definition: command.cpp:15
Definition: backlight.h:6