From ca8df55858953476f2681dc1de432f66c8765356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cruz?= Date: Wed, 30 Dec 2020 03:40:58 +0000 Subject: [PATCH] Added mac variant of portuguese keymap extras (#11260) * Added mac variant of portuguese keymap This keymap is very similar to the existing portuguese keymap, but some symbols are moved around. Apply suggestions from code review Corrected whitespace and implemented some suggested changes. Co-authored-by: Ryan Converted some spaces to nbsp Added sendstring ISO version * Apply suggestions from code review Added suggestions from code review Co-authored-by: Ryan * Replaced space with nbsp * Corrected 2 chars in ascii_to_shift_lut { and } require shift Co-authored-by: Ryan --- docs/ja/reference_keymap_extras.md | 1 + docs/reference_keymap_extras.md | 1 + .../keymap_extras/keymap_portuguese_osx_iso.h | 234 ++++++++++++++++++ .../sendstring_portuguese_osx_iso.h | 100 ++++++++ 4 files changed, 336 insertions(+) create mode 100644 quantum/keymap_extras/keymap_portuguese_osx_iso.h create mode 100644 quantum/keymap_extras/sendstring_portuguese_osx_iso.h diff --git a/docs/ja/reference_keymap_extras.md b/docs/ja/reference_keymap_extras.md index e8104e5f3..fb9d167ae 100644 --- a/docs/ja/reference_keymap_extras.md +++ b/docs/ja/reference_keymap_extras.md @@ -51,6 +51,7 @@ HID Keyboard/Keypad usage ページでは 256 未満の usage が定義されて | Norwegian | `keymap_norwegian.h` | | Polish | `keymap_polish.h` | | Portuguese | `keymap_portuguese.h` | +| Portuguese (macOS, ISO) | `keymap_portuguese_osx_iso.h` | | Portuguese (Brazil) | `keymap_br_abnt2.h` | | Romanian | `keymap_romanian.h` | | Russian* | `keymap_russian.h` | diff --git a/docs/reference_keymap_extras.md b/docs/reference_keymap_extras.md index 7e3d9bf27..f2abb4e59 100644 --- a/docs/reference_keymap_extras.md +++ b/docs/reference_keymap_extras.md @@ -46,6 +46,7 @@ To use these, simply `#include` the corresponding [header file](https://github.c |Norwegian |`keymap_norwegian.h` | |Polish |`keymap_polish.h` | |Portuguese |`keymap_portuguese.h` | +|Portuguese (macOS, ISO) |`keymap_portuguese_osx_iso.h` | |Portuguese (Brazil) |`keymap_br_abnt2.h` | |Romanian |`keymap_romanian.h` | |Russian* |`keymap_russian.h` | diff --git a/quantum/keymap_extras/keymap_portuguese_osx_iso.h b/quantum/keymap_extras/keymap_portuguese_osx_iso.h new file mode 100644 index 000000000..b2e52063a --- /dev/null +++ b/quantum/keymap_extras/keymap_portuguese_osx_iso.h @@ -0,0 +1,234 @@ +/* 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 . + */ + +#pragma once + +#include "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ § │ 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 PT_SECT KC_GRV // § +#define PT_1 KC_1 // 1 +#define PT_2 KC_2 // 2 +#define PT_3 KC_3 // 3 +#define PT_4 KC_4 // 4 +#define PT_5 KC_5 // 5 +#define PT_6 KC_6 // 6 +#define PT_7 KC_7 // 7 +#define PT_8 KC_8 // 8 +#define PT_9 KC_9 // 9 +#define PT_0 KC_0 // 0 +#define PT_QUOT KC_MINS // ' +#define PT_PLUS KC_EQL // + +// Row 2 +#define PT_Q KC_Q // Q +#define PT_W KC_W // W +#define PT_E KC_E // E +#define PT_R KC_R // R +#define PT_T KC_T // T +#define PT_Y KC_Y // Y +#define PT_U KC_U // U +#define PT_I KC_I // I +#define PT_O KC_O // O +#define PT_P KC_P // P +#define PT_MORD KC_LBRC // º +#define PT_ACUT KC_RBRC // ´ (dead) +// Row 3 +#define PT_A KC_A // A +#define PT_S KC_S // S +#define PT_D KC_D // D +#define PT_F KC_F // F +#define PT_G KC_G // G +#define PT_H KC_H // H +#define PT_J KC_J // J +#define PT_K KC_K // K +#define PT_L KC_L // L +#define PT_CCED KC_SCLN // Ç +#define PT_TILD KC_QUOT // ~ (dead) +#define PT_BSLS KC_NUHS // (backslash) +// Row 4 +#define PT_LABK KC_NUBS // < +#define PT_Z KC_Z // Z +#define PT_X KC_X // X +#define PT_C KC_C // C +#define PT_V KC_V // V +#define PT_B KC_B // B +#define PT_N KC_N // N +#define PT_M KC_M // M +#define PT_COMM KC_COMM // , +#define PT_DOT KC_DOT // . +#define PT_MINS KC_SLSH // - + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ± │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │     │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │     │   │   │   │   │   │   │   │   │   │   │ ª │ ` │   │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐  │ + * │      │   │   │   │   │   │   │   │   │   │   │ ^ │ | │  │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │    │ > │   │   │   │   │   │   │   │ ; │ : │ _ │        │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │     │    │     │                       │     │    │     │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define PT_PLMN S(PT_SECT) // ± +#define PT_EXLM S(PT_1) // ! +#define PT_DQUO S(PT_2) // " +#define PT_HASH S(PT_3) // # +#define PT_DLR S(PT_4) // $ +#define PT_PERC S(PT_5) // % +#define PT_AMPR S(PT_6) // & +#define PT_SLSH S(PT_7) // / +#define PT_LPRN S(PT_8) // ( +#define PT_RPRN S(PT_9) // ) +#define PT_EQL S(PT_0) // = +#define PT_QUES S(PT_QUOT) // ? +#define PT_ASTR S(PT_PLUS) // * +// Row 2 +#define PT_FORD S(PT_MORD) // ª +#define PT_GRV S(PT_ACUT) // ` (dead) +// Row 3 +#define PT_CIRC S(PT_TILD) // ^ (dead) +#define PT_PIPE S(PT_BSLS) // | +// Row 4 +#define PT_RABK S(PT_LABK) // > +#define PT_SCLN S(PT_COMM) // ; +#define PT_COLN S(PT_DOT) // : +#define PT_UNDS S(PT_MINS) // _ + +/* Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │   │  │ @ │ € │ £ │ ‰ │ ¶ │ ÷ │ [ │ ] │ ≠ │   │   │     │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │     │ Œ │ ∑ │ Æ │ ® │ ™ │ ¥ │ † │ ı │ Ø │ π │ ° │ ¨ │   │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐  │ + * │      │ Å │ ß │ ∂ │ ƒ │ ˙ │ ˇ │ ¯ │ „ │ ‘ │ ¸ │ ˜ │ ‹ │  │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │    │ ≤ │ Ω │ « │ © │ √ │ ∫ │ ¬ │ µ │ “ │ … │ — │        │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │     │    │     │                       │     │    │     │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define PT_APPL A(PT_1) //  (Apple logo) +#define PT_AT A(PT_2) // @ +#define PT_EURO A(PT_3) // € +#define PT_PND A(PT_4) // £ +#define PT_PERM A(PT_5) // ‰ +#define PT_PILC A(PT_6) // ¶ +#define PT_DIV A(PT_7) // ÷ +#define PT_LBRC A(PT_8) // [ +#define PT_RBRC A(PT_9) // ] +#define PT_NEQL A(PT_0) // ≠ +// Row 2 +#define PT_OE A(PT_Q) // Œ +#define PT_NARS A(PT_W) // ∑ +#define PT_AE A(PT_E) // Æ +#define PT_REGD A(PT_R) // ® +#define PT_TM A(PT_T) // ™ +#define PT_YEN A(PT_Y) // ¥ +#define PT_DAGG A(PT_U) // † +#define PT_DLSI A(PT_I) // ı +#define PT_OSTR A(PT_O) // Ø +#define PT_PI A(PT_P) // π +#define PT_DEG A(PT_MORD) // ° +#define PT_DIAE A(PT_ACUT) // ¨ (dead) +// Row 3 +#define PT_ARNG A(PT_A) // å +#define PT_SS A(PT_S) // ß +#define PT_PDIF A(PT_D) // ∂ +#define PT_FHK A(PT_F) // ƒ +#define PT_DOTA A(PT_G) // ˙ +#define PT_CARN A(PT_H) // ˇ +#define PT_MACR A(PT_J) // ¯ +#define PT_DLQU A(PT_K) // „ +#define PT_LSQU A(PT_L) // ‘ +#define PT_CEDL A(PT_CCED) // ¸ +#define PT_STIL A(PT_TILD) // ˜ (dead) +#define PT_LSAQ A(PT_BSLS) // ‹ +// Row 4 +#define PT_LTEQ A(PT_LABK) // ≤ +#define PT_OMEG A(PT_Z) // Ω +#define PT_LDAQ A(PT_X) // « +#define PT_COPY A(PT_C) // © +#define PT_SQRT A(PT_V) // √ +#define PT_INTG A(PT_B) // ∫ +#define PT_NOT A(PT_N) // ¬ +#define PT_MICR A(PT_M) // µ +#define PT_LDQU A(PT_COMM) // “ +#define PT_ELLP A(PT_DOT) // … +#define PT_MDSH A(PT_MINS) // — + +/* Shift+Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │   │ ¡ │ fi │ fl │ ¢ │ ∞ │ • │ ⁄ │ { │ } │ ≈ │ ¿ │ ◊ │     │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │     │   │   │   │   │   │   │ ‡ │ ˚ │   │ ∏ │   │ ˝ │   │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐  │ + * │      │   │   │ ∆ │   │   │   │   │ ‚ │ ’ │ ˛ │ ˆ │ › │  │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │    │ ≥ │   │ » │   │   │   │   │   │ ” │ · │ – │        │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │     │    │     │                       │     │    │     │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define PT_IEXL S(A(PT_1)) // ¡ +#define PT_FI S(A(PT_2)) // fi +#define PT_FL S(A(PT_3)) // fl +#define PT_CENT S(A(PT_4)) // ¢ +#define PT_INFN S(A(PT_5)) // ∞ +#define PT_BULT S(A(PT_6)) // • +#define PT_FRSL S(A(PT_7)) // ⁄ +#define PT_LCBR S(A(PT_8)) // { +#define PT_RCBR S(A(PT_9)) // } +#define PT_AEQL S(A(PT_0)) // ≈ +#define PT_IQUE S(A(PT_QUOT)) // ¿ +#define PT_LOZN S(A(PT_PLUS)) // ◊ +// Row 2 +#define PT_DDAG S(A(PT_U)) // ‡ +#define PT_RNGA S(A(PT_I)) // ˚ +#define PT_NARP S(A(PT_P)) // ∏ +#define PT_DACU S(A(PT_ACUT)) // ˝ +// Row 3 +#define PT_INCR S(A(PT_D)) // ∆ +#define PT_SLQU S(A(PT_K)) // ‚ +#define PT_RSQU S(A(PT_L)) // ’ +#define PT_OGON S(A(PT_CCED)) // ˛ +#define PT_DCIR S(A(PT_TILD)) // ˆ (dead) +#define PT_RSAQ S(A(PT_BSLS)) // › +// Row 4 +#define PT_GTEQ S(A(PT_LABK)) // ≥ +#define PT_RDAQ S(A(PT_X)) // » +#define PT_RDQU S(A(PT_COMM)) // ” +#define PT_MDDT S(A(PT_DOT)) // · +#define PT_NDSH S(A(PT_MINS)) // – diff --git a/quantum/keymap_extras/sendstring_portuguese_osx_iso.h b/quantum/keymap_extras/sendstring_portuguese_osx_iso.h new file mode 100644 index 000000000..1799347f3 --- /dev/null +++ b/quantum/keymap_extras/sendstring_portuguese_osx_iso.h @@ -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 . + */ + +// Sendstring lookup tables for Portuguese layouts + +#pragma once + +#include "keymap_portuguese_osx_iso.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, 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_altgr_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, 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(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, 0, 1, 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, 0, 0, 1, 0, 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, PT_1, PT_2, PT_3, PT_4, PT_5, PT_6, PT_QUOT, + // ( ) * + , - . / + PT_8, PT_9, PT_PLUS, PT_PLUS, PT_COMM, PT_MINS, PT_DOT, PT_7, + // 0 1 2 3 4 5 6 7 + PT_0, PT_1, PT_2, PT_3, PT_4, PT_5, PT_6, PT_7, + // 8 9 : ; < = > ? + PT_8, PT_9, PT_DOT, PT_COMM, PT_LABK, PT_0, PT_LABK, PT_QUOT, + // @ A B C D E F G + PT_2, PT_A, PT_B, PT_C, PT_D, PT_E, PT_F, PT_G, + // H I J K L M N O + PT_H, PT_I, PT_J, PT_K, PT_L, PT_M, PT_N, PT_O, + // P Q R S T U V W + PT_P, PT_Q, PT_R, PT_S, PT_T, PT_U, PT_V, PT_W, + // X Y Z [ \ ] ^ _ + PT_X, PT_Y, PT_Z, PT_8, PT_BSLS, PT_9, PT_TILD, PT_MINS, + // ` a b c d e f g + PT_ACUT, PT_A, PT_B, PT_C, PT_D, PT_E, PT_F, PT_G, + // h i j k l m n o + PT_H, PT_I, PT_J, PT_K, PT_L, PT_M, PT_N, PT_O, + // p q r s t u v w + PT_P, PT_Q, PT_R, PT_S, PT_T, PT_U, PT_V, PT_W, + // x y z { | } ~ DEL + PT_X, PT_Y, PT_Z, PT_8, PT_BSLS, PT_9, PT_TILD, KC_DEL +};