Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Firmware/Compiled/DC29.uf2
Binary file not shown.
125 changes: 78 additions & 47 deletions Firmware/Source/DC29/src/serialconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,236 +465,267 @@ void updateSerialConsole(void){
udi_cdc_putc(data);//echo input
if(data == 13){ //enter
int newKeymapCounter = 0;
uint8_t pending_modifier = 0;
for(int x=0; x<newKeystrokeCounter; x++){
if(newKeystroke[x] == '['){
x++;
if(newKeystroke[x] == 'c' && newKeystroke[x+1] == 't' && newKeystroke[x+2] == 'r' && newKeystroke[x+3] == 'l' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
newKeymap[newKeymapCounter] = HID_MODIFIER_LEFT_CTRL;
newKeymapCounter ++;
if(newKeystroke[x] == 'c' && newKeystroke[x+1] == 't' && newKeystroke[x+2] == 'r' && newKeystroke[x+3] == 'l' && newKeystroke[x+4] == ']'){
pending_modifier |= HID_MODIFIER_LEFT_CTRL;
x += 4;
} else if(newKeystroke[x] == 'a' && newKeystroke[x+1] == 'l' && newKeystroke[x+2] == 't' && newKeystroke[x+3] == ']' && newKeystroke[x+4] != '['){
newKeymap[newKeymapCounter] = HID_MODIFIER_LEFT_ALT;
newKeymapCounter ++;
} else if(newKeystroke[x] == 'a' && newKeystroke[x+1] == 'l' && newKeystroke[x+2] == 't' && newKeystroke[x+3] == ']'){
pending_modifier |= HID_MODIFIER_LEFT_ALT;
x += 3;
} else if(newKeystroke[x] == 's' && newKeystroke[x+1] == 'h' && newKeystroke[x+2] == 'i' && newKeystroke[x+3] == 'f' && newKeystroke[x+4] == 't' && newKeystroke[x+5] == ']' && newKeystroke[x+6] != '['){
newKeymap[newKeymapCounter] = HID_MODIFIER_LEFT_SHIFT;
newKeymapCounter ++;
} else if(newKeystroke[x] == 's' && newKeystroke[x+1] == 'h' && newKeystroke[x+2] == 'i' && newKeystroke[x+3] == 'f' && newKeystroke[x+4] == 't' && newKeystroke[x+5] == ']'){
pending_modifier |= HID_MODIFIER_LEFT_SHIFT;
x += 5;
} else if(newKeystroke[x] == 'g' && newKeystroke[x+1] == 'u' && newKeystroke[x+2] == 'i' && newKeystroke[x+3] == ']' && newKeystroke[x+4] != '['){
newKeymap[newKeymapCounter] = HID_MODIFIER_LEFT_UI;
newKeymapCounter ++;
} else if(newKeystroke[x] == 'g' && newKeystroke[x+1] == 'u' && newKeystroke[x+2] == 'i' && newKeystroke[x+3] == ']'){
pending_modifier |= HID_MODIFIER_LEFT_UI;
x += 3;
} else if(newKeystroke[x] == 'p' && newKeystroke[x+1] == 'l' && newKeystroke[x+2] == 'a' && newKeystroke[x+3] == 'y' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 'p' && newKeystroke[x+1] == 'l' && newKeystroke[x+2] == 'a' && newKeystroke[x+3] == 'y' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_PLAY;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 'n' && newKeystroke[x+1] == 'e' && newKeystroke[x+2] == 'x' && newKeystroke[x+3] == 't' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 'n' && newKeystroke[x+1] == 'e' && newKeystroke[x+2] == 'x' && newKeystroke[x+3] == 't' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_NEXT;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 'b' && newKeystroke[x+1] == 'a' && newKeystroke[x+2] == 'c' && newKeystroke[x+3] == 'k' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 'b' && newKeystroke[x+1] == 'a' && newKeystroke[x+2] == 'c' && newKeystroke[x+3] == 'k' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_BACK;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 's' && newKeystroke[x+1] == 't' && newKeystroke[x+2] == 'o' && newKeystroke[x+3] == 'p' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 's' && newKeystroke[x+1] == 't' && newKeystroke[x+2] == 'o' && newKeystroke[x+3] == 'p' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_STOP;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 'e' && newKeystroke[x+1] == 'j' && newKeystroke[x+2] == 'e' && newKeystroke[x+3] == 'c' && newKeystroke[x+4] == 't' && newKeystroke[x+5] != ']' && newKeystroke[x+6] != '['){
} else if(newKeystroke[x] == 'e' && newKeystroke[x+1] == 'j' && newKeystroke[x+2] == 'e' && newKeystroke[x+3] == 'c' && newKeystroke[x+4] == 't' && newKeystroke[x+5] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_EJECT;
newKeymapCounter ++;
pending_modifier = 0;
x += 5;
} else if(newKeystroke[x] == 'm' && newKeystroke[x+1] == 'u' && newKeystroke[x+2] == 't' && newKeystroke[x+3] == 'e' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 'm' && newKeystroke[x+1] == 'u' && newKeystroke[x+2] == 't' && newKeystroke[x+3] == 'e' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_MUTE;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 'v' && newKeystroke[x+1] == 'o' && newKeystroke[x+2] == 'l' && newKeystroke[x+3] == '+' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 'v' && newKeystroke[x+1] == 'o' && newKeystroke[x+2] == 'l' && newKeystroke[x+3] == '+' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_VOL_PLUS;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 'v' && newKeystroke[x+1] == 'o' && newKeystroke[x+2] == 'l' && newKeystroke[x+3] == '-' && newKeystroke[x+4] == ']' && newKeystroke[x+5] != '['){
} else if(newKeystroke[x] == 'v' && newKeystroke[x+1] == 'o' && newKeystroke[x+2] == 'l' && newKeystroke[x+3] == '-' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 240;//media key identifier
newKeymapCounter ++;
newKeymap[newKeymapCounter] = HID_MEDIA_VOL_MINUS;
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 58;//F1
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '2' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 59;//F2
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '3' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 60;//F3
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '4' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 61;//F4
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '5' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 62;//F5
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '6' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 63;//F6
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '7' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 64;//F7
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '8' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 65;//F8
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '9' && newKeystroke[x+2] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 66;//F9
newKeymapCounter ++;
pending_modifier = 0;
x += 2;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '0' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 67;//F10
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '1' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 68;//F11
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '2' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 69;//F12
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '3' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 104;//F13
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '4' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 105;//F14
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '5' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 106;//F15
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '6' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 107;//F16
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '7' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 108;//F17
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '8' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 109;//F18
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '1' && newKeystroke[x+2] == '9' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 110;//F19
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '2' && newKeystroke[x+2] == '0' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 111;//F20
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '2' && newKeystroke[x+2] == '1' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 112;//F21
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '2' && newKeystroke[x+2] == '2' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 113;//F22
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '2' && newKeystroke[x+2] == '3' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 114;//F23
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'F' && newKeystroke[x+1] == '2' && newKeystroke[x+2] == '4' && newKeystroke[x+3] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 115;//F24
newKeymapCounter ++;
pending_modifier = 0;
x += 3;
} else if(newKeystroke[x] == 'n' && newKeystroke[x+1] == 'o' && newKeystroke[x+2] == 'n' && newKeystroke[x+3] == 'e' && newKeystroke[x+4] == ']'){
newKeymap[newKeymapCounter] = 0; //No modifiers
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter ++;
newKeymap[newKeymapCounter] = 0; //No key
newKeymapCounter ++;
pending_modifier = 0;
x += 4;
}
} else {
if(ascii_to_hid[newKeystroke[x]] > 127){
newKeymap[newKeymapCounter] = HID_MODIFIER_LEFT_SHIFT;
newKeymap[newKeymapCounter] = HID_MODIFIER_LEFT_SHIFT | pending_modifier;
newKeymapCounter++;
newKeymap[newKeymapCounter] = ascii_to_hid[newKeystroke[x]]-128;
newKeymapCounter++;
} else {
newKeymap[newKeymapCounter] = 0;
newKeymap[newKeymapCounter] = pending_modifier;
newKeymapCounter++;
newKeymap[newKeymapCounter] = ascii_to_hid[newKeystroke[x]];
newKeymapCounter++;
}
pending_modifier = 0;
}
}
if(newKeymapCounter + keymaplength < 231){
Expand Down
Loading