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
31
32
33
34
35
|
#include "command.h"
#include <ion.h>
#include <ion/src/device/led.h>
namespace Ion {
namespace Device {
namespace Bench {
namespace Command {
// Input must be of the form "0xAABBCC" or "ON" or "OFF"
void LED(const char * input) {
if (strcmp(input, sON) == 0) {
Ion::LED::Device::init();
Ion::Console::writeLine(sOK);
return;
}
if (strcmp(input, sOFF) == 0) {
Ion::LED::Device::shutdown();
Ion::Console::writeLine(sOK);
return;
}
if (input == nullptr || input[0] != '0' || input[1] != 'x' || !isHex(input[2]) ||!isHex(input[3]) || !isHex(input[4]) || !isHex(input[5]) || !isHex(input[6]) || !isHex(input[7]) || input[8] != NULL) {
Ion::Console::writeLine(sSyntaxError);
return;
}
uint32_t hexColor = hexNumber(input+2);
KDColor ledColor = KDColor::RGB24(hexColor);
Ion::LED::setColor(ledColor);
Ion::Console::writeLine(sOK);
}
}
}
}
}
|