Crates.io | rog_anime |
lib.rs | rog_anime |
version | 1.3.0 |
source | src |
created_at | 2021-04-11 04:13:08.150921 |
updated_at | 2021-12-19 09:28:18.754223 |
description | Types useful for translating images and other data for display on the ASUS AniMe Matrix display |
homepage | https://gitlab.com/asus-linux/asus-nb-ctrl |
repository | https://gitlab.com/asus-linux/asus-nb-ctrl |
max_upload_size | |
id | 381882 |
size | 114,931 |
rog-anime
is a crate for use with ASUS laptops that have an AniMe matrix display built in to them. The crate can be used with zbus to communicate with the asusd
daemon from the project this crate is part of, or it can be used standalone to write the data directly to USB by transforming the data to USB HID packets using builtin functions.
Supported so far is:
This crate is mostly purpose built for use with asus-nb-ctrl
which is a complete daemon and toolset for Linux on ASUS ROG/TUF machines, but can be used in general for example building a new controller for Windows OS.
dbus
is enabled by default - this uses zvariant
to enable sending some types over dbus interfaces.
use std::{
env, error::Error, f32::consts::PI, path::Path, process::exit, thread::sleep, time::Duration,
};
use rog_anime::{
AniMeDataBuffer, {AniMeImage, Vec2},
};
use rog_dbus::AuraDbusClient;
fn main() -> Result<(), Box<dyn Error>> {
let (client, _) = AuraDbusClient::new().unwrap();
let mut image = AniMeImage::from_png(
Path::new("./doom.png"),
0.9, // scale
0.0, // rotation
Vec2::new(0.0, 0.0), // position
0.3, // brightness
)?;
loop {
image.angle += 0.05;
if image.angle > PI * 2.0 {
image.angle = 0.0
}
image.update();
client
.proxies()
.anime()
.write(<AniMeDataBuffer>::from(&image))
.unwrap();
sleep(Duration::from_micros(500));
}
}
let mut image = AniMeImage::from_png(
Path::new("./doom.png"),
0.9, // scale
0.0, // rotation
Vec2::new(0.0, 0.0), // position
0.3, // brightness
)?;
// convert to intermediate packet format
let buffer = <AniMeDataBuffer>::from(&image)
// then to USB HID
let data = AniMePacketType::from(buffer);
// and then write direct
for packet in data.iter() {
write_usb(packet); // some usb call here
}
data/controller.gif
is an example ASUS diagonally orientated gif.data/diagonal-template.*
are templates for diagonal images or gifs.See https://blog.joshwalsh.me/asus-anime-matrix/ for details on how the diagonal layout works.
diagonal-template.*
is provided from the website above. It is best to
export the final file to 36px height - no scaling is done in asusd or
rog-anime crate for diagonal displays.