Added special char cmd
parent
2545f15b30
commit
779965ff33
|
@ -102,6 +102,17 @@ void _hid_send_state(_hid_send_state_args args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void hid_send_special_char(uint16_t char_id) {
|
||||||
|
uint8_t packet[RAW_EPSIZE] = {
|
||||||
|
CMD_SPECIAL_CHAR,
|
||||||
|
(char_id >> 0) & 0xFF,
|
||||||
|
(char_id >> 8) & 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
raw_hid_send(packet, RAW_EPSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BETA_ENABLE_SPELLCHECK
|
#ifdef BETA_ENABLE_SPELLCHECK
|
||||||
void hid_send_word() {
|
void hid_send_word() {
|
||||||
uint8_t packet[RAW_EPSIZE] = {
|
uint8_t packet[RAW_EPSIZE] = {
|
||||||
|
|
|
@ -19,6 +19,8 @@ void _hid_send_state(_hid_send_state_args args);
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
void hid_send_special_char(uint16_t char_utf_8);
|
||||||
|
|
||||||
#ifdef BETA_ENABLE_SPELLCHECK
|
#ifdef BETA_ENABLE_SPELLCHECK
|
||||||
void hid_send_word(void);
|
void hid_send_word(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Sent by host when connection is initiated.
|
// Sent by host when connection is initiated.
|
||||||
//
|
//
|
||||||
// Packet structure:
|
// Packet structure:
|
||||||
|
@ -7,6 +10,9 @@
|
||||||
// # of Bytes: | 1 |
|
// # of Bytes: | 1 |
|
||||||
#define CMD_HELLO 0x00
|
#define CMD_HELLO 0x00
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Sent periodically by host to test connection.
|
// Sent periodically by host to test connection.
|
||||||
// Keyboard should ignore this command.
|
// Keyboard should ignore this command.
|
||||||
//
|
//
|
||||||
|
@ -15,6 +21,9 @@
|
||||||
// # of Bytes: | 1 |
|
// # of Bytes: | 1 |
|
||||||
#define CMD_RUTHERE 0x01
|
#define CMD_RUTHERE 0x01
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Send keyboard state to host.
|
// Send keyboard state to host.
|
||||||
//
|
//
|
||||||
// Packet structure:
|
// Packet structure:
|
||||||
|
@ -40,23 +49,7 @@
|
||||||
#define CMD_SEND_STATE 0x02
|
#define CMD_SEND_STATE 0x02
|
||||||
|
|
||||||
|
|
||||||
// Sent by keyboard to host when a complete word is typed.
|
|
||||||
// Host checks if this is a known word.
|
|
||||||
// If it is not, host responds with the same CMD (see below).
|
|
||||||
//
|
|
||||||
// Packet structure (sent by keyboard):
|
|
||||||
// Data: | cmd | word length | keycodes |
|
|
||||||
// # of Bytes: | 1 | 1 | ? |
|
|
||||||
//
|
|
||||||
// word length: number of bytes in `keycodes` block
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Packet structure (sent by host):
|
|
||||||
// Data: | cmd | typo? |
|
|
||||||
// # of Bytes: | 1 | 1 |
|
|
||||||
//
|
|
||||||
// typo: If this is 0x01, the word we got was a typo.
|
|
||||||
#define CMD_SPELLCHECK_WORD 0x04
|
|
||||||
|
|
||||||
// Animation data. Sent by host.
|
// Animation data. Sent by host.
|
||||||
//
|
//
|
||||||
|
@ -76,3 +69,38 @@
|
||||||
// Minimum height is 0, maximum is 250.
|
// Minimum height is 0, maximum is 250.
|
||||||
#define CMD_ANIM_DATA_fft 0x00
|
#define CMD_ANIM_DATA_fft 0x00
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Sent by keyboard to host when a complete word is typed.
|
||||||
|
// Host checks if this is a known word.
|
||||||
|
// If it is not, host responds with the same CMD (see below).
|
||||||
|
//
|
||||||
|
// Packet structure (sent by keyboard):
|
||||||
|
// Data: | cmd | word length | keycodes |
|
||||||
|
// # of Bytes: | 1 | 1 | ? |
|
||||||
|
//
|
||||||
|
// word length: number of bytes in `keycodes` block
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Packet structure (sent by host):
|
||||||
|
// Data: | cmd | typo? |
|
||||||
|
// # of Bytes: | 1 | 1 |
|
||||||
|
//
|
||||||
|
// typo: If this is 0x01, the word we got was a typo.
|
||||||
|
#define CMD_SPELLCHECK_WORD 0x04
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Sent by host when a "special char" key is pressed.
|
||||||
|
// Handled by host interface.
|
||||||
|
//
|
||||||
|
// Packet structure:
|
||||||
|
// Data: | cmd | character |
|
||||||
|
// # of Bytes: | 1 | 2 |
|
||||||
|
//
|
||||||
|
// character:
|
||||||
|
// uint16_t, character id
|
||||||
|
//
|
||||||
|
#define CMD_SPECIAL_CHAR 0x05
|
|
@ -15,6 +15,15 @@
|
||||||
#include "secrets.h"
|
#include "secrets.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Send a special character.
|
||||||
|
// Returns false if character was caught, true otherwise.
|
||||||
|
bool send_special_character(uint16_t keycode) {
|
||||||
|
if ( (keycode > M_SPECIAL_TOP) && (keycode < M_SPECIAL_BOTTОM) ) {
|
||||||
|
hid_send_special_char(keycode - M_SPECIAL_TOP - 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LEADER_EXTERNS();
|
LEADER_EXTERNS();
|
||||||
|
@ -29,6 +38,22 @@ void matrix_scan_user(void) {
|
||||||
SEND_STRING(SECRET_EMAIL);
|
SEND_STRING(SECRET_EMAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SEQ_TWO_KEYS(KC_S, KC_H) {
|
||||||
|
send_special_character(M_SC_SHRUG);
|
||||||
|
}
|
||||||
|
|
||||||
|
SEQ_THREE_KEYS(KC_Y, KC_A, KC_E) {
|
||||||
|
send_special_character(M_SC_YAE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SEQ_FOUR_KEYS(KC_L, KC_Y, KC_U, KC_S) {
|
||||||
|
send_special_character(M_SC_LYUS);
|
||||||
|
}
|
||||||
|
|
||||||
|
SEQ_FOUR_KEYS(KC_B, KC_Y, KC_U, KC_S) {
|
||||||
|
send_special_character(M_SC_BYUS);
|
||||||
|
}
|
||||||
|
|
||||||
//SEQ_ONE_KEY(KC_F) {}
|
//SEQ_ONE_KEY(KC_F) {}
|
||||||
//
|
//
|
||||||
//SEQ_TWO_KEYS(KC_A, KC_S) {
|
//SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||||
|
@ -48,6 +73,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (!process_spellcheck(keycode, record)) { return false; }
|
if (!process_spellcheck(keycode, record)) { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Handle special chars
|
||||||
|
if (record->event.pressed) {
|
||||||
|
if (!send_special_character(keycode)) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
// Handle macros
|
// Handle macros
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case M_RESETWM:
|
case M_RESETWM:
|
||||||
|
|
|
@ -17,6 +17,7 @@ extern rgb_config_t rgb_matrix_config;
|
||||||
#define LC_PINK LC_HSV(243, 222, 234)
|
#define LC_PINK LC_HSV(243, 222, 234)
|
||||||
#define LC_CYAN LC_HSV(134, 255, 213)
|
#define LC_CYAN LC_HSV(134, 255, 213)
|
||||||
#define LC_ORANGE LC_HSV( 14, 255, 255)
|
#define LC_ORANGE LC_HSV( 14, 255, 255)
|
||||||
|
#define LC_WHITE LC_HSV( 0, 0, 150)
|
||||||
|
|
||||||
#define LC_RU_B LC_HSV( 0, 0, 165)
|
#define LC_RU_B LC_HSV( 0, 0, 165)
|
||||||
#define LC_RU_G LC_HSV(153, 255, 153)
|
#define LC_RU_G LC_HSV(153, 255, 153)
|
||||||
|
@ -26,7 +27,33 @@ extern rgb_config_t rgb_matrix_config;
|
||||||
// (Must be done before keymaps are loaded)
|
// (Must be done before keymaps are loaded)
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
M_SHUTDOWN = BETA_SAFE_RANGE,
|
M_SHUTDOWN = BETA_SAFE_RANGE,
|
||||||
|
|
||||||
|
// Macros
|
||||||
M_RESETWM,
|
M_RESETWM,
|
||||||
M_RU_CTRL,
|
M_RU_CTRL,
|
||||||
M_RU_ALT
|
M_RU_ALT,
|
||||||
|
|
||||||
|
// Special characters.
|
||||||
|
// M_SPECIAL_TOP and M_SPECIAL_BOTTOM are
|
||||||
|
// bounds used to parse these. Only special
|
||||||
|
// characters should be between them.
|
||||||
|
//
|
||||||
|
// Also, characters here should be in the same
|
||||||
|
// order as they are in the host inteface.
|
||||||
|
M_SPECIAL_TOP,
|
||||||
|
M_SC_GRAVE,
|
||||||
|
M_SC_TILD,
|
||||||
|
M_SC_QUOT,
|
||||||
|
M_SC_LBR,
|
||||||
|
M_SC_RBR,
|
||||||
|
M_SC_LCBR,
|
||||||
|
M_SC_RCBR,
|
||||||
|
M_SC_LKVCH,
|
||||||
|
M_SC_RKVCH,
|
||||||
|
|
||||||
|
M_SC_LYUS,
|
||||||
|
M_SC_BYUS,
|
||||||
|
M_SC_YAE,
|
||||||
|
M_SC_SHRUG,
|
||||||
|
M_SPECIAL_BOTTОM
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_LEAD,\
|
KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_LEAD,\
|
||||||
KC_H, KC_J, KC_K, MO(LAYER_SYMBOLS), KC_L, KC_NO,\
|
KC_H, KC_J, KC_K, MO(LAYER_SYMBOLS), KC_L, KC_NO,\
|
||||||
KC_NO, KC_N, KC_M, KC_P, KC_DOT, KC_COMMA, TT(LAYER_FKEYS),\
|
KC_NO, KC_N, KC_M, KC_P, KC_DOT, KC_COMMA, TT(LAYER_FKEYS),\
|
||||||
KC_RIGHT, KC_NO, TO(LAYER_KEYBOARD), TO(LAYER_RUSSIAN), LGUI(KC_SPACE),\
|
KC_RIGHT, KC_NO, TO(LAYER_KEYBOARD), KC_NO, LGUI(KC_SPACE),\
|
||||||
\
|
\
|
||||||
KC_LNG1, KC_LNG2,\
|
KC_LNG1, KC_LNG2,\
|
||||||
KC_LNG3,\
|
KC_LNG3,\
|
||||||
KC_NO, KC_RSHIFT, KC_ENTER\
|
TO(LAYER_RUSSIAN), KC_RSHIFT, KC_ENTER\
|
||||||
)
|
)
|
||||||
|
|
||||||
BETA_LAYER_MAGIC_MACRO
|
BETA_LAYER_MAGIC_MACRO
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_NO,\
|
RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_NO,\
|
||||||
RU_HA, RU_ZHE, RU_KA, MO(LAYER_SYMBOLS_RU), RU_EL, KC_NO,\
|
RU_HA, RU_ZHE, RU_KA, MO(LAYER_SYMBOLS_RU), RU_EL, KC_NO,\
|
||||||
RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\
|
RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, TO(LAYER_MAIN), KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||||
\
|
\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT,\
|
KC_TRANSPARENT, KC_TRANSPARENT,\
|
||||||
KC_TRANSPARENT,\
|
KC_TRANSPARENT,\
|
||||||
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT\
|
TO(LAYER_MAIN), KC_TRANSPARENT, KC_TRANSPARENT\
|
||||||
)
|
)
|
||||||
|
|
||||||
BETA_LAYER_MAGIC_MACRO
|
BETA_LAYER_MAGIC_MACRO
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
#ifdef BETA_LAYER_KEYS
|
#ifdef BETA_LAYER_KEYS
|
||||||
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
|
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
|
||||||
KC_NO, RU_EXLM, RU_DQUO, RU_NUM, RU_SCLN, RU_PERC, KC_NO,\
|
KC_NO, RU_EXLM, RU_DQUO, RU_NUM, RU_SCLN, RU_PERC, KC_NO,\
|
||||||
KC_NO, KC_NO, RU_LPRN, RU_RPRN, RU_QUES, KC_NO, KC_NO,\
|
KC_NO, M_SC_GRAVE, RU_LPRN, RU_RPRN, RU_QUES, M_SC_LCBR, KC_NO,\
|
||||||
KC_NO, KC_NO, KC_NO, RU_COMM, RU_DOT, RU_DQUO,\
|
KC_NO, M_SC_TILD, M_SC_QUOT, RU_COMM, RU_DOT, RU_DQUO,\
|
||||||
KC_NO, KC_NO, KC_NO, KC_NO, RU_EXLM, KC_NO, KC_NO,\
|
KC_NO, KC_NO, M_SC_LBR, M_SC_RBR, RU_EXLM, M_SC_RCBR, KC_NO,\
|
||||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
|
KC_NO, KC_NO, KC_NO, M_SC_LKVCH, M_SC_RKVCH,\
|
||||||
\
|
\
|
||||||
KC_NO, KC_NO,\
|
KC_NO, KC_NO,\
|
||||||
KC_NO,\
|
KC_NO,\
|
||||||
KC_NO, KC_NO, KC_NO,\
|
KC_NO, KC_NO, KC_NO,\
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||
KC_NO, RU_COLN, RU_QUES, RU_ASTR, RU_LPRN, RU_RPRN, KC_NO,\
|
KC_NO, RU_COLN, RU_QUES, RU_ASTR, RU_LPRN, RU_RPRN, KC_NO,\
|
||||||
|
@ -38,10 +38,10 @@
|
||||||
#ifdef BETA_LAYER_LEDS
|
#ifdef BETA_LAYER_LEDS
|
||||||
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
|
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
|
||||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||||
LC_OFF, LC_CYAN, LC_CYAN, LC_PINK, LC_OFF, \
|
LC_WHITE, LC_CYAN, LC_CYAN, LC_PINK, LC_WHITE, \
|
||||||
LC_OFF, LC_OFF, LC_PINK, LC_PINK, LC_PINK, \
|
LC_WHITE, LC_WHITE, LC_PINK, LC_PINK, LC_PINK, \
|
||||||
LC_OFF, LC_OFF, LC_OFF, LC_PINK, LC_OFF, \
|
LC_OFF, LC_WHITE, LC_WHITE, LC_PINK, LC_WHITE, \
|
||||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
LC_OFF, LC_OFF, LC_WHITE, LC_WHITE, \
|
||||||
\
|
\
|
||||||
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
|
||||||
LC_OFF, LC_OFF, LC_CYAN, LC_OFF, LC_CYAN, \
|
LC_OFF, LC_OFF, LC_CYAN, LC_OFF, LC_CYAN, \
|
||||||
|
|
Loading…
Reference in New Issue