Yank out old commandline mode stub

pull/18/head
Jesse Vincent 9 years ago
parent 2ffda682db
commit 6c6dfa30c1

@ -43,14 +43,6 @@ byte temporary_keymap = 0;
byte commandBuffer[32];
int commandBufferSize;
bool commandMode;
bool commandPromptPrinted;
// Console related
void process_command_buffer();
// EEPROM related // EEPROM related
void save_primary_keymap(byte keymap); void save_primary_keymap(byte keymap);
@ -66,6 +58,10 @@ void begin_warping();
void end_warping(); void end_warping();
void warp_mouse(Key key); void warp_mouse(Key key);
//internals
void reboot_bootloader();
// hardware keymap interaction // hardware keymap interaction
void setup_pins(); void setup_pins();
void setup_input_pins(); void setup_input_pins();

@ -143,12 +143,7 @@ void scan_matrix() {
// Command mode // Command mode
// //
void reboot_bootloader() {
void command_reboot_bootloader() {
Keyboard.println("Rebooting to bootloader");
Serial.end();
// Set the magic bits to get a Caterina-based device // Set the magic bits to get a Caterina-based device
// to reboot into the bootloader and stay there, rather // to reboot into the bootloader and stay there, rather
// than run move onward // than run move onward
@ -169,89 +164,6 @@ void command_reboot_bootloader() {
// happens before the watchdog reboots us // happens before the watchdog reboots us
} }
void command_plugh() {
commandMode = !commandMode;
if (commandMode) {
Keyboard.println("");
Keyboard.println("Entering command mode!");
} else {
Keyboard.println("Leaving command mode!");
Keyboard.println("");
}
}
void setup_command_mode() {
commandBufferSize = 0;
commandMode = false;
commandPromptPrinted = false;
}
boolean command_ends_in_return() {
if (
commandBuffer[commandBufferSize - 1] == KEY_ENTER ||
commandBuffer[commandBufferSize - 1] == KEY_RETURN ) {
return true;
} else {
return false;
}
}
boolean is_command_buffer(byte* myCommand) {
if (!command_ends_in_return()) {
return false;
}
int i = 0;
do {
if (commandBuffer[i] != myCommand[i]) {
return false;
}
} while (myCommand[++i] != 0x00);
return true;
}
void process_command_buffer() {
if (!command_ends_in_return()) {
return;
}
// This is the only command we might want to execute when
// we're not in command mode, as it's the only way to toggle
// command mode on
static byte cmd_plugh[] = {KEY_P, KEY_L, KEY_U, KEY_G, KEY_H, 0x00};
if (is_command_buffer(cmd_plugh)) {
command_plugh();
}
// if we've toggled command mode off, get out of here.
if (!commandMode) {
commandBufferSize = 0;
return;
}
// Handle all the other commands here
static byte cmd_reboot_bootloader[] = { KEY_B, KEY_O, KEY_O, KEY_T, KEY_L, KEY_O, KEY_A, KEY_D, KEY_E, KEY_R, 0x00};
static byte cmd_version[] = { KEY_V, KEY_E, KEY_R, KEY_S, KEY_I, KEY_O, KEY_N, 0x00};
if (is_command_buffer(cmd_reboot_bootloader)) {
command_reboot_bootloader();
} else if (is_command_buffer(cmd_version)) {
Keyboard.println("");
Keyboard.print("This is Keyboardio Firmware ");
Keyboard.println(VERSION);
}
if (!commandPromptPrinted ) {
Keyboard.print(">>> ");
commandPromptPrinted = true;
commandBufferSize = 0;
}
}
void setup() { void setup() {
wdt_disable(); wdt_disable();
Serial.begin(115200); Serial.begin(115200);
@ -260,7 +172,6 @@ void setup() {
Mouse.begin(); Mouse.begin();
setup_leds(); setup_leds();
led_bootup(); led_bootup();
setup_command_mode();
setup_matrix(); setup_matrix();
setup_pins(); setup_pins();
rightsx1509.fetchPinStates(); rightsx1509.fetchPinStates();
@ -379,18 +290,6 @@ void press_key(Key mappedKey) {
Keyboard.press(Key_LShift.rawKey); Keyboard.press(Key_LShift.rawKey);
} }
Keyboard.press(mappedKey.rawKey); Keyboard.press(mappedKey.rawKey);
if (commandBufferSize >= 31) {
commandBufferSize = 0;
}
commandBuffer[commandBufferSize++] = mappedKey.rawKey;
if ( mappedKey.rawKey == KEY_ENTER ||
mappedKey.rawKey == KEY_RETURN ) {
commandPromptPrinted = false;
process_command_buffer();
commandBufferSize = 0;
}
} }
void make_input(sx1509Class sx1509, int pin) { void make_input(sx1509Class sx1509, int pin) {

Loading…
Cancel
Save