Move away from matrix-based key layout

This commit is contained in:
2023-03-17 23:37:43 +01:00
parent 4e83970cc3
commit 5c154141d0
12 changed files with 384 additions and 269 deletions

View File

@ -8,12 +8,19 @@
//! updating `memory.x` ensures a rebuild of the application with the
//! new memory settings.
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::{env, fs};
use tgnt::layer::Layer;
fn main() {
memory();
serialize_layout();
}
fn memory() {
// Put `memory.x` in our output directory and ensure it's
// on the linker search path.
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
@ -36,3 +43,17 @@ fn main() {
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
//println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
}
fn serialize_layout() {
println!("cargo:rerun-if-changed=layers.ron");
let layers = fs::read_to_string("layers.ron").expect("Failed to read layers.ron");
let layers: Vec<Layer> = ron::from_str(&layers).expect("Failed to deserialize layers.ron");
let serialized = postcard::to_stdvec(&layers).expect("Failed to serialize layers");
File::create("./src/layers.pc")
.expect("Failed to create layers.pc")
.write_all(&serialized)
.expect("Failed to write layers.pc");
}