Crates.io | dygma_focus |
lib.rs | dygma_focus |
version | 0.4.11 |
source | src |
created_at | 2023-12-22 19:42:35.516256 |
updated_at | 2024-09-30 23:05:10.687958 |
description | Dygma focus api, for use with dygma keyboards |
homepage | |
repository | https://github.com/mbwilding/dygma-focus-api-rs |
max_upload_size | |
id | 1078627 |
size | 221,274 |
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.
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(())
}