|
|
|
@ -97,4 +97,47 @@ Kaleidoscope_::useLoopHook(loopHook hook) {
|
|
|
|
|
appendLoopHook (hook);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
Kaleidoscope_::focusHook(const char *command) {
|
|
|
|
|
enum {
|
|
|
|
|
ON,
|
|
|
|
|
OFF,
|
|
|
|
|
GETSTATE,
|
|
|
|
|
} subCommand;
|
|
|
|
|
|
|
|
|
|
if (strncmp_P(command, PSTR("layer."), 6) != 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (strcmp_P (command + 6, PSTR("on")) == 0)
|
|
|
|
|
subCommand = ON;
|
|
|
|
|
else if (strcmp_P(command + 6, PSTR("off")) == 0)
|
|
|
|
|
subCommand = OFF;
|
|
|
|
|
else if (strcmp_P(command + 6, PSTR("getState")) == 0)
|
|
|
|
|
subCommand = GETSTATE;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
switch (subCommand) {
|
|
|
|
|
case ON:
|
|
|
|
|
{
|
|
|
|
|
uint8_t layer = Serial.parseInt();
|
|
|
|
|
Layer.on(layer);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case OFF:
|
|
|
|
|
{
|
|
|
|
|
uint8_t layer = Serial.parseInt();
|
|
|
|
|
Layer.off(layer);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case GETSTATE:
|
|
|
|
|
Serial.println(Layer.getLayerState(), BIN);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Kaleidoscope_ Kaleidoscope;
|
|
|
|
|