···11+{
22+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
33+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
44+ // List of extensions which should be recommended for users of this workspace.
55+ "recommendations": [
66+ "rust-lang.rust-analyzer",
77+ "tamasfe.even-better-toml",
88+ ],
99+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
1010+ "unwantedRecommendations": []
1111+}
···11+[package]
22+edition = "2024"
33+rust-version = "1.85.0"
44+name = "macropad"
55+version = "0.1.0"
66+authors = ["Eric Wood <eric@ericwood.org>"]
77+resolver = "2"
88+99+[dependencies]
1010+embassy-embedded-hal = { version = "0.5.0", features = ["defmt"] }
1111+embassy-sync = { version = "0.7.2", features = ["defmt"] }
1212+embassy-executor = { version = "0.9.1", features = [
1313+ "arch-cortex-m",
1414+ "executor-thread",
1515+ "executor-interrupt",
1616+ "defmt",
1717+] }
1818+embassy-time = { version = "0.5.0", features = [
1919+ "defmt",
2020+ "defmt-timestamp-uptime",
2121+] }
2222+embassy-rp = { version = "0.9.0", features = [
2323+ "defmt",
2424+ "unstable-pac",
2525+ "time-driver",
2626+ "critical-section-impl",
2727+ "rp2040",
2828+] }
2929+embassy-futures = { version = "0.1.2" }
3030+embassy-usb = { version = "0.5.1", features = ["defmt"] }
3131+embassy-usb-logger = { version = "0.5.1" }
3232+usbd-hid = "0.9.0"
3333+3434+defmt = "1.0.1"
3535+defmt-rtt = "1.1.0"
3636+fixed = "1.29.0"
3737+fixed-macro = "1.2.0"
3838+3939+cortex-m = { version = "0.7.7", features = ["inline-asm"] }
4040+cortex-m-rt = "0.7.5"
4141+panic-probe = { version = "1.0.0", features = ["print-defmt"] }
4242+futures = { version = "0.3.31", default-features = false, features = [
4343+ "async-await",
4444+ "cfg-target-has-atomic",
4545+ "unstable",
4646+] }
4747+heapless = "0.9.2"
4848+4949+embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0" }
5050+embedded-hal-async = "1.0.0"
5151+embedded-hal-bus = { version = "0.3.0", features = ["async"] }
5252+embedded-io-async = { version = "0.7.0", features = ["defmt"] }
5353+embedded-storage = { version = "0.3" }
5454+static_cell = "2.1.1"
5555+portable-atomic = { version = "1.11.1", features = ["critical-section"] }
5656+log = "0.4.28"
5757+pio-proc = "0.3.0"
5858+pio = "0.3.0"
5959+rand = { version = "0.9.2", default-features = false }
6060+ws2812-spi = "0.5.1"
6161+smart-leds = "0.4.0"
6262+embedded-graphics = { version = "0.8.1", features = ["defmt"] }
6363+sh1106 = { version = "0.5.0", features = ["graphics"] }
6464+sb-rotary-encoder = "0.1.0"
6565+midi-convert = "0.2.0"
6666+usbd-midi = "0.5.0"
6767+6868+[profile.release]
6969+debug = true
7070+7171+# Below configs are here to mute the rust-analyzer error.
7272+# "Can't find crate for 'test'" as this is a no_std project
7373+[[bin]]
7474+name = "macropad"
7575+test = false
7676+bench = false
+21
LICENSE
···11+MIT License
22+33+Copyright (c) 2023 Mike Panetta
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
+36
build.rs
···11+//! This build script copies the `memory.x` file from the crate root into
22+//! a directory where the linker can always find it at build time.
33+//! For many projects this is optional, as the linker always searches the
44+//! project root directory -- wherever `Cargo.toml` is. However, if you
55+//! are using a workspace or have a more complicated build setup, this
66+//! build script becomes required. Additionally, by requesting that
77+//! Cargo re-run the build script whenever `memory.x` is changed,
88+//! updating `memory.x` ensures a rebuild of the application with the
99+//! new memory settings.
1010+1111+use std::env;
1212+use std::fs::File;
1313+use std::io::Write;
1414+use std::path::PathBuf;
1515+1616+fn main() {
1717+ // Put `memory.x` in our output directory and ensure it's
1818+ // on the linker search path.
1919+ let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
2020+ File::create(out.join("memory.x"))
2121+ .unwrap()
2222+ .write_all(include_bytes!("memory.x"))
2323+ .unwrap();
2424+ println!("cargo:rustc-link-search={}", out.display());
2525+2626+ // By default, Cargo will re-run a build script whenever
2727+ // any file in the project changes. By specifying `memory.x`
2828+ // here, we ensure the build script is only re-run when
2929+ // `memory.x` is changed.
3030+ println!("cargo:rerun-if-changed=memory.x");
3131+3232+ println!("cargo:rustc-link-arg-bins=--nmagic");
3333+ println!("cargo:rustc-link-arg-bins=-Tlink.x");
3434+ println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
3535+ println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
3636+}
+17
memory.x
···11+MEMORY {
22+ BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100
33+ FLASH : ORIGIN = 0x10000100, LENGTH = 8192K - 0x100
44+55+ /* Pick one of the two options for RAM layout */
66+77+ /* OPTION A: Use all RAM banks as one big block */
88+ /* Reasonable, unless you are doing something */
99+ /* really particular with DMA or other concurrent */
1010+ /* access that would benefit from striping */
1111+ RAM : ORIGIN = 0x20000000, LENGTH = 264K
1212+1313+ /* OPTION B: Keep the unstriped sections separate */
1414+ /* RAM: ORIGIN = 0x20000000, LENGTH = 256K */
1515+ /* SCRATCH_A: ORIGIN = 0x20040000, LENGTH = 4K */
1616+ /* SCRATCH_B: ORIGIN = 0x20041000, LENGTH = 4K */
1717+}