From 25cf81fdfea5276896eab5d60bad1d65e2120379 Mon Sep 17 00:00:00 2001 From: Andrea Nall Date: Sun, 25 Jul 2021 16:56:30 -0500 Subject: [PATCH] Add Adafruit Macropad BSP --- Cargo.toml | 1 + boards/adafruit_macropad/Cargo.toml | 18 ++++++++ boards/adafruit_macropad/src/lib.rs | 64 +++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 boards/adafruit_macropad/Cargo.toml create mode 100644 boards/adafruit_macropad/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 0f4cfee..d89057d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,4 +5,5 @@ members = [ "boards/pico", "boards/pico_explorer", "boards/pico_lipo_16mb", + "boards/adafruit_macropad", ] diff --git a/boards/adafruit_macropad/Cargo.toml b/boards/adafruit_macropad/Cargo.toml new file mode 100644 index 0000000..b64fbc4 --- /dev/null +++ b/boards/adafruit_macropad/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "adafruit_macropad" +version = "0.1.0" +authors = ["Andrea Nall "] +edition = "2018" +description = "Board Support Package for the Adafruit Macropad" +license = "MIT OR Apache-2.0" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +cortex-m = "0.7.2" +rp2040-hal = { path = "../../rp2040-hal", version = "0.1.0" } +cortex-m-rt = { version = "0.6.14", optional = true } + +[features] +default = ["rt"] +rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/adafruit_macropad/src/lib.rs b/boards/adafruit_macropad/src/lib.rs new file mode 100644 index 0000000..3cc1355 --- /dev/null +++ b/boards/adafruit_macropad/src/lib.rs @@ -0,0 +1,64 @@ +#![no_std] + +pub use rp2040_hal as hal; + +#[cfg(feature = "rt")] +extern crate cortex_m_rt; +#[cfg(feature = "rt")] +pub use cortex_m_rt::entry; + +pub use hal::pac; + +hal::bsp_pins!( + Gpio0 { name: button }, + Gpio1 { name: key1 }, + Gpio2 { name: key2 }, + Gpio3 { name: key3 }, + Gpio4 { name: key4 }, + Gpio5 { name: key5 }, + Gpio6 { name: key6 }, + Gpio7 { name: key7 }, + Gpio8 { name: key8 }, + Gpio9 { name: key9 }, + Gpio10 { name: key10 }, + Gpio11 { name: key11 }, + Gpio12 { name: key12 }, + Gpio13 { name: led }, + Gpio14 { + name: speaker_shutdown + }, + Gpio15 { name: speaker }, + Gpio17 { + name: encoder_rota, + aliases: { PullUpInput: RotaryA } + }, + Gpio18 { + name: encoder_rotb, + aliases: { PullUpInput: RotaryB } + }, + Gpio19 { name: neopixel }, + Gpio20 { + name: sda, + aliases: { FunctionI2C: Sda } + }, + Gpio21 { + name: scl, + aliases: { FunctionI2C: Scl } + }, + // This CS is on the wrong SPI channel so cannot be controlled by the peripheral + Gpio22 { name: oled_cs }, + Gpio23 { name: oled_reset }, + Gpio24 { name: oled_dc }, + Gpio26 { + name: sclk, + aliases: { FunctionSpi: Sclk } + }, + Gpio27 { + name: mosi, + aliases: { FunctionSpi: Mosi } + }, + Gpio28 { + name: miso, + aliases: { FunctionSpi: Miso } + }, +);