#keyboard #focus #api #dygma

dygma_focus

Dygma focus api, for use with dygma keyboards

18 unstable releases (3 breaking)

new 0.4.8 Apr 26, 2024
0.4.7 Apr 26, 2024
0.4.6 Feb 8, 2024
0.4.4 Jan 19, 2024
0.1.1 Dec 22, 2023

#503 in Hardware support

Download history 48/week @ 2023-12-30 1/week @ 2024-01-06 31/week @ 2024-01-13 4/week @ 2024-01-20 6/week @ 2024-02-03 5/week @ 2024-02-17 49/week @ 2024-02-24 5/week @ 2024-03-02 5/week @ 2024-03-09 1/week @ 2024-03-16 88/week @ 2024-03-30 18/week @ 2024-04-06

106 downloads per month

Custom license

215KB
3.5K SLoC

Dygma Focus API (Rust)

crates.io

About

This crate is a Rust implementation of the Dygma Focus API.

Make sure to not have Bazecor running and connected while trying to communicate with your keyboard.

Usage

Cargo.toml

[dependencies]
anyhow = "1.0"
dygma_focus = { version = "0.4", default-features = false, features = ["is_async"] }
tokio = { version = "1", features = ["full"] }

You can set the features to is_async or is_sync depending on your use case, default is is_async.

src/main.rs

use anyhow::Result;
use dygma_focus::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
    // Open the first device found and declare as mutable
    // Other constructors are under Focus::new_*
    let mut focus = Focus::new_first_available()?;

    // Here is an example method, most have a get and set method
    // There are also other methods for triggering macros or switching layers for example
    println!("version: {}", &focus.version().await?);

    Ok(())
}

Projects using this crate

Dygma Layer Switcher

Dependencies

~146MB
~2.5M SLoC