Blame view

build3/ion/src/device/bench/command/keyboard.cpp 571 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
  #include "command.h"
  #include <ion.h>
  
  namespace Ion {
  namespace Device {
  namespace Bench {
  namespace Command {
  
  void Keyboard(const char * input) {
    if (input != nullptr) {
      reply(sSyntaxError);
      return;
    }
    char result[9+Ion::Keyboard::NumberOfKeys+1] = { 'K', 'E', 'Y', 'B', 'O', 'A', 'R', 'D', '=' };
    Ion::Keyboard::State state = Ion::Keyboard::scan();
    for (uint8_t i=0; i<Ion::Keyboard::NumberOfKeys; i++) {
      result[9+i] = state.keyDown((Ion::Keyboard::Key)i) ? '1' : '0';
    }
    result[9+Ion::Keyboard::NumberOfKeys] = 0;
    reply(result);
  }
  
  }
  }
  }
  }