diff --git a/Readme.md b/Readme.md index 62983b5..1d8230e 100644 --- a/Readme.md +++ b/Readme.md @@ -11,6 +11,8 @@ Modified by Ernesto Sanchez to support multiple keyboard layouts Modified by Mümin Köykıran to support Turkish keyboard layouts +Modified by Carlos Gutierrez to support Latin American keyboard layout + Supported layouts: * tr_tr * be_be @@ -19,6 +21,7 @@ Supported layouts: * de_de * en_us (default) * es_es +* es_la * fi_fi * fr_fr * it_it @@ -26,6 +29,8 @@ Supported layouts: __NOTE1:__ Only en_us and es_es are tested at july 2017. __NOTE2:__ tr_tr tested at March 2018. The result is perfect. +__NOTE2:__ es_la tested at February 2021. Perfect + Download and installation ========================= @@ -51,6 +56,7 @@ You can use: * kbd_de_de * kbd_en_us * kbd_es_es +* kdb_es_la * kbd_fi_fi * kbd_fr_fr * kbd_it_it @@ -78,3 +84,6 @@ Open an issue, ask me on twitter to [@ernesto_xload](http://www.twitter.com/erne Turkish implemented and tested by: [@MrKoykiran](https://twitter.com/MrKoykiran/) or visit www.muminkoykiran.com + +Latin American implemented and tested by: +[@gtzsec](https://twitter.com/gtzsec) diff --git a/src/DigiKeyboard.h b/src/DigiKeyboard.h index c3cbe81..040d2c2 100644 --- a/src/DigiKeyboard.h +++ b/src/DigiKeyboard.h @@ -23,33 +23,47 @@ #endif #ifdef kbd_cz_cz #include "digi_cz_cz.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_da_dk #include "digi_da_dk.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_de_de #include "digi_de_de.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_es_es #include "digi_es_es.h" +#define LANG_SWITCH 0 +#endif +#ifdef kbd_es_la +#include "digi_es_la.h" +#define LANG_SWITCH 6 #endif #ifdef kbd_fi_fi #include "digi_fi_fi.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_fr_fr #include "digi_fr_fr.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_it_it #include "digi_it_it.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_pt_pt #include "digi_pt_pt.h" +#define LANG_SWITCH 0 #endif #ifdef kbd_tr_tr #include "digi_tr_tr.h" +#define LANG_SWITCH 0 #endif #ifndef _kbd_lang #include "digi_en_us.h" +#define LANG_SWITCH 0 #endif // TODO: Work around Arduino 12 issues better. @@ -172,10 +186,7 @@ class DigiKeyboardDevice : public Print { usbDeviceDisconnect(); _delay_ms(250); usbDeviceConnect(); - - - usbInit(); - + usbInit(); sei(); // TODO: Remove the next two lines once we fix @@ -246,8 +257,12 @@ class DigiKeyboardDevice : public Print { else if(chr == '>') { sendKeyStroke(100, MOD_SHIFT_RIGHT); } - else if(chr == '|') { - sendKeyStroke(100, MOD_ALT_RIGHT); + else if(chr == '|') { + if(LANG_SWITCH == 6){ // for latam keyboard + sendKeyStroke(0x35); + }else{ + sendKeyStroke(100, MOD_ALT_RIGHT); // default en_us + } } else { diff --git a/src/digi_es_la.h b/src/digi_es_la.h new file mode 100644 index 0000000..55ef8f2 --- /dev/null +++ b/src/digi_es_la.h @@ -0,0 +1,132 @@ +#define _kbd_lang + +#include +// Lookup table to convert ascii characters in to keyboard scan codes +// Format: most signifficant bit indicates if scan code should be sent with shift modifier +// remaining 7 bits are to be used as scan code number. + +#define SHIFT 0x80 +#define ALTGR 0x40 + +const unsigned char ascii_to_scan_code_table[] PROGMEM = { + 0x2a, // BS Backspace + 0x2b, // TAB Tab + 0x28, // LF Enter + 0x00, // VT + 0x00, // FF + 0x00, // CR + 0x00, // SO + 0x00, // SI + 0x00, // DEL + 0x00, // DC1 + 0x00, // DC2 + 0x00, // DC3 + 0x00, // DC4 + 0x00, // NAK + 0x00, // SYN + 0x00, // ETB + 0x00, // CAN + 0x00, // EM + 0x00, // SUB + 0x00, // ESC + 0x00, // FS + 0x00, // GS + 0x00, // RS + 0x00, // US + 0x2c, // ' ' (space) + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x20|SHIFT, // # + 0x21|SHIFT, // $ + 0x22|SHIFT, // % + 0x23|SHIFT, // & + 0x2d, // ' + 0x25|SHIFT, // ( + 0x26|SHIFT, // ) + 0x30|SHIFT, // * + 0x30, // + + 0x36, // , + 0x38, // - + 0x37, // . + 0x24|SHIFT, // / + 0x27, // 0 + 0x1e, // 1 + 0x1f, // 2 + 0x20, // 3 + 0x21, // 4 + 0x22, // 5 + 0x23, // 6 + 0x24, // 7 + 0x25, // 8 + 0x26, // 9 + 0x37|SHIFT, // : + 0x36|SHIFT, // ; + 0x03, // < //KEY_NON_US_100 + 0x27|SHIFT, // = + 0x03|SHIFT, // > //KEY_NON_US_100 + SHIFT + 0x2d|SHIFT, // ? + 0x14|ALTGR, // @ + 0x04|SHIFT, // A + 0x05|SHIFT, // B + 0x06|SHIFT, // C + 0x07|SHIFT, // D + 0x08|SHIFT, // E + 0x09|SHIFT, // F + 0x0a|SHIFT, // G + 0x0b|SHIFT, // H + 0x0c|SHIFT, // I + 0x0d|SHIFT, // J + 0x0e|SHIFT, // K + 0x0f|SHIFT, // L + 0x10|SHIFT, // M + 0x11|SHIFT, // N + 0x12|SHIFT, // O + 0x13|SHIFT, // P + 0x14|SHIFT, // Q + 0x15|SHIFT, // R + 0x16|SHIFT, // S + 0x17|SHIFT, // T + 0x18|SHIFT, // U + 0x19|SHIFT, // V + 0x1a|SHIFT, // W + 0x1b|SHIFT, // X + 0x1c|SHIFT, // Y + 0x1d|SHIFT, // Z + 0x34|SHIFT, // [ + 0x2d|ALTGR, // bslash + 0x32|SHIFT, // ] + 0x34|SHIFT, // ^ + 0x38|SHIFT, // _ + 0x2f, // ` + 0x04, // a + 0x05, // b + 0x06, // c + 0x07, // d + 0x08, // e + 0x09, // f + 0x0a, // g + 0x0b, // h + 0x0c, // i + 0x0d, // j + 0x0e, // k + 0x0f, // l + 0x10, // m + 0x11, // n + 0x12, // o + 0x13, // p + 0x14, // q + 0x15, // r + 0x16, // s + 0x17, // t + 0x18, // u + 0x19, // v + 0x1a, // w + 0x1b, // x + 0x1c, // y + 0x1d, // z + 0x34, // { + 0x35, // | + 0x32, // } + 0x30|ALTGR, // ~ + 0x00, // DEL +};