Code Monkey home page Code Monkey logo

t-deck-keyboard-hydra's Introduction

t-deck-keyboard-hydra

This repo further expands on hasn0life's extended keyboard firmware for the Lilygo t-deck.
Critically, it adds the ability for the main ESP32-S3 to toggle the backlight, and to set a 'raw output' mode, for firmwares that want to implement their own, more advanced keyboard features.

This has been made specifically to enable the possibility of using the advanced features in MicroHydra's KeyBoard module (like key-repeating, global keyboard shortcuts, held keys, etc).

I used hasn0life's firmware as a jumping off point for two reasons; First being that I had difficulties actually getting the original firmware code to work at all. And second, because flashing new firmware on the T-deck's keyboard is annoying, and I imagine that most people would prefer to only have to do it once, so you might as well get the best of both worlds in one firmware :)
The kb firmware defaults to setting 'raw output' off, to allow backwards-compatibility with other firmwares.


Reference

For reference, here are the flags used for sending settings from the main controller, to the keyboard:
0 - Backlight off
1 - Backlight on
2 - Raw output off
3 - Raw output on

And, here's the formula used for packing columns/rows into an integer for raw output:
rawKeys[rawIndex] = (colIndex << 4) | (rowIndex + 1)


The firmware also pulses the interrupt pin to HIGH any time the keyboard would print a keystroke.




That's all I have to add. Here's the rest of the original readme by hasn0life, which includes some further information about their firmware (and how to flash it):



This repo adds the following features to the keyboard microcontroller in the Lilygo t-deck:

  • sym + $/speaker now makes forward slash \
  • mic key produces tilde ~
  • alt and right shift = toggle capslock
  • left shift and sym = toggle symlock
    • space key produces space under sym/symlock
  • holding sym lets you type symbols continuously
  • long pressing a printable key lets you type a symbol
  • long pressing the backspace key lets you continuously erase

It's based on the firmware Lilygo provides and incorporates features from the bbq20kbd, while keeping the original protocol compatible (for now?)

How to Program the Keyboard Controller

The t-deck contains an ESP32C3 configured as an I2C slave to read the keyboard inputs. It's accessed using the 6 pin connector holes below the reset button. The t-deck repo seems to describe it upside down as of this writing.

Hardware Setup

There are many ways to program this controller, I'm going to do it using the FTDI TTL-232R-3V3 USB to serial cable. Other USB to serial converters may also be used. Connect the pins as shown in the diagram below (TX to RX, RX to TX, GND to GND). To put the ESP32C3 into programming mode, short the BL pin to ground and power it on.

Note: the header doesnt use standard breadboard spaced holes so you might want to use wires.

Note 2: ESP32C3 controller has to be turned on by pin 10 in the main ESP32S3, so make sure it's firmware does that (the default firmware does).

t-deck    |
         |=|  rst button       ftdi cable
          |                ____________
          |               | RTS         Green
        o | TX -----------| RX          Yellow
        o | RX -----------| TX          Orange
        o | BL -----|     | VCC         Red
        o | RST    /      | CTS         Brown
        o | GND ----o-----| GND         Black
        o | VCC           |_____________
          |             
-|       /
_|______/

Software Settings

The Arduino IDE configuration in the tools menu:

  • Board -> ESP32C3 Dev Module
  • USB CDC On Boot -> disabled
  • CPU Frequency -> 40MHz
  • USB DFU On Boot -> Disable
  • Flash Mode -> DIO 40MHz
  • Flash Size -> 4MB(32Mb)
  • Partition Scheme -> Default 4Mb with spifs
  • Upload Speed -> 921600

Select the COM port of the USB to serial cable. Once the controller is in programming mode (it'll print a message over the UART saying "waiting for download" when powered up with the BL pin shorted to ground) press download on the Arduino IDE and it should upload the firmware. Restart the device afterwards.

Future Additions

Feel free to suggest ideas or modify it for your own needs.

t-deck-keyboard-hydra's People

Contributors

hasn0life avatar echo-lalia avatar

Stargazers

 avatar

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.