1
0
Fork 0

Add Serbian keymaps and sendstring LUT (#8560)

* Add Serbian keymaps and sendstring LUT

* Apply suggestions from code review

Co-Authored-By: Konstantin Đorđević <vomindoraan@gmail.com>

* Fix formatting

Co-authored-by: Konstantin Đorđević <vomindoraan@gmail.com>
This commit is contained in:
Ryan 2020-04-01 14:01:01 +11:00 committed by GitHub
parent 17af712b7c
commit fec4283022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 400 additions and 0 deletions

View file

@ -0,0 +1,136 @@
/* Copyright 2020
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "keymap.h"
// clang-format off
/*
*
*  `  1  2  3  4  5  6  7  8  9  0  '  +        
*
*       Љ  Њ  Е  Р  Т  З  У  И  О  П  Ш  Ђ      
*     
*        А  С  Д  Ф  Г  Х  Ј  К  Л  Ч  Ћ  Ж     
*
*      <  Ѕ  Џ  Ц  В  Б  Н  М  ,  .  -           
*
*                                                     
*
*/
// Row 1
#define RS_GRV KC_GRV // `
#define RS_1 KC_1 // 1
#define RS_2 KC_2 // 2
#define RS_3 KC_3 // 3
#define RS_4 KC_4 // 4
#define RS_5 KC_5 // 5
#define RS_6 KC_6 // 6
#define RS_7 KC_7 // 7
#define RS_8 KC_8 // 8
#define RS_9 KC_9 // 9
#define RS_0 KC_0 // 0
#define RS_QUOT KC_MINS // ' (dead)
#define RS_PLUS KC_EQL // +
// Row 2
#define RS_LJE KC_Q // Љ
#define RS_NJE KC_W // Њ
#define RS_IE KC_E // Е
#define RS_ER KC_R // Р
#define RS_TE KC_T // Т
#define RS_ZE KC_Y // З
#define RS_U KC_U // У
#define RS_I KC_I // И
#define RS_O KC_O // О
#define RS_PE KC_P // П
#define RS_SHA KC_LBRC // Ш
#define RS_DJE KC_RBRC // Ђ
// Row 3
#define RS_A KC_A // А
#define RS_ES KC_S // С
#define RS_DE KC_D // Д
#define RS_EF KC_F // Ф
#define RS_GHE KC_G // Г
#define RS_HA KC_H // Х
#define RS_JE KC_J // Ј
#define RS_KA KC_K // К
#define RS_EL KC_L // Л
#define RS_CHE KC_SCLN // Ч
#define RS_TSHE KC_QUOT // Ћ
#define RS_ZHE KC_NUHS // Ж
// Row 4
#define RS_LABK KC_NUBS // <
#define RS_DZE KC_Z // Ѕ
#define RS_DZHE KC_X // Џ
#define RS_TSE KC_C // Ц
#define RS_VE KC_V // В
#define RS_BE KC_B // Б
#define RS_EN KC_N // Н
#define RS_EM KC_M // М
#define RS_COMM KC_COMM // ,
#define RS_DOT KC_DOT // .
#define RS_MINS KC_SLSH // -
/* Shifted symbols
*
*  ~  !  " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │       │
*
*                                               
*     
*                                               
*
*      >                       ;  :  _           
*
*                                                     
*
*/
// Row 1
#define RS_TILD S(RS_GRV) // ~
#define RS_EXLM S(RS_1) // !
#define RS_DQUO S(RS_2) // "
#define RS_HASH S(RS_3) // #
#define RS_DLR S(RS_4) // $
#define RS_PERC S(RS_5) // %
#define RS_AMPR S(RS_6) // &
#define RS_SLSH S(RS_7) // /
#define RS_LPRN S(RS_8) // (
#define RS_RPRN S(RS_9) // )
#define RS_EQL S(RS_0) // =
#define RS_DEG S(RS_QUOT) // ?
#define RS_UNDS S(RS_PLUS) // *
// Row 4
#define RS_RABK S(RS_LABK) // >
#define RS_SCLN S(RS_COMM) // ;
#define RS_COLN S(RS_DOT) // :
#define RS_UNDS S(RS_MINS) // _
/* AltGr symbols
*
*                                               
*
*                                              
*     
*                                               
*
*                                                
*
*                                                     
*
*/
// Row 2
#define RS_EURO ALGR(RS_IE) // €

View file

@ -0,0 +1,164 @@
/* Copyright 2020
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "keymap.h"
// clang-format off
/*
*
*    1  2  3  4  5  6  7  8  9  0  '  +        
*
*       Q  W  E  R  T  Z  U  I  O  P  Š  Đ      
*     
*        A  S  D  F  G  H  J  K  L  Č  Ć  Ž     
*
*      <  Y  X  C  V  B  N  M  ,  .  -           
*
*                                                     
*
*/
// Row 1
#define RS_SLQU KC_GRV // (dead)
#define RS_1 KC_1 // 1
#define RS_2 KC_2 // 2
#define RS_3 KC_3 // 3
#define RS_4 KC_4 // 4
#define RS_5 KC_5 // 5
#define RS_6 KC_6 // 6
#define RS_7 KC_7 // 7
#define RS_8 KC_8 // 8
#define RS_9 KC_9 // 9
#define RS_0 KC_0 // 0
#define RS_QUOT KC_MINS // '
#define RS_PLUS KC_EQL // +
// Row 2
#define RS_Q KC_Q // Q
#define RS_W KC_W // W
#define RS_E KC_E // E
#define RS_R KC_R // R
#define RS_T KC_T // T
#define RS_Z KC_Y // Z
#define RS_U KC_U // U
#define RS_I KC_I // I
#define RS_O KC_O // O
#define RS_P KC_P // P
#define RS_SCAR KC_LBRC // Š
#define RS_DSTR KC_RBRC // Đ
// Row 3
#define RS_A KC_A // A
#define RS_S KC_S // S
#define RS_D KC_D // D
#define RS_F KC_F // F
#define RS_G KC_G // G
#define RS_H KC_H // H
#define RS_J KC_J // J
#define RS_K KC_K // K
#define RS_L KC_L // L
#define RS_CCAR KC_SCLN // Č
#define RS_CACU KC_QUOT // Ć
#define RS_ZCAR KC_NUHS // Ž
// Row 4
#define RS_LABK KC_NUBS // <
#define RS_Y KC_Z // Y
#define RS_X KC_X // X
#define RS_C KC_C // C
#define RS_V KC_V // V
#define RS_B KC_B // B
#define RS_N KC_N // N
#define RS_M KC_M // M
#define RS_COMM KC_COMM // ,
#define RS_DOT KC_DOT // .
#define RS_MINS KC_SLSH // -
/* Shifted symbols
*
*  ~  !  " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │       │
*
*                                               
*     
*                                               
*
*      >                       ;  :  _           
*
*                                                     
*
*/
// Row 1
#define RS_TILD S(RS_SLQU) // ~
#define RS_EXLM S(RS_1) // !
#define RS_DQUO S(RS_2) // "
#define RS_HASH S(RS_3) // #
#define RS_DLR S(RS_4) // $
#define RS_PERC S(RS_5) // %
#define RS_AMPR S(RS_6) // &
#define RS_SLSH S(RS_7) // /
#define RS_LPRN S(RS_8) // (
#define RS_RPRN S(RS_9) // )
#define RS_EQL S(RS_0) // =
#define RS_DEG S(RS_QUOT) // ?
#define RS_UNDS S(RS_PLUS) // *
// Row 4
#define RS_RABK S(RS_LABK) // >
#define RS_SCLN S(RS_COMM) // ;
#define RS_COLN S(RS_DOT) // :
#define RS_UNDS S(RS_MINS) // _
/* AltGr symbols
*
*        ˇ  ^  ˘  °  ˛  `  ˙  ´  ˝  ¨  ¸        
*
*       \  |                         ÷  ×      
*     
*                 [  ]        ł  Ł     ß  ¤     
*
*                  @  {  }  §                    
*
*                                                     
*
*/
// Row 1
#define RS_CARN ALGR(RS_2) // ˇ (dead)
#define RS_CIRC ALGR(RS_3) // ^ (dead)
#define RS_BREV ALGR(RS_4) // ˘ (dead)
#define RS_RNGA ALGR(RS_5) // ° (dead)
#define RS_OGON ALGR(RS_6) // ˛ (dead)
#define RS_GRV ALGR(RS_7) // `
#define RS_DOTA ALGR(RS_8) // ˙ (dead)
#define RS_ACUT ALGR(RS_9) // ´ (dead)
#define RS_DACU ALGR(RS_0) // ˝ (dead)
#define RS_DIAE ALGR(RS_QUOT) // ¨ (dead)
#define RS_CEDL ALGR(RS_PLUS) // ¸ (dead)
// Row 2
#define RS_BSLS ALGR(RS_Q) // (backslash)
#define RS_PIPE ALGR(RS_W) // |
#define RS_EURO ALGR(RS_E) // €
#define RS_DIV ALGR(RS_SCAR) // ÷
#define RS_MUL ALGR(RS_DSTR) // ×
// Row 3
#define RS_LBRC ALGR(RS_F) // [
#define RS_RBRC ALGR(RS_G) // ]
#define RS_LLST ALGR(RS_K) // ł
#define RS_CLST ALGR(RS_L) // Ł
#define RS_SS ALGR(RS_CACU) // ß
#define RS_CURR ALGR(RS_ZCAR) // ¤
// Row 4
#define RS_AT ALGR(RS_V) // @
#define RS_LCBR ALGR(RS_B) // {
#define RS_RCBR ALGR(RS_N) // }
#define RS_SECT ALGR(RS_M) // §

View file

@ -0,0 +1,100 @@
/* Copyright 2020
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Sendstring lookup tables for Serbian (Latin) layouts
#pragma once
#include "keymap_serbian_latin.h"
#include "quantum.h"
// clang-format off
const uint8_t ascii_to_shift_lut[16] PROGMEM = {
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
KCLUT_ENTRY(0, 1, 1, 1, 1, 1, 1, 0),
KCLUT_ENTRY(1, 1, 1, 0, 0, 0, 0, 1),
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
KCLUT_ENTRY(0, 0, 1, 1, 0, 1, 1, 1),
KCLUT_ENTRY(0,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KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// CAN EM SUB ESC FS GS RS US
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ! " # $ % & '
KC_SPC, RS_1, RS_2, RS_3, RS_4, RS_5, RS_6, RS_QUOT,
// ( ) * + , - . /
RS_8, RS_9, RS_PLUS, RS_PLUS, RS_COMM, RS_MINS, RS_DOT, RS_7,
// 0 1 2 3 4 5 6 7
RS_0, RS_1, RS_2, RS_3, RS_4, RS_5, RS_6, RS_7,
// 8 9 : ; < = > ?
RS_8, RS_9, RS_DOT, RS_COMM, RS_LABK, RS_0, RS_LABK, RS_QUOT,
// @ A B C D E F G
RS_V, RS_A, RS_B, RS_C, RS_D, RS_E, RS_F, RS_G,
// H I J K L M N O
RS_H, RS_I, RS_J, RS_K, RS_L, RS_M, RS_N, RS_O,
// P Q R S T U V W
RS_P, RS_Q, RS_R, RS_S, RS_T, RS_U, RS_V, RS_W,
// X Y Z [ \ ] ^ _
RS_X, RS_Y, RS_Z, RS_F, RS_Q, RS_G, RS_3, RS_MINS,
// ` a b c d e f g
RS_7, RS_A, RS_B, RS_C, RS_D, RS_E, RS_F, RS_G,
// h i j k l m n o
RS_H, RS_I, RS_J, RS_K, RS_L, RS_M, RS_N, RS_O,
// p q r s t u v w
RS_P, RS_Q, RS_R, RS_S, RS_T, RS_U, RS_V, RS_W,
// x y z { | } ~ DEL
RS_X, RS_Y, RS_Z, RS_B, RS_W, RS_N, RS_1, KC_DEL
};