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

annemone

v0.1.9

Published

Anne Pro 2 RGB control through Node.js

Downloads

10

Readme

Annemone

Anne Pro 2 RGB control through Node.js

NPM Version Downloads Stats

About This Project

This Node.js module allows controlling the Anne Pro 2 RGB keyboard keys without ObinsKit. Anne Pro 1 compatibility has not been tested as I don't have that keyboard.

Currently, settings are not saved and custom LED graphics set with this module are lost when the keyboard loses power or when user changes the profile with a keyboard button. This works similarly to the profile preview mode in ObinsKit.

Prerequisites

  • Node v12.x LTS or newer
  • npm 6.x or newer
  • Anne Pro 2 keyboard connected over USB

Installation

Windows, Linux, OSX:

npm install -g annemone

CLI currently only supports setting the entire keyboard to one color.

As an Node package:

  1. Install as an npm package
  2. var Annemone = require('annemone')
  3. const LEDController = new Annemone.LEDController();

Usage example

CLI

Set keyboard to red: annemone single 255 0 255

annemone module

Annemone.LEDController.setMultiColorLed(ledMatrix)

Set per-key RBG value.

Accepts a two-dimensional matrix with RGB values corresponding to each of the 61 keys as they appear on the keyboard.

There's a delay between commands as the keyboard doesn't understand commands that are sent faster than 50ms apart. This is also compounded by the fact that HID doesn't have high data throughput rate. Consider using the setSingleColorLed method if your application don't need to set per-key color.

Example matrix:

[
    [255, 0, 0] // esc
    [255, 0, 0] // 1
    [255, 0, 0] // 2
    ...
],
[
    [255, 0, 0] // tab
    [255, 0, 0] // q
    [255, 0, 0] // w
    ...
]
...

Annemone.LEDController.setIndividualKeys(matrixState)

Alternative way to set individual key colors. Takes an object with each key and its corresponding color like this: { f: [255,0,0], esc: [0,255,255]}

Note that this function is not aware of the current keyboard state and will turn off all LEDs not specified in the input object.

Annemone.LEDController.setSingleColorLed(rgb)

Set all keys to one color.

Takes an array with 3 elements: red, green and blue.

Example RGB: [255, 0, 0]

Annemone.LEDController.generateMultiColor(arrayOfRgbValues, mcu_address = 65, command_info = [32, 3, 255, 2])

HID packet generator for setMultiColorLed.

  • arrayOfRgbValues: 70 sequential rgb values for each key (skip the following keys as they do not exist on the board: 41, 43, 55, 57, 60, 61, 63, 64)
  • mcu_address: not sure what an MCU is internally, possibly depends on whether this is an Anne Pro or Anne Pro 2, code suggests this can only be 65 or 49
  • command_info:
    • 32: appears to select the destination (32 is LED)
    • 3: LED command type selector
    • 255: unknown, doesn't do anything
    • 2: selects a preset lighting profile (2 is static rainbow for example)

Annemone.LEDController.generateOneColor(rbg_color, mcu_address = 65)

HID packet generator for setSingleColorLed.

Annemone.LEDController.write(message)

HID write wrapper with a forced delay.

Needed due to Anne Pro 2 ignoring commands when they're sent faster than 50ms apart from each other.

Development setup

To install a local version for development purposes, use the following set of commands:

git clone https://github.com/manualmanul/Annemone.git
cd Annemone
npm i

Now that you have a local version of Annemone, you can use these commands in Node to import it locally:

var Annemone = require("./index.js");
const LEDController = new Annemone.LEDController();

Release History

  • v0.0.1
    • Added single and multi set modes
  • v0.1.1
    • Changed multi set input data format to a 2D matrix
  • v0.1.2
    • Added a CLI version of Annemone
  • v0.1.3 & v0.1.4
    • Version bumps to get the NPM registry to pull README updates
  • v0.1.5
    • Added pid 32777
  • v0.1.6
    • Added some docs, some static vars, improved setMultiColorLed, general code refactor
  • v0.1.7
    • Added new productId and switched to HEX for VID and PID
  • v0.1.8
    • Added a function to set keys individually

Meta

Manual – @manualmanul[email protected]

Distributed under the MIT license. See LICENSE for more information.

See also the list of contributors who participated in this project.

Contributing

  1. Fork it (https://github.com/manualmanul/annemone/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request