diff options
| -rw-r--r-- | keyboard/planck/keymap_common.h | 68 | ||||
| -rw-r--r-- | keyboard/planck/keymap_french.h | 2 | ||||
| -rw-r--r-- | keyboard/planck/keymap_nordic.h | 4 | ||||
| -rw-r--r-- | keyboard/planck/keymap_spanish.h | 4 | ||||
| -rw-r--r-- | protocol/lufa/lufa.c | 91 |
5 files changed, 52 insertions, 117 deletions
diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h index 73df8424a..21908a2be 100644 --- a/keyboard/planck/keymap_common.h +++ b/keyboard/planck/keymap_common.h | |||
| @@ -78,74 +78,6 @@ extern const uint16_t fn_actions[]; | |||
| 78 | #define S(kc) LSFT(kc) | 78 | #define S(kc) LSFT(kc) |
| 79 | #define F(kc) FUNC(kc) | 79 | #define F(kc) FUNC(kc) |
| 80 | 80 | ||
| 81 | // For software implementation of colemak | ||
| 82 | #define CM_Q KC_Q | ||
| 83 | #define CM_W KC_W | ||
| 84 | #define CM_F KC_E | ||
| 85 | #define CM_P KC_R | ||
| 86 | #define CM_G KC_T | ||
| 87 | #define CM_J KC_Y | ||
| 88 | #define CM_L KC_U | ||
| 89 | #define CM_U KC_I | ||
| 90 | #define CM_Y KC_O | ||
| 91 | #define CM_SCLN KC_P | ||
| 92 | |||
| 93 | #define CM_A KC_A | ||
| 94 | #define CM_R KC_S | ||
| 95 | #define CM_S KC_D | ||
| 96 | #define CM_T KC_F | ||
| 97 | #define CM_D KC_G | ||
| 98 | #define CM_H KC_H | ||
| 99 | #define CM_N KC_J | ||
| 100 | #define CM_E KC_K | ||
| 101 | #define CM_I KC_L | ||
| 102 | #define CM_O KC_SCLN | ||
| 103 | |||
| 104 | #define CM_Z KC_Z | ||
| 105 | #define CM_X KC_X | ||
| 106 | #define CM_C KC_C | ||
| 107 | #define CM_V KC_V | ||
| 108 | #define CM_B KC_B | ||
| 109 | #define CM_K KC_N | ||
| 110 | #define CM_M KC_M | ||
| 111 | #define CM_COMM KC_COMM | ||
| 112 | #define CM_DOT KC_DOT | ||
| 113 | #define CM_SLSH KC_SLSH | ||
| 114 | |||
| 115 | // Make it easy to support these in macros | ||
| 116 | #define KC_CM_Q CM_Q | ||
| 117 | #define KC_CM_W CM_W | ||
| 118 | #define KC_CM_F CM_F | ||
| 119 | #define KC_CM_P CM_P | ||
| 120 | #define KC_CM_G CM_G | ||
| 121 | #define KC_CM_J CM_J | ||
| 122 | #define KC_CM_L CM_L | ||
| 123 | #define KC_CM_U CM_U | ||
| 124 | #define KC_CM_Y CM_Y | ||
| 125 | #define KC_CM_SCLN CM_SCLN | ||
| 126 | |||
| 127 | #define KC_CM_A CM_A | ||
| 128 | #define KC_CM_R CM_R | ||
| 129 | #define KC_CM_S CM_S | ||
| 130 | #define KC_CM_T CM_T | ||
| 131 | #define KC_CM_D CM_D | ||
| 132 | #define KC_CM_H CM_H | ||
| 133 | #define KC_CM_N CM_N | ||
| 134 | #define KC_CM_E CM_E | ||
| 135 | #define KC_CM_I CM_I | ||
| 136 | #define KC_CM_O CM_O | ||
| 137 | |||
| 138 | #define KC_CM_Z CM_Z | ||
| 139 | #define KC_CM_X CM_X | ||
| 140 | #define KC_CM_C CM_C | ||
| 141 | #define KC_CM_V CM_V | ||
| 142 | #define KC_CM_B CM_B | ||
| 143 | #define KC_CM_K CM_K | ||
| 144 | #define KC_CM_M CM_M | ||
| 145 | #define KC_CM_COMM CM_COMM | ||
| 146 | #define KC_CM_DOT CM_DOT | ||
| 147 | #define KC_CM_SLSH CM_SLSH | ||
| 148 | |||
| 149 | #define M(kc) kc | 0x3000 | 81 | #define M(kc) kc | 0x3000 |
| 150 | 82 | ||
| 151 | #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) | 83 | #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) |
diff --git a/keyboard/planck/keymap_french.h b/keyboard/planck/keymap_french.h index 71c8033c2..ccfaed8f0 100644 --- a/keyboard/planck/keymap_french.h +++ b/keyboard/planck/keymap_french.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #define FR_QUOT KC_3 | 14 | #define FR_QUOT KC_3 |
| 15 | #define FR_APOS KC_4 | 15 | #define FR_APOS KC_4 |
| 16 | #define FR_LPRN KC_5 | 16 | #define FR_LPRN KC_5 |
| 17 | #define FR_DASH KC_6 | 17 | #define FR_MINS KC_6 |
| 18 | #define FR_EGRV KC_7 | 18 | #define FR_EGRV KC_7 |
| 19 | #define FR_UNDS KC_8 | 19 | #define FR_UNDS KC_8 |
| 20 | #define FR_CCED KC_9 | 20 | #define FR_CCED KC_9 |
diff --git a/keyboard/planck/keymap_nordic.h b/keyboard/planck/keymap_nordic.h index 56ae8b63b..02a704216 100644 --- a/keyboard/planck/keymap_nordic.h +++ b/keyboard/planck/keymap_nordic.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define NO_APOS KC_NUHS | 19 | #define NO_APOS KC_NUHS |
| 20 | 20 | ||
| 21 | #define NO_LESS KC_NUBS | 21 | #define NO_LESS KC_NUBS |
| 22 | #define NO_DASH KC_SLSH | 22 | #define NO_MINS KC_SLSH |
| 23 | 23 | ||
| 24 | // Shifted characters | 24 | // Shifted characters |
| 25 | #define NO_SECT LSFT(NO_HALF) | 25 | #define NO_SECT LSFT(NO_HALF) |
| @@ -38,7 +38,7 @@ | |||
| 38 | #define NO_GRTR LSFT(NO_LESS) | 38 | #define NO_GRTR LSFT(NO_LESS) |
| 39 | #define NO_SCLN LSFT(KC_COMM) | 39 | #define NO_SCLN LSFT(KC_COMM) |
| 40 | #define NO_COLN LSFT(KC_DOT) | 40 | #define NO_COLN LSFT(KC_DOT) |
| 41 | #define NO_UNDS LSFT(NO_DASH) | 41 | #define NO_UNDS LSFT(NO_MINS) |
| 42 | 42 | ||
| 43 | // Alt Gr-ed characters | 43 | // Alt Gr-ed characters |
| 44 | #define NO_AT ALGR(KC_2) | 44 | #define NO_AT ALGR(KC_2) |
diff --git a/keyboard/planck/keymap_spanish.h b/keyboard/planck/keymap_spanish.h index 50bcb999b..7f980afbc 100644 --- a/keyboard/planck/keymap_spanish.h +++ b/keyboard/planck/keymap_spanish.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #define ES_CCED KC_NUHS | 20 | #define ES_CCED KC_NUHS |
| 21 | 21 | ||
| 22 | #define ES_LESS KC_NUBS | 22 | #define ES_LESS KC_NUBS |
| 23 | #define ES_DASH KC_SLSH | 23 | #define ES_MINS KC_SLSH |
| 24 | 24 | ||
| 25 | // Shifted characters | 25 | // Shifted characters |
| 26 | #define ES_ASML LSFT(ES_OVRR) | 26 | #define ES_ASML LSFT(ES_OVRR) |
| @@ -42,7 +42,7 @@ | |||
| 42 | #define ES_GRTR LSFT(ES_LESS) | 42 | #define ES_GRTR LSFT(ES_LESS) |
| 43 | #define ES_SCLN LSFT(ES_COMM) | 43 | #define ES_SCLN LSFT(ES_COMM) |
| 44 | #define ES_COLN LSFT(ES_DOT) | 44 | #define ES_COLN LSFT(ES_DOT) |
| 45 | #define ES_UNDS LSFT(ES_DASH) | 45 | #define ES_UNDS LSFT(ES_MINS) |
| 46 | 46 | ||
| 47 | // Alt Gr-ed characters | 47 | // Alt Gr-ed characters |
| 48 | #define ES_BSLS ALGR(ES_OVRR) | 48 | #define ES_BSLS ALGR(ES_OVRR) |
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index e5267fead..c9504483a 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c | |||
| @@ -445,6 +445,14 @@ static uint8_t keyboard_leds(void) | |||
| 445 | 445 | ||
| 446 | static void send_keyboard(report_keyboard_t *report) | 446 | static void send_keyboard(report_keyboard_t *report) |
| 447 | { | 447 | { |
| 448 | |||
| 449 | #ifdef BLUETOOTH_ENABLE | ||
| 450 | bluefruit_serial_send(0xFD); | ||
| 451 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { | ||
| 452 | bluefruit_serial_send(report->raw[i]); | ||
| 453 | } | ||
| 454 | #endif | ||
| 455 | |||
| 448 | uint8_t timeout = 255; | 456 | uint8_t timeout = 255; |
| 449 | 457 | ||
| 450 | if (USB_DeviceState != DEVICE_STATE_Configured) | 458 | if (USB_DeviceState != DEVICE_STATE_Configured) |
| @@ -482,17 +490,24 @@ static void send_keyboard(report_keyboard_t *report) | |||
| 482 | 490 | ||
| 483 | keyboard_report_sent = *report; | 491 | keyboard_report_sent = *report; |
| 484 | 492 | ||
| 485 | #ifdef BLUETOOTH_ENABLE | ||
| 486 | bluefruit_serial_send(0xFD); | ||
| 487 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { | ||
| 488 | bluefruit_serial_send(report->raw[i]); | ||
| 489 | } | ||
| 490 | #endif | ||
| 491 | } | 493 | } |
| 492 | 494 | ||
| 493 | static void send_mouse(report_mouse_t *report) | 495 | static void send_mouse(report_mouse_t *report) |
| 494 | { | 496 | { |
| 495 | #ifdef MOUSE_ENABLE | 497 | #ifdef MOUSE_ENABLE |
| 498 | |||
| 499 | #ifdef BLUETOOTH_ENABLE | ||
| 500 | bluefruit_serial_send(0xFD); | ||
| 501 | bluefruit_serial_send(0x00); | ||
| 502 | bluefruit_serial_send(0x03); | ||
| 503 | bluefruit_serial_send(report->buttons); | ||
| 504 | bluefruit_serial_send(report->x); | ||
| 505 | bluefruit_serial_send(report->y); | ||
| 506 | bluefruit_serial_send(report->v); // should try sending the wheel v here | ||
| 507 | bluefruit_serial_send(report->h); // should try sending the wheel h here | ||
| 508 | bluefruit_serial_send(0x00); | ||
| 509 | #endif | ||
| 510 | |||
| 496 | uint8_t timeout = 255; | 511 | uint8_t timeout = 255; |
| 497 | 512 | ||
| 498 | if (USB_DeviceState != DEVICE_STATE_Configured) | 513 | if (USB_DeviceState != DEVICE_STATE_Configured) |
| @@ -511,19 +526,6 @@ static void send_mouse(report_mouse_t *report) | |||
| 511 | /* Finalize the stream transfer to send the last packet */ | 526 | /* Finalize the stream transfer to send the last packet */ |
| 512 | Endpoint_ClearIN(); | 527 | Endpoint_ClearIN(); |
| 513 | 528 | ||
| 514 | |||
| 515 | #ifdef BLUETOOTH_ENABLE | ||
| 516 | bluefruit_serial_send(0xFD); | ||
| 517 | bluefruit_serial_send(0x00); | ||
| 518 | bluefruit_serial_send(0x03); | ||
| 519 | bluefruit_serial_send(report->buttons); | ||
| 520 | bluefruit_serial_send(report->x); | ||
| 521 | bluefruit_serial_send(report->y); | ||
| 522 | bluefruit_serial_send(report->v); // should try sending the wheel v here | ||
| 523 | bluefruit_serial_send(report->h); // should try sending the wheel h here | ||
| 524 | bluefruit_serial_send(0x00); | ||
| 525 | #endif | ||
| 526 | |||
| 527 | #endif | 529 | #endif |
| 528 | } | 530 | } |
| 529 | 531 | ||
| @@ -550,6 +552,23 @@ static void send_system(uint16_t data) | |||
| 550 | 552 | ||
| 551 | static void send_consumer(uint16_t data) | 553 | static void send_consumer(uint16_t data) |
| 552 | { | 554 | { |
| 555 | |||
| 556 | #ifdef BLUETOOTH_ENABLE | ||
| 557 | static uint16_t last_data = 0; | ||
| 558 | if (data == last_data) return; | ||
| 559 | last_data = data; | ||
| 560 | uint16_t bitmap = CONSUMER2BLUEFRUIT(data); | ||
| 561 | bluefruit_serial_send(0xFD); | ||
| 562 | bluefruit_serial_send(0x00); | ||
| 563 | bluefruit_serial_send(0x02); | ||
| 564 | bluefruit_serial_send((bitmap>>8)&0xFF); | ||
| 565 | bluefruit_serial_send(bitmap&0xFF); | ||
| 566 | bluefruit_serial_send(0x00); | ||
| 567 | bluefruit_serial_send(0x00); | ||
| 568 | bluefruit_serial_send(0x00); | ||
| 569 | bluefruit_serial_send(0x00); | ||
| 570 | #endif | ||
| 571 | |||
| 553 | uint8_t timeout = 255; | 572 | uint8_t timeout = 255; |
| 554 | 573 | ||
| 555 | if (USB_DeviceState != DEVICE_STATE_Configured) | 574 | if (USB_DeviceState != DEVICE_STATE_Configured) |
| @@ -568,21 +587,6 @@ static void send_consumer(uint16_t data) | |||
| 568 | Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); | 587 | Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); |
| 569 | Endpoint_ClearIN(); | 588 | Endpoint_ClearIN(); |
| 570 | 589 | ||
| 571 | #ifdef BLUETOOTH_ENABLE | ||
| 572 | static uint16_t last_data = 0; | ||
| 573 | if (data == last_data) return; | ||
| 574 | last_data = data; | ||
| 575 | uint16_t bitmap = CONSUMER2BLUEFRUIT(data); | ||
| 576 | bluefruit_serial_send(0xFD); | ||
| 577 | bluefruit_serial_send(0x00); | ||
| 578 | bluefruit_serial_send(0x02); | ||
| 579 | bluefruit_serial_send((bitmap>>8)&0xFF); | ||
| 580 | bluefruit_serial_send(bitmap&0xFF); | ||
| 581 | bluefruit_serial_send(0x00); | ||
| 582 | bluefruit_serial_send(0x00); | ||
| 583 | bluefruit_serial_send(0x00); | ||
| 584 | bluefruit_serial_send(0x00); | ||
| 585 | #endif | ||
| 586 | 590 | ||
| 587 | } | 591 | } |
| 588 | 592 | ||
| @@ -881,19 +885,18 @@ int main(void) | |||
| 881 | #endif | 885 | #endif |
| 882 | 886 | ||
| 883 | #ifdef BLUETOOTH_ENABLE | 887 | #ifdef BLUETOOTH_ENABLE |
| 884 | print_set_sendchar(sendchar); | ||
| 885 | serial_init(); | 888 | serial_init(); |
| 886 | #endif | 889 | #endif |
| 887 | 890 | ||
| 888 | 891 | ||
| 889 | /* wait for USB startup & debug output */ | 892 | /* wait for USB startup & debug output */ |
| 890 | while (USB_DeviceState != DEVICE_STATE_Configured) { | 893 | // while (USB_DeviceState != DEVICE_STATE_Configured) { |
| 891 | // #if defined(INTERRUPT_CONTROL_ENDPOINT) | 894 | // #if defined(INTERRUPT_CONTROL_ENDPOINT) |
| 892 | // ; | 895 | // ; |
| 893 | // #else | 896 | // #else |
| 894 | USB_USBTask(); | 897 | USB_USBTask(); |
| 895 | // #endif | 898 | // #endif |
| 896 | } | 899 | // } |
| 897 | print("USB configured.\n"); | 900 | print("USB configured.\n"); |
| 898 | 901 | ||
| 899 | /* init modules */ | 902 | /* init modules */ |
| @@ -905,13 +908,13 @@ int main(void) | |||
| 905 | 908 | ||
| 906 | print("Keyboard start.\n"); | 909 | print("Keyboard start.\n"); |
| 907 | while (1) { | 910 | while (1) { |
| 908 | while (USB_DeviceState == DEVICE_STATE_Suspended) { | 911 | // while (USB_DeviceState == DEVICE_STATE_Suspended) { |
| 909 | print("[s]"); | 912 | // print("[s]"); |
| 910 | suspend_power_down(); | 913 | // suspend_power_down(); |
| 911 | if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { | 914 | // if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { |
| 912 | USB_Device_SendRemoteWakeup(); | 915 | // USB_Device_SendRemoteWakeup(); |
| 913 | } | 916 | // } |
| 914 | } | 917 | // } |
| 915 | 918 | ||
| 916 | #ifdef MIDI_ENABLE | 919 | #ifdef MIDI_ENABLE |
| 917 | midi_device_process(&midi_device); | 920 | midi_device_process(&midi_device); |
