Giter VIP home page Giter VIP logo

circuitpython_keyboard_layouts's Introduction

Keyboard Layouts For Circuitpython

The goal of this repository is to contain a list of keyboard layouts for use with the Circuitpython adafruit_hid library, that can be used as a reference for international keyboards and can be distributed as a "bundle" in the style of the Adafruit bundle.

It can be used with circup for easy installation.

circup bundle-add Neradoc/Circuitpython_Keyboard_Layouts
circup install keyboard_layout_win_fr keycode_win_fr

There's a couple of project-specific guides:

Install your language

To install both the layout and keycode files for your language, you need to copy 2 files to your board. Pick the language and platforms that match yours. Use the .py version, or the .mpy version matching your version of Circuitpython. The mpy files take less space and are better suited for Circuitpython boards with less than 1MB of drive.

  • keyboard_layout_win_fr.mpy (pick your platform/language)
  • keycode_win_fr.mpy (pick your platform/language)

The files go directly in the directory called "lib" on the board.

CIRCUITPY drive screenshot

Don't forget to also install the adafruit_hid library in the lib directory.

Use the libraries

Layouts

Layouts require the latest version of the adafruit_hid library (at least 5.x.x).

For the plaform platform (win, mac) and the layout language lang. The module keyboard_layout_platform_lang has a class called KeyboardLayout. It contains the layout information for use with the Keyboard to type text.

import usb_hid
from adafruit_hid.keyboard import Keyboard
from keyboard_layout_win_fr import KeyboardLayout
keyboard = Keyboard(usb_hid.devices)
layout = KeyboardLayout(keyboard)
layout.write("Bonjour le monde")

Switching layouts on start can be done by conditionally importing a different layout module, or renaming the imported layout class like this for example:

from keyboard_layout_win_fr import KeyboardLayout as LayoutFR
from keyboard_layout_win_de import KeyboardLayout as LayoutDE

Keycodes

keycode_<platform>_<lang> modules are an attempt to make it easier to swap layouts. While keycode numbers are really physical positions on a keyboard, HID Keycodes normally reference the US keyboard for key names. These localized keycodes offer a level of conversion allowing to use Keycode.A across azerty and qwerty keyboards for example. It won't swap control and command to match the platform however. (A helper module could do that).

if IS_AZERTY:
	from keycode_mac_fr import Keycode
else:
	from adafruit_hid.keycode import Keycode

kbd.send(Keycode.COMMAND, Keycode.A)

Helpers

The consumer_control_extended module brings a big list of names for the consumer controls page in the HID specs, to be used with adafruit_hid.consumer_control.

The Layout Generator

This needs to be further documentend, but for now tests/make_validated.sh shows an example of how to use it. There is a live version of the web generator, though it might not always be the current release.

https://www.neradoc.me/layouts/

circuitpython_keyboard_layouts's People

Contributors

neradoc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

circuitpython_keyboard_layouts's Issues

TR lang "i" Problem

print » qwertyuıopğüasdfghjklşizxcvbnmöç||QWERTYUIOPĞÜASDFGHJKLŞİZXCVBNMÖÇ
write » qwertyuıopğüasdfghjklşîzxcvbnmöç||QWERTYUIOPĞÜASDFGHJKLŞİZXCVBNMÖÇ

print » i
write » î

Add support for the Brazilian Portuguese keyboard layout (ABNT2)

Hi, I'm trying to map the pt-BR keyboard layout but I couldn't figure out how to do so.

I found this website that lists the Scancodes for my keyboard, I then copied the preexisting French keyboard to change the codes so they match the ones in the website, but soon saw that the German was completely different.

Is there a article or wiki with instructions on how to make a map like that? How could I use one of these layouts in a Raspberry Pico with Adafruit CircuitPython HID?

I'm sorry to bother you with this.
Thanks in advance.

Missing CH layout

I'm trying to use the german keyboard layout for my Rubber Ducky built using a Raspberry Pi Pico, but it won't work on a swiss keyboard as expected. Is there an upcoming update adding the CH keyboard layout?

curly braces not working on the Italian keyboard

Hello, i can't seem to get the curly braces "{}" working on the italian keyboard, i was trying to use them but i get this error
ValueError: No keycode available for character '{' (123/0x7b)

DE not working

It doesn't work for me, just spits out some gibberish. ):

image

