From: Patrick O'Doherty
Date: Sat, 10 Jul 2021 22:08:35 +0000 (-0700) Subject: 2021 nix flake updates & some minor cleanup X-Git-Url: https://git.patrickod.com/vpn/log/static/git-logo.png?a=commitdiff_plain;h=7b363ff299aa4caf985392e76033df6a36606410;p=keywing-rs.git 2021 nix flake updates & some minor cleanup --- diff --git a/.envrc b/.envrc index 051d09d..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -eval "$(lorri direnv)" +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a28f98d --- /dev/null +++ b/flake.lock @@ -0,0 +1,88 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1614513358, + "narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5466c5bbece17adaab2d82fae80b46e807611bf3", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "narHash": "sha256-CM4XxuzS4VaTH3WYwUUmPBUSc2BNVLhv8JEahERWUWY=", + "path": "/home/patrickod/code/nixpkgs", + "type": "path" + }, + "original": { + "path": "/home/patrickod/code/nixpkgs", + "type": "path" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1617325113, + "narHash": "sha256-GksR0nvGxfZ79T91UUtWjjccxazv6Yh/MvEJ82v1Xmw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "54c1e44240d8a527a8f4892608c4bce5440c3ecb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1625796896, + "narHash": "sha256-yAFp4hslYKZcZwAXSiKnFezSFY/kdoh4l5qqioTtHFM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "76732f3ddba766b1fe772fca80aafbc9cccd78dd", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..20b8f1a --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "rust ARM M-0 development"; + inputs = { + nixpkgs.url = "path:/home/patrickod/code/nixpkgs"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + rust = pkgs.rust-bin.nightly.latest.default.override { + extensions = [ + "clippy-preview" + "rust-src" + "rustfmt-preview" + ]; + targets = [ + "thumbv7em-none-eabihf" + ]; + }; + in + { + devShell = pkgs.mkShell { + buildInputs = [ + pkgs.gcc-arm-embedded + pkgs.probe-run + pkgs.flip-link + pkgs.cargo-hf2 + rust + ]; + }; + } + ); +} diff --git a/keywing/src/main.rs b/keywing/src/main.rs index 28841c1..aaa1d48 100644 --- a/keywing/src/main.rs +++ b/keywing/src/main.rs @@ -56,6 +56,12 @@ fn inner_main() -> Result<(), &'static str> { ); let mut delay = Delay::new(_core.SYST, &mut _clocks); + // set pins low to prevent floating values read as data by the pixels + let mut front_neopixel_pin = _pins.d11.into_push_pull_output(&mut _pins.port); + let mut rear_neopixel_pin = _pins.neopixel.into_push_pull_output(&mut _pins.port); + front_neopixel_pin.set_low().unwrap(); + rear_neopixel_pin.set_high().unwrap(); + // use ChannelMode::NoBlockS rtt_init_print!(NoBlockSkip, 4096); @@ -107,14 +113,10 @@ fn inner_main() -> Result<(), &'static str> { lcd.set_orientation(Orientation::Landscape).unwrap(); - let mut _buffy = [0u16; 24 * 32]; let mut buffy2 = [[0u16; 320]; 240]; let mut fbuffy = buffer::FrameBuffer::new(&mut buffy2); - // // rrrrr gggggg bbbbb - // buffy.iter_mut().for_each(|px| *px = 0b11111_000000_00000); - let mut style = TextStyleBuilder::new(Font8x16) .text_color(Rgb565::WHITE) .background_color(Rgb565::BLACK)