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
|
#include "command.h"
#include <ion.h>
#include <ion/src/device/backlight.h>
namespace Ion {
namespace Device {
namespace Bench {
namespace Command {
void Backlight(const char * input) {
// Input must be of the form "0xAA" or "ON" or "OFF"
if (strcmp(input, sON) == 0) {
Ion::Backlight::Device::init();
reply(sOK);
return;
}
if (strcmp(input, sOFF) == 0) {
Ion::Backlight::Device::shutdown();
reply(sOK);
return;
}
if (input == nullptr || input[0] != '0' || input[1] != 'x' || !isHex(input[2]) ||!isHex(input[3]) || input[4] != NULL) {
reply(sSyntaxError);
return;
}
uint32_t brightness = hexNumber(input+2);
Ion::Backlight::setBrightness(brightness);
reply(sOK);
}
}
}
}
}
|