I fail to add bundle with circup 1.4.0

Not sure if this is a bug in circup or a problem with the repo, but I fail to install the easy way (with circup):

CircUp, A CircuitPython module updater. Version 1.4.0

C:\Project>circup bundle-add Neradoc/Circuitpython_Keyboard_Layouts
Bundle invalid, is the repository a valid circup bundle ?
    Neradoc/Circuitpython_Keyboard_Layouts´´´

I'll go the manual way, I just wanted you to know, and if you think it is a circup issue, let me know I will try to open an issue there.

tuple for HIGHER_ASCII for use dead key

Hello,
the use of tuple for HIGHER_ASCII would allow to write the composed characters of the French language
but require code change for processing because two press and release needed


example:

    ASCII_TO_KEYCODE = (
        # 0
        b"\x00"  # NUL
        ...
        ...
        b"\x25"  # _
        b"\x24"  # ` # Warning dead key, only work with space if alone (^ =  press ^ and release all + press space and release all)

 HIGHER_ASCII = {
        "€": 0x08,  # € - altgr will be added thanks to NEED_ALTGR
        'é': 0x1f,
        'è': 0x24,
        'ç': 0x26,
        'à': 0x27,
        '°': 0xad,
        '£': 0xb0,
        '¤': 0x30, # not 0xb0
        'ù': 0x34,
        '²': 0x35,
        'µ': 0xb1,
        '§': 0xb8,
	'¨': 0xAF, # important add ¨ !!!
	'À' (0x24, 0x94) # `+ A ,(press ` release all and press A release all)
        #  TODO: add missing ÀÈÉÙ (ÀÈÙ is compose key) É-> altcode only !!!
    }

DIAERESIS ¨ val=0xA8 keyboard key=0x2F | SHIFT
----Dead key FR-------
À = ` + A
 = ^ + A
Ä = ¨ + A
È = ` + E
Ê = ^ + E
Ë = ¨ + E
Î = ^ + I
Ï = ¨ + I
Ô = ^ + O
Ö = ¨ + O
Ù = ` + U
Û = ^ + U
Ü = ¨ + U
â = ^ + a
ä = ¨ + a
ê = ^ + e
ë = ¨ + e
î = ^ + i
ï = ¨ + i
ô = ^ + o
ö = ¨ + o
û = ^ + u
ü = ¨ + u
ÿ = ¨ + y
-----------------------

Cannot generate the FR-Bépo layout

Hello,

I’m reporting this issue here but it is not reletive with CicuitPython directly: the issue comes from the tool provided for creating custom layout.

I’m trying to create the layout for kbdfrnb, but the web application raises an error :

The source could not be interpreted, or is not supported, check the spelling.
https://kbdlayout.info/kbdfrnb
data/kbdlayout-info-frnb.xml
Error Layout

Error Keycodes

Backslash not working

I am working with the german layout.
It works fine, except for the backslash.

I write:
STRING \

But the result is:
`

Can I change or add this in the script?

dont work

i did everything on the list but now my payload wont run if i plug it in?

Please add support for CircuitPython 9.x

circup prints the following when updating:

Downloading latest bundles for Neradoc/Circuitpython_Keyboard_Layouts (20221209).
py:
Extracting:  [####################################]  100%
8.x-mpy:
Extracting:  [####################################]  100%
9.x-mpy:
There was a problem downloading that platform bundle. Skipping and using existing download if available.

I am using:

$ circup --version
CircUp, A CircuitPython module updater. Version 1.5.2

Trying to change my default US layout to SP layout

I'm trying to create a USB Rubber Ducky with Raspberry Pi Pico following this tutorial: https://www.youtube.com/watch?v=e_f9p-_JWZw&t=472s

The thing is i've tried to get your layout and keycode for SP keyboard, move both file to the raspberry pico lib folder, and i've also changed code.py as you suggested on this post: dbisu/pico-ducky#10 (comment)

When I've done everything, my code.py corrupted and could do anything else. What am I doing wrong?

Thanks for your time.

Regards,

Guillem

Support For tr Keyboard Layout. (tr_tr)

Hello,I've Been Looking For tr_tr Keyboard Layout But I Couldn't Find It.Then I Tried to Do It Myself But Couldn't Figure Out How to Do.

Is There Any Way I Can Make It Myself Or Do I Have To Wait?

Sorry For Taking Your Time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.