Numworks Epsilon  1.4.1
Graphing Calculator Operating System
backlight.cpp
Go to the documentation of this file.
1 #include "command.h"
2 #include <ion.h>
4 
5 namespace Ion {
6 namespace Device {
7 namespace Bench {
8 namespace Command {
9 
10 void Backlight(const char * input) {
11  // Input must be of the form "0xAA" or "ON" or "OFF"
12  if (strcmp(input, sON) == 0) {
14  reply(sOK);
15  return;
16  }
17  if (strcmp(input, sOFF) == 0) {
19  reply(sOK);
20  return;
21  }
22  if (input == nullptr || input[0] != '0' || input[1] != 'x' || !isHex(input[2]) ||!isHex(input[3]) || input[4] != NULL) {
24  return;
25  }
26  uint32_t brightness = hexNumber(input+2);
28  reply(sOK);
29 }
30 
31 }
32 }
33 }
34 }
const char *const sOK
Definition: command.cpp:9
const char *const sSyntaxError
Definition: command.cpp:11
void Backlight(const char *input)
Definition: backlight.cpp:10
void setBrightness(uint8_t b)
Definition: backlight.cpp:16
const char *const sON
Definition: command.cpp:12
const char *const sOFF
Definition: command.cpp:13
unsigned int uint32_t
Definition: stdint.h:6
#define NULL
Definition: stddef.h:4
uint32_t hexNumber(const char *s, int maxLength)
Definition: command.cpp:33
uint8_t brightness()
Definition: backlight.cpp:20
void reply(const char *s)
Definition: command.cpp:15
int strcmp(const char *s1, const char *s2)
Definition: strcmp.c:3
Definition: backlight.h:6