Annemone

Control your Anne Pro 2 RGBs with NodeJS


Project maintained by illixion Hosted on GitHub Pages — Theme by mattgraham

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

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.

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/illixion/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

Meta

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/illixion/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