Crate wooting_sdk

Source
Expand description

§rust-wooting-sdk

This crate provides Rust bindings to the Analog and RGB SDKs provided by Wooting for the Wooting One and Wooting Two.

§Example

See the wooting-sdk/src/examples/ directory for more examples.

use wooting_sdk::{
    analog::read_analog_key,
    rgb::RgbKeyboard,
    Key
};

let min = u8::min_value();
let max = u8::max_value();

// Check how far down W has been pressed..
match read_analog_key(Key::W)? {
    min => { /* ..not pressed. */ },
    max => { /* ..completely pressed. */ },
    _ => { /* ..partially pressed. */ },
}

let mut keyboard = RgbKeyboard::default();

// Modify the keyboard array so QWERTY will be set to white..
keyboard.array_set_full(&[
    (Key::Q, (255, 255, 255)),
    (Key::W, (255, 255, 255)),
    (Key::E, (255, 255, 255)),
    (Key::R, (255, 255, 255)),
    (Key::T, (255, 255, 255)),
    (Key::Y, (255, 255, 255)),
]);

// ..and apply the change.
keyboard.array_update();

Modules§

analog
Contains functions from Wooting’s Analog SDK.
rgb
Contains functions from Wooting’s RGB SDK.

Enums§

Key
Represents a key on the keyboard.
WootingError
Represents an error that can occur when querying the state of a Wooting keyboard.

Traits§

FromScanIndex
Types that implement this trait can be associated with a scan index.
IntoMatrixRowColumn
Types that implement this trait can be transformed into a matrix row and column.