npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@klathmon/qmk-hid-display

v1.1.2

Published

A small node script that will communicate with a qmk keyboard over raw hid

Downloads

14

Readme

QMK-HID-Display

A small node script that will collect data and send updates to a qmk enabled keyboard to show on the OLED display.

Klathmon's Fork

I forked this and changed it so it should run on both MacOS and Windows, and I added a host volume graph and a battery level graph to Perf. I also changed the package name to be @klathmon/qmk-hid-display so that I could publish it and run it on any computer that has node installed by just doing npx @klathmon/qmk-hid-display.

Pre-requisites

  • To use this script you must have a QMK enabled keyboard with OLED displays such as the Lily58.
  • You also need to have flashed the keyboard with custom QMK firmware that has the corresponding OLED update code
  • The update code can be found on my qmk_firmware fork in the lily58 branch.
  • You will also need to have copied over my custom font from this repo
    • This font can be found in the qmk_firmware fork here: glcdfont.c
    • font.bmp

Development Setup

  • Clone this repo
  • Run npm install in '/qmk-hid-display'
  • Plug in your QMK enabled keyboard that has the custom firmware (linked above)
  • Open '/qmk-hid-display' in VS Code
  • Press F5 to start debugging

Using the script

  • Clone this repo
  • Run npm install in '/qmk-hid-display'
  • Plug in your QMK enabled keyboard that has the custom firmware (linked above)
  • Run npm run start

How it works

  • The script simply calls various node api/packages to collect data that we want to use for the display on the keyboard oled screen
  • The examples included are:
    • Perf - shows stats for cpu, memory usage (mem), disk activity (dsk), and network bandwidth use (net). As a little bar graph.
    • Stock - shows current stock price of 4 tech stocks I added, MSFT, AAPL, GOOG, and FB.
    • Weather - shows current weather forecast for the Seattle area.
  • But essentially you can use anything that fits into the 21x4 character screen and is available in the font image
  • Once per second, the script sends over the screen data to the keyboard one line at a time which is then sent to the slave oled on the keyboard
  • The keyboard can also send data back to the script to indicate which data it would like to show.
  • Data must be sent in the form of an 84 (21*4) length byte array, where each byte corresponds to an index in the font image
    • Warning - I don't know that there is sufficient array length checks in the example firmware, so do be sure not to send the wrong amount of data
  • The keyboard already takes care of mapping normal ascii chars to the font data index, so you can just convert an 84 length string into char codes (using charCodeAt) and send that.
  • The script does some slightly fancy stuff to map to different parts of the font image where I've drawn sideways titles so that it reads correctly on the oled (but those can only be 4 spaces long due to the orientation of the oled displays)
  • Since all the processing is done in the script and the keyboard just displays whatever you send, you don't need to re-flash the firmware at all
  • This means you could do fancy effects like scrolling the text if it was too long by just sending a different string in each update (see the startWeatherMonitor())

To anyone brave enough to use this - Good Luck!