arduino-libraries / Keyboard

GNU Lesser General Public License v3.0
229 stars 160 forks source link

Adds support for Danish language #59

Closed PJ789 closed 2 years ago

PJ789 commented 2 years ago

KeyboardLayout_da_DK.cpp is ordinary Danish keyboard layout Keyboard.h references da_DK.cpp Keyboard_da_DK.h defines scan codes for special Danish characters such as ÆØ.

PJ789 commented 2 years ago

Hi @edgar-bonet ... please could I ask you to review & approve my changes again? Hopefully should be quicker/easier this time; the Swedish layout is almost identical. Main differences are the | character placement, and the Æ & Ø characters versus Ä & Ö.

github-actions[bot] commented 2 years ago

Memory usage change @ 3589bbabc4b58eda09c6b53b60a2e82c52b9b28d

Board flash % RAM for global variables %
arduino:avr:leonardo 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|examples/Serial
flash|%|examples/Serial
RAM for global variables|% -|-|-|-|- arduino:avr:leonardo|0|0.0|0|0.0 arduino:sam:arduino_due_x_dbg|0|0.0|N/A|N/A arduino:samd:mkrzero|0|0.0|0|0.0
Click for full report CSV ``` Board,examples/Serial
flash,%,examples/Serial
RAM for global variables,% arduino:avr:leonardo,0,0.0,0,0.0 arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A arduino:samd:mkrzero,0,0.0,0,0.0 ```
edgar-bonet commented 2 years ago

I looked up three sources: Wikipedia, an interactive layout comparator, and the layouts provided by my OS. They all agree that, within the ASCII repertoire, there are two differences between the Swedish and the Danish layouts:

character Swedish Danish
\| AltGr–<, 0x32\|ALT_GR AltGr–′, 0x2e\|ALT_GR
\ AltGr–+, 0x2d\|ALT_GR AltGr–<, 0x32\|ALT_GR

This pull request addresses | but leaves \ in its Swedish position (AltGr–+ = 0x2d|ALT_GR). It seems to me this is missing:

--- a/src/KeyboardLayout_da_DK.cpp
+++ b/src/KeyboardLayout_da_DK.cpp
@@ -99,7 +99,7 @@ extern const uint8_t KeyboardLayout_da_DK[128] PROGMEM =
        0x1c|SHIFT,    // Y
        0x1d|SHIFT,    // Z
        0x25|ALT_GR,   // [
-       0x2d|ALT_GR,   // bslash
+       0x32|ALT_GR,   // bslash
        0x26|ALT_GR,   // ]
        0x00,          // ^  not supported (requires dead key + space)
        0x38|SHIFT,    // _

You may want to check that Keyboard.write('\\'); does type a backslash.

PJ789 commented 2 years ago

Agreed.

PJ789 commented 2 years ago

Confirmed your suspicion... I'll make that change.. Thanks @edgar-bonet .

PJ789 commented 2 years ago

@facchinm please could you add this pull request? @edgar-bonet has reviewed (and improved).

github-actions[bot] commented 2 years ago

Memory usage change @ 124a0cbf4ef271b96c4dd673ebf28299862fb0b5

Board flash % RAM for global variables %
arduino:avr:leonardo 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|examples/Serial
flash|%|examples/Serial
RAM for global variables|% -|-|-|-|- arduino:avr:leonardo|0|0.0|0|0.0 arduino:sam:arduino_due_x_dbg|0|0.0|N/A|N/A arduino:samd:mkrzero|0|0.0|0|0.0
Click for full report CSV ``` Board,examples/Serial
flash,%,examples/Serial
RAM for global variables,% arduino:avr:leonardo,0,0.0,0,0.0 arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A arduino:samd:mkrzero,0,0.0,0,0.0 ```
github-actions[bot] commented 2 years ago

Memory usage change @ 0efcff84ac0ea2e6991d1ae6e4d3ffe54b09d4b1

Board flash % RAM for global variables %
arduino:avr:leonardo 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|examples/Serial
flash|%|examples/Serial
RAM for global variables|% -|-|-|-|- arduino:avr:leonardo|0|0.0|0|0.0 arduino:sam:arduino_due_x_dbg|0|0.0|N/A|N/A arduino:samd:mkrzero|0|0.0|0|0.0
Click for full report CSV ``` Board,examples/Serial
flash,%,examples/Serial
RAM for global variables,% arduino:avr:leonardo,0,0.0,0,0.0 arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A arduino:samd:mkrzero,0,0.0,0,0.0 ```
PJ789 commented 2 years ago

Recreating this pull request... because can't revert an accidental commit :( due to limitations of github.com