Advanced Aura feature

Groundwork for 'advanced' aura modes
Add single zone + Doom light flash
Fix mocking for ROGCC
Better prepare & change to mapping of keyboard layouts to models and functions
Refactor and begin using new key layout stuff
Enable first arg to rogcc to set layout in mocking feature mode
Complete refactor of key layouts, and to RON serde
This commit is contained in:
Luke D. Jones
2022-12-11 11:50:47 +13:00
parent e3ecaa92bd
commit 1cbffedaeb
134 changed files with 8249 additions and 4390 deletions

View File

@@ -13,14 +13,18 @@ edition = "2021"
exclude = ["data"]
[features]
default = ["dbus", "toml"]
default = ["dbus", "ron"]
dbus = ["zbus"]
[dependencies]
serde.workspace = true
serde_derive.workspace = true
toml = { workspace = true, optional = true }
zbus = { workspace = true, optional = true }
[dev-dependencies]
serde_json.workspace = true
# cli and logging
log.workspace = true
# Device control
sysfs-class.workspace = true # used for backlight control and baord ID
ron = { version = "*", optional = true }

View File

@@ -0,0 +1,246 @@
# rog-aura
## What is it?
rog-aura is a helper crate for interacting with the RGB keyboards found on many ASUS ROG gaming laptops such as the Zephyrus, Strix, TUF, and a few others.
The crate is primarily used in the asusctl suite of tools.
The majority of the crate deals with converting from the API to USB packets suitable for sending raw to the USB device.
## Features
- Detect USB keyboard type, or if the kayboard is an I2C connected one (typical on TUF)
- Set various basic modes
- Set various basic zones
- Set advanced/direct addressing of:
+ Single zone
+ Multizone
+ Per-key
- Physical layout mapping
## Config files
The crate includes config files for helping to determine what laptop models support what feature. This is heavily dependant on folks testing and contributing data.
It also includes layouts for some laptops. Also heavily dependant on contributions.
# Support list
`aura_support.ron` is the support listing file. It functions as a database of which models support which features.
```ron
(
board_name: "G513QR",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
```
in the above example the board name is found from `cat /sys/devices/virtual/dmi/id/board_name`. In some model ranges the last letter (which is likely the dGPU/feature variant) can be ommited. `layout_name` is the first part of a related filename for the layout as described in the next section - the filename should be postfixed with a locale such as `g513i_US.ron`.
`basic_modes` are the default inbuilt modes the keyboard supports. Not all keyboards have the same set of modes. `basic_zones` is a secondary part of `basic_modes` where this lists which zones can be set as part of the basic mode. Each zone reauires a full basic mode setting. The zones supported here are
- `Key1`
- `Key2`
- `Key3`
- `Key4`
- `Logo`
- `BarLeft`
- `BarRight`
note that the zone support seems to have changed with new generations of keyboards and is shifted to `advanced_type`. The `advanced_type` field is taken in to account when setting advanced effects. It can be combined with the keyboard layout also to be used in a GUI.
`advanced_type` can be one of:
- `None`, no advanced aura at all
- `PerKey`, can use any of `LedCode` except for the `Zoned` items below which work in a different way
- `Zoned`, takes an array such as:
+ `Zoned([SingleZone])`, only one zone
+ `Zoned([ ... ]),`, array with any combination of:
- `ZonedKbLeft` // keyboard left
- `ZonedKbLeftMid` // keyboard left-middle
- `ZonedKbRightMid` // etc
- `ZonedKbRight`
- `LightbarRight`
- `LightbarRightCorner`
- `LightbarRightBottom`
- `LightbarLeftBottom`
- `LightbarLeftCorner`
- `LightbarLeft`
# Layouts
The layout structure is kept in a `.ron`, which is "rusty object notation". The way this works is best demonstrated:
```ron
(
locale: "US",
key_shapes: {
// This is a regular LED spot, it has a size (width x height), and padding around each edge.
// The final size should be (width + pad_left + pad_right, height + pad_top + pad_bottom)
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
// There is nothing in this space but it takes up room
"func_space": Blank(
width: 0.2,
height: 0.0,
),
// This backspace button is composed of 3 individual LED
"backspace1": Led(
width: 0.65,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backspace2": Led(
width: 0.7,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backspace3": Led(
width: 0.65,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
},
key_rows: [
(
// Padding generally isn't required but is available just in case
pad_left: 0.1,
pad_top: 0.1,
// Each row is a horizontal row of keys of the keyboard
row: [
// Declare a tuple of `Key`, and the String name to use from the hashmap above
(Spacing, "rog_spacer"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(Rog, "rog_row"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
// There are two non-led types, `Blocking` which is intended to block something like a row-laser
(Blocking, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
// and `Spacing` which is intended to act like a non-visible LED
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Spacing, "func_space"),
(Del, "func_key"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace3_1, "backspace1"),
(Backspace3_2, "backspace2"),
(Backspace3_3, "backspace3"),
(Spacing, "func_space"),
(Home, "regular"),
],
),
]
)
```
**There are two types of layouts to be considered when building one; per-key, and zoned.**
A zoned keyboard layout includes single zoned + no zones (but not per-key). The layout for this is fairly freeform, and can be built using regular keys from `LedCode` but can not include these per-key specific codes:
- `LidLogo`
- `LidLeft`
- `LidRight`
it can include regular keys and:
- `SingleZone`, if this is used then the `ZonedKb*` should not be used
- `ZonedKbLeft`
- `ZonedKbLeftMid`
- `ZonedKbRightMid`
- `ZonedKbRight`
- `LightbarRight`
- `LightbarRightCorner`
- `LightbarRightBottom`
- `LightbarLeftBottom`
- `LightbarLeftCorner`
- `LightbarLeft`
#### `Key`
Every `Key` in the enum maps to a USB packet + RGB index in that packet. The raw mapping is seen in `per_key_raw_bytes.ods` in the data dir, for example there is a single LED backspace, and a 3-LED backspace.
#### `key_shapes`
This is a hashmap of `String`:`ShapeType`, as shown by the previous example such as:
```
// This is a regular LED spot, it has a size (width x height), and padding around each edge.
// The final size should be (width + pad_left + pad_right, height + pad_top + pad_bottom)
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
```
"regular" being the key used by the keys in each key row.
# Testing
When working with Rog Control Center you can test layouts by starting the app on CLI with options:
```
-h, --help print help message
-v, --version show program version number
-b, --board-name set board name for testing, this will make ROGCC show only the keyboard page
-l, --layout-viewing put ROGCC in layout viewing mode - this is helpful for finding existing layouts that might match your laptop
```

View File

@@ -0,0 +1,450 @@
([
(
board_name: "FA506I",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "FA506Q",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
),
(
board_name: "FA507",
layout_name: "fa507",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "FX505D",
layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "FX506HC",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G512",
layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G512LI",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G512LV",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G513IC",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
),
(
board_name: "G513IH",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G513IM",
layout_name: "g513i-per-key",
basic_modes: [Flash, Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G513QE",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G513QM",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G513QR",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G513QY",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G513RC",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
),
(
board_name: "G513RM",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
),
(
board_name: "G531",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G531",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
),
(
board_name: "G531GD",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G531GT",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G531GU",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G531GV",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G531GW",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G532",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G533Q",
layout_name: "g533q-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G712LI",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G712LV",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G712LW",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G713IC",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G713QM",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G713QR",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G713RM",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G713RS",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G713RW",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G731",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
),
(
board_name: "G731GT",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G731GU",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
),
(
board_name: "G731GV",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G731GW",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "G733Q",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GA402R",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GA503Q",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GA503QE",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GA503R",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GL504G",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4, Logo, BarLeft, BarRight],
advanced_type: None,
),
(
board_name: "GL531",
layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GL553VE",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "GM501G",
layout_name: "fa507",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "GU502",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GU502G",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GU502L",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GU502LU",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GU603H",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
),
(
board_name: "GU603Z",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
),
(
board_name: "GV301Q",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GV601R",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
),
(
board_name: "GX502",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GX531",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
),
(
board_name: "GX550L",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GX551Q",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GX701",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GX703H",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: None,
),
(
board_name: "ga401qQ",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
),
])

View File

