]> patrickod personal git archive - keywing-rs.git/commitdiff
2021 nix flake updates & some minor cleanup patrickod/feather-m4
authorPatrick O'Doherty <p@trickod.com>
Sat, 10 Jul 2021 22:08:35 +0000 (15:08 -0700)
committerPatrick O'Doherty <p@trickod.com>
Sat, 10 Jul 2021 22:08:35 +0000 (15:08 -0700)
.envrc
.gitignore [new file with mode: 0644]
flake.lock [new file with mode: 0644]
flake.nix [new file with mode: 0644]
keywing/src/main.rs

diff --git a/.envrc b/.envrc
index 051d09d292a8d078291285bb1c6931a94d1e9a89..3550a30f2de389e537ee40ca5e64a77dc185c79b 100644 (file)
--- a/.envrc
+++ b/.envrc
@@ -1 +1 @@
-eval "$(lorri direnv)"
+use flake
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..92b2793
--- /dev/null
@@ -0,0 +1 @@
+.direnv
diff --git a/flake.lock b/flake.lock
new file mode 100644 (file)
index 0000000..a28f98d
--- /dev/null
@@ -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 (file)
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
+          ];
+        };
+      }
+    );
+}
index 28841c15c79ac518989ed4f1c5c24fff83eba6c4..aaa1d488e7e114d422597a8f9efe7d85f180fc82 100644 (file)
@@ -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)