Update Swedish keymap and add sendstring LUT (#8365)

This commit is contained in:
Ryan 2020-03-13 11:09:30 +11:00 committed by GitHub
parent 6734a39811
commit 2b63896466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 253 additions and 62 deletions

View File

@ -14,74 +14,165 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEYMAP_SWEDISH_H
#define KEYMAP_SWEDISH_H
#pragma once
#include "keymap.h"
// Normal characters
#define SE_HALF KC_GRV
#define SE_PLUS KC_MINS
#define SE_ACUT KC_EQL
// clang-format off
#define SE_AM KC_LBRC
#define SE_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout
#define SE_AE KC_QUOT // ä
#define SE_OSLH KC_SCLN // ö
#define SE_APOS KC_NUHS
/*
*
*  §  1  2  3  4  5  6  7  8  9  0  +  ´        
*
*       Q  W  E  R  T  Y  U  I  O  P  Å  ¨      
*     
*        A  S  D  F  G  H  J  K  L  Ö  Ä  '     
*
*      <  Z  X  C  V  B  N  M  ,  .  -           
*
*                                                     
*
*/
// Row 1
#define SE_SECT KC_GRV // §
#define SE_1 KC_1 // 1
#define SE_2 KC_2 // 2
#define SE_3 KC_3 // 3
#define SE_4 KC_4 // 4
#define SE_5 KC_5 // 5
#define SE_6 KC_6 // 6
#define SE_7 KC_7 // 7
#define SE_8 KC_8 // 8
#define SE_9 KC_9 // 9
#define SE_0 KC_0 // 0
#define SE_PLUS KC_MINS // +
#define SE_ACUT KC_EQL // ´ (dead)
// Row 2
#define SE_Q KC_Q // Q
#define SE_W KC_W // W
#define SE_E KC_E // E
#define SE_R KC_R // R
#define SE_T KC_T // T
#define SE_Y KC_Y // Y
#define SE_U KC_U // U
#define SE_I KC_I // I
#define SE_O KC_O // O
#define SE_P KC_P // P
#define SE_ARNG KC_LBRC // Å
#define SE_DIAE KC_RBRC // ¨ (dead)
// Row 3
#define SE_A KC_A // A
#define SE_S KC_S // S
#define SE_D KC_D // D
#define SE_F KC_F // F
#define SE_G KC_G // G
#define SE_H KC_H // H
#define SE_J KC_J // J
#define SE_K KC_K // K
#define SE_L KC_L // L
#define SE_ODIA KC_SCLN // Ö
#define SE_ADIA KC_QUOT // Ä
#define SE_QUOT KC_NUHS // '
// Row 4
#define SE_LABK KC_NUBS // <
#define SE_Z KC_Z // Z
#define SE_X KC_X // X
#define SE_C KC_C // C
#define SE_V KC_V // V
#define SE_B KC_B // B
#define SE_N KC_N // N
#define SE_M KC_M // M
#define SE_COMM KC_COMM // ,
#define SE_DOT KC_DOT // .
#define SE_MINS KC_SLSH // -
#define SE_LESS KC_NUBS
#define SE_MINS KC_SLSH
/* Shifted symbols
*
*  ½  !  " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │       │
*
*                                        ^      
*     
*                                         *     
*
*      >                       ;  :  _           
*
*                                                     
*
*/
// Row 1
#define SE_HALF S(SE_SECT) // ½
#define SE_EXLM S(SE_1) // !
#define SE_DQUO S(SE_2) // "
#define SE_HASH S(SE_3) // #
#define SE_CURR S(SE_4) // ¤
#define SE_PERC S(SE_5) // %
#define SE_AMPR S(SE_6) // &
#define SE_SLSH S(SE_7) // /
#define SE_LPRN S(SE_8) // (
#define SE_RPRN S(SE_9) // )
#define SE_EQL S(SE_0) // =
#define SE_QUES S(SE_PLUS) // ?
#define SE_GRV S(SE_ACUT) // ` (dead)
// Row 2
#define SE_CIRC S(SE_DIAE) // ^ (dead)
// Row 3
#define SE_ASTR S(SE_QUOT) // *
// Row 4
#define SE_RABK S(SE_LABK) // >
#define SE_SCLN S(SE_COMM) // ;
#define SE_COLN S(SE_DOT) // :
#define SE_UNDS S(SE_MINS) // _
// Shifted characters
#define SE_SECT LSFT(SE_HALF)
#define SE_QUO2 LSFT(KC_2)
#define SE_BULT LSFT(KC_4)
#define SE_AMPR LSFT(KC_6)
#define SE_SLSH LSFT(KC_7)
#define SE_LPRN LSFT(KC_8)
#define SE_RPRN LSFT(KC_9)
#define SE_EQL LSFT(KC_0)
#define SE_QUES LSFT(SE_PLUS)
#define SE_GRV LSFT(SE_ACUT)
/* AltGr symbols
*
*        @  £  $       {  [  ]  }  \           
*
*                                        ~      
*     
*                                               
*
*      |                    µ                    
*
*                                                     
*
*/
// Row 1
#define SE_AT ALGR(SE_2) // @
#define SE_PND ALGR(SE_3) // £
#define SE_DLR ALGR(SE_4) // $
#define SE_EURO ALGR(SE_5) // €
#define SE_LCBR ALGR(SE_7) // {
#define SE_LBRC ALGR(SE_8) // [
#define SE_RBRC ALGR(SE_9) // ]
#define SE_RCBR ALGR(SE_0) // }
#define SE_BSLS ALGR(SE_PLUS) // (backslash)
// Row 2
#define SE_TILD ALGR(SE_DIAE) // ~ (dead)
// Row 4
#define SE_PIPE ALGR(SE_LABK) // |
#define SE_MICR ALGR(SE_M) // µ
#define SE_CIRC LSFT(KC_RBRC) // ^
// DEPRECATED
#include "keymap_nordic.h"
#define SE_GRTR LSFT(SE_LESS)
#define SE_SCLN LSFT(KC_COMM)
#define SE_COLN LSFT(KC_DOT)
#define SE_UNDS LSFT(SE_MINS)
#undef NO_AE
#undef NO_CIRC
#undef NO_OSLH
// Alt Gr-ed characters
#define SE_AT ALGR(KC_2)
#define SE_PND ALGR(KC_3)
#define SE_DLR ALGR(KC_4)
#define SE_LCBR ALGR(KC_7)
#define SE_LBRC ALGR(KC_8)
#define SE_RBRC ALGR(KC_9)
#define SE_RCBR ALGR(KC_0)
#define SE_PIPE ALGR(KC_NUBS)
#define SE_EURO ALGR(KC_E)
#define SE_TILD ALGR(SE_QUOT)
#define SE_BSLS ALGR(KC_MINS)
#define SE_MU ALGR(KC_M)
#define SE_AA KC_LBRC // å
#define SE_ASTR LSFT(KC_BSLS) // *
// Norwegian unique MAC characters (not vetted for Swedish)
#define SE_ACUT_MAC KC_EQL // =
#define SE_APOS_MAC KC_NUBS // '
#define SE_AT_MAC KC_BSLS // @
#define SE_BSLS_MAC ALGR(LSFT(KC_7)) // '\'
#define SE_DLR_MAC ALGR(KC_4) // $
#define SE_GRV_MAC ALGR(SE_BSLS) // `
#define SE_GRTR_MAC LSFT(KC_GRV) // >
#define SE_LCBR_MAC ALGR(LSFT(KC_8)) // {
#define SE_LESS_MAC KC_GRV // <
#define SE_PIPE_MAC ALGR(KC_7) // |
#define SE_RCBR_MAC ALGR(LSFT(KC_9)) // }
#endif
#define NO_AE SE_AE
#define NO_CIRC SE_CIRC
#define NO_OSLH SE_ODIA
#define NO_AA SE_ARNG
#define NO_ASTR SE_ASTR
// Swedish macOS symbols (not vetted)
#define NO_ACUT_MAC SE_ACUT
#define NO_APOS_MAC SE_LABK
#define NO_AT_MAC SE_ADIA
#define NO_BSLS_MAC S(SE_LCBR)
#define NO_DLR_MAC SE_CURR
#define NO_GRV_MAC SE_BSLS
#define NO_GRTR_MAC SE_HALF
#define NO_LCBR_MAC S(SE_LBRC)
#define NO_LESS_MAC SE_SECT
#define NO_PIPE_MAC SE_LCBR
#define NO_RCBR_MAC S(SE_RBRC)

View File

@ -0,0 +1,100 @@
/* Copyright 2019
*
* 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 Swedish layouts
#pragma once
#include "keymap_swedish.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, 0, 1, 1, 0),
KCLUT_EN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M = {
// NUL SOH STX ETX EOT ENQ ACK BEL
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// BS TAB LF VT FF CR SO SI
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, SE_1, SE_2, SE_3, SE_4, SE_5, SE_6, SE_QUOT,
// ( ) * + , - . /
SE_8, SE_9, SE_QUOT, SE_PLUS, SE_COMM, SE_MINS, SE_DOT, SE_7,
// 0 1 2 3 4 5 6 7
SE_0, SE_1, SE_2, SE_3, SE_4, SE_5, SE_6, SE_7,
// 8 9 : ; < = > ?
SE_8, SE_9, SE_DOT, SE_COMM, SE_LABK, SE_0, SE_LABK, SE_PLUS,
// @ A B C D E F G
SE_2, SE_A, SE_B, SE_C, SE_D, SE_E, SE_F, SE_G,
// H I J K L M N O
SE_H, SE_I, SE_J, SE_K, SE_L, SE_M, SE_N, SE_O,
// P Q R S T U V W
SE_P, SE_Q, SE_R, SE_S, SE_T, SE_U, SE_V, SE_W,
// X Y Z [ \ ] ^ _
SE_X, SE_Y, SE_Z, SE_8, SE_PLUS, SE_9, SE_DIAE, SE_MINS,
// ` a b c d e f g
SE_ACUT, SE_A, SE_B, SE_C, SE_D, SE_E, SE_F, SE_G,
// h i j k l m n o
SE_H, SE_I, SE_J, SE_K, SE_L, SE_M, SE_N, SE_O,
// p q r s t u v w
SE_P, SE_Q, SE_R, SE_S, SE_T, SE_U, SE_V, SE_W,
// x y z { | } ~ DEL
SE_X, SE_Y, SE_Z, SE_7, SE_LABK, SE_0, SE_DIAE, KC_DEL
};