Something went wrong. Try again.
A Zig library for driving Elgato Stream Deck devices over USB HID.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172// SPDX-FileCopyrightText: © 2025 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! The Stream Deck Mini. Its six keys are arranged in a grid three//! across and two down, each with its own 80x80 display, and it has//! neither encoders nor a touchscreen.//!//! `devices.zig` gathers this module together with the one for every//! other model, so that the control groups can look up the properties//! of whichever device they are attached to.
const ElgatoStreamDeckMini = @This();
const KeyFeature = @import("../Keys.zig").KeyFeature;
pub const vendor: u16 = 0x0fd9;pub const product: u16 = 0x0063;
/// What this model's keys look like and what they can do. Every device/// module declares this, so the fields and functions below are the same/// from one model to the next even though the values differ.pub const keys = struct { /// The number of columns in the key grid. pub const cols: u5 = 3; /// The number of rows in the key grid. pub const rows: u5 = 2; /// The number of touch keys beyond the grid. This model has none. pub const touch: u5 = 0; /// The total number of keys, the grid and the touch keys together. pub const count: u8 = @as(u8, cols) * rows + touch;
/// What the given key is capable of, or null if this model has no /// such key. Keys are numbered from zero. Every key here displays a /// BMP image sent with a v1 header, turned a quarter turn first /// because the displays are mounted on their side. /// /// **Confirmed against the hardware.** The quarter turn and the /// left/right flip below were settled by putting the same figure on /// four keys under the four corrections a table can be wrong by and /// looking at which one read correctly. What this library carried /// before -- the same quarter turn with a top/bottom flip instead /// -- was a half turn out, so every key image on a Mini came out /// upside down. /// /// Elgato's HID documentation says to rotate ninety degrees /// clockwise and says nothing about a flip, so this does what the /// documentation says and one thing more. The likeliest reason is /// that `bmp.zig` writes its rows bottom-up, as a BMP's have been /// written since 1990, and the documentation does not say which row /// order these devices expect -- but the two ways of writing this /// transform are algebraically the same, so that explanation is a /// reasonable guess rather than something the experiment showed. pub fn getFeature(key: u8) ?KeyFeature { switch (key) { 0...5 => { return .{ .image = .{ .header_format = .v1, .image_format = .BMP, .width = 80, .height = 80, .rotation = .@"90", .flip_left_right = true, .flip_top_bottom = false, }, }; }, else => return null, } }};