@@ -0,0 +1,317 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular2": Led(
width: 1.0,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"func_key": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.1,
),
"func_space": Blank(
width: 0.5,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 1.2,
height: 0.0,
),
"backspace": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bkslash": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 1.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.3,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.5,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 2.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.7,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.9,
pad_right: 1.4,
pad_top: 0.1,
pad_bottom: 0.0,
),
"arrows_spacer": Blank(
width: 14.5,
height: 0.0,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.4,
pad_bottom: 0.1,
),
"numpad_tall": Led(
width: 1.0,
height: 2.2,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: -1.2,
),
"numpad_wide": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Spacing, "func_space"),
(Del, "func_key"),
(NumPadPause, "func_key"),
(NumPadPrtSc, "func_key"),
(NumPadHome, "func_key"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(Spacing, "func_space"),
(NumLock, "regular"),
(FwdSlash, "regular"),
(Star, "regular"),
(Hyphen, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "bkslash"),
(Spacing, "func_space"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(NumPadPlus, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(Spacing, "func_space"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(Spacing, "func_space"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(NumPadEnter, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular2"),
(Meta, "regular2"),
(LAlt, "regular2"),
(Spacebar, "spacebar"),
(RAlt, "regular2"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
(Spacing, "func_space"),
(N0, "numpad_wide"),
(NumPadDel, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -0,0 +1,334 @@
(
locale: "US",
key_shapes: {
"rog_spacer": Blank(
width: 2.5,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.2,
pad_bottom: 0.5,
),
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular2": Led(
width: 1.0,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"func_key": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.1,
),
"func_space": Blank(
width: 0.5,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 1.2,
height: 0.0,
),
"backspace": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bkslash": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 1.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.3,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.5,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 2.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.7,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.9,
pad_right: 1.4,
pad_top: 0.1,
pad_bottom: 0.0,
),
"arrows_spacer": Blank(
width: 14.5,
height: 0.0,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.4,
pad_bottom: 0.1,
),
"numpad_tall": Led(
width: 1.0,
height: 2.2,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: -1.2,
),
"numpad_wide": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Spacing, "rog_spacer"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Del, "func_key"),
(NumPadPause, "func_key"),
(NumPadPrtSc, "func_key"),
(NumPadHome, "func_key"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(NumLock, "regular"),
(FwdSlash, "regular"),
(Star, "regular"),
(Hyphen, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "bkslash"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(NumPadPlus, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(NumPadEnter, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular2"),
(Meta, "regular2"),
(LAlt, "regular2"),
(Spacebar, "spacebar"),
(RAlt, "regular2"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
(N0, "numpad_wide"),
(NumPadDel, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -0,0 +1,281 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular2": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.2,
pad_bottom: 0.1,
),
"func_key": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.1,
),
"func_space": Blank(
width: 0.5,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 1.2,
height: 0.0,
),
"backspace": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bkslash": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 1.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.3,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.5,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.7,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows_spacer": Blank(
width: 16.6,
height: 0.0,
),
"numpad_tall": Led(
width: 1.0,
height: 2.2,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: -1.2,
),
"right_wide": Led(
width: 2.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Del, "func_key"),
(NumPadPause, "func_key"),
(NumPadPrtSc, "func_key"),
(NumPadHome, "func_key"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(NumLock, "regular"),
(FwdSlash, "regular"),
(Star, "regular"),
(Hyphen, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "bkslash"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(NumPadPlus, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "right_wide"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(NumPadEnter, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(RAlt, "regular"),
(RAlt, "regular"),
(RCtrl, "right_wide"),
(Up, "regular"),
(N0, "regular"),
(NumPadDel, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "regular2"),
(Down, "regular2"),
(Right, "regular2"),
],
),
],
)

View File

@@ -0,0 +1,312 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular_spacing": Blank(
width: 1.2,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.6,
),
"rog_row_blocking": Blank(
width: 1.2,
height: 0.0,
),
"func_space": Blank(
width: 0.6,
height: 0.0,
),
"backspace": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backslash": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 3.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.1,
pad_right: 1.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows_spacer": Blank(
width: 15.0,
height: 0.0,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.1,
pad_bottom: 0.1,
),
"row_end_spacing": Blank(
width: 0.4,
height: 0.0,
),
},
key_rows: [
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Blocking, "rog_row_blocking"),
(Blocking, "rog_row_blocking"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogFan, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Esc, "regular"),
(Spacing, "regular_spacing"),
(F1, "regular"),
(F2, "regular"),
(F3, "regular"),
(F4, "regular"),
(Spacing, "func_space"),
(F5, "regular"),
(F6, "regular"),
(F7, "regular"),
(F8, "regular"),
(Spacing, "func_space"),
(F9, "regular"),
(F10, "regular"),
(F11, "regular"),
(F12, "regular"),
(Spacing, "row_end_spacing"),
(Del, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(Spacing, "row_end_spacing"),
(Home, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "backslash"),
(Spacing, "row_end_spacing"),
(PgUp, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(Spacing, "row_end_spacing"),
(PgDn, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(Spacing, "row_end_spacing"),
(End, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(PrtSc, "regular"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
(Spacing, "row_end_spacing"),
(PrtSc, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -1,161 +0,0 @@
matches = [
'G513',
]
locale = "US"
[[rows]]
height = 0.8
row = [
'NormalSpacer',
'FuncSpacer',
'VolDown',
'VolUp',
'MicMute',
'Fan',
'Rog',
]
[[rows]]
height = 0.8
row = [
'Esc',
'FuncSpacer',
'F1',
'F2',
'F3',
'F4',
'FuncSpacer',
'F5',
'F6',
'F7',
'F8',
'FuncSpacer',
'F9',
'F10',
'F11',
'F12',
'RowEndSpacer',
'NumPadDel',
]
[[rows]]
height = 1.0
row = [
'Tilde',
'N1',
'N2',
'N3',
'N4',
'N5',
'N6',
'N7',
'N8',
'N9',
'N0',
'Hyphen',
'Equals',
'BkSpc',
'RowEndSpacer',
'Home',
]
[[rows]]
height = 1.0
row = [
'Tab',
'Q',
'W',
'E',
'R',
'T',
'Y',
'U',
'I',
'O',
'P',
'LBracket',
'RBracket',
'BackSlash',
'RowEndSpacer',
'PgUp',
]
[[rows]]
height = 1.0
row = [
'Caps',
'A',
'S',
'D',
'F',
'G',
'H',
'J',
'K',
'L',
'SemiColon',
'Quote',
'Return',
'RowEndSpacer',
'PgDn',
]
[[rows]]
height = 1.0
row = [
'LShift',
'Z',
'X',
'C',
'V',
'B',
'N',
'M',
'Comma',
'Period',
'FwdSlash',
'Rshift',
'RowEndSpacer',
'End',
]
[[rows]]
height = 1.2
row = [
'LCtrl',
'LFn',
'Meta',
'LAlt',
'Space',
'RAlt',
'PrtSc',
'RCtrl',
'ArrowSpacer',
'Up',
'ArrowSpacer',
'RowEndSpacer',
'RFn',
]
[[rows]]
height = 0.8
row = [
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'ArrowSpacer',
'Left',
'Down',
'Right',
'ArrowSpacer',
]

View File

@@ -0,0 +1,366 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular_spacing": Blank(
width: 1.2,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.6,
),
"rog_row_blocking": Blank(
width: 1.2,
height: 0.0,
),
"func_space": Blank(
width: 0.6,
height: 0.0,
),
"backspace": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backslash": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 3.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.1,
pad_right: 1.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows_spacer": Blank(
width: 15.0,
height: 0.0,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.1,
pad_bottom: 0.1,
),
"row_end_spacing": Blank(
width: 0.4,
height: 0.0,
),
"lightbar_left": Led(
width: 0.4,
height: 3.0,
pad_left: -1.0,
pad_right: 0.1,
pad_top: -2.7,
pad_bottom: 0.1,
),
"lightbar_corner_left": Led(
width: 0.4,
height: 0.4,
pad_left: -0.5,
pad_right: 0.1,
pad_top: 0.5,
pad_bottom: 0.1,
),
"lightbar_bottom": Led(
width: 10.1,
height: 0.4,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.5,
pad_bottom: 0.1,
),
"lightbar_corner_right": Led(
width: 0.4,
height: 0.4,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.5,
pad_bottom: 0.1,
),
"lightbar_right": Led(
width: 0.4,
height: 3.0,
pad_left: -0.5,
pad_right: 0.1,
pad_top: -2.7,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Blocking, "rog_row_blocking"),
(Blocking, "rog_row_blocking"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogFan, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Esc, "regular"),
(Spacing, "regular_spacing"),
(F1, "regular"),
(F2, "regular"),
(F3, "regular"),
(F4, "regular"),
(Spacing, "func_space"),
(F5, "regular"),
(F6, "regular"),
(F7, "regular"),
(F8, "regular"),
(Spacing, "func_space"),
(F9, "regular"),
(F10, "regular"),
(F11, "regular"),
(F12, "regular"),
(Spacing, "row_end_spacing"),
(Del, "regular"), // Should be super/insert
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(Spacing, "row_end_spacing"),
(MediaPlay, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "backslash"),
(Spacing, "row_end_spacing"),
(MediaStop, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(Spacing, "row_end_spacing"),
(MediaNext, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(Spacing, "row_end_spacing"),
(MediaPrev, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(PrtSc, "regular"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
(Spacing, "row_end_spacing"),
(PrtSc, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LightbarLeft, "lightbar_left"),
(LightbarLeftCorner, "lightbar_corner_left"),
(LightbarLeftBottom, "lightbar_bottom"),
(LightbarRightBottom, "lightbar_bottom"),
(LightbarRightCorner, "lightbar_corner_right"),
(LightbarRight, "lightbar_right"),
],
),
],
)

View File

@@ -0,0 +1,366 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular_spacing": Blank(
width: 1.2,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.6,
),
"rog_row_blocking": Blank(
width: 1.2,
height: 0.0,
),
"func_space": Blank(
width: 0.6,
height: 0.0,
),
"backspace": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backslash": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 3.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.1,
pad_right: 1.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows_spacer": Blank(
width: 15.0,
height: 0.0,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.1,
pad_bottom: 0.1,
),
"row_end_spacing": Blank(
width: 0.4,
height: 0.0,
),
"lightbar_left": Led(
width: 0.4,
height: 3.0,
pad_left: -1.0,
pad_right: 0.1,
pad_top: -2.7,
pad_bottom: 0.1,
),
"lightbar_corner_left": Led(
width: 0.4,
height: 0.4,
pad_left: -0.5,
pad_right: 0.1,
pad_top: 0.5,
pad_bottom: 0.1,
),
"lightbar_bottom": Led(
width: 10.1,
height: 0.4,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.5,
pad_bottom: 0.1,
),
"lightbar_corner_right": Led(
width: 0.4,
height: 0.4,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.5,
pad_bottom: 0.1,
),
"lightbar_right": Led(
width: 0.4,
height: 3.0,
pad_left: -0.5,
pad_right: 0.1,
pad_top: -2.7,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Blocking, "rog_row_blocking"),
(Blocking, "rog_row_blocking"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogFan, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Esc, "regular"),
(Spacing, "regular_spacing"),
(F1, "regular"),
(F2, "regular"),
(F3, "regular"),
(F4, "regular"),
(Spacing, "func_space"),
(F5, "regular"),
(F6, "regular"),
(F7, "regular"),
(F8, "regular"),
(Spacing, "func_space"),
(F9, "regular"),
(F10, "regular"),
(F11, "regular"),
(F12, "regular"),
(Spacing, "row_end_spacing"),
(Del, "regular"), // Should be super/insert
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(Spacing, "row_end_spacing"),
(MediaPlay, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "backslash"),
(Spacing, "row_end_spacing"),
(MediaStop, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(Spacing, "row_end_spacing"),
(MediaNext, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(Spacing, "row_end_spacing"),
(MediaPrev, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(PrtSc, "regular"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
(Spacing, "row_end_spacing"),
(PrtSc, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LightbarLeft, "lightbar_left"),
(LightbarLeftCorner, "lightbar_corner_left"),
(LightbarLeftBottom, "lightbar_bottom"),
(LightbarRightBottom, "lightbar_bottom"),
(LightbarRightCorner, "lightbar_corner_right"),
(LightbarRight, "lightbar_right"),
],
),
],
)

View File

@@ -1,135 +0,0 @@
matches = [
'G533',
]
locale = "US"
[[rows]]
height = 0.8
row = [
'NormalSpacer',
'FuncSpacer',
'VolDown',
'VolUp',
'MicMute',
'Fan',
'Rog',
]
[[rows]]
height = 0.8
row = [
'Esc',
'FuncSpacer',
'F1',
'F2',
'F3',
'F4',
'FuncSpacer',
'F5',
'F6',
'F7',
'F8',
'FuncSpacer',
'F9',
'F10',
'F11',
'F12',
'Del',
]
[[rows]]
height = 1.0
row = [
'Tilde',
'N1',
'N2',
'N3',
'N4',
'N5',
'N6',
'N7',
'N8',
'N9',
'N0',
'Hyphen',
'Equals',
'BkSpc',
'MediaPlay',
]
[[rows]]
height = 1.0
row = [
'Tab',
'Q',
'W',
'E',
'R',
'T',
'Y',
'U',
'I',
'O',
'P',
'LBracket',
'RBracket',
'BackSlash',
'MediaStop',
]
[[rows]]
height = 1.0
row = [
'Caps',
'A',
'S',
'D',
'F',
'G',
'H',
'J',
'K',
'L',
'SemiColon',
'Quote',
'Return',
'MediaPrev',
]
[[rows]]
height = 1.0
row = [
'LShift',
'Z',
'X',
'C',
'V',
'B',
'N',
'M',
'Comma',
'Period',
'FwdSlash',
'RshiftSmall',
'UpRegular',
'MediaNext',
]
[[rows]]
height = 1.0
row = [
'LCtrlMed',
'LFn',
'Meta',
'LAlt',
'Space',
'RAlt',
'PrtSc',
'RCtrl',
'ArrowRegularSpacer',
'LeftRegular',
'DownRegular',
'RightRegular',
]

View File

@@ -0,0 +1,293 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular_spacing": Blank(
width: 1.2,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.6,
),
"rog_row_blocking": Blank(
width: 1.2,
height: 0.0,
),
"func_space": Blank(
width: 0.6,
height: 0.0,
),
"backspace": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backslash": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 1.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrow_space": Blank(
width: 0.8,
height: 0.0,
),
},
key_rows: [
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Blocking, "rog_row_blocking"),
(Blocking, "rog_row_blocking"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogFan, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Esc, "regular"),
(Spacing, "regular_spacing"),
(F1, "regular"),
(F2, "regular"),
(F3, "regular"),
(F4, "regular"),
(Spacing, "func_space"),
(F5, "regular"),
(F6, "regular"),
(F7, "regular"),
(F8, "regular"),
(Spacing, "func_space"),
(F9, "regular"),
(F10, "regular"),
(F11, "regular"),
(F12, "regular"),
(Del, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(MediaPlay, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "backslash"),
(MediaStop, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(MediaPrev, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(Up, "up_arrow"),
(MediaNext, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(PrtSc, "regular"),
(RCtrl, "rctrl"),
(Spacing, "arrow_space"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -0,0 +1,294 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular_spacing": Blank(
width: 1.2,
height: 0.0,
),
"rog_row_blocking": Blank(
width: 1.2,
height: 0.0,
),
"func_space": Blank(
width: 0.6,
height: 0.0,
),
"backspace": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backslash": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 3.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 1.0,
height: 1.0,
pad_left: 1.0,
pad_right: 1.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows_spacer": Blank(
width: 14.7,
height: 0.0,
),
"arrows": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Blocking, "rog_row_blocking"),
(Blocking, "rog_row_blocking"),
(VolDown, "regular"),
(VolUp, "regular"),
(MicMute, "regular"),
(RogFan, "regular"),
(RogApp, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Esc, "regular"),
(Spacing, "regular_spacing"),
(F1, "regular"),
(F2, "regular"),
(F3, "regular"),
(F4, "regular"),
(Spacing, "func_space"),
(F5, "regular"),
(F6, "regular"),
(F7, "regular"),
(F8, "regular"),
(Spacing, "func_space"),
(F9, "regular"),
(F10, "regular"),
(F11, "regular"),
(F12, "regular"),
(Del, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(Home, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "backslash"),
(PgUp, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(PgDn, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
(End, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(PrtSc, "regular"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
(RFn, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -1,154 +0,0 @@
matches = [
'GA401',
'GA402',
'GU603',
'GV301',
'GA502',
'GA503',
]
locale = "US"
[[rows]]
height = 0.8
row = [
'NormalSpacer',
'FuncSpacer',
'VolDown',
'VolUp',
'MicMute',
'Rog',
]
[[rows]]
height = 0.8
row = [
'Esc',
'FuncSpacer',
'F1',
'F2',
'F3',
'F4',
'FuncSpacer',
'F5',
'F6',
'F7',
'F8',
'FuncSpacer',
'F9',
'F10',
'F11',
'F12',
]
[[rows]]
height = 1.0
row = [
'Tilde',
'N1',
'N2',
'N3',
'N4',
'N5',
'N6',
'N7',
'N8',
'N9',
'N0',
'Hyphen',
'Equals',
'BkSpc',
]
[[rows]]
height = 1.0
row = [
'Tab',
'Q',
'W',
'E',
'R',
'T',
'Y',
'U',
'I',
'O',
'P',
'LBracket',
'RBracket',
'BackSlash',
]
[[rows]]
height = 1.0
row = [
'Caps',
'A',
'S',
'D',
'F',
'G',
'H',
'J',
'K',
'L',
'SemiColon',
'Quote',
'Return',
]
[[rows]]
height = 1.0
row = [
'LShift',
'Z',
'X',
'C',
'V',
'B',
'N',
'M',
'Comma',
'Period',
'FwdSlash',
'Rshift',
]
[[rows]]
height = 1.2
row = [
'LCtrl',
'LFn',
'Meta',
'LAlt',
'Space',
'RAlt',
'PrtSc',
'RCtrl',
'ArrowSpacer',
'Up',
'ArrowSpacer',
]
[[rows]]
height = 0.8
row = [
'FuncSpacer',
'FuncSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'Left',
'Down',
'Right',
'ArrowSpacer',
]

View File

@@ -0,0 +1,299 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular2": Led(
width: 1.0,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rog_spacer": Blank(
width: 2.5,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.2,
pad_bottom: 0.5,
),
"func_key": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.1,
),
"func_space": Blank(
width: 0.2,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 0.6,
height: 0.0,
),
"backspace": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bkslash": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift": Led(
width: 3.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.8,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rctrl": Led(
width: 1.2,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 1.0,
height: 0.6,
pad_left: 1.6,
pad_right: 1.6,
pad_top: 0.1,
pad_bottom: 0.0,
),
"arrows_spacer": Blank(
width: 14.1,
height: 0.0,
),
"arrows": Led(
width: 1.0,
height: 0.6,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.7,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Spacing, "rog_spacer"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Spacing, "func_space"),
(Del, "func_key"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "bkslash"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "rshift"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular2"),
(Meta, "regular2"),
(LAlt, "regular2"),
(Spacebar, "spacebar"),
(RAlt, "regular2"),
(RCtrl, "rctrl"),
(Up, "up_arrow"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -0,0 +1,305 @@
(
locale: "US",
key_shapes: {
"rog_row_spacing": Blank(
width: 1.2,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.2,
pad_bottom: 0.6,
),
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"regular2": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.2,
pad_bottom: 0.1,
),
"func_key": Led(
width: 1.0,
height: 0.7,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.1,
),
"func_space": Blank(
width: 0.5,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 1.2,
height: 0.0,
),
"backspace": Led(
width: 2.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bkslash": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 1.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return": Led(
width: 2.3,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.5,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lctrl": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar": Led(
width: 5.7,
height: 1.3,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows_spacer": Blank(
width: 16.6,
height: 0.0,
),
"numpad_tall": Led(
width: 1.0,
height: 2.2,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: -1.2,
),
"right_wide": Led(
width: 2.9,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Blocking, "rog_row_spacing"),
(Blocking, "rog_row_spacing"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Del, "func_key"),
(NumPadPause, "func_key"),
(NumPadPrtSc, "func_key"),
(NumPadHome, "func_key"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tilde, "regular"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace, "backspace"),
(NumLock, "regular"),
(FwdSlash, "regular"),
(Star, "regular"),
(Hyphen, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "bkslash"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(NumPadPlus, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return, "return"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift, "right_wide"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(NumPadEnter, "numpad_tall"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(LCtrl, "lctrl"),
(LFn, "regular"),
(Meta, "regular"),
(LAlt, "regular"),
(Spacebar, "spacebar"),
(RAlt, "regular"),
(RAlt, "regular"),
(RAlt, "regular"),
(RCtrl, "right_wide"),
(Up, "regular"),
(N0, "regular"),
(NumPadDel, "regular"),
],
),
(
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
row: [
(Spacing, "arrows_spacer"),
(Left, "regular2"),
(Down, "regular2"),
(Right, "regular2"),
],
),
],
)

View File

@@ -1,180 +0,0 @@
matches = [
'GL504',
]
locale = "US"
[[rows]]
height = 0.8
row = [
'NormalSpacer',
'FuncSpacer',
'VolDown',
'VolUp',
'MicMute',
'Rog',
]
[[rows]]
height = 0.8
row = [
'Esc',
'FuncSpacer',
'F1',
'F2',
'F3',
'F4',
'FuncSpacer',
'F5',
'F6',
'F7',
'F8',
'FuncSpacer',
'F9',
'F10',
'F11',
'F12',
'RowEndSpacer',
'Del',
'NumPadPause',
'NumPadPrtSc',
'NumPadHome',
]
[[rows]]
height = 1.0
row = [
'Tilde',
'N1',
'N2',
'N3',
'N4',
'N5',
'N6',
'N7',
'N8',
'N9',
'N0',
'Hyphen',
'Equals',
'BkSpc',
'RowEndSpacer',
'NumLock',
'FwdSlash',
'Star',
'Hyphen',
]
[[rows]]
height = 1.0
row = [
'Tab',
'Q',
'W',
'E',
'R',
'T',
'Y',
'U',
'I',
'O',
'P',
'LBracket',
'RBracket',
'BackSlash',
'RowEndSpacer',
'N7',
'N8',
'N9',
'NumPadPlus',
]
[[rows]]
height = 1.0
row = [
'Caps',
'A',
'S',
'D',
'F',
'G',
'H',
'J',
'K',
'L',
'SemiColon',
'Quote',
'Return',
'RowEndSpacer',
'N4',
'N5',
'N6',
'NumPadPlus',
]
[[rows]]
height = 1.0
row = [
'LShift',
'Z',
'X',
'C',
'V',
'B',
'N',
'M',
'Comma',
'Period',
'FwdSlash',
'Rshift',
'RowEndSpacer',
'N1',
'N2',
'N3',
'NumPadEnter',
]
[[rows]]
height = 1.0
row = [
'LCtrl',
'LFn',
'Meta',
'LAlt',
'Space',
'RAlt',
'RFn',
'RFn',
'RCtrlLarge',
'RowEndSpacer',
'UpRegular',
'N0',
'NumPadDel',
'NumPadEnter',
]
[[rows]]
height = 1.0
row = [
'FuncSpacer',
'FuncSpacer',
'FuncSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'LeftRegular',
'RowEndSpacer',
'DownRegular',
'RightRegular',
'NormalSpacer',
]

View File

@@ -0,0 +1,382 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bottom_row": Led(
width: 1.0,
height: 1.2,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rog_row_spacing": Blank(
width: 0.9,
height: 0.0,
),
"rog_row": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.2,
pad_bottom: 0.4,
),
"func_key": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.4,
),
"func_space": Blank(
width: 0.7,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 0.6,
height: 0.0,
),
"end_space": Blank(
width: 0.4,
height: 0.0,
),
"ctrl_bkslash": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tilde": Led(
width: 0.7,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
// The backspace button is composed of 3 individual LED
"backspace1": Led(
width: 0.7,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backspace2": Led(
width: 0.7,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backspace3": Led(
width: 0.7,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return1": Led(
width: 0.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return2": Led(
width: 0.8,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return3": Led(
width: 0.8,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift1": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift2": Led(
width: 1.0,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift3": Led(
width: 1.0,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar_left": Led(
width: 1.1,
height: 1.4,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar_mid": Led(
width: 1.2,
height: 1.4,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar_right": Led(
width: 1.1,
height: 1.4,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.2,
pad_right: 1.2,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.5,
pad_bottom: 0.1,
),
"arrow_row_blocking": Blank(
width: 1.115,
height: 0.0,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Blocking, "rog_row_spacing"),
(Blocking, "rog_row_spacing"),
(VolDown, "rog_row"),
(VolUp, "rog_row"),
(MicMute, "rog_row"),
(RogApp, "rog_row"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(Spacing, "end_space"),
(Del, "func_key"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Tilde, "tilde"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace3_1, "backspace1"),
(Backspace3_2, "backspace2"),
(Backspace3_3, "backspace3"),
(Spacing, "end_space"),
(Home, "regular"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "ctrl_bkslash"),
(Spacing, "end_space"),
(PgUp, "regular"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return3_1, "return1"),
(Return3_2, "return2"),
(Return3_3, "return3"),
(Spacing, "end_space"),
(PgDn, "regular"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift3_1, "rshift1"),
(Rshift3_2, "rshift2"),
(Rshift3_3, "rshift3"),
(Spacing, "end_space"),
(End, "regular"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(LCtrl, "bottom_row"),
(LFn, "bottom_row"),
(Meta, "bottom_row"),
(LAlt, "bottom_row"),
(Spacebar5_1, "spacebar_left"),
(Spacebar5_2, "spacebar_mid"),
(Spacebar5_3, "spacebar_mid"),
(Spacebar5_4, "spacebar_mid"),
(Spacebar5_5, "spacebar_right"),
(RAlt, "bottom_row"),
(PrtSc, "bottom_row"),
(RCtrl, "bottom_row"),
(Up, "up_arrow"),
(Spacing, "end_space"),
(RFn, "bottom_row"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

View File

@@ -1,172 +0,0 @@
matches = [
'GX502',
'GU502',
]
locale = "US"
[[rows]]
height = 0.8
row = [
'NormalSpacer',
'FuncSpacer',
'VolDown',
'VolUp',
'MicMute',
'Rog',
]
[[rows]]
height = 0.8
row = [
'Esc',
'FuncSpacer',
'F1',
'F2',
'F3',
'F4',
'FuncSpacer',
'F5',
'F6',
'F7',
'F8',
'FuncSpacer',
'F9',
'F10',
'F11',
'F12',
'RowEndSpacer',
'Del',
]
[[rows]]
height = 1.0
row = [
'Tilde',
'N1',
'N2',
'N3',
'N4',
'N5',
'N6',
'N7',
'N8',
'N9',
'N0',
'Hyphen',
'Equals',
'BkSpc3_1',
'BkSpc3_2',
'BkSpc3_3',
'RowEndSpacer',
'Home',
]
[[rows]]
height = 1.0
row = [
'Tab',
'Q',
'W',
'E',
'R',
'T',
'Y',
'U',
'I',
'O',
'P',
'LBracket',
'RBracket',
'BackSlash',
'RowEndSpacer',
'PgUp',
]
[[rows]]
height = 1.0
row = [
'Caps',
'A',
'S',
'D',
'F',
'G',
'H',
'J',
'K',
'L',
'SemiColon',
'Quote',
'Return3_1',
'Return3_2',
'Return3_3',
'RowEndSpacer',
'PgDn',
]
[[rows]]
height = 1.0
row = [
'LShift',
'Z',
'X',
'C',
'V',
'B',
'N',
'M',
'Comma',
'Period',
'FwdSlash',
'Rshift3_1',
'Rshift3_2',
'Rshift3_3',
'RowEndSpacer',
'End',
]
[[rows]]
height = 1.2
row = [
'LCtrl',
'LFn',
'Meta',
'LAlt',
'Space5_1',
'Space5_2',
'Space5_3',
'Space5_4',
'Space5_5',
'RAlt',
'PrtSc',
'RCtrl',
'ArrowSpacer',
'Up',
'ArrowSpacer',
'RowEndSpacer',
'RFn',
]
[[rows]]
height = 0.8
row = [
'FuncSpacer',
'FuncSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'NormalSpacer',
'Left',
'Down',
'Right',
'ArrowSpacer',
]

View File

@@ -0,0 +1,346 @@
(
locale: "US",
key_shapes: {
"regular": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"bottom_row": Led(
width: 1.0,
height: 1.2,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"func_key": Led(
width: 1.0,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.0,
pad_bottom: 0.4,
),
"func_space": Blank(
width: 0.7,
height: 0.0,
),
"esc_func_spacing": Blank(
width: 0.6,
height: 0.0,
),
"ctrl_bkslash": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tilde": Led(
width: 0.7,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"tab": Led(
width: 1.4,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"capsplonk": Led(
width: 1.6,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
// The backspace button is composed of 3 individual LED
"backspace1": Led(
width: 0.7,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backspace2": Led(
width: 0.7,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"backspace3": Led(
width: 0.7,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return1": Led(
width: 0.8,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return2": Led(
width: 0.8,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"return3": Led(
width: 0.8,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"lshift": Led(
width: 2.2,
height: 1.0,
pad_left: 0.1,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift1": Led(
width: 1.0,
height: 1.0,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift2": Led(
width: 1.0,
height: 1.0,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"rshift3": Led(
width: 1.0,
height: 1.0,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar_left": Led(
width: 1.1,
height: 1.4,
pad_left: 0.1,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar_mid": Led(
width: 1.2,
height: 1.4,
pad_left: 0.0,
pad_right: 0.0,
pad_top: 0.1,
pad_bottom: 0.1,
),
"spacebar_right": Led(
width: 1.1,
height: 1.4,
pad_left: 0.0,
pad_right: 0.1,
pad_top: 0.1,
pad_bottom: 0.1,
),
"up_arrow": Led(
width: 0.8,
height: 0.8,
pad_left: 1.2,
pad_right: 1.2,
pad_top: 0.1,
pad_bottom: 0.1,
),
"arrows": Led(
width: 0.8,
height: 0.8,
pad_left: 0.1,
pad_right: 0.1,
pad_top: -0.5,
pad_bottom: 0.1,
),
"arrow_row_blocking": Blank(
width: 1.115,
height: 0.0,
),
},
key_rows: [
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Esc, "func_key"),
(Spacing, "esc_func_spacing"),
(F1, "func_key"),
(F2, "func_key"),
(F3, "func_key"),
(F4, "func_key"),
(Spacing, "func_space"),
(F5, "func_key"),
(F6, "func_key"),
(F7, "func_key"),
(F8, "func_key"),
(Spacing, "func_space"),
(F9, "func_key"),
(F10, "func_key"),
(F11, "func_key"),
(F12, "func_key"),
(RogApp, "func_key"),
(RogApp, "func_key"),
(Pause, "func_key"),
(PgDn, "func_key"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Tilde, "tilde"),
(N1, "regular"),
(N2, "regular"),
(N3, "regular"),
(N4, "regular"),
(N5, "regular"),
(N6, "regular"),
(N7, "regular"),
(N8, "regular"),
(N9, "regular"),
(N0, "regular"),
(Hyphen, "regular"),
(Equals, "regular"),
(Backspace3_1, "backspace1"),
(Backspace3_2, "backspace2"),
(Backspace3_3, "backspace3"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Tab, "tab"),
(Q, "regular"),
(W, "regular"),
(E, "regular"),
(R, "regular"),
(T, "regular"),
(Y, "regular"),
(U, "regular"),
(I, "regular"),
(O, "regular"),
(P, "regular"),
(LBracket, "regular"),
(RBracket, "regular"),
(BackSlash, "ctrl_bkslash"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Caps, "capsplonk"),
(A, "regular"),
(S, "regular"),
(D, "regular"),
(F, "regular"),
(G, "regular"),
(H, "regular"),
(J, "regular"),
(K, "regular"),
(L, "regular"),
(SemiColon, "regular"),
(Quote, "regular"),
(Return3_1, "return1"),
(Return3_2, "return2"),
(Return3_3, "return3"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(LShift, "lshift"),
(Z, "regular"),
(X, "regular"),
(C, "regular"),
(V, "regular"),
(B, "regular"),
(N, "regular"),
(M, "regular"),
(Comma, "regular"),
(Period, "regular"),
(FwdSlash, "regular"),
(Rshift3_1, "rshift1"),
(Rshift3_2, "rshift2"),
(Rshift3_3, "rshift3"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(LCtrl, "bottom_row"),
(LFn, "bottom_row"),
(Meta, "bottom_row"),
(LAlt, "bottom_row"),
(Spacebar5_1, "spacebar_left"),
(Spacebar5_2, "spacebar_mid"),
(Spacebar5_3, "spacebar_mid"),
(Spacebar5_4, "spacebar_mid"),
(Spacebar5_5, "spacebar_right"),
(RAlt, "bottom_row"),
(PrtSc, "bottom_row"),
(RCtrl, "bottom_row"),
(Up, "up_arrow"),
],
),
(
pad_left: 0.1,
pad_top: 0.1,
row: [
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Blocking, "arrow_row_blocking"),
(Left, "arrows"),
(Down, "arrows"),
(Right, "arrows"),
],
),
],
)

Binary file not shown.

576
rog-aura/src/advanced.rs Normal file
View File

@@ -0,0 +1,576 @@
use log::warn;
use serde::{Deserialize, Serialize};
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
/// The `LedCode` used in setting up keyboard layouts is important because it
/// determines the idexing for an RGB value in the final USB packets (for
/// per-key addressable keyboards).
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
pub enum LedCode {
VolUp,
VolDown,
MicMute,
#[default]
RogApp,
RogFan,
Esc,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
Del,
Tilde,
N1,
N2,
N3,
N4,
N5,
N6,
N7,
N8,
N9,
N0,
Hyphen,
Equals,
Backspace,
/// For keyboards where the backspace button has 3 LED
Backspace3_1,
Backspace3_2,
Backspace3_3,
Home,
Tab,
Q,
W,
E,
R,
T,
Y,
U,
I,
O,
P,
LBracket,
RBracket,
BackSlash,
PgUp,
Caps,
A,
S,
D,
F,
G,
H,
J,
K,
L,
SemiColon,
Quote,
Return,
/// For keyboards where the return button has 3 LED
Return3_1,
Return3_2,
Return3_3,
PgDn,
LShift,
/// For keyboards where the left shift button has 3 LED
LShift3_1,
LShift3_2,
LShift3_3,
Z,
X,
C,
V,
B,
N,
M,
Comma,
Period,
FwdSlash,
Star,
NumPadDel,
NumPadPlus,
NumPadEnter,
NumPadPause,
NumPadPrtSc,
NumPadHome,
NumLock,
Rshift,
Rshift3_1,
Rshift3_2,
Rshift3_3,
End,
LCtrl,
LFn,
Meta,
LAlt,
Spacebar,
/// For keyboards where the spacebar button has 5 LED
Spacebar5_1,
Spacebar5_2,
Spacebar5_3,
Spacebar5_4,
Spacebar5_5,
Pause,
RAlt,
PrtSc,
RCtrl,
Up,
Down,
Left,
Right,
RFn,
MediaPlay,
MediaStop,
MediaNext,
MediaPrev,
LidLogo,
LidLeft,
LidRight,
/// Used by per-key and multizoned
LightbarRight,
/// Used by per-key and multizoned
LightbarRightCorner,
/// Used by per-key and multizoned
LightbarRightBottom,
/// Used by per-key and multizoned
LightbarLeftBottom,
/// Used by per-key and multizoned
LightbarLeftCorner,
/// Used by per-key and multizoned
LightbarLeft,
/// Use if the keyboard supports only a single zone. This zone uses the same
/// packet data as the `Zoned*` below
SingleZone,
/// Use if the keyboard supports 4 zones, this is the left zone
ZonedKbLeft,
/// Use if the keyboard supports 4 zones, this is the left-center zone
ZonedKbLeftMid,
/// Use if the keyboard supports 4 zones, this is the right-center zone
ZonedKbRightMid,
/// Use if the keyboard supports 4 zones, this is the right zone
ZonedKbRight,
/// To be ignored by effects
Spacing,
/// To be ignored by effects
Blocking,
}
impl LedCode {
pub fn is_placeholder(&self) -> bool {
matches!(self, Self::Spacing | Self::Blocking)
}
pub fn is_keyboard_zone(&self) -> bool {
matches!(
self,
Self::ZonedKbLeft | Self::ZonedKbLeftMid | Self::ZonedKbRightMid | Self::ZonedKbRight
)
}
pub fn is_lightbar_zone(&self) -> bool {
matches!(
self,
Self::LightbarLeft
| Self::LightbarLeftCorner
| Self::LightbarLeftBottom
| Self::LightbarRightBottom
| Self::LightbarRightCorner
| Self::LightbarRight
)
}
}
/// Represents the per-key raw USB packets
pub type UsbPackets = Vec<Vec<u8>>;
/// A `UsbPackets` contains all data to change the full set of keyboard
/// key colours individually.
///
/// Each row of the internal array is a full HID packet that can be sent
/// to the keyboard EC. One row controls one group of keys, these keys are not
/// necessarily all on the same row of the keyboard, with some splitting between
/// two rows.
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct LedUsbPackets {
/// The packet data used to send data to the USB keyboard
usb_packets: UsbPackets,
/// Wether or not this packet collection is zoned. The determines which
/// starting bytes are used and what the indexing is for lightbar RGB
/// colours
zoned: bool,
}
impl Default for LedUsbPackets {
fn default() -> Self {
Self::new_per_key()
}
}
impl LedUsbPackets {
/// Set up a series of per-key packets. This includes setting all the
/// required starting bytes per packet, but does not set any colours.
///
/// These packets will not work with per-zone keyboards
pub fn new_per_key() -> Self {
let mut set = vec![vec![0u8; 64]; 11];
// set[0].copy_from_slice(&KeyColourArray::get_init_msg());
for (count, row) in set.iter_mut().enumerate() {
row[0] = 0x5d; // Report ID
row[1] = 0xbc; // Mode = custom??, 0xb3 is builtin
row[2] = 0x00;
row[3] = 0x01; // ??
row[4] = 0x01; // ??, 4,5,6 are normally RGB for builtin mode colours
row[5] = 0x01; // ??
row[6] = (count as u8) << 4; // Key group
if count == 10 {
row[7] = 0x08; // 0b00001000
} else {
row[7] = 0x10; // 0b00010000 addressing? flips for group a0
}
row[8] = 0x00;
}
Self {
usb_packets: set,
zoned: false,
}
}
/// Create new zoned packets. Although the result is a nested `Vec` only the
/// first vector is available. The final packet is slightly different
/// for single-zoned compared to multizoned.
///
/// This packet will not work with per-key keyboards
///
/// Wireshark captures show:
/// ```ignore
/// 5d,bc,01,01,00,00,00,00,00,ff,00,00, RED, single zone
/// 5d,bc,01,01,04,00,00,00,00,ff,00,00, RED, multizone
/// ```
pub fn new_zoned(multizoned: bool) -> Self {
let mut pkt = vec![0u8; 64];
pkt[0] = 0x5d; // Report ID
pkt[1] = 0xbc; // Mode = custom??, 0xb3 is builtin
pkt[2] = 0x01;
pkt[3] = 0x01; // ??
if !multizoned {
pkt[4] = 0x00; // This doesn't actually seem to matter on this
// keyboard?
} else {
pkt[4] = 0x04; // ??, 4,5,6 are normally RGB for builtin mode
// colours
}
Self {
usb_packets: vec![pkt],
zoned: true,
}
}
/// Initialise and clear the keyboard for custom effects, this must be done
/// for every time mode switches from builtin to custom
#[inline]
pub const fn get_init_msg() -> [u8; 64] {
let mut init = [0u8; 64];
init[0] = 0x5d; // Report ID
init[1] = 0xbc; // Mode = custom??, 0xb3 is builtin
init
}
/// Set the RGB colour of an `LedCode`
#[inline]
pub fn set(&mut self, key: LedCode, r: u8, g: u8, b: u8) {
if let Some(c) = self.rgb_for_led_code(key) {
c[0] = r;
c[1] = g;
c[2] = b;
}
}
/// Indexes in to `UsbPackets` at the correct row and column
/// to set a series of three bytes to the chosen R,G,B values
///
/// Indexing is different for `zoned` and assumes that only one packet is
/// generated for all the zones
fn rgb_for_led_code(&mut self, led_code: LedCode) -> Option<&mut [u8]> {
let zoned = self.zoned;
// Tuples are indexes in to array
let (row, col) = match led_code {
LedCode::VolDown => (0, 15),
LedCode::VolUp => (0, 18),
LedCode::MicMute => (0, 21),
LedCode::RogApp => (0, 24),
//
LedCode::Esc => (1, 24),
LedCode::F1 => (1, 30),
LedCode::F2 => (1, 33),
LedCode::F3 => (1, 36),
LedCode::F4 => (1, 39),
LedCode::F5 => (1, 45),
LedCode::F6 => (1, 48),
LedCode::F7 => (1, 51),
LedCode::F8 => (1, 54),
//
LedCode::F9 => (2, 12),
LedCode::F10 => (2, 15),
LedCode::F11 => (2, 18),
LedCode::F12 => (2, 21),
LedCode::Del => (2, 24),
LedCode::Tilde => (2, 39),
LedCode::N1 => (2, 42),
LedCode::N2 => (2, 45),
LedCode::N3 => (2, 48),
LedCode::N4 => (2, 51),
LedCode::N5 => (2, 54),
//
LedCode::N6 => (3, 9),
LedCode::N7 => (3, 12),
LedCode::N8 => (3, 15),
LedCode::N9 => (3, 18),
LedCode::N0 => (3, 21),
LedCode::Hyphen => (3, 24),
LedCode::Equals => (3, 27),
LedCode::Backspace3_1 => (3, 30),
LedCode::Backspace3_2 => (3, 33),
LedCode::Backspace3_3 => (3, 36),
LedCode::Home => (3, 39),
LedCode::Tab => (3, 54),
//
LedCode::Q => (4, 9),
LedCode::W => (4, 12),
LedCode::E => (4, 15),
LedCode::R => (4, 18),
LedCode::T => (4, 21),
LedCode::Y => (4, 24),
LedCode::U => (4, 27),
LedCode::I => (4, 30),
LedCode::O => (4, 33),
LedCode::P => (4, 36),
LedCode::LBracket => (4, 39),
LedCode::RBracket => (4, 42),
LedCode::BackSlash => (4, 45),
LedCode::PgUp => (4, 54),
//
LedCode::Caps => (5, 21),
LedCode::A => (5, 24),
LedCode::S => (5, 27),
LedCode::D => (5, 30),
LedCode::F => (5, 33),
LedCode::G => (5, 36),
LedCode::H => (5, 39),
LedCode::J => (5, 42),
LedCode::K => (5, 45),
LedCode::L => (5, 48),
LedCode::SemiColon => (5, 51),
LedCode::Quote => (5, 54),
//
LedCode::Return => (6, 9),
LedCode::Return3_1 => (6, 12),
LedCode::Return3_2 => (6, 15),
LedCode::Return3_3 => (6, 18),
LedCode::PgDn => (6, 21),
LedCode::LShift => (6, 36),
// TODO: Find correct locations
LedCode::LShift3_1 => (6, 36),
LedCode::LShift3_2 => (6, 36),
LedCode::LShift3_3 => (6, 36),
LedCode::Z => (6, 42),
LedCode::X => (6, 45),
LedCode::C => (6, 48),
LedCode::V => (6, 51),
LedCode::B => (6, 54),
//
LedCode::N => (7, 9),
LedCode::M => (7, 12),
LedCode::Comma => (7, 15),
LedCode::Period => (7, 18),
LedCode::FwdSlash => (7, 21),
LedCode::Rshift => (7, 24),
LedCode::Rshift3_1 => (7, 27),
LedCode::Rshift3_2 => (7, 30),
LedCode::Rshift3_3 => (7, 33),
LedCode::End => (7, 36),
LedCode::LCtrl => (7, 51),
LedCode::LFn => (7, 54),
//
LedCode::Meta => (8, 9),
LedCode::LAlt => (8, 12),
LedCode::Spacebar5_1 => (8, 15),
LedCode::Spacebar5_2 => (8, 18),
LedCode::Spacebar5_3 => (8, 21),
LedCode::Spacebar5_4 => (8, 24),
LedCode::Spacebar5_5 => (8, 27),
LedCode::RAlt => (8, 30),
LedCode::PrtSc => (8, 33),
LedCode::RCtrl => (8, 36),
LedCode::Up => (8, 42),
LedCode::RFn => (8, 51),
//
LedCode::Left => (9, 54),
//
LedCode::Down => (10, 9),
LedCode::Right => (10, 12),
LedCode::LidLogo => (11, 9),
LedCode::LidLeft => (11, 36),
LedCode::LidRight => (11, 39),
//
LedCode::SingleZone | LedCode::ZonedKbLeft => (0, 9),
LedCode::ZonedKbLeftMid => (0, 12),
LedCode::ZonedKbRightMid => (0, 15),
LedCode::ZonedKbRight => (0, 18),
LedCode::LightbarRight => if zoned {(0, 27)} else { (11, 15)},
LedCode::LightbarRightCorner => if zoned {(0, 30)} else {(11, 18)},
LedCode::LightbarRightBottom => if zoned {(0, 33)} else{(11, 21)},
LedCode::LightbarLeftBottom => if zoned {(0, 36)} else{(11, 24)},
LedCode::LightbarLeftCorner => if zoned {(0, 39)} else{(11, 27)},
LedCode::LightbarLeft => if zoned {(0, 42)} else{(11, 30)},
//
LedCode::Spacing
| LedCode::Blocking
// TODO: the addressing of the following
| LedCode::MediaPlay
| LedCode::MediaStop
| LedCode::MediaPrev
| LedCode::MediaNext
| LedCode::Pause
| LedCode::NumLock
| LedCode::Star
| LedCode::NumPadDel
| LedCode::NumPadPlus
| LedCode::NumPadEnter
| LedCode::NumPadPause
| LedCode::NumPadPrtSc
| LedCode::NumPadHome
| LedCode::RogFan
| LedCode::Spacebar
| LedCode::Backspace => return None,
};
if self.zoned && row > 0 {
warn!(
"LedCode {led_code:?} for zoned is not correct or out of Zone range. Setting to 0",
);
return None;
}
Some(&mut self.usb_packets[row][col..=col + 2])
}
#[inline]
pub fn get(&self) -> UsbPackets {
self.usb_packets.clone()
}
#[inline]
pub fn get_ref(&self) -> &UsbPackets {
&self.usb_packets
}
#[inline]
pub fn get_mut(&mut self) -> &mut UsbPackets {
&mut self.usb_packets
}
}
impl From<LedUsbPackets> for UsbPackets {
fn from(k: LedUsbPackets) -> Self {
k.usb_packets
}
}
#[cfg(test)]
mod tests {
use crate::advanced::{LedCode, LedUsbPackets, UsbPackets};
macro_rules! colour_check_zoned {
($zone:expr, $pkt_idx_start:expr) => {
let mut zone = LedUsbPackets::new_zoned(true);
let c = zone.rgb_for_led_code($zone).unwrap();
c[0] = 255;
c[1] = 255;
c[2] = 255;
let pkt: UsbPackets = zone.into();
assert_eq!(pkt[0][$pkt_idx_start], 0xff);
assert_eq!(pkt[0][$pkt_idx_start + 1], 0xff);
assert_eq!(pkt[0][$pkt_idx_start + 2], 0xff);
};
}
#[test]
fn zone_to_packet_check() {
let zone = LedUsbPackets::new_zoned(true);
let pkt: UsbPackets = zone.into();
assert_eq!(pkt[0][0], 0x5d);
assert_eq!(pkt[0][1], 0xbc);
assert_eq!(pkt[0][2], 0x01);
assert_eq!(pkt[0][3], 0x01);
assert_eq!(pkt[0][4], 0x04);
colour_check_zoned!(LedCode::ZonedKbLeft, 9);
colour_check_zoned!(LedCode::ZonedKbLeftMid, 12);
colour_check_zoned!(LedCode::ZonedKbRightMid, 15);
colour_check_zoned!(LedCode::ZonedKbRight, 18);
colour_check_zoned!(LedCode::LightbarRight, 27);
colour_check_zoned!(LedCode::LightbarRightCorner, 30);
colour_check_zoned!(LedCode::LightbarRightBottom, 33);
colour_check_zoned!(LedCode::LightbarLeftBottom, 36);
colour_check_zoned!(LedCode::LightbarLeftCorner, 39);
colour_check_zoned!(LedCode::LightbarLeft, 42);
}
#[test]
fn perkey_to_packet_check() {
let per_key = LedUsbPackets::new_per_key();
let pkt: UsbPackets = per_key.into();
assert_eq!(pkt[0][0], 0x5d);
assert_eq!(pkt[0][1], 0xbc);
assert_eq!(pkt[0][2], 0x00);
assert_eq!(pkt[0][3], 0x01);
assert_eq!(pkt[0][4], 0x01);
assert_eq!(pkt[0][5], 0x01);
let mut per_key = LedUsbPackets::new_per_key();
let c = per_key.rgb_for_led_code(LedCode::D).unwrap();
c[0] = 255;
c[1] = 255;
c[2] = 255;
let c = per_key.rgb_for_led_code(LedCode::O).unwrap();
c[0] = 255;
c[1] = 255;
c[2] = 255;
let c = per_key.rgb_for_led_code(LedCode::N0).unwrap();
c[0] = 255;
c[1] = 255;
c[2] = 255;
let c = per_key.rgb_for_led_code(LedCode::M).unwrap();
c[0] = 255;
c[1] = 255;
c[2] = 255;
let pkt: UsbPackets = per_key.into();
assert_eq!(pkt[5][30], 0xff); // D, red
assert_eq!(pkt[5][31], 0xff); // D
assert_eq!(pkt[5][32], 0xff); // D
assert_eq!(pkt[5][33], 0x00); // D
assert_eq!(pkt[4][33], 0xff); // O, red
assert_eq!(pkt[4][34], 0xff); // O
assert_eq!(pkt[4][35], 0xff); // O
assert_eq!(pkt[4][36], 0x00); // O
assert_eq!(pkt[7][12], 0xff); // M, red
assert_eq!(pkt[7][13], 0xff); // M
assert_eq!(pkt[7][14], 0xff); // M
assert_eq!(pkt[7][15], 0x00); // M
}
}

View File

@@ -0,0 +1,148 @@
use crate::advanced::LedCode;
impl From<LedCode> for &str {
fn from(k: LedCode) -> Self {
(&k).into()
}
}
impl From<&LedCode> for &str {
fn from(k: &LedCode) -> Self {
match k {
LedCode::VolUp => "Volume Up",
LedCode::VolDown => "Volume Down",
LedCode::MicMute => "Mute Mic",
LedCode::RogApp => "ROG",
LedCode::RogFan => "Fan Control",
LedCode::Esc => "Escape",
LedCode::F1 => "F1",
LedCode::F2 => "F2",
LedCode::F3 => "F3",
LedCode::F4 => "F4",
LedCode::F5 => "F5",
LedCode::F6 => "F6",
LedCode::F7 => "F7",
LedCode::F8 => "F8",
LedCode::F9 => "F9",
LedCode::F10 => "F10",
LedCode::F11 => "F11",
LedCode::F12 => "F12",
LedCode::Del => "Delete",
LedCode::Tilde => "Tilde",
LedCode::N1 => "1",
LedCode::N2 => "2",
LedCode::N3 => "3",
LedCode::N4 => "4",
LedCode::N5 => "5",
LedCode::N6 => "6",
LedCode::N7 => "7",
LedCode::N8 => "8",
LedCode::N9 => "9",
LedCode::N0 => "0",
LedCode::Hyphen => "-",
LedCode::Equals => "=",
LedCode::Backspace => "Backspace",
LedCode::Backspace3_1 => "Backspace LED 1",
LedCode::Backspace3_2 => "Backspace LED 2",
LedCode::Backspace3_3 => "Backspace LED 3",
LedCode::Home => "Home",
LedCode::Tab => "Tab",
LedCode::Q => "Q",
LedCode::W => "W",
LedCode::E => "E",
LedCode::R => "R",
LedCode::T => "T",
LedCode::Y => "Y",
LedCode::U => "U",
LedCode::I => "I",
LedCode::O => "O",
LedCode::P => "P",
LedCode::LBracket => "[",
LedCode::RBracket => "]",
LedCode::BackSlash => "\\",
LedCode::PgUp => "Page Up",
LedCode::Caps => "Caps Lock",
LedCode::A => "A",
LedCode::S => "S",
LedCode::D => "D",
LedCode::F => "F",
LedCode::G => "G",
LedCode::H => "H",
LedCode::J => "J",
LedCode::K => "K",
LedCode::L => "L",
LedCode::SemiColon => ";",
LedCode::Quote => "'",
LedCode::Return => "Return",
LedCode::Return3_1 => "Return LED 1",
LedCode::Return3_2 => "Return LED 2",
LedCode::Return3_3 => "Return LED 3",
LedCode::PgDn => "Page Down",
LedCode::LShift => "Left Shift",
LedCode::LShift3_1 => "Left Shift LED 1",
LedCode::LShift3_2 => "Left Shift LED 2",
LedCode::LShift3_3 => "Left Shift LED 3",
LedCode::Z => "Z",
LedCode::X => "X",
LedCode::C => "C",
LedCode::V => "V",
LedCode::B => "B",
LedCode::N => "N",
LedCode::M => "M",
LedCode::Comma => ",",
LedCode::Period => ".",
LedCode::Star => "*",
LedCode::NumPadDel => "Delete",
LedCode::NumPadPlus => "+",
LedCode::NumPadEnter => "Enter",
LedCode::NumPadPause => "Pause",
LedCode::NumPadPrtSc => "Print Screen",
LedCode::NumPadHome => "Home",
LedCode::NumLock => "Num-Lock",
LedCode::FwdSlash => "/",
LedCode::Rshift => "Right Shift",
LedCode::Rshift3_1 => "Right Shift LED 1",
LedCode::Rshift3_2 => "Right Shift LED 2",
LedCode::Rshift3_3 => "Right Shift LED 3",
LedCode::End => "End",
LedCode::LCtrl => "Left Control",
LedCode::LFn => "Left Fn",
LedCode::Meta => "Meta",
LedCode::LAlt => "Left Alt",
LedCode::Spacebar => "Space",
LedCode::Spacebar5_1 => "Space LED 1",
LedCode::Spacebar5_2 => "Space LED 2",
LedCode::Spacebar5_3 => "Space LED 3",
LedCode::Spacebar5_4 => "Space LED 4",
LedCode::Spacebar5_5 => "Space LED 5",
LedCode::RAlt => "Right Alt",
LedCode::PrtSc => "Print Screen",
LedCode::RCtrl => "Right Control",
LedCode::Pause => "Pause",
LedCode::Up => "Up",
LedCode::Down => "Down",
LedCode::Left => "Left",
LedCode::Right => "Right",
LedCode::RFn => "Right Fn",
LedCode::MediaPlay => "Media Play",
LedCode::MediaStop => "Media Stop",
LedCode::MediaNext => "Media Next",
LedCode::MediaPrev => "Media Previous",
LedCode::LidLogo => "Lid Logo",
LedCode::LidLeft => "Lid Left",
LedCode::LidRight => "Lid Right",
LedCode::LightbarRight => "Lightbar Right",
LedCode::LightbarRightCorner => "Lightbar Right Corner",
LedCode::LightbarRightBottom => "Lightbar Right Bottom",
LedCode::LightbarLeftBottom => "Lightbar Left Bottom",
LedCode::LightbarLeftCorner => "Lightbar Left Corner",
LedCode::LightbarLeft => "Lightbar Left",
LedCode::Spacing | LedCode::Blocking => "",
LedCode::SingleZone => "Single Zoned Keyboard",
LedCode::ZonedKbLeft => "Left Zone (zone 1)",
LedCode::ZonedKbLeftMid => "Center-left Zone (zone 2)",
LedCode::ZonedKbRightMid => "Center-right Zone (zone 3)",
LedCode::ZonedKbRight => "Right Zone (zone 4)",
}
}
}

View File

@@ -0,0 +1,189 @@
use std::fs::OpenOptions;
use std::io::Read;
use log::{error, info, warn};
use serde_derive::{Deserialize, Serialize};
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
pub const ASUS_LED_MODE_CONF: &str = "/usr/share/asusd/aura_support.ron";
pub const ASUS_LED_MODE_USER_CONF: &str = "/etc/asusd/asusd_user_ledmodes.ron";
pub const ASUS_KEYBOARD_DEVICES: [&str; 4] = ["1866", "1869", "1854", "19b6"];
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct LedSupportFile(Vec<LaptopLedData>);
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
pub struct LaptopLedData {
/// Found via `cat /sys/class/dmi/id/board_name`, e.g `GU603ZW`.
/// The match doesn't have to be the complete model number as it is
/// typically broken down such:
/// - GU = product
/// - 603 = model/platform
/// - Z = variant/year or perhaps dGPU model (such as RTX 3xxx)
/// - W = possibly dGPU model (such as RTX 3060Ti)
pub board_name: String,
pub layout_name: String,
pub basic_modes: Vec<AuraModeNum>,
pub basic_zones: Vec<AuraZone>,
pub advanced_type: AdvancedAuraType,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct LaptopLedData456 {
pub prod_family: String,
pub board_names: Vec<String>,
pub standard: Vec<AuraModeNum>,
pub multizone: Vec<AuraZone>,
pub per_key: bool,
}
impl LaptopLedData {
pub fn get_data() -> Self {
let dmi = sysfs_class::DmiId::default();
let board_name = dmi.board_name().expect("Could not get board_name");
// let prod_family = dmi.product_family().expect("Could not get
// product_family");
if let Some(modes) = LedSupportFile::load_from_config() {
if let Some(data) = modes.matcher(&board_name) {
return data;
}
}
info!("Using generic LED control for keyboard brightness only");
LaptopLedData::default()
}
}
impl LedSupportFile {
pub fn get(&self) -> &[LaptopLedData] {
&self.0
}
/// The list is stored in ordered format, so the iterator must be reversed
/// to ensure we match to *whole names* first before doing a glob match
pub fn matcher(self, board_name: &str) -> Option<LaptopLedData> {
for config in self.0.iter().rev() {
if board_name.contains(&config.board_name) {
info!("LedSupport: Matched to {}", config.board_name);
return Some(config.clone());
}
}
None
}
pub fn load_from_config() -> Option<Self> {
let mut loaded = false;
let mut data = LedSupportFile::default();
// Load user configs first so they are first to be checked
if let Ok(mut file) = OpenOptions::new().read(true).open(ASUS_LED_MODE_USER_CONF) {
let mut buf = String::new();
if let Ok(l) = file.read_to_string(&mut buf) {
if l == 0 {
warn!("{} is empty", ASUS_LED_MODE_USER_CONF);
} else {
if let Ok(mut tmp) = ron::from_str::<LedSupportFile>(&buf) {
data.0.append(&mut tmp.0);
}
info!(
"Loaded user-defined LED support data from {}",
ASUS_LED_MODE_USER_CONF
);
}
}
}
// Load and append the default LED support data
if let Ok(mut file) = OpenOptions::new().read(true).open(ASUS_LED_MODE_CONF) {
let mut buf = String::new();
if let Ok(l) = file.read_to_string(&mut buf) {
if l == 0 {
warn!("{} is empty", ASUS_LED_MODE_CONF);
} else {
let mut tmp: LedSupportFile = ron::from_str(&buf)
.map_err(|e| error!("{e}"))
.unwrap_or_else(|_| panic!("Could not deserialise {}", ASUS_LED_MODE_CONF));
data.0.append(&mut tmp.0);
loaded = true;
info!(
"Loaded default LED support data from {}",
ASUS_LED_MODE_CONF
);
}
}
}
data.0.sort_by(|a, b| a.board_name.cmp(&b.board_name));
if loaded {
return Some(data);
}
warn!("Does {} exist?", ASUS_LED_MODE_USER_CONF);
None
}
}
#[cfg(test)]
mod tests {
use std::fs::OpenOptions;
use std::io::{Read, Write};
use std::path::PathBuf;
use ron::ser::PrettyConfig;
use super::LaptopLedData;
use crate::advanced::LedCode;
use crate::aura_detection::LedSupportFile;
// use crate::zoned::Zone;
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
#[test]
fn check_data_parse() {
let led = LaptopLedData {
board_name: "Test".to_owned(),
layout_name: "ga401".to_owned(),
basic_modes: vec![AuraModeNum::Static],
basic_zones: vec![AuraZone::Key1, AuraZone::Logo, AuraZone::BarLeft],
advanced_type: AdvancedAuraType::Zoned(vec![LedCode::LightbarRight]),
};
assert!(ron::to_string(&led).is_ok());
// assert_eq!(json, String::new());
}
#[test]
fn check_data_file_parse() {
let mut data = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
data.push("data/aura_support.ron");
let mut file = OpenOptions::new().read(true).open(&data).unwrap();
let mut buf = String::new();
file.read_to_string(&mut buf).unwrap();
let tmp = ron::from_str::<LedSupportFile>(&buf).unwrap();
// Ensure the data is sorted
let mut tmp_sort = tmp.clone();
tmp_sort.0.sort_by(|a, b| a.board_name.cmp(&b.board_name));
if tmp != tmp_sort {
let sorted =
ron::ser::to_string_pretty(&tmp_sort, PrettyConfig::new().depth_limit(2)).unwrap();
let mut file = OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(&data)
.unwrap();
file.write_all(sorted.as_bytes()).unwrap();
panic!(
"aura_support.ron not sorted, should be {sorted}. File rewritten with correct \
order, run test again"
)
}
let my_config = PrettyConfig::new().depth_limit(2);
println!(
"RON: {}",
ron::ser::to_string_pretty(&tmp, my_config).unwrap()
);
}
}

View File

@@ -4,12 +4,15 @@ pub const LED_INIT3: [u8; 6] = [0x5d, 0x05, 0x20, 0x31, 0, 0x08];
pub const LED_INIT4: &str = "^ASUS Tech.Inc."; // ^ == 0x5e
pub const LED_INIT5: [u8; 6] = [0x5e, 0x05, 0x20, 0x31, 0, 0x08];
use std::fmt::Display;
use std::str::FromStr;
use serde_derive::{Deserialize, Serialize};
use std::{fmt::Display, str::FromStr};
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
use crate::{error::Error, LED_MSG_LEN};
use crate::error::Error;
use crate::LED_MSG_LEN;
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
@@ -280,8 +283,8 @@ impl FromStr for AuraZone {
}
}
/// Default factory modes structure. This easily converts to an USB HID packet with:
/// ```rust
/// Default factory modes structure. This easily converts to an USB HID packet
/// with: ```rust
/// // let bytes: [u8; LED_MSG_LEN] = mode.into();
/// ```
#[cfg_attr(feature = "dbus", derive(Type))]
@@ -366,8 +369,8 @@ impl AuraParameters {
}
impl AuraEffect {
/// A helper to provide detail on what effects have which parameters, e.g the static
/// factory mode accepts only one colour.
/// A helper to provide detail on what effects have which parameters, e.g
/// the static factory mode accepts only one colour.
pub const fn allowed_parameters(mode: AuraModeNum) -> AuraParameters {
match mode {
AuraModeNum::Static

View File

@@ -0,0 +1,33 @@
use super::{EffectState, InputForEffect};
use crate::advanced::LedCode;
use crate::Colour;
pub struct InputBased {
address: LedCode,
colour: Colour,
/// - audio
/// - cpu freq
/// - temperature
/// - fan speed
/// - time
input: Box<dyn InputForEffect>,
}
impl EffectState for InputBased {
fn next_colour_state(&mut self, _layout: &crate::layouts::KeyLayout) {
self.input.next_colour_state();
self.colour = self.input.get_colour();
}
fn get_colour(&self) -> Colour {
self.colour
}
fn get_led(&self) -> LedCode {
self.address
}
fn set_led(&mut self, address: LedCode) {
self.address = address
}
}

View File

@@ -0,0 +1,82 @@
use serde::{Deserialize, Serialize};
use super::EffectState;
use crate::advanced::LedCode;
use crate::layouts::KeyLayout;
use crate::{effect_state_impl, Colour, Speed};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Breathe {
address: LedCode,
/// The starting colour
start_colour1: Colour,
/// The secondary starting colour
start_colour2: Colour,
/// The speed at which to cycle between the colours
speed: Speed,
/// Temporary data to help keep state
#[serde(skip)]
colour: Colour,
#[serde(skip)]
count_flipped: bool,
#[serde(skip)]
use_colour1: bool,
}
impl Breathe {
pub fn new(address: LedCode, colour1: Colour, colour2: Colour, speed: Speed) -> Self {
Self {
address,
start_colour1: colour1,
start_colour2: colour2,
speed,
colour: colour1,
count_flipped: false,
use_colour1: true,
}
}
}
impl EffectState for Breathe {
effect_state_impl!();
fn next_colour_state(&mut self, _layout: &KeyLayout) {
let Self {
start_colour1: colour1,
start_colour2: colour2,
speed,
colour: colour_actual,
count_flipped: flipped,
use_colour1,
..
} = self;
let speed = 4 - <u8>::from(*speed);
if *colour_actual == Colour(0, 0, 0) {
*use_colour1 = !*use_colour1;
}
let colour = if !*use_colour1 { colour2 } else { colour1 };
let r1_scale = colour.0 / speed / 2;
let g1_scale = colour.1 / speed / 2;
let b1_scale = colour.2 / speed / 2;
if *colour_actual == Colour(0, 0, 0) {
*flipped = true;
} else if colour_actual >= colour {
*flipped = false;
}
if !*flipped {
colour_actual.0 = colour_actual.0.saturating_sub(r1_scale);
colour_actual.1 = colour_actual.1.saturating_sub(g1_scale);
colour_actual.2 = colour_actual.2.saturating_sub(b1_scale);
} else {
colour_actual.0 = colour_actual.0.saturating_add(r1_scale);
colour_actual.1 = colour_actual.1.saturating_add(g1_scale);
colour_actual.2 = colour_actual.2.saturating_add(b1_scale);
}
}
}

View File

@@ -0,0 +1,164 @@
use serde::{Deserialize, Serialize};
use crate::advanced::LedCode;
use crate::effects::{p_random, EffectState};
use crate::layouts::KeyLayout;
use crate::{effect_state_impl, Colour};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DoomFlicker {
address: LedCode,
start_colour: Colour,
max_percentage: u8,
min_percentage: u8,
#[serde(skip)]
count: u8,
#[serde(skip)]
colour: Colour,
}
impl DoomFlicker {
pub fn new(address: LedCode, colour: Colour, max_percentage: u8, min_percentage: u8) -> Self {
Self {
address,
colour,
count: 4,
max_percentage,
min_percentage,
start_colour: colour,
}
}
}
impl EffectState for DoomFlicker {
effect_state_impl!();
fn next_colour_state(&mut self, _layout: &KeyLayout) {
let Self {
max_percentage,
min_percentage,
colour,
start_colour,
..
} = self;
if self.count == 0 {
self.count = 4;
}
self.count -= 1;
if self.count != 0 {
return;
}
// TODO: make a "percentage" method on Colour.
let max_light = Colour(
(start_colour.0 as f32 / 100.0 * *max_percentage as f32) as u8,
(start_colour.1 as f32 / 100.0 * *max_percentage as f32) as u8,
(start_colour.2 as f32 / 100.0 * *max_percentage as f32) as u8,
);
// min light is a percentage of the set colour
let min_light = Colour(
(start_colour.0 as f32 / 100.0 * *min_percentage as f32) as u8,
(start_colour.1 as f32 / 100.0 * *min_percentage as f32) as u8,
(start_colour.2 as f32 / 100.0 * *min_percentage as f32) as u8,
);
// Convert the 255 to percentage
let amount = (p_random() & 7) as f32 * 8.0;
let set_colour = |colour: &mut u8, max: f32, min: f32| {
let pc = amount / max * 100.0;
let min_amount = pc * min / 100.0; // percentage of min colour
let max_amount = pc * max / 100.0; // percentage of max colour
if *colour as f32 - min_amount < min {
*colour = min as u8;
} else {
*colour = (max - max_amount) as u8;
}
};
set_colour(&mut colour.0, max_light.0 as f32, min_light.0 as f32);
set_colour(&mut colour.1, max_light.1 as f32, min_light.1 as f32);
set_colour(&mut colour.2, max_light.2 as f32, min_light.2 as f32);
self.count = 4;
}
}
pub struct LightFlash {
pub count: i32,
pub max_light: i32,
pub min_light: i32,
pub max_time: i32,
pub min_time: i32,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DoomLightFlash {
address: LedCode,
start_colour: Colour,
max_percentage: u8,
min_percentage: u8,
#[serde(skip)]
max_time: i32,
#[serde(skip)]
min_time: i32,
#[serde(skip)]
count: u8,
#[serde(skip)]
colour: Colour,
}
impl DoomLightFlash {
pub fn new(address: LedCode, colour: Colour, max_percentage: u8, min_percentage: u8) -> Self {
Self {
address,
colour,
count: 4,
max_percentage,
min_percentage,
start_colour: colour,
max_time: 32,
min_time: 7,
}
}
}
impl EffectState for DoomLightFlash {
effect_state_impl!();
fn next_colour_state(&mut self, _layout: &KeyLayout) {
let Self {
max_percentage,
min_percentage,
colour,
start_colour,
..
} = self;
self.count -= 1;
if self.count != 0 {
return;
}
// TODO: make a "percentage" method on Colour.
let max_light = Colour(
(start_colour.0 as f32 / 100.0 * *max_percentage as f32) as u8,
(start_colour.1 as f32 / 100.0 * *max_percentage as f32) as u8,
(start_colour.2 as f32 / 100.0 * *max_percentage as f32) as u8,
);
// min light is a percentage of the set colour
let min_light = Colour(
(start_colour.0 as f32 / 100.0 * *min_percentage as f32) as u8,
(start_colour.1 as f32 / 100.0 * *min_percentage as f32) as u8,
(start_colour.2 as f32 / 100.0 * *min_percentage as f32) as u8,
);
if *colour == max_light {
*colour = min_light;
self.count = ((p_random() & self.min_time) + 1) as u8;
} else {
*colour = max_light;
self.count = ((p_random() & self.max_time) + 1) as u8;
}
}
}

291
rog-aura/src/effects/mod.rs Normal file
View File

@@ -0,0 +1,291 @@
use serde_derive::{Deserialize, Serialize};
mod doom;
pub use doom::*;
mod base;
pub use base::*;
mod breathe;
pub use breathe::*;
mod static_;
pub use static_::*;
use crate::advanced::{LedCode, LedUsbPackets, UsbPackets};
use crate::layouts::KeyLayout;
use crate::Colour;
// static mut RNDINDEX: usize = 0;
static mut PRNDINDEX: usize = 0;
/// Pseudo random table ripped straight out of room4doom
pub const RNDTABLE: [i32; 256] = [
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66, 74, 21, 211, 47, 80, 242, 154,
27, 205, 128, 161, 89, 77, 36, 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188,
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224, 149, 104, 25, 178, 252, 182,
202, 182, 141, 197, 4, 81, 181, 242, 145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175,
249, 0, 175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235, 25, 92, 20, 145, 138,
77, 69, 166, 78, 176, 173, 212, 166, 113, 94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37,
171, 75, 136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196, 135, 106, 63, 197, 195,
86, 96, 203, 113, 101, 170, 247, 181, 113, 80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112,
166, 103, 241, 24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224, 145, 224, 81,
206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95, 28, 139, 123, 98, 125, 196, 15, 70, 194, 253,
54, 14, 109, 226, 71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36, 17, 46, 52,
231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106, 197, 242, 98, 43, 39, 175, 254, 145, 190,
84, 118, 222, 187, 136, 120, 163, 236, 249,
];
pub fn p_random() -> i32 {
unsafe {
PRNDINDEX = (PRNDINDEX + 1) & 0xff;
RNDTABLE[PRNDINDEX]
}
}
pub trait InputForEffect {
/// Calculate the next colour state
fn next_colour_state(&mut self);
/// Return the resulting colour. Implementers should store the colour to
/// return it.
fn get_colour(&self) -> Colour;
}
pub(crate) trait EffectState {
/// Calculate the next colour state
fn next_colour_state(&mut self, _layout: &KeyLayout);
/// Return the resulting colour. Implementers should store the colour to
/// return it.
fn get_colour(&self) -> Colour;
fn get_led(&self) -> LedCode;
fn set_led(&mut self, address: LedCode);
}
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct AdvancedEffects {
effects: Vec<Effect>,
zoned: bool,
}
impl AdvancedEffects {
#[inline]
pub fn new(zoned: bool) -> Self {
Self {
effects: Default::default(),
zoned,
}
}
#[inline]
pub fn push(&mut self, action: Effect) {
self.effects.push(action);
}
#[inline]
pub fn insert(&mut self, index: usize, action: Effect) {
self.effects.insert(index, action);
}
/// Remove an item at this position from the run buffer. If the `index`
/// supplied is not in range then `None` is returned, otherwise the
/// `ActionData` at that location is yeeted and returned.
#[inline]
pub fn remove_item(&mut self, index: usize) -> Option<Effect> {
if index < self.effects.len() {
return Some(self.effects.remove(index));
}
None
}
pub fn next_state(&mut self, layout: &KeyLayout) {
for effect in &mut self.effects {
effect.next_state(layout);
}
}
pub fn create_packets(&self) -> UsbPackets {
let mut usb_packets = if self.zoned {
// TODO: figure out if that single byte difference for multizone actually
// matters
LedUsbPackets::new_zoned(true)
} else {
LedUsbPackets::new_per_key()
};
for effect in &self.effects {
let c = effect.colour();
usb_packets.set(effect.led(), c.0, c.1, c.2);
}
usb_packets.into()
}
}
// how to be lazy
#[macro_export]
macro_rules! effect_state_impl {
() => {
fn get_colour(&self) -> $crate::Colour {
self.colour
}
fn get_led(&self) -> $crate::advanced::LedCode {
self.address.clone()
}
/// Change the led type
fn set_led(&mut self, address: $crate::advanced::LedCode) {
self.address = address;
}
};
}
/// A helper macro to quickly add new effects to the matching on `Effect`
macro_rules! effect_impl {
($($effect:ident),*) => {
impl Effect {
/// Get the type of LED set
pub fn led(&self) -> $crate::advanced::LedCode {
match self {
$(Effect::$effect(c) => c.get_led(),)*
}
}
/// Change the led type (can be used to change location of the effect)
pub fn set_led(&mut self, address: $crate::advanced::LedCode) {
match self {
$(Effect::$effect(c) => c.set_led(address),)*
}
}
/// Calculate the next state of the effect
pub fn next_state(&mut self, layout: &KeyLayout) {
match self {
$(Effect::$effect(c) => c.next_colour_state(layout),)*
}
}
/// Get the calculated colour
pub fn colour(&self) -> $crate::Colour {
match self {
$(Effect::$effect(c) => c.get_colour(),)*
}
}
}
};
}
/// The main effect container, a sequencer will call various methods on this to
/// update states and get colours
///
/// Every effect is added here to quickly and easily match within `Effect`
#[derive(Debug, Clone, Deserialize, Serialize)]
pub enum Effect {
Static(Static),
Breathe(Breathe),
DoomFlicker(DoomFlicker),
DoomLightFlash(DoomLightFlash),
}
impl Default for Effect {
fn default() -> Self {
Self::Static(Static::new(LedCode::default(), Colour::default()))
}
}
effect_impl!(Static, Breathe, DoomFlicker, DoomLightFlash);
#[cfg(test)]
mod tests {
use crate::advanced::LedCode;
use crate::effects::{AdvancedEffects, Breathe, DoomFlicker, Effect, Static};
use crate::layouts::KeyLayout;
use crate::{Colour, Speed};
#[test]
fn single_key_next_state_then_create() {
let layout = KeyLayout::default_layout();
let mut seq = AdvancedEffects::new(false);
seq.effects
.push(Effect::Static(Static::new(LedCode::F, Colour(255, 127, 0))));
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 255);
assert_eq!(packets[5][34], 127);
assert_eq!(packets[5][35], 0);
}
#[test]
fn cycle_breathe() {
let layout = KeyLayout::default_layout();
let mut seq = AdvancedEffects::new(false);
seq.effects.push(Effect::Breathe(Breathe::new(
LedCode::F,
Colour(255, 127, 0),
Colour(127, 0, 255),
Speed::Med,
)));
let s =
ron::ser::to_string_pretty(&seq, ron::ser::PrettyConfig::new().depth_limit(4)).unwrap();
println!("{s}");
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 213);
assert_eq!(packets[5][34], 106);
assert_eq!(packets[5][35], 0);
// dbg!(&packets[5][33..=35]);
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 171);
assert_eq!(packets[5][34], 85);
assert_eq!(packets[5][35], 0);
}
#[test]
fn cycle_flicker() {
let layout = KeyLayout::default_layout();
let mut seq = AdvancedEffects::new(false);
seq.effects.push(Effect::DoomFlicker(DoomFlicker::new(
LedCode::F,
Colour(255, 127, 80),
100,
10,
)));
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 255);
assert_eq!(packets[5][34], 127);
assert_eq!(packets[5][35], 80);
// The random is deterministic
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[5][33], 215);
assert_eq!(packets[5][34], 87);
assert_eq!(packets[5][35], 40);
}
}

View File

@@ -0,0 +1,25 @@
use serde::{Deserialize, Serialize};
use super::EffectState;
use crate::advanced::LedCode;
use crate::layouts::KeyLayout;
use crate::{effect_state_impl, Colour};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Static {
address: LedCode,
/// The starting colour
colour: Colour,
}
impl Static {
pub fn new(address: LedCode, colour: Colour) -> Self {
Self { address, colour }
}
}
impl EffectState for Static {
effect_state_impl!();
fn next_colour_state(&mut self, _layout: &KeyLayout) {}
}

View File

@@ -1,5 +1,4 @@
use std::error;
use std::fmt;
use std::{error, fmt};
#[derive(Debug)]
pub enum Error {
@@ -7,8 +6,9 @@ pub enum Error {
ParseSpeed,
ParseDirection,
ParseBrightness,
Io(std::io::Error),
Toml(toml::de::Error),
IoPath(String, std::io::Error),
Ron(ron::Error),
RonParse(ron::error::SpannedError),
}
impl fmt::Display for Error {
@@ -19,22 +19,23 @@ impl fmt::Display for Error {
Error::ParseSpeed => write!(f, "Could not parse speed"),
Error::ParseDirection => write!(f, "Could not parse direction"),
Error::ParseBrightness => write!(f, "Could not parse brightness"),
Error::Io(io) => write!(f, "IO Error: {io}"),
Error::Toml(e) => write!(f, "TOML Parse Error: {e}"),
Error::IoPath(path, io) => write!(f, "IO Error: {path}, {io}"),
Error::Ron(e) => write!(f, "RON Parse Error: {e}"),
Error::RonParse(e) => write!(f, "RON Parse Error: {e}"),
}
}
}
impl error::Error for Error {}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Self::Io(e)
impl From<ron::Error> for Error {
fn from(e: ron::Error) -> Self {
Self::Ron(e)
}
}
impl From<toml::de::Error> for Error {
fn from(e: toml::de::Error) -> Self {
Self::Toml(e)
impl From<ron::error::SpannedError> for Error {
fn from(e: ron::error::SpannedError) -> Self {
Self::RonParse(e)
}
}

View File

@@ -1,155 +0,0 @@
use crate::keys::Key;
impl From<Key> for &str {
fn from(k: Key) -> Self {
(&k).into()
}
}
impl From<&Key> for &str {
fn from(k: &Key) -> Self {
match k {
Key::VolUp => "Volume Up",
Key::VolDown => "Volume Down",
Key::MicMute => "Mute Mic",
Key::Rog => "ROG",
Key::Fan => "Fan Control",
Key::Esc => "Escape",
Key::F1 => "F1",
Key::F2 => "F2",
Key::F3 => "F3",
Key::F4 => "F4",
Key::F5 => "F5",
Key::F6 => "F6",
Key::F7 => "F7",
Key::F8 => "F8",
Key::F9 => "F9",
Key::F10 => "F10",
Key::F11 => "F11",
Key::F12 => "F12",
Key::Del => "Delete",
Key::Tilde => "Tilde",
Key::N1 => "1",
Key::N2 => "2",
Key::N3 => "3",
Key::N4 => "4",
Key::N5 => "5",
Key::N6 => "6",
Key::N7 => "7",
Key::N8 => "8",
Key::N9 => "9",
Key::N0 => "0",
Key::Hyphen => "-",
Key::Equals => "=",
Key::BkSpc => "Backspace",
Key::BkSpc3_1 => "Backspace LED 1",
Key::BkSpc3_2 => "Backspace LED 2",
Key::BkSpc3_3 => "Backspace LED 3",
Key::Home => "Home",
Key::Tab => "Tab",
Key::Q => "Q",
Key::W => "W",
Key::E => "E",
Key::R => "R",
Key::T => "T",
Key::Y => "Y",
Key::U => "U",
Key::I => "I",
Key::O => "O",
Key::P => "P",
Key::LBracket => "[",
Key::RBracket => "]",
Key::BackSlash => "\\",
Key::PgUp => "Page Up",
Key::Caps => "Caps Lock",
Key::A => "A",
Key::S => "S",
Key::D => "D",
Key::F => "F",
Key::G => "G",
Key::H => "H",
Key::J => "J",
Key::K => "K",
Key::L => "L",
Key::SemiColon => ";",
Key::Quote => "'",
Key::Return => "Return",
Key::Return3_1 => "Return LED 1",
Key::Return3_2 => "Return LED 2",
Key::Return3_3 => "Return LED 3",
Key::PgDn => "Page Down",
Key::LShift => "Left Shift",
Key::LShift3_1 => "Left Shift LED 1",
Key::LShift3_2 => "Left Shift LED 2",
Key::LShift3_3 => "Left Shift LED 3",
Key::Z => "Z",
Key::X => "X",
Key::C => "C",
Key::V => "V",
Key::B => "B",
Key::N => "N",
Key::M => "M",
Key::Comma => ",",
Key::Period => ".",
Key::Star => "*",
Key::NumPadDel => "Delete",
Key::NumPadPlus => "+",
Key::NumPadEnter => "Enter",
Key::NumPadPause => "Pause",
Key::NumPadPrtSc => "Print Screen",
Key::NumPadHome => "Home",
Key::NumLock => "Num-Lock",
Key::FwdSlash => "/",
Key::Rshift => "Right Shift",
Key::RshiftSmall => "Right Shift",
Key::Rshift3_1 => "Right Shift LED 1",
Key::Rshift3_2 => "Right Shift LED 2",
Key::Rshift3_3 => "Right Shift LED 3",
Key::End => "End",
Key::LCtrl => "Left Control",
Key::LCtrlMed => "Left Control",
Key::LFn => "Left Fn",
Key::Meta => "Meta",
Key::LAlt => "Left Alt",
Key::Space => "Space",
Key::Space5_1 => "Space LED 1",
Key::Space5_2 => "Space LED 2",
Key::Space5_3 => "Space LED 3",
Key::Space5_4 => "Space LED 4",
Key::Space5_5 => "Space LED 5",
Key::RAlt => "Right Alt",
Key::PrtSc => "Print Screen",
Key::RCtrl => "Right Control",
Key::RCtrlLarge => "Right Control",
Key::Pause => "Pause",
Key::Up => "Up",
Key::Down => "Down",
Key::Left => "Left",
Key::Right => "Right",
Key::UpRegular => "Up",
Key::DownRegular => "Down",
Key::LeftRegular => "Left",
Key::RightRegular => "Right",
Key::UpSplit => "Up",
Key::DownSplit => "Down",
Key::LeftSplit => "Left",
Key::RightSplit => "Right",
Key::RFn => "Right Fn",
Key::MediaPlay => "Media Play",
Key::MediaStop => "Media Stop",
Key::MediaNext => "Media Next",
Key::MediaPrev => "Media Previous",
Key::NormalBlank
| Key::NormalSpacer
| Key::FuncBlank
| Key::FuncSpacer
| Key::ArrowBlank
| Key::ArrowSpacer
| Key::ArrowRegularBlank
| Key::ArrowRegularSpacer
| Key::ArrowSplitBlank
| Key::ArrowSplitSpacer
| Key::RowEndSpacer => "",
}
}
}

View File

@@ -1,358 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
pub enum Key {
VolUp,
VolDown,
MicMute,
#[default]
Rog,
Fan,
Esc,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
Del,
Tilde,
N1,
N2,
N3,
N4,
N5,
N6,
N7,
N8,
N9,
N0,
Hyphen,
Equals,
BkSpc,
BkSpc3_1,
BkSpc3_2,
BkSpc3_3,
Home,
Tab,
Q,
W,
E,
R,
T,
Y,
U,
I,
O,
P,
LBracket,
RBracket,
BackSlash,
PgUp,
Caps,
A,
S,
D,
F,
G,
H,
J,
K,
L,
SemiColon,
Quote,
Return,
Return3_1,
Return3_2,
Return3_3,
PgDn,
LShift,
LShift3_1,
LShift3_2,
LShift3_3,
Z,
X,
C,
V,
B,
N,
M,
Comma,
Period,
FwdSlash,
Star,
NumPadDel,
NumPadPlus,
NumPadEnter,
NumPadPause,
NumPadPrtSc,
NumPadHome,
NumLock,
Rshift,
RshiftSmall,
Rshift3_1,
Rshift3_2,
Rshift3_3,
End,
LCtrl,
LCtrlMed,
LFn,
Meta,
LAlt,
Space,
Space5_1,
Space5_2,
Space5_3,
Space5_4,
Space5_5,
Pause,
RAlt,
PrtSc,
RCtrl,
RCtrlLarge,
Up,
Down,
Left,
Right,
UpRegular,
DownRegular,
LeftRegular,
RightRegular,
UpSplit,
DownSplit,
LeftSplit,
RightSplit,
RFn,
MediaPlay,
MediaStop,
MediaNext,
MediaPrev,
NormalBlank,
/// To be ignored by per-key effects
NormalSpacer,
FuncBlank,
/// To be ignored by per-key effects
FuncSpacer,
ArrowBlank,
/// To be ignored by per-key effects
ArrowSpacer,
ArrowRegularBlank,
/// To be ignored by per-key effects
ArrowRegularSpacer,
ArrowSplitBlank,
/// To be ignored by per-key effects
ArrowSplitSpacer,
/// A gap between regular rows and the rightside buttons
RowEndSpacer,
}
impl Key {
pub fn is_placeholder(&self) -> bool {
let shape = KeyShape::from(self);
shape.is_blank() || shape.is_spacer()
}
}
/// Types of shapes of LED on keyboards. The shape is used for visual representations
///
/// A post fix of Spacer *must be ignored by per-key effects
#[derive(Debug, Default, Clone, Copy, Deserialize, Serialize)]
pub enum KeyShape {
Tilde,
#[default]
Normal,
NormalBlank,
NormalSpacer,
Func,
FuncBlank,
FuncSpacer,
Space,
Space5,
LCtrlMed,
LShift,
/// Used in a group of 3 (LED's)
LShift3,
RShift,
RshiftSmall,
/// Used in a group of 3 (LED's)
RShift3,
Return,
Return3,
Tab,
Caps,
Backspace,
/// Used in a group of 3 (LED's)
Backspace3,
Arrow,
ArrowBlank,
ArrowSpacer,
ArrowSplit,
ArrowSplitBlank,
ArrowSplitSpacer,
ArrowRegularBlank,
ArrowRegularSpacer,
RowEndSpacer,
}
impl KeyShape {
pub const fn width(&self) -> f32 {
match self {
Self::Tilde | Self::Arrow => 0.8,
Self::Normal
| Self::NormalBlank
| Self::NormalSpacer
| Self::Func
| Self::FuncBlank
| Self::Space5
| Self::ArrowBlank
| Self::ArrowSpacer
| Self::ArrowSplit
| Self::ArrowSplitBlank
| Self::ArrowSplitSpacer => 1.0,
Self::FuncSpacer => 0.6,
Self::Space => 5.0,
Self::LCtrlMed => 1.1,
Self::LShift | Self::Backspace => 2.0,
Self::LShift3 => 0.67,
Self::RShift => 2.8,
Self::RshiftSmall => 1.8,
Self::RShift3 => 0.93,
Self::Return => 2.2,
Self::Return3 => 0.7333,
Self::Tab => 1.4,
Self::Caps => 1.6,
Self::Backspace3 => 0.666,
Self::ArrowRegularBlank | Self::ArrowRegularSpacer => 0.7,
Self::RowEndSpacer => 0.1,
}
}
/// A blank is used to space keys out in GUI's and can be used or ignored
/// depednign on the per-key effect
pub const fn is_blank(&self) -> bool {
matches!(
self,
Self::NormalBlank
| Self::FuncBlank
| Self::ArrowBlank
| Self::ArrowSplitBlank
| Self::ArrowRegularBlank
)
}
/// A spacer is used to space keys out in GUI's, but ignored in per-key effects
pub const fn is_spacer(&self) -> bool {
matches!(
self,
Self::FuncSpacer
| Self::NormalSpacer
| Self::ArrowSpacer
| Self::ArrowSplitSpacer
| Self::ArrowRegularSpacer
)
}
/// All keys with a postfix of some number
pub const fn is_group(&self) -> bool {
matches!(
self,
Self::LShift3 | Self::RShift3 | Self::Return3 | Self::Space5 | Self::Backspace3
)
}
/// Mostly intended as a helper for signalling when to draw a
/// split/compact arrow cluster
pub const fn is_arrow_cluster(&self) -> bool {
matches!(self, Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer)
}
pub const fn is_arrow_splits(&self) -> bool {
matches!(self, Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer)
}
}
impl From<Key> for KeyShape {
fn from(k: Key) -> Self {
match k {
Key::VolUp
| Key::VolDown
| Key::MicMute
| Key::Rog
| Key::Fan
| Key::Esc
| Key::F1
| Key::F2
| Key::F3
| Key::F4
| Key::F5
| Key::F6
| Key::F7
| Key::F8
| Key::F9
| Key::F10
| Key::F11
| Key::F12
| Key::Del => KeyShape::Func,
Key::Tilde => KeyShape::Tilde,
Key::BkSpc => KeyShape::Backspace,
Key::BkSpc3_1 | Key::BkSpc3_2 | Key::BkSpc3_3 => KeyShape::Backspace3,
Key::Tab | Key::BackSlash => KeyShape::Tab,
Key::Caps => KeyShape::Caps,
Key::Return => KeyShape::Return,
Key::Return3_1 | Key::Return3_2 | Key::Return3_3 => KeyShape::Return3,
Key::LCtrlMed => KeyShape::LCtrlMed,
Key::LShift => KeyShape::LShift,
Key::Rshift | Key::RCtrlLarge => KeyShape::RShift,
Key::RshiftSmall => KeyShape::RshiftSmall,
Key::Rshift3_1 | Key::Rshift3_2 | Key::Rshift3_3 => KeyShape::RShift3,
Key::Space => KeyShape::Space,
Key::Space5_1 | Key::Space5_2 | Key::Space5_3 | Key::Space5_4 | Key::Space5_5 => {
KeyShape::Space5
}
Key::NumPadPause | Key::NumPadPrtSc | Key::NumPadHome | Key::NumPadDel => {
KeyShape::Func
}
Key::NormalBlank => KeyShape::NormalBlank,
Key::NormalSpacer => KeyShape::NormalSpacer,
Key::FuncBlank => KeyShape::FuncBlank,
Key::FuncSpacer => KeyShape::FuncSpacer,
Key::Up | Key::Down | Key::Left | Key::Right => KeyShape::Arrow,
Key::ArrowBlank => KeyShape::ArrowBlank,
Key::ArrowSpacer => KeyShape::ArrowSpacer,
Key::ArrowRegularBlank => KeyShape::ArrowRegularBlank,
Key::ArrowRegularSpacer => KeyShape::ArrowRegularSpacer,
Key::UpSplit | Key::LeftSplit | Key::DownSplit | Key::RightSplit => {
KeyShape::ArrowSplit
}
Key::ArrowSplitBlank => KeyShape::ArrowSplitBlank,
Key::ArrowSplitSpacer => KeyShape::ArrowSplitSpacer,
Key::RowEndSpacer => KeyShape::RowEndSpacer,
_ => KeyShape::Normal,
}
}
}
impl From<&Key> for KeyShape {
fn from(k: &Key) -> Self {
(*k).into()
}
}

554
rog-aura/src/layouts.rs Normal file
View File

@@ -0,0 +1,554 @@
//! A series of pre-defined layouts. These were mostly used to generate an
//! editable config.
use std::collections::{HashMap, HashSet};
use std::fs::{self, OpenOptions};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::slice::Iter;
use log::warn;
use serde::{Deserialize, Serialize};
use crate::advanced::LedCode;
use crate::aura_detection::LaptopLedData;
use crate::error::Error;
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
/// The `key_type` plays a role in effects (eventually). You could for example
/// add a `ShapeType::Spacing` to pad out an effect, such as a laserbeam across
/// a row so that it doesn't appear to *jump* across a gap
///
/// w=1.0, h=1.0 should be considered the size of a typical key like 'A'
#[derive(Debug, Deserialize, Serialize, Clone)]
pub enum KeyShape {
Led {
width: f32,
height: f32,
pad_left: f32,
pad_right: f32,
pad_top: f32,
pad_bottom: f32,
},
Blank {
width: f32,
height: f32,
},
}
impl KeyShape {
pub fn new_led(
width: f32,
height: f32,
pad_left: f32,
pad_right: f32,
pad_top: f32,
pad_bottom: f32,
) -> Self {
Self::Led {
width,
height,
pad_left,
pad_right,
pad_top,
pad_bottom,
}
}
pub fn new_blank(width: f32, height: f32) -> Self {
Self::Blank { width, height }
}
/// Scale the shape up/down. Intended for use in UI on a clone
pub fn scale(&mut self, scale: f32) {
match self {
KeyShape::Led {
width,
height,
pad_left,
pad_right,
pad_top,
pad_bottom,
} => {
*width *= scale;
*height *= scale;
*pad_left *= scale;
*pad_right *= scale;
*pad_top *= scale;
*pad_bottom *= scale;
}
KeyShape::Blank { width, height } => {
*width *= scale;
*height *= scale;
}
}
}
}
/// The first `Key` will determine the row height.
///
/// Every row is considered to start a x=0, with the first row being y=0,
/// and following rows starting after the previous row_y+pad_top and
/// row_x+pad_left
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct KeyRow {
pad_left: f32,
pad_top: f32,
/// The `Key` is what provides an RGB index location in the final USB
/// packets
row: Vec<(LedCode, String)>,
/// The final data structure merged key_shapes and rows
#[serde(skip)]
built_row: Vec<(LedCode, KeyShape)>,
}
impl KeyRow {
pub fn new(pad_left: f32, pad_top: f32, row: Vec<(LedCode, String)>) -> Self {
Self {
pad_left,
pad_top,
row,
built_row: Default::default(),
}
}
pub fn row(&self) -> Iter<'_, (LedCode, KeyShape)> {
self.built_row.iter()
}
pub fn row_ref(&self) -> &[(LedCode, KeyShape)] {
&self.built_row
}
/// Find and return the heightest height of this row
pub fn height(&self) -> f32 {
if self.built_row.is_empty() {
return 0.0;
}
let mut h = 0.0;
for k in &self.built_row {
let height = match &k.1 {
KeyShape::Led {
height,
pad_top,
pad_bottom,
..
} => height + pad_top + pad_bottom,
KeyShape::Blank { height, .. } => *height,
};
if h < height {
h = height
}
}
h
}
/// Return the total row width
pub fn width(&self) -> f32 {
if self.built_row.is_empty() {
return 0.0;
}
let mut w = 0.0;
for k in &self.built_row {
match &k.1 {
KeyShape::Led {
width,
pad_left,
pad_right,
..
} => w += width + pad_left + pad_right,
KeyShape::Blank { width, .. } => w += width,
}
}
w
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct KeyLayout {
/// Localization of this keyboard layout
locale: String,
/// The shapes of keys used
key_shapes: HashMap<String, KeyShape>,
/// The rows of keys of this layout
key_rows: Vec<KeyRow>,
/// Should be copied from the `LaptopLedData` as laptops may have the same
/// layout, but different EC features
#[serde(skip)]
basic_modes: Vec<AuraModeNum>,
/// Should be copied from the `LaptopLedData` as laptops may have the same
/// layout, but different EC features
#[serde(skip)]
basic_zones: Vec<AuraZone>,
/// Paired with the key selection in UI. Determines if individual keys are
/// selectable, zones, or single zone.
///
/// Should be copied from the `LaptopLedData` as laptops may have the same
/// layout, but different EC features.
#[serde(skip)]
advanced_type: AdvancedAuraType,
}
impl KeyLayout {
pub fn from_file(path: &Path) -> Result<Self, Error> {
let mut file = OpenOptions::new()
.read(true)
.open(path)
.map_err(|e| Error::IoPath(path.to_string_lossy().to_string(), e))?;
let mut buf = String::new();
let read_len = file
.read_to_string(&mut buf)
.map_err(|e| Error::IoPath(path.to_string_lossy().to_string(), e))?;
if read_len == 0 {
Err(Error::IoPath(
path.to_string_lossy().to_string(),
std::io::ErrorKind::InvalidData.into(),
))
} else {
let mut data = ron::from_str::<Self>(&buf)?;
let mut unused = HashSet::new();
for k in data.key_shapes.keys() {
unused.insert(k);
}
let rows = &mut data.key_rows;
for row in rows {
for k in &mut row.row {
if let Some(shape) = data.key_shapes.get(&k.1) {
row.built_row.push((k.0, shape.clone()));
unused.remove(&k.1);
} else {
warn!("Key {:?} was missing matching shape {}", k.0, k.1);
}
}
}
if !unused.is_empty() {
warn!("The layout {path:?} had unused shapes {unused:?}",);
}
Ok(data)
}
}
pub fn rows(&self) -> Iter<KeyRow> {
self.key_rows.iter()
}
pub fn rows_ref(&self) -> &[KeyRow] {
&self.key_rows
}
pub fn basic_modes(&self) -> &[AuraModeNum] {
&self.basic_modes
}
pub fn basic_zones(&self) -> &[AuraZone] {
&self.basic_zones
}
pub fn advanced_type(&self) -> &AdvancedAuraType {
&self.advanced_type
}
pub fn max_height(&self) -> f32 {
let mut height = 0.0;
for r in &self.key_rows {
height += r.height();
}
height
}
pub fn max_width(&self) -> f32 {
let mut width = 0.0;
for r in &self.key_rows {
let tmp = r.width();
if width < tmp {
width = tmp
}
}
width
}
/// Find a layout matching the name in `LaptopLedData` in the provided dir
pub fn find_layout(led_data: LaptopLedData, mut data_path: PathBuf) -> Result<Self, Error> {
// TODO: locales
let layout_file = format!("{}_US.ron", led_data.layout_name);
data_path.push("layouts");
data_path.push(layout_file);
let path = data_path.as_path();
let mut tmp = KeyLayout::from_file(path)?;
tmp.basic_modes = led_data.basic_modes;
tmp.basic_zones = led_data.basic_zones;
tmp.advanced_type = led_data.advanced_type;
Ok(tmp)
}
pub fn layout_files(mut data_path: PathBuf) -> Result<Vec<PathBuf>, Error> {
data_path.push("layouts");
let path = data_path.as_path();
let mut files = Vec::new();
fs::read_dir(path)
.map_err(|e| {
println!("{:?}, {e}", path);
e
})
.unwrap()
.for_each(|p| {
if let Ok(p) = p {
files.push(p.path());
}
});
Ok(files)
}
}
impl KeyLayout {
pub fn default_layout() -> Self {
Self {
locale: "US".to_owned(),
basic_modes: vec![
AuraModeNum::Static,
AuraModeNum::Breathe,
AuraModeNum::Pulse,
],
basic_zones: vec![AuraZone::None],
advanced_type: AdvancedAuraType::None,
key_shapes: HashMap::from([(
"regular".to_owned(),
KeyShape::new_led(1.0, 1.0, 0.1, 0.1, 0.1, 0.1),
)]),
key_rows: vec![
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Esc, "regular".to_owned()),
(LedCode::F1, "regular".to_owned()),
(LedCode::F2, "regular".to_owned()),
(LedCode::F3, "regular".to_owned()),
(LedCode::F4, "regular".to_owned()),
// not sure which key to put here
(LedCode::F5, "regular".to_owned()),
(LedCode::F6, "regular".to_owned()),
(LedCode::F7, "regular".to_owned()),
(LedCode::F8, "regular".to_owned()),
(LedCode::F9, "regular".to_owned()),
(LedCode::F10, "regular".to_owned()),
(LedCode::F11, "regular".to_owned()),
(LedCode::F12, "regular".to_owned()),
],
),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Tilde, "regular".to_owned()),
(LedCode::N1, "regular".to_owned()),
(LedCode::N2, "regular".to_owned()),
(LedCode::N3, "regular".to_owned()),
(LedCode::N4, "regular".to_owned()),
(LedCode::N5, "regular".to_owned()),
(LedCode::N6, "regular".to_owned()),
(LedCode::N7, "regular".to_owned()),
(LedCode::N8, "regular".to_owned()),
(LedCode::N9, "regular".to_owned()),
(LedCode::N0, "regular".to_owned()),
(LedCode::Hyphen, "regular".to_owned()),
(LedCode::Equals, "regular".to_owned()),
(LedCode::Backspace, "regular".to_owned()),
],
),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Tab, "regular".to_owned()),
(LedCode::Q, "regular".to_owned()),
(LedCode::W, "regular".to_owned()),
(LedCode::E, "regular".to_owned()),
(LedCode::R, "regular".to_owned()),
(LedCode::T, "regular".to_owned()),
(LedCode::Y, "regular".to_owned()),
(LedCode::U, "regular".to_owned()),
(LedCode::I, "regular".to_owned()),
(LedCode::O, "regular".to_owned()),
(LedCode::P, "regular".to_owned()),
(LedCode::LBracket, "regular".to_owned()),
(LedCode::RBracket, "regular".to_owned()),
(LedCode::BackSlash, "regular".to_owned()),
],
),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::Caps, "regular".to_owned()),
(LedCode::A, "regular".to_owned()),
(LedCode::S, "regular".to_owned()),
(LedCode::D, "regular".to_owned()),
(LedCode::F, "regular".to_owned()),
(LedCode::G, "regular".to_owned()),
(LedCode::H, "regular".to_owned()),
(LedCode::J, "regular".to_owned()),
(LedCode::K, "regular".to_owned()),
(LedCode::L, "regular".to_owned()),
(LedCode::SemiColon, "regular".to_owned()),
(LedCode::Quote, "regular".to_owned()),
(LedCode::Return, "regular".to_owned()),
],
),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::LShift, "regular".to_owned()),
(LedCode::Z, "regular".to_owned()),
(LedCode::X, "regular".to_owned()),
(LedCode::C, "regular".to_owned()),
(LedCode::V, "regular".to_owned()),
(LedCode::B, "regular".to_owned()),
(LedCode::N, "regular".to_owned()),
(LedCode::M, "regular".to_owned()),
(LedCode::Comma, "regular".to_owned()),
(LedCode::Period, "regular".to_owned()),
(LedCode::FwdSlash, "regular".to_owned()),
(LedCode::Rshift, "regular".to_owned()),
],
),
KeyRow::new(
0.1,
0.1,
vec![
(LedCode::LCtrl, "regular".to_owned()),
(LedCode::LFn, "regular".to_owned()),
(LedCode::Meta, "regular".to_owned()),
(LedCode::LAlt, "regular".to_owned()),
(LedCode::Spacebar, "regular".to_owned()),
(LedCode::RAlt, "regular".to_owned()),
(LedCode::PrtSc, "regular".to_owned()),
(LedCode::RCtrl, "regular".to_owned()),
],
),
],
}
}
}
#[cfg(test)]
mod tests {
use std::collections::HashSet;
use std::fs::{self, OpenOptions};
use std::io::Read;
use std::path::PathBuf;
use crate::aura_detection::LedSupportFile;
use crate::layouts::KeyLayout;
#[test]
fn check_parse_all() {
const DATA_DIR: &str = env!("CARGO_MANIFEST_DIR");
let mut data_path = PathBuf::from(DATA_DIR);
data_path.push("data");
data_path.push("layouts");
let path = data_path.as_path();
let mut buf = String::new();
for p in fs::read_dir(path)
.map_err(|e| {
println!("{:?}, {e}", path);
e
})
.unwrap()
{
let path = p.unwrap().path();
let mut file = OpenOptions::new().read(true).open(&path).unwrap();
file.read_to_string(&mut buf).unwrap();
let data: KeyLayout = ron::from_str(&buf).unwrap();
let mut unused = HashSet::new();
for k in data.key_shapes.keys() {
unused.insert(k);
}
let rows = &data.key_rows;
for row in rows {
for k in &row.row {
if data.key_shapes.get(&k.1).is_some() {
unused.remove(&k.1);
} else {
panic!("Key {:?} was missing matching shape {}", k.0, k.1);
}
}
}
if !unused.is_empty() {
panic!("The layout {path:?} had unused shapes {unused:?}",);
}
buf.clear();
}
// println!(
// "RON: {}",
// ron::ser::to_string_pretty(&tmp,
// PrettyConfig::new().depth_limit(4)).unwrap() );
// let mut data = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
// data.push("data/aura-support2.json");
// let mut file =
// OpenOptions::new().write(true).create(true).truncate(true).open(&
// data).unwrap(); file.write_all(json.as_bytes()).unwrap();
}
#[test]
fn check_layout_file_links() {
const DATA_DIR: &str = env!("CARGO_MANIFEST_DIR");
let mut data_path = PathBuf::from(DATA_DIR);
data_path.push("data");
data_path.push("aura_support.ron");
let mut buf = String::new();
let mut file = OpenOptions::new().read(true).open(&data_path).unwrap();
file.read_to_string(&mut buf).unwrap();
let data: LedSupportFile = ron::from_str(&buf).unwrap();
data_path.pop();
data_path.push("layouts");
data_path.push("loop_prep");
for config in data.get().iter().rev() {
buf.clear();
let layout_file = format!("{}_US.ron", config.layout_name);
data_path.pop();
data_path.push(&layout_file);
let mut file = OpenOptions::new()
.read(true)
.open(&data_path)
.map_err(|e| {
panic!(
"Error checking {data_path:?} for {} : {e:?}",
config.board_name
)
})
.unwrap();
if let Err(e) = file.read_to_string(&mut buf) {
panic!(
"Error checking {data_path:?} for {} : {e:?}",
config.board_name
)
}
if let Err(e) = ron::from_str::<KeyLayout>(&buf) {
panic!("Error checking {data_path:?} : {e:?}")
}
}
}
}

View File

@@ -1,170 +0,0 @@
use super::{KeyLayout, KeyRow};
use crate::keys::Key;
impl KeyLayout {
/// Similar to GX502, but not per-key enabled
pub fn g513_layout() -> Self {
Self {
matches: vec!["G513".into()],
locale: "US".to_owned(),
rows: vec![
KeyRow::new(
0.8,
vec![
Key::NormalSpacer,
Key::FuncSpacer,
Key::VolDown,
Key::VolUp,
Key::MicMute,
Key::Fan,
Key::Rog,
],
),
KeyRow::new(
0.8,
vec![
Key::Esc,
Key::FuncSpacer,
Key::F1,
Key::F2,
Key::F3,
Key::F4,
Key::FuncSpacer, // not sure which key to put here
Key::F5,
Key::F6,
Key::F7,
Key::F8,
Key::FuncSpacer,
Key::F9,
Key::F10,
Key::F11,
Key::F12,
Key::RowEndSpacer,
Key::Del,
],
),
KeyRow::new(
1.0,
vec![
Key::Tilde,
Key::N1,
Key::N2,
Key::N3,
Key::N4,
Key::N5,
Key::N6,
Key::N7,
Key::N8,
Key::N9,
Key::N0,
Key::Hyphen,
Key::Equals,
Key::BkSpc,
Key::RowEndSpacer,
Key::Home,
],
),
KeyRow::new(
1.0,
vec![
Key::Tab,
Key::Q,
Key::W,
Key::E,
Key::R,
Key::T,
Key::Y,
Key::U,
Key::I,
Key::O,
Key::P,
Key::LBracket,
Key::RBracket,
Key::BackSlash,
Key::RowEndSpacer,
Key::PgUp,
],
),
KeyRow::new(
1.0,
vec![
Key::Caps,
Key::A,
Key::S,
Key::D,
Key::F,
Key::G,
Key::H,
Key::J,
Key::K,
Key::L,
Key::SemiColon,
Key::Quote,
Key::Return,
Key::RowEndSpacer,
Key::PgDn,
],
),
KeyRow::new(
1.0,
vec![
Key::LShift,
Key::Z,
Key::X,
Key::C,
Key::V,
Key::B,
Key::N,
Key::M,
Key::Comma,
Key::Period,
Key::FwdSlash,
Key::Rshift,
Key::RowEndSpacer,
Key::End,
],
),
KeyRow::new(
1.0,
vec![
Key::LCtrl,
Key::LFn,
Key::Meta,
Key::LAlt,
Key::Space,
Key::RAlt,
Key::PrtSc,
Key::RCtrl,
Key::ArrowSpacer,
Key::Up,
Key::ArrowSpacer,
Key::RowEndSpacer,
Key::RFn,
],
),
KeyRow::new(
1.0,
vec![
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::Left,
Key::Down,
Key::Right,
Key::ArrowSpacer,
],
),
],
}
}
}

View File

@@ -1,156 +0,0 @@
use super::{KeyLayout, KeyRow};
use crate::keys::Key;
impl KeyLayout {
pub fn ga401_layout() -> Self {
Self {
matches: vec!["GA401".into(), "GA402".into()],
locale: "US".to_owned(),
rows: vec![
KeyRow::new(
0.8,
vec![
Key::NormalSpacer,
Key::FuncSpacer,
Key::VolDown,
Key::VolUp,
Key::MicMute,
Key::Rog,
],
),
KeyRow::new(
0.8,
vec![
Key::Esc,
Key::FuncSpacer,
Key::F1,
Key::F2,
Key::F3,
Key::F4,
Key::FuncSpacer, // not sure which key to put here
Key::F5,
Key::F6,
Key::F7,
Key::F8,
Key::FuncSpacer,
Key::F9,
Key::F10,
Key::F11,
Key::F12,
],
),
KeyRow::new(
1.0,
vec![
Key::Tilde,
Key::N1,
Key::N2,
Key::N3,
Key::N4,
Key::N5,
Key::N6,
Key::N7,
Key::N8,
Key::N9,
Key::N0,
Key::Hyphen,
Key::Equals,
Key::BkSpc,
],
),
KeyRow::new(
1.0,
vec![
Key::Tab,
Key::Q,
Key::W,
Key::E,
Key::R,
Key::T,
Key::Y,
Key::U,
Key::I,
Key::O,
Key::P,
Key::LBracket,
Key::RBracket,
Key::BackSlash,
],
),
KeyRow::new(
1.0,
vec![
Key::Caps,
Key::A,
Key::S,
Key::D,
Key::F,
Key::G,
Key::H,
Key::J,
Key::K,
Key::L,
Key::SemiColon,
Key::Quote,
Key::Return,
],
),
KeyRow::new(
1.0,
vec![
Key::LShift,
Key::Z,
Key::X,
Key::C,
Key::V,
Key::B,
Key::N,
Key::M,
Key::Comma,
Key::Period,
Key::FwdSlash,
Key::Rshift,
],
),
KeyRow::new(
1.0,
vec![
Key::LCtrl,
Key::LFn,
Key::Meta,
Key::LAlt,
Key::Space,
Key::RAlt,
Key::PrtSc,
Key::RCtrl,
Key::ArrowSpacer,
Key::Up,
Key::ArrowSpacer,
],
),
KeyRow::new(
1.2,
vec![
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::Left,
Key::Down,
Key::Right,
Key::ArrowSpacer,
],
),
],
}
}
}

View File

@@ -1,178 +0,0 @@
use super::{KeyLayout, KeyRow};
use crate::keys::Key;
impl KeyLayout {
pub fn gx502_layout() -> Self {
Self {
matches: vec!["GX502".into(), "GU502".into()],
locale: "US".to_owned(),
rows: vec![
KeyRow::new(
0.8,
vec![
Key::NormalSpacer,
Key::FuncSpacer,
Key::VolDown,
Key::VolUp,
Key::MicMute,
Key::Rog,
],
),
KeyRow::new(
0.8,
vec![
Key::Esc,
Key::FuncSpacer,
Key::F1,
Key::F2,
Key::F3,
Key::F4,
Key::FuncSpacer, // not sure which key to put here
Key::F5,
Key::F6,
Key::F7,
Key::F8,
Key::FuncSpacer,
Key::F9,
Key::F10,
Key::F11,
Key::F12,
Key::RowEndSpacer,
Key::Del,
],
),
KeyRow::new(
1.0,
vec![
Key::Tilde,
Key::N1,
Key::N2,
Key::N3,
Key::N4,
Key::N5,
Key::N6,
Key::N7,
Key::N8,
Key::N9,
Key::N0,
Key::Hyphen,
Key::Equals,
Key::BkSpc3_1,
Key::BkSpc3_2,
Key::BkSpc3_3,
Key::RowEndSpacer,
Key::Home,
],
),
KeyRow::new(
1.0,
vec![
Key::Tab,
Key::Q,
Key::W,
Key::E,
Key::R,
Key::T,
Key::Y,
Key::U,
Key::I,
Key::O,
Key::P,
Key::LBracket,
Key::RBracket,
Key::BackSlash,
Key::RowEndSpacer,
Key::PgUp,
],
),
KeyRow::new(
1.0,
vec![
Key::Caps,
Key::A,
Key::S,
Key::D,
Key::F,
Key::G,
Key::H,
Key::J,
Key::K,
Key::L,
Key::SemiColon,
Key::Quote,
Key::Return3_1,
Key::Return3_2,
Key::Return3_3,
Key::RowEndSpacer,
Key::PgDn,
],
),
KeyRow::new(
1.0,
vec![
Key::LShift,
Key::Z,
Key::X,
Key::C,
Key::V,
Key::B,
Key::N,
Key::M,
Key::Comma,
Key::Period,
Key::FwdSlash,
Key::Rshift3_1,
Key::Rshift3_2,
Key::Rshift3_3,
Key::RowEndSpacer,
Key::End,
],
),
KeyRow::new(
1.0,
vec![
Key::LCtrl,
Key::LFn,
Key::Meta,
Key::LAlt,
Key::Space5_1,
Key::Space5_2,
Key::Space5_3,
Key::Space5_4,
Key::Space5_5,
Key::RAlt,
Key::PrtSc,
Key::RCtrl,
Key::ArrowSpacer,
Key::Up,
Key::ArrowSpacer,
Key::RowEndSpacer,
Key::RFn,
],
),
KeyRow::new(
1.0,
vec![
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::ArrowSpacer,
Key::Left,
Key::Down,
Key::Right,
Key::ArrowSpacer,
],
),
],
}
}
}

View File

@@ -1,105 +0,0 @@
//! A series of pre-defined layouts. These were mostly used to generate an editable
//! config.
/// Hardcoded layout. Was used to generate a toml default
pub mod g513;
/// Hardcoded layout. Was used to generate a toml default
pub mod ga401;
/// Hardcoded layout. Was used to generate a toml default
pub mod gx502;
use crate::{error::Error, keys::Key};
use serde::{Deserialize, Serialize};
use std::{
fs::{self, OpenOptions},
io::Read,
path::{Path, PathBuf},
slice::Iter,
};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct KeyLayout {
/// A series of board names that this layout can be used for. The board names
/// stored with the layout can be globbed, e.g, GA401 will match all of the
/// GA401I and GA401Q range variants.
///
/// `/sys/class/dmi/id/board_name`
matches: Vec<String>,
locale: String,
rows: Vec<KeyRow>,
}
impl KeyLayout {
pub fn from_file(path: &Path) -> Result<Self, Error> {
let mut file = OpenOptions::new().read(true).open(path)?;
let mut buf = String::new();
let read_len = file.read_to_string(&mut buf)?;
if read_len == 0 {
Err(Error::Io(std::io::ErrorKind::InvalidData.into()))
} else {
Ok(toml::from_str::<Self>(&buf)?)
}
}
pub fn matches(&self, board_name: &str) -> bool {
let board = board_name.to_ascii_uppercase();
for tmp in &self.matches {
if board.contains(tmp.as_str()) {
return true;
}
}
false
}
pub fn rows(&self) -> Iter<KeyRow> {
self.rows.iter()
}
pub fn rows_ref(&self) -> &[KeyRow] {
&self.rows
}
/// Find a layout matching the provided board name in the provided dir
pub fn find_layout(board_name: &str, mut data_path: PathBuf) -> Result<Self, Error> {
let mut layout = KeyLayout::ga401_layout(); // default
data_path.push("layouts");
let path = data_path.as_path();
for p in fs::read_dir(path).map_err(|e| {
println!("{:?}, {e}", path);
e
})? {
let tmp = KeyLayout::from_file(&p?.path()).unwrap();
if tmp.matches(board_name) {
layout = tmp;
break;
}
}
Ok(layout)
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct KeyRow {
height: f32,
row: Vec<Key>,
}
impl KeyRow {
pub fn new(height: f32, row: Vec<Key>) -> Self {
Self { height, row }
}
pub fn row(&self) -> Iter<'_, Key> {
self.row.iter()
}
pub fn row_ref(&self) -> &[Key] {
&self.row
}
pub fn height(&self) -> f32 {
self.height
}
}

View File

@@ -1,168 +0,0 @@
#[allow(clippy::upper_case_acronyms)]
pub struct GX502Layout(Vec<[Key; 17]>);
impl KeyLayout for GX502Layout {
fn get_rows(&self) -> &Vec<[Key; 17]> {
&self.0
}
}
impl Default for GX502Layout {
fn default() -> Self {
GX502Layout(vec![
[
Key::NormalSpacer,
Key::FuncSpacer,
Key::VolDown,
Key::VolUp,
Key::MicMute,
Key::Rog,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
],
[
Key::Esc,
Key::NormalBlank,
Key::F1,
Key::F2,
Key::F3,
Key::F4,
Key::NormalBlank, // not sure which key to put here
Key::F5,
Key::F6,
Key::F7,
Key::F8,
Key::NormalBlank,
Key::F9,
Key::F10,
Key::F11,
Key::F12,
Key::Del,
],
[
Key::Tilde,
Key::N1,
Key::N2,
Key::N3,
Key::N4,
Key::N5,
Key::N6,
Key::N7,
Key::N8,
Key::N9,
Key::N0,
Key::Hyphen,
Key::Equals,
Key::BkSpc3_1,
Key::BkSpc3_2,
Key::BkSpc3_3,
Key::Home,
],
[
Key::Tab,
Key::Q,
Key::W,
Key::E,
Key::R,
Key::T,
Key::Y,
Key::U,
Key::I,
Key::O,
Key::P,
Key::LBracket,
Key::RBracket,
Key::BackSlash,
Key::BackSlash,
Key::BackSlash,
Key::PgUp,
],
[
Key::Caps,
Key::A,
Key::S,
Key::D,
Key::F,
Key::G,
Key::H,
Key::J,
Key::K,
Key::L,
Key::SemiColon,
Key::Quote,
Key::Quote,
Key::Return3_1,
Key::Return3_2,
Key::Return3_3,
Key::PgDn,
],
[
Key::LShift,
Key::LShift,
Key::Z,
Key::X,
Key::C,
Key::V,
Key::B,
Key::N,
Key::M,
Key::Comma,
Key::Period,
Key::FwdSlash,
Key::FwdSlash,
Key::Rshift3_1,
Key::Rshift3_2,
Key::Rshift3_3,
Key::End,
],
[
Key::LCtrl,
Key::LFn,
Key::Meta,
Key::LAlt,
Key::Space5_1,
Key::Space5_2,
Key::Space5_3,
Key::Space5_4,
Key::Space5_5,
Key::RAlt,
Key::PrtSc,
Key::RCtrl,
Key::RCtrl,
Key::Left,
Key::Up,
Key::Right,
Key::RFn,
],
[
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::NormalBlank,
Key::Left,
Key::Down,
Key::Right,
Key::NormalBlank,
],
])
}
}

View File

@@ -1,21 +1,20 @@
/// A container of images/grids/gifs/pauses which can be iterated over to generate
/// cool effects
mod sequencer;
pub use sequencer::*;
mod builtin_modes;
use advanced::LedCode;
pub use builtin_modes::*;
mod per_key_rgb;
pub use per_key_rgb::*;
mod per_zone;
pub use per_zone::*;
/// A container of images/grids/gifs/pauses which can be iterated over to
/// generate cool effects
pub mod effects;
/// All handling for `RgbAddress`ing.
pub mod advanced;
/// Convert the `RgbAddress` to `&str` labels
pub mod advanced_to_str;
pub mod error;
pub mod key_to_str;
pub mod keys;
pub use key_to_str::*;
pub use advanced_to_str::*;
/// Helper for detecting what is available
pub mod aura_detection;
/// Helpers for consructing keyboard layouts for UI use and effects
pub mod layouts;
pub mod usb;
@@ -25,8 +24,18 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const RED: Colour = Colour(0xff, 0x00, 0x00);
pub const GREEN: Colour = Colour(0x00, 0xff, 0x00);
pub const BLUE: Colour = Colour(0x00, 0x00, 0xff);
pub const VIOLET: Colour = Colour(0x9B, 0x26, 0xB6);
pub const TEAL: Colour = Colour(0x00, 0x7C, 0x80);
pub const VIOLET: Colour = Colour(0x9b, 0x26, 0xb6);
pub const TEAL: Colour = Colour(0x00, 0x7c, 0x80);
pub const YELLOW: Colour = Colour(0xff, 0xef, 0x00);
pub const ORANGE: Colour = Colour(0xff, 0xa4, 0x00);
pub const GRADIENT: [Colour; 7] = [RED, VIOLET, BLUE, TEAL, GREEN, YELLOW, ORANGE];
#[derive(Debug, Clone, PartialEq, Eq, Default, serde::Deserialize, serde::Serialize)]
pub enum AdvancedAuraType {
/// A `None` will apply the effect to the whole keyboard via basic-static
/// mode
#[default]
None,
Zoned(Vec<LedCode>),
PerKey,
}

View File

@@ -1,247 +0,0 @@
use crate::keys::Key;
use serde_derive::{Deserialize, Serialize};
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
/// Represents the per-key raw USB packets
pub type PerKeyRaw = Vec<Vec<u8>>;
/// A `KeyColourArray` contains all data to change the full set of keyboard
/// key colours individually.
///
/// Each row of the internal array is a full HID packet that can be sent
/// to the keyboard EC. One row controls one group of keys, these keys are not
/// necessarily all on the same row of the keyboard, with some splitting between
/// two rows.
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct KeyColourArray(PerKeyRaw);
impl Default for KeyColourArray {
fn default() -> Self {
Self::new()
}
}
impl KeyColourArray {
pub fn new() -> Self {
let mut set = vec![vec![0u8; 64]; 11];
// set[0].copy_from_slice(&KeyColourArray::get_init_msg());
for (count, row) in set.iter_mut().enumerate() {
row[0] = 0x5d; // Report ID
row[1] = 0xbc; // Mode = custom??, 0xb3 is builtin
row[2] = 0x00;
row[3] = 0x01; // ??
row[4] = 0x01; // ??, 4,5,6 are normally RGB for builtin mode colours
row[5] = 0x01; // ??
row[6] = (count as u8) << 4; // Key group
if count == 10 {
row[7] = 0x08; // 0b00001000
} else {
row[7] = 0x10; // 0b00010000 addressing? flips for group a0
}
row[8] = 0x00;
}
KeyColourArray(set)
}
/// Initialise and clear the keyboard for custom effects, this must be done for
/// every time mode switches from builtin to custom
#[inline]
pub const fn get_init_msg() -> [u8; 64] {
let mut init = [0u8; 64];
init[0] = 0x5d; // Report ID
init[1] = 0xbc; // Mode = custom??, 0xb3 is builtin
init
}
#[inline]
pub fn set(&mut self, key: Key, r: u8, g: u8, b: u8) {
if let Some(c) = self.rgb_for_key(key) {
c[0] = r;
c[1] = g;
c[2] = b;
}
}
/// Indexes in to `KeyColourArray` at the correct row and column
/// to set a series of three bytes to the chosen R,G,B values
pub fn rgb_for_key(&mut self, key: Key) -> Option<&mut [u8]> {
// Tuples are indexes in to array
let (row, col) = match key {
Key::VolDown => (0, 15),
Key::VolUp => (0, 18),
Key::MicMute => (0, 21),
Key::Rog => (0, 24),
//
Key::Esc => (1, 24),
Key::F1 => (1, 30),
Key::F2 => (1, 33),
Key::F3 => (1, 36),
Key::F4 => (1, 39),
Key::F5 => (1, 45),
Key::F6 => (1, 48),
Key::F7 => (1, 51),
Key::F8 => (1, 54),
//
Key::F9 => (2, 12),
Key::F10 => (2, 15),
Key::F11 => (2, 18),
Key::F12 => (2, 21),
Key::Del => (2, 24),
Key::Tilde => (2, 39),
Key::N1 => (2, 42),
Key::N2 => (2, 45),
Key::N3 => (2, 48),
Key::N4 => (2, 51),
Key::N5 => (2, 54),
//
Key::N6 => (3, 9),
Key::N7 => (3, 12),
Key::N8 => (3, 15),
Key::N9 => (3, 18),
Key::N0 => (3, 21),
Key::Hyphen => (3, 24),
Key::Equals => (3, 27),
Key::BkSpc3_1 => (3, 30),
Key::BkSpc3_2 => (3, 33),
Key::BkSpc3_3 => (3, 36),
Key::Home => (3, 39),
Key::Tab => (3, 54),
//
Key::Q => (4, 9),
Key::W => (4, 12),
Key::E => (4, 15),
Key::R => (4, 18),
Key::T => (4, 21),
Key::Y => (4, 24),
Key::U => (4, 27),
Key::I => (4, 30),
Key::O => (4, 33),
Key::P => (4, 36),
Key::LBracket => (4, 39),
Key::RBracket => (4, 42),
Key::BackSlash => (4, 45),
Key::PgUp => (4, 54),
//
Key::Caps => (5, 21),
Key::A => (5, 24),
Key::S => (5, 27),
Key::D => (5, 30),
Key::F => (5, 33),
Key::G => (5, 36),
Key::H => (5, 39),
Key::J => (5, 42),
Key::K => (5, 45),
Key::L => (5, 48),
Key::SemiColon => (5, 51),
Key::Quote => (5, 54),
//
Key::Return => (6, 9),
Key::Return3_1 => (6, 12),
Key::Return3_2 => (6, 15),
Key::Return3_3 => (6, 18),
Key::PgDn => (6, 21),
Key::LShift => (6, 36),
// TODO: Find correct locations
Key::LShift3_1 => (6, 36),
Key::LShift3_2 => (6, 36),
Key::LShift3_3 => (6, 36),
Key::Z => (6, 42),
Key::X => (6, 45),
Key::C => (6, 48),
Key::V => (6, 51),
Key::B => (6, 54),
//
Key::N => (7, 9),
Key::M => (7, 12),
Key::Comma => (7, 15),
Key::Period => (7, 18),
Key::FwdSlash => (7, 21),
Key::Rshift => (7, 24),
Key::Rshift3_1 => (7, 27),
Key::Rshift3_2 => (7, 30),
Key::Rshift3_3 => (7, 33),
Key::End => (7, 36),
Key::LCtrl => (7, 51),
Key::LFn => (7, 54),
//
Key::Meta => (8, 9),
Key::LAlt => (8, 12),
Key::Space5_1 => (8, 15),
Key::Space5_2 => (8, 18),
Key::Space5_3 => (8, 21),
Key::Space5_4 => (8, 24),
Key::Space5_5 => (8, 27),
Key::RAlt => (8, 30),
Key::PrtSc => (8, 33),
Key::RCtrl => (8, 36),
Key::Up => (8, 42),
Key::RFn => (8, 51),
//
Key::Left => (9, 54),
//
Key::Down => (10, 9),
Key::Right => (10, 12),
Key::NormalBlank
| Key::FuncBlank
| Key::NormalSpacer
| Key::FuncSpacer
| Key::ArrowBlank
| Key::ArrowSpacer
| Key::UpRegular
| Key::DownRegular
| Key::LeftRegular
| Key::RightRegular
| Key::UpSplit
| Key::DownSplit
| Key::LeftSplit
| Key::RightSplit
| Key::ArrowRegularBlank
| Key::ArrowRegularSpacer
| Key::ArrowSplitBlank
| Key::ArrowSplitSpacer
| Key::RshiftSmall
| Key::LCtrlMed
| Key::MediaPlay
| Key::MediaStop
| Key::MediaPrev
| Key::MediaNext
| Key::Pause
| Key::NumLock
| Key::Star
| Key::NumPadDel
| Key::NumPadPlus
| Key::NumPadEnter
| Key::NumPadPause
| Key::NumPadPrtSc
| Key::NumPadHome
| Key::RCtrlLarge
| Key::RowEndSpacer => return None,
Key::Fan | Key::Space | Key::BkSpc => return None,
};
Some(&mut self.0[row][col..=col + 2])
}
#[inline]
pub fn get(&self) -> PerKeyRaw {
self.0.clone()
}
#[inline]
pub fn get_ref(&self) -> &PerKeyRaw {
&self.0
}
#[inline]
pub fn get_mut(&mut self) -> &mut PerKeyRaw {
&mut self.0
}
}
impl From<KeyColourArray> for PerKeyRaw {
fn from(k: KeyColourArray) -> Self {
k.0
}
}

View File

@@ -1,123 +0,0 @@
use serde_derive::{Deserialize, Serialize};
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
/// Represents the zoned raw USB packets
pub type ZonedRaw = Vec<u8>;
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
pub enum PerZone {
None,
KeyboardLeft,
KeyboardCenterLeft,
KeyboardCenterRight,
KeyboardRight,
LightbarRight,
LightbarRightCorner,
LightbarRightBottom,
LightbarLeftBottom,
LightbarLeftCorner,
LightbarLeft,
}
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ZonedColourArray(ZonedRaw);
impl Default for ZonedColourArray {
fn default() -> Self {
Self::new()
}
}
impl ZonedColourArray {
pub fn new() -> Self {
let mut pkt = vec![0u8; 64];
pkt[0] = 0x5d; // Report ID
pkt[1] = 0xbc; // Mode = custom??, 0xb3 is builtin
pkt[2] = 0x01;
pkt[3] = 0x01; // ??
pkt[4] = 0x04; // ??, 4,5,6 are normally RGB for builtin mode colours
ZonedColourArray(pkt)
}
pub fn rgb_for_zone(&mut self, zone: PerZone) -> &mut [u8] {
match zone {
PerZone::None | PerZone::KeyboardLeft => &mut self.0[9..=11],
PerZone::KeyboardCenterLeft => &mut self.0[12..=14],
PerZone::KeyboardCenterRight => &mut self.0[15..=17],
PerZone::KeyboardRight => &mut self.0[18..=20],
// Two sections missing here?
PerZone::LightbarRight => &mut self.0[27..=29],
PerZone::LightbarRightCorner => &mut self.0[30..=32],
PerZone::LightbarRightBottom => &mut self.0[33..=35],
PerZone::LightbarLeftBottom => &mut self.0[36..=38],
PerZone::LightbarLeftCorner => &mut self.0[39..=41],
PerZone::LightbarLeft => &mut self.0[42..=44],
}
}
#[inline]
pub fn get(&self) -> ZonedRaw {
self.0.clone()
}
#[inline]
pub fn get_ref(&self) -> &ZonedRaw {
&self.0
}
#[inline]
pub fn get_mut(&mut self) -> &mut ZonedRaw {
&mut self.0
}
}
impl From<ZonedColourArray> for ZonedRaw {
fn from(k: ZonedColourArray) -> Self {
k.0
}
}
#[cfg(test)]
mod tests {
use crate::{PerZone, ZonedColourArray, ZonedRaw};
macro_rules! colour_check {
($zone:expr, $pkt_idx_start:expr) => {
let mut zone = ZonedColourArray::new();
let c = zone.rgb_for_zone($zone);
c[0] = 255;
c[1] = 255;
c[2] = 255;
let pkt: ZonedRaw = zone.get();
assert_eq!(pkt[$pkt_idx_start], 0xff);
assert_eq!(pkt[$pkt_idx_start + 1], 0xff);
assert_eq!(pkt[$pkt_idx_start + 2], 0xff);
};
}
#[test]
fn zone_to_packet_check() {
let zone = ZonedColourArray::new();
let pkt: ZonedRaw = zone.into();
assert_eq!(pkt[0], 0x5d);
assert_eq!(pkt[1], 0xbc);
assert_eq!(pkt[2], 0x01);
assert_eq!(pkt[3], 0x01);
assert_eq!(pkt[4], 0x04);
colour_check!(PerZone::KeyboardLeft, 9);
colour_check!(PerZone::KeyboardCenterLeft, 12);
colour_check!(PerZone::KeyboardCenterRight, 15);
colour_check!(PerZone::KeyboardRight, 18);
colour_check!(PerZone::LightbarRight, 27);
colour_check!(PerZone::LightbarRightCorner, 30);
colour_check!(PerZone::LightbarRightBottom, 33);
colour_check!(PerZone::LightbarLeftBottom, 36);
colour_check!(PerZone::LightbarLeftCorner, 39);
colour_check!(PerZone::LightbarLeft, 42);
}
}

View File

@@ -1,250 +0,0 @@
use crate::{layouts::KeyLayout, p_random, Colour, EffectState, LedType, Speed};
use serde_derive::{Deserialize, Serialize};
macro_rules! effect_state_impl {
() => {
fn get_colour(&self) -> Colour {
self.colour
}
fn get_led_type(&self) -> LedType {
self.led_type.clone()
}
/// Change the led type
fn set_led_type(&mut self, led_type: LedType) {
self.led_type = led_type;
}
};
}
macro_rules! effect_impl {
($($effect:ident),*) => {
impl Effect {
/// Get the type of LED set
pub fn get_led_type(&self) -> LedType {
match self {
$(Effect::$effect(c) => c.get_led_type(),)*
}
}
/// Change the led type
pub fn set_led_type(&mut self, led_type: LedType) {
match self {
$(Effect::$effect(c) => c.set_led_type(led_type),)*
}
}
/// Calculate the next state of the effect
pub fn next_state(&mut self, layout: &KeyLayout) {
match self {
$(Effect::$effect(c) => c.next_colour_state(layout),)*
}
}
/// Get the calculated colour
pub fn get_colour(&self) -> Colour {
match self {
$(Effect::$effect(c) => c.get_colour(),)*
}
}
}
};
}
/**************************************************************************************************/
#[derive(Debug, Clone, Deserialize, Serialize)]
pub enum Effect {
Static(Static),
Breathe(Breathe),
Flicker(Flicker),
}
impl Default for Effect {
fn default() -> Self {
Self::Static(Static::new(LedType::default(), Colour::default()))
}
}
effect_impl!(Static, Breathe, Flicker);
/**************************************************************************************************/
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Static {
led_type: LedType,
/// The starting colour
colour: Colour,
}
impl Static {
pub fn new(led_type: LedType, colour: Colour) -> Self {
Self { led_type, colour }
}
}
impl EffectState for Static {
fn next_colour_state(&mut self, _layout: &KeyLayout) {}
effect_state_impl!();
}
/**************************************************************************************************/
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Breathe {
led_type: LedType,
/// The starting colour
start_colour1: Colour,
/// The secondary starting colour
start_colour2: Colour,
/// The speed at which to cycle between the colours
speed: Speed,
/// Temporary data to help keep state
#[serde(skip)]
colour: Colour,
#[serde(skip)]
count_flipped: bool,
#[serde(skip)]
use_colour1: bool,
}
impl Breathe {
pub fn new(led_type: LedType, colour1: Colour, colour2: Colour, speed: Speed) -> Self {
Self {
led_type,
start_colour1: colour1,
start_colour2: colour2,
speed,
colour: colour1,
count_flipped: false,
use_colour1: true,
}
}
}
impl EffectState for Breathe {
fn next_colour_state(&mut self, _layout: &KeyLayout) {
let Self {
start_colour1: colour1,
start_colour2: colour2,
speed,
colour: colour_actual,
count_flipped: flipped,
use_colour1,
..
} = self;
let speed = 4 - <u8>::from(*speed);
if *colour_actual == Colour(0, 0, 0) {
*use_colour1 = !*use_colour1;
}
let colour = if !*use_colour1 { colour2 } else { colour1 };
let r1_scale = colour.0 / speed / 2;
let g1_scale = colour.1 / speed / 2;
let b1_scale = colour.2 / speed / 2;
if *colour_actual == Colour(0, 0, 0) {
*flipped = true;
} else if colour_actual >= colour {
*flipped = false;
}
if !*flipped {
colour_actual.0 = colour_actual.0.saturating_sub(r1_scale);
colour_actual.1 = colour_actual.1.saturating_sub(g1_scale);
colour_actual.2 = colour_actual.2.saturating_sub(b1_scale);
} else {
colour_actual.0 = colour_actual.0.saturating_add(r1_scale);
colour_actual.1 = colour_actual.1.saturating_add(g1_scale);
colour_actual.2 = colour_actual.2.saturating_add(b1_scale);
}
}
effect_state_impl!();
}
/**************************************************************************************************/
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Flicker {
led_type: LedType,
start_colour: Colour,
max_percentage: u8,
min_percentage: u8,
#[serde(skip)]
count: u8,
#[serde(skip)]
colour: Colour,
}
impl Flicker {
pub fn new(led_type: LedType, colour: Colour, max_percentage: u8, min_percentage: u8) -> Self {
Self {
led_type,
colour,
count: 4,
max_percentage,
min_percentage,
start_colour: colour,
}
}
}
impl EffectState for Flicker {
fn next_colour_state(&mut self, _layout: &KeyLayout) {
let Self {
max_percentage,
min_percentage,
colour,
start_colour,
..
} = self;
if self.count == 0 {
self.count = 4;
}
self.count -= 1;
if self.count != 0 {
return;
}
// TODO: make a "percentage" method on Colour.
let max_light = Colour(
(start_colour.0 as f32 / 100.0 * *max_percentage as f32) as u8,
(start_colour.1 as f32 / 100.0 * *max_percentage as f32) as u8,
(start_colour.2 as f32 / 100.0 * *max_percentage as f32) as u8,
);
// min light is a percentage of the set colour
let min_light = Colour(
(start_colour.0 as f32 / 100.0 * *min_percentage as f32) as u8,
(start_colour.1 as f32 / 100.0 * *min_percentage as f32) as u8,
(start_colour.2 as f32 / 100.0 * *min_percentage as f32) as u8,
);
// Convert the 255 to percentage
let amount = (p_random() & 7) as f32 * 8.0;
let set_colour = |colour: &mut u8, max: f32, min: f32| {
let pc = amount / max * 100.0;
let min_amount = pc * min / 100.0; // percentage of min colour
let max_amount = pc * max / 100.0; // percentage of max colour
if *colour as f32 - min_amount < min {
*colour = min as u8;
} else {
*colour = (max - max_amount) as u8;
}
};
set_colour(&mut colour.0, max_light.0 as f32, min_light.0 as f32);
set_colour(&mut colour.1, max_light.1 as f32, min_light.1 as f32);
set_colour(&mut colour.2, max_light.2 as f32, min_light.2 as f32);
self.count = 4;
}
effect_state_impl!();
}

View File

@@ -1,219 +0,0 @@
mod effects;
pub use effects::*;
use crate::{
keys::Key, layouts::KeyLayout, Colour, KeyColourArray, PerKeyRaw, PerZone, ZonedColourArray,
};
use serde_derive::{Deserialize, Serialize};
// static mut RNDINDEX: usize = 0;
static mut PRNDINDEX: usize = 0;
/// Pseudo random table ripped straight out of room4doom
pub const RNDTABLE: [i32; 256] = [
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66, 74, 21, 211, 47, 80, 242, 154,
27, 205, 128, 161, 89, 77, 36, 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188,
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224, 149, 104, 25, 178, 252, 182,
202, 182, 141, 197, 4, 81, 181, 242, 145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175,
249, 0, 175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235, 25, 92, 20, 145, 138,
77, 69, 166, 78, 176, 173, 212, 166, 113, 94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37,
171, 75, 136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196, 135, 106, 63, 197, 195,
86, 96, 203, 113, 101, 170, 247, 181, 113, 80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112,
166, 103, 241, 24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224, 145, 224, 81,
206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95, 28, 139, 123, 98, 125, 196, 15, 70, 194, 253,
54, 14, 109, 226, 71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36, 17, 46, 52,
231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106, 197, 242, 98, 43, 39, 175, 254, 145, 190,
84, 118, 222, 187, 136, 120, 163, 236, 249,
];
pub fn p_random() -> i32 {
unsafe {
PRNDINDEX = (PRNDINDEX + 1) & 0xFF;
RNDTABLE[PRNDINDEX]
}
}
pub(crate) trait EffectState {
/// Calculate the next colour state
fn next_colour_state(&mut self, _layout: &KeyLayout);
/// Return the resulting colour. Implementers should store the colour to return it.
fn get_colour(&self) -> Colour;
fn get_led_type(&self) -> LedType;
fn set_led_type(&mut self, led_type: LedType);
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub enum LedType {
Key(Key),
Zone(PerZone),
}
impl Default for LedType {
fn default() -> Self {
Self::Zone(PerZone::None)
}
}
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct Sequences(Vec<Effect>);
impl Sequences {
#[inline]
pub fn new() -> Self {
Self(Vec::new())
}
#[inline]
pub fn push(&mut self, action: Effect) {
self.0.push(action);
}
#[inline]
pub fn insert(&mut self, index: usize, action: Effect) {
self.0.insert(index, action);
}
/// Remove an item at this position from the run buffer. If the `index` supplied
/// is not in range then `None` is returned, otherwise the `ActionData` at that location
/// is yeeted and returned.
#[inline]
pub fn remove_item(&mut self, index: usize) -> Option<Effect> {
if index < self.0.len() {
return Some(self.0.remove(index));
}
None
}
pub fn next_state(&mut self, layout: &KeyLayout) {
for effect in &mut self.0 {
effect.next_state(layout);
}
}
pub fn create_packets(&self) -> PerKeyRaw {
let mut keys = KeyColourArray::new();
let mut zones = ZonedColourArray::new();
let mut is_per_key = false;
for effect in &self.0 {
match effect.get_led_type() {
LedType::Key(key) => {
is_per_key = true;
if let Some(rgb) = keys.rgb_for_key(key) {
let c = effect.get_colour();
rgb[0] = c.0;
rgb[1] = c.1;
rgb[2] = c.2;
}
}
LedType::Zone(z) => {
let rgb = zones.rgb_for_zone(z);
let c = effect.get_colour();
rgb[0] = c.0;
rgb[1] = c.1;
rgb[2] = c.2;
}
}
}
if is_per_key {
keys.into()
} else {
vec![zones.into()]
}
}
}
#[cfg(test)]
mod tests {
use crate::{
keys::Key, layouts::KeyLayout, Breathe, Colour, Effect, Flicker, LedType, Sequences, Speed,
Static,
};
#[test]
fn single_key_next_state_then_create() {
let layout = KeyLayout::gx502_layout();
let mut seq = Sequences::new();
seq.0.push(Effect::Static(Static::new(
LedType::Key(Key::F),
Colour(255, 127, 0),
)));
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 255);
assert_eq!(packets[5][34], 127);
assert_eq!(packets[5][35], 0);
}
#[test]
fn cycle_breathe() {
let layout = KeyLayout::gx502_layout();
let mut seq = Sequences::new();
seq.0.push(Effect::Breathe(Breathe::new(
LedType::Key(Key::F),
Colour(255, 127, 0),
Colour(127, 0, 255),
Speed::Med,
)));
let s = serde_json::to_string_pretty(&seq).unwrap();
println!("{s}");
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 213);
assert_eq!(packets[5][34], 106);
assert_eq!(packets[5][35], 0);
// dbg!(&packets[5][33..=35]);
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 171);
assert_eq!(packets[5][34], 85);
assert_eq!(packets[5][35], 0);
}
#[test]
fn cycle_flicker() {
let layout = KeyLayout::gx502_layout();
let mut seq = Sequences::new();
seq.0.push(Effect::Flicker(Flicker::new(
LedType::Key(Key::F),
Colour(255, 127, 80),
100,
10,
)));
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[0][0], 0x5d);
assert_eq!(packets[5][33], 255);
assert_eq!(packets[5][34], 127);
assert_eq!(packets[5][35], 80);
// The random is deterministic
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
seq.next_state(&layout);
let packets = seq.create_packets();
assert_eq!(packets[5][33], 215);
assert_eq!(packets[5][34], 87);
assert_eq!(packets[5][35], 40);
}
}

View File

@@ -1,5 +1,7 @@
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
use std::ops::{BitAnd, BitOr};
use serde::{Deserialize, Serialize};
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
@@ -16,12 +18,12 @@ pub const LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
/// Writes out the correct byte string for brightness
pub const fn aura_brightness_bytes(brightness: u8) -> [u8; 17] {
[
0x5A, 0xBA, 0xC5, 0xC4, brightness, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x5a, 0xba, 0xc5, 0xc4, brightness, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]
}
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Serialize, Deserialize, Default)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Serialize, Deserialize, Default)]
pub enum AuraDevice {
Tuf,
X1854,
@@ -45,6 +47,19 @@ impl From<&str> for AuraDevice {
}
}
impl Debug for AuraDevice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Tuf => write!(f, "Tuf"),
Self::X1854 => write!(f, "0x1854"),
Self::X1869 => write!(f, "0x1869"),
Self::X1866 => write!(f, "0x1866"),
Self::X19B6 => write!(f, "0x19B6"),
Self::Unknown => write!(f, "Unknown"),
}
}
}
/// This struct is intended as a helper to pass args to generic dbus interface
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
@@ -73,7 +88,8 @@ impl AuraDevTuf {
/// # Bits for older 0x1866 keyboard model
///
/// Keybord and Lightbar require Awake, Boot and Sleep apply to both
/// Keybord and Lightbar regardless of if either are enabled (or Awake is enabled)
/// Keybord and Lightbar regardless of if either are enabled (or Awake is
/// enabled)
///
/// | Byte 1 | Byte 2 | Byte 3 | function | hex |
/// |------------|------------|------------|----------|----------|
@@ -83,7 +99,6 @@ impl AuraDevTuf {
/// | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
/// | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
/// | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
///
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Serialize, Deserialize)]
#[repr(u32)]
@@ -161,7 +176,6 @@ impl BitAnd<AuraDev1866> for AuraDev1866 {
/// | 0000 | 0100 | 04 | lightbar on | bit 3 |
/// | 0000 | 1000 | 08 | lightbar off sleep | bit 4 |
/// | 0001 | 0000 | 10 | lightbar shtdn off | bit 5 |
///
#[cfg_attr(feature = "dbus", derive(Type))]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Serialize, Deserialize)]
#[repr(u32)]
@@ -226,9 +240,8 @@ impl BitAnd<AuraDev19b6> for AuraDev19b6 {
#[cfg(test)]
mod tests {
use crate::usb::AuraDev19b6;
use super::AuraDev1866;
use crate::usb::AuraDev19b6;
#[test]
fn check_0x1866_control_bytes() {
@@ -370,7 +383,7 @@ mod tests {
assert_eq!(bytes[2], 0x0f);
let byte3 = [
//AuraDev19b6::AwakeLid,
// AuraDev19b6::AwakeLid,
AuraDev19b6::BootLid,
AuraDev19b6::SleepLid,
AuraDev19b6::ShutdownLid,
@@ -393,7 +406,7 @@ mod tests {
AuraDev19b6::AwakeLid,
AuraDev19b6::BootLid,
AuraDev19b6::SleepLid,
//AuraDev19b6::ShutdownLid,
// AuraDev19b6::ShutdownLid,
];
let bytes = AuraDev19b6::to_bytes(&byte3);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
@@ -401,9 +414,9 @@ mod tests {
let byte3 = [
AuraDev19b6::AwakeLid,
//AuraDev19b6::BootLid,
// AuraDev19b6::BootLid,
AuraDev19b6::SleepLid,
//AuraDev19b6::ShutdownLid,
// AuraDev19b6::ShutdownLid,
];
let bytes = AuraDev19b6::to_bytes(&byte3);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);