Blame view

build1/epsilon-master/ion/src/device/bench/command/print.cpp 609 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  #include "command.h"
  #include <ion.h>
  #include <ion/src/device/led.h>
  #include <kandinsky.h>
  
  namespace Ion {
  namespace Device {
  namespace Bench {
  namespace Command {
  
  // Input must be of the form "XX,YY,STRING"
  void Print(const char * input) {
    if (input == nullptr || !isHex(input[0]) || !isHex(input[1]) || input[2] != ',' || !isHex(input[3]) || !isHex(input[4]) || input[5] != ',') {
      reply(sKO);
      return;
    }
  
    char x = hexNumber(input, 2);
    char y = hexNumber(input+3, 2);
  
    KDContext * ctx = KDIonContext::sharedContext();
    ctx->drawString(input+6, KDPoint(x, y));
  
    reply(sOK);
  }
  
  }
  }
  }
  }