aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorGravatar Ryan <fauxpark@gmail.com>2020-03-17 01:30:17 +1100
committerGravatar GitHub <noreply@github.com>2020-03-16 14:30:17 +0000
commit910c466cfefebdd491c200cdd07cbf1a12ebd51d (patch)
treeccb8680543b0acbf6a35364c40e18933b253d0b8 /quantum
parent19dbcf38149a2ba9a51935aae36c276a6dbd4b01 (diff)
downloadqmk_firmware-910c466cfefebdd491c200cdd07cbf1a12ebd51d.tar.gz
Update Brazilian keymap and add sendstring LUT (#8435)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_extras/keymap_br_abnt2.h206
-rw-r--r--quantum/keymap_extras/sendstring_br_abnt2.h80
2 files changed, 236 insertions, 50 deletions
diff --git a/quantum/keymap_extras/keymap_br_abnt2.h b/quantum/keymap_extras/keymap_br_abnt2.h
index eecd6f2b0..9d83fdf4e 100644
--- a/quantum/keymap_extras/keymap_br_abnt2.h
+++ b/quantum/keymap_extras/keymap_br_abnt2.h
@@ -14,61 +14,167 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef KEYMAP_BR_ABNT2_H
-#define KEYMAP_BR_ABNT2_H
+#pragma once
#include "keymap.h"
-/* Scan codes for the Brazilian ABNT2 keyboard layout */
+// clang-format off
-#define BR_CCDL KC_SCLN // Ç same scancode as ;: on US layout
-#define BR_SCLN KC_SLSH // ;: same scancode as /? on US layout
-#define BR_QUOT KC_GRV // '" same scancode as `~ on US layout
-#define BR_TILD KC_QUOT // ~^ dead keys, same scancode as '" on US layout
-#define BR_ACUT KC_LBRC // ´` dead keys, same scancode as [{ on US layout
-#define BR_LBRC KC_RBRC // [{ same scancode as ]} on US layout
-#define BR_RBRC KC_BSLS // ]} same scancode as \| on US layout
-#define BR_BSLS KC_NUBS // \| uses the non-US hash scancode (#~, sometimes §±)
-#define BR_SLSH KC_INT1 // /? uses the INTL1 scancode
-
-#define BR_COLN LSFT(BR_SCLN) // shifted :
-#define BR_DQT LSFT(BR_QUOT) // shifted "
-#define BR_CIRC LSFT(BR_TILD) // shifted ^ (dead key)
-#define BR_GRAV LSFT(BR_ACUT) // shifted ` (dead key)
-#define BR_LCBR LSFT(BR_LBRC) // shifted {
-#define BR_RCBR LSFT(BR_RBRC) // shifted }
-#define BR_PIPE LSFT(BR_BSLS) // shifted |
-#define BR_QUES LSFT(BR_SLSH) // shifted ?
-#define BR_TRMA LSFT(KC_6) // shifted ¨ (dead key - trema accent)
-
-// On the ABNT2 the keypad comma and the keypad dot scancodes are switched
-// (presumably because in Brazil comma is used as the decimal separator)
-#define BR_KPDT KC_KP_COMMA // keypad .
-#define BR_KPCM KC_KP_DOT // keypad ,
+/*
+ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
+ * │ ' │ 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 BR_QUOT KC_GRV // '
+#define BR_1 KC_1 // 1
+#define BR_2 KC_2 // 2
+#define BR_3 KC_3 // 3
+#define BR_4 KC_4 // 4
+#define BR_5 KC_5 // 5
+#define BR_6 KC_6 // 6
+#define BR_7 KC_7 // 7
+#define BR_8 KC_8 // 8
+#define BR_9 KC_9 // 9
+#define BR_0 KC_0 // 0
+#define BR_MINS KC_MINS // -
+#define BR_EQL KC_EQL // =
+// Row 2
+#define BR_Q KC_Q // Q
+#define BR_W KC_W // W
+#define BR_E KC_E // E
+#define BR_R KC_R // R
+#define BR_T KC_T // T
+#define BR_Y KC_Y // Y
+#define BR_U KC_U // U
+#define BR_I KC_I // I
+#define BR_O KC_O // O
+#define BR_P KC_P // P
+#define BR_ACUT KC_LBRC // ´ (dead)
+#define BR_LBRC KC_RBRC // [
+// Row 3
+#define BR_A KC_A // A
+#define BR_S KC_S // S
+#define BR_D KC_D // D
+#define BR_F KC_F // F
+#define BR_G KC_G // G
+#define BR_H KC_H // H
+#define BR_J KC_J // J
+#define BR_K KC_K // K
+#define BR_L KC_L // L
+#define BR_CCED KC_SCLN // Ç
+#define BR_TILD KC_QUOT // ~ (dead)
+#define BR_RBRC KC_BSLS // ]
+// Row 4
+#define BR_BSLS KC_NUBS // (backslash)
+#define BR_Z KC_Z // Z
+#define BR_X KC_X // X
+#define BR_C KC_C // C
+#define BR_V KC_V // V
+#define BR_B KC_B // B
+#define BR_N KC_N // N
+#define BR_M KC_M // M
+#define BR_COMM KC_COMM // ,
+#define BR_DOT KC_DOT // .
+#define BR_SCLN KC_SLSH // ;
+#define BR_SLSH KC_INT1 // /
+// Numpad
+#define BR_PDOT KC_PCMM // .
+#define BR_PCMM KC_PDOT // ,
-#define BR_1UP LALT(KC_1) // 1 superscript ¹ alt+1
-#define BR_2UP LALT(KC_2) // 2 superscript ² alt+2
-#define BR_3UP LALT(KC_3) // 3 superscript ³ alt+3
-#define BR_PND LALT(KC_4) // Pound sign £ alt+4
-#define BR_CENT LALT(KC_5) // Cent sign ¢ alt+5
-#define BR_NOT LALT(KC_6) // Not sign ¬ alt+6
-#define BR_SECT LALT(KC_EQL) // Section sign § alt+=
-#define BR_FORD LALT(BR_LBRC) // Feminine Ordinal Sign ª alt+[
-#define BR_MORD LALT(BR_RBRC) // Masculine Ordinal Sign º alt+]
-#define BR_DGRE LALT(BR_SLSH) // Degree sign ° alt+/
+/* Shifted symbols
+ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
+ * │ " │ ! │ @ │ # │ $ │ % │ ¨ │ & │ * │ ( │ ) │ _ │ + │       │
+ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
+ * │     │   │   │   │   │   │   │   │   │   │   │ ` │ { │     │
+ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐    │
+ * │      │   │   │   │   │   │   │   │   │   │   │ ^ │ } │    │
+ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤
+ * │    │ | │   │   │   │   │   │   │   │ < │ > │ : │ ? │      │
+ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬──┴─┬────┤
+ * │    │    │    │                        │    │    │    │    │
+ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘
+ */
+// Row 1
+#define BR_DQUO S(BR_QUOT) // "
+#define BR_EXLM S(BR_1) // !
+#define BR_AT S(BR_2) // @
+#define BR_HASH S(BR_3) // #
+#define BR_DLR S(BR_4) // $
+#define BR_PERC S(BR_5) // %
+#define BR_DIAE S(BR_6) // ¨ (dead)
+#define BR_AMPR S(BR_7) // &
+#define BR_ASTR S(BR_8) // *
+#define BR_LPRN S(BR_9) // (
+#define BR_RPRN S(BR_0) // )
+#define BR_UNDS S(BR_MINS) // _
+#define BR_PLUS S(BR_EQL) // +
+// Row 2
+#define BR_GRV S(BR_ACUT) // ` (dead)
+#define BR_LCBR S(BR_LBRC) // {
+// Row 3
+#define BR_CIRC S(BR_TILD) // ^ (dead)
+#define BR_RCBR S(BR_RBRC) // }
+// Row 4
+#define BR_PIPE S(BR_BSLS) // |
+#define BR_LABK S(BR_COMM) // <
+#define BR_RABK S(BR_DOT) // >
+#define BR_COLN S(BR_SCLN) // :
+#define BR_QUES S(BR_SLSH) // ?
-#define BR_EURO LALT(KC_E) // Euro sign € alt+e
-#define BR_NDTD LALT(BR_TILD) // Non-dead key tilde ~ alt+~
-#define BR_NDAC LALT(BR_ACUT) // Non-dead key acute accent ´ alt+´
-#define BR_NDGV LALT(BR_QUOT) // Non-dead key grave accent ` alt+'
-#define BR_NDCR LALT(BR_CIRC) // Non-dead key circumflex accent ^ alt+^ (alt+shift+~)
-#define BR_NDTR LALT(BR_TRMA) // Non-dead key trema accent ¨ alt+¨ (alt+shift+6)
+/* AltGr symbols
+ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
+ * │   │ ¹ │ ² │ ³ │ £ │ ¢ │ ¬ │   │   │   │   │   │ § │       │
+ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
+ * │     │   │   │ ° │   │   │   │   │   │   │   │   │ ª │     │
+ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐    │
+ * │      │   │   │   │   │   │   │   │   │   │   │   │ º │    │
+ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤
+ * │    │   │   │   │ ₢ │   │   │   │   │   │   │   │   │      │
+ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬──┴─┬────┤
+ * │    │    │    │                        │    │    │    │    │
+ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘
+ */
+// Row 1
+#define BR_SUP1 ALGR(BR_1) // ¹
+#define BR_SUP2 ALGR(BR_2) // ²
+#define BR_SUP3 ALGR(BR_3) // ³
+#define BR_PND ALGR(BR_4) // £
+#define BR_CENT ALGR(BR_5) // ¢
+#define BR_NOT ALGR(BR_6) // ¬
+#define BR_SECT ALGR(BR_EQL) // §
+// Row 2
+#define BR_DEG ALGR(BR_E) // °
+#define BR_FORD ALGR(BR_LBRC) // ª
+// Row 3
+#define BR_MORD ALGR(BR_RBRC) // º
+// Row 4
+#define BR_CRUZ ALGR(BR_C) // ₢
-// For 101-key keyboard layouts, the ABNT2 layout allows
-// the slash and question mark to be typed using alt+q and alt+w.
-// The shortcuts are provided here for completeness' sake,
-// but it's recommended to use BR_SLSH and BR_QUES instead
-#define BR_ASLS LALT(KC_Q)
-#define BR_AQST LALT(KC_W)
+// DEPRECATED
+#define BR_CCDL BR_CCED
+#define BR_DQT BR_DQUO
+#define BR_TRMA BR_DIAE
+#define BR_GRAV BR_GRV
+#define BR_KPDT BR_PDOT
+#define BR_KPCM BR_PCMM
+#define BR_1UP BR_SUP1
+#define BR_2UP BR_SUP2
+#define BR_3UP BR_SUP3
+#define BR_ASLS BR_SLSH
+#define BR_AQST BR_QUES
-#endif
+// Not present on Windows 10?
+#define BR_NDTD ALGR(BR_TILD) // ~
+#define BR_NDAC ALGR(BR_ACUT) // ´
+#define BR_NDGV ALGR(BR_QUOT) // `
+#define BR_NDCR ALGR(BR_CIRC) // ^
+#define BR_NDTR ALGR(BR_DIAE) // ¨
diff --git a/quantum/keymap_extras/sendstring_br_abnt2.h b/quantum/keymap_extras/sendstring_br_abnt2.h
new file mode 100644
index 000000000..f2946e54b
--- /dev/null
+++ b/quantum/keymap_extras/sendstring_br_abnt2.h
@@ -0,0 +1,80 @@
+/* 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 Brazilian (ABNT2) layouts
+
+#pragma once
+
+#include "keymap_br_abnt2.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, 1, 0, 0, 0, 0),
+ KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
+ KCLUT_ENTRY(0, 0, 1, 0, 1, 0, 1, 1),
+ KCLUT_ENTRY(1, 1, 1, 1, 1, 1, 1, 1),
+ KCLUT_ENTRY(1, 1, 1, 1, 1, 1, 1, 1),
+ KCLUT_ENTRY(1, 1, 1, 1, 1, 1, 1, 1),
+ KCLUT_ENTRY(1, 1, 1, 0, 0, 0, 1, 1),
+ KCLUT_ENTRY(1, 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, 1, 1, 1, 0, 0)
+};
+
+const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
+ // 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, BR_1, BR_QUOT, BR_3, BR_4, BR_5, BR_7, BR_QUOT,
+ // ( ) * + , - . /
+ BR_9, BR_0, BR_8, BR_EQL, BR_COMM, BR_MINS, BR_DOT, BR_SLSH,
+ // 0 1 2 3 4 5 6 7
+ BR_0, BR_1, BR_2, BR_3, BR_4, BR_5, BR_6, BR_7,
+ // 8 9 : ; < = > ?
+ BR_8, BR_9, BR_SCLN, BR_SCLN, BR_COMM, BR_EQL, BR_DOT, BR_SLSH,
+ // @ A B C D E F G
+ BR_2, BR_A, BR_B, BR_C, BR_D, BR_E, BR_F, BR_G,
+ // H I J K L M N O
+ BR_H, BR_I, BR_J, BR_K, BR_L, BR_M, BR_N, BR_O,
+ // P Q R S T U V W
+ BR_P, BR_Q, BR_R, BR_S, BR_T, BR_U, BR_V, BR_W,
+ // X Y Z [ \ ] ^ _
+ BR_X, BR_Y, BR_Z, BR_LBRC, BR_BSLS, BR_RBRC, BR_TILD, BR_MINS,
+ // ` a b c d e f g
+ BR_ACUT, BR_A, BR_B, BR_C, BR_D, BR_E, BR_F, BR_G,
+ // h i j k l m n o
+ BR_H, BR_I, BR_J, BR_K, BR_L, BR_M, BR_N, BR_O,
+ // p q r s t u v w
+ BR_P, BR_Q, BR_R, BR_S, BR_T, BR_U, BR_V, BR_W,
+ // x y z { | } ~ DEL
+ BR_X, BR_Y, BR_Z, BR_LBRC, BR_BSLS, BR_RBRC, BR_TILD, KC_DEL
+};