Add bsp for Pico and Pimoroni Pico LiPo

This commit is contained in:
Hmvp 2021-07-03 10:15:39 +02:00 committed by 9names
parent 0d4b0e5645
commit c4f30a8ba6
9 changed files with 115 additions and 14 deletions

View file

@ -2,5 +2,7 @@
members = [ members = [
"rp2040-hal", "rp2040-hal",
"boards/feather_rp2040", "boards/feather_rp2040",
"boards/pico",
"boards/pico_explorer", "boards/pico_explorer",
"boards/pico_lipo_16mb",
] ]

View file

@ -1,7 +0,0 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

View file

@ -1,13 +1,15 @@
[package] [package]
name = "pico-bsp" name = "pico"
version = "0.1.0" version = "0.1.0"
authors = ["evan <evanmolder@gmail.com>"] authors = ["evan <evanmolder@gmail.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/pico-bsc" homepage = "https://github.com/rp-rs/rp-hal/boards/pico"
description = "Board Support Package for the Raspberry Pi Pico" description = "Board Support Package for the Raspberry Pi Pico"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
rp2040-hal = "0.1.0" cortex-m = "0.7.2"
rp2040-hal = { path = "../../rp2040-hal", version = "0.1.0" }
cortex-m-rt = { version = "0.6.14", optional = true }

45
boards/pico/src/lib.rs Normal file
View file

@ -0,0 +1,45 @@
#![no_std]
extern crate 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: gpio0 },
Gpio1 { name: gpio1 },
Gpio2 { name: gpio2 },
Gpio3 { name: gpio3 },
Gpio4 { name: gpio4 },
Gpio5 { name: gpio5 },
Gpio6 { name: gpio6 },
Gpio7 { name: gpio7 },
Gpio8 { name: gpio8 },
Gpio9 { name: gpio9 },
Gpio10 { name: gpio10 },
Gpio11 { name: gpio11 },
Gpio12 { name: gpio12 },
Gpio13 { name: gpio13 },
Gpio14 { name: gpio14 },
Gpio15 { name: gpio15 },
Gpio16 { name: gpio16 },
Gpio17 { name: gpio17 },
Gpio18 { name: gpio18 },
Gpio19 { name: gpio19 },
Gpio20 { name: gpio20 },
Gpio21 { name: gpio21 },
Gpio22 { name: gpio22 },
Gpio23 { name: bootsel },
Gpio24 { name: vbus_detect },
Gpio25 { name: led },
Gpio26 { name: gpio26 },
Gpio27 { name: gpio27 },
Gpio28 { name: gpio28 },
Gpio29 {
name: voltage_monitor
},
);

View file

@ -86,10 +86,7 @@ hal::bsp_pins!(
name: i2c_scl, name: i2c_scl,
aliases: { FunctionI2C: Scl } aliases: { FunctionI2C: Scl }
}, },
Gpio22 { Gpio22 { name: i2c_int },
name: i2c_int,
aliases: { FunctionI2C: Int }
},
Gpio25 { name: led }, Gpio25 { name: led },
Gpio26 { name: adc0 }, Gpio26 { name: adc0 },
Gpio27 { name: adc1 }, Gpio27 { name: adc1 },

View file

@ -0,0 +1,19 @@
[package]
name = "pico_lipo_16_mb"
version = "0.1.0"
authors = ["Hmvp <hmvp@users.noreply.github.com>"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/pico_lipo_16_mb"
description = "Board Support Package for the Pico LiPo 16 Mb"
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"]

View file

@ -0,0 +1,43 @@
#![no_std]
extern crate 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: gpio0 },
Gpio1 { name: gpio1 },
Gpio2 { name: gpio2 },
Gpio3 { name: gpio3 },
Gpio4 { name: gpio4 },
Gpio5 { name: gpio5 },
Gpio6 { name: gpio6 },
Gpio7 { name: gpio7 },
Gpio8 { name: gpio8 },
Gpio9 { name: gpio9 },
Gpio10 { name: gpio10 },
Gpio11 { name: gpio11 },
Gpio12 { name: gpio12 },
Gpio13 { name: gpio13 },
Gpio14 { name: gpio14 },
Gpio15 { name: gpio15 },
Gpio16 { name: gpio16 },
Gpio17 { name: gpio17 },
Gpio18 { name: gpio18 },
Gpio19 { name: gpio19 },
Gpio20 { name: gpio20 },
Gpio21 { name: gpio21 },
Gpio22 { name: gpio22 },
Gpio23 { name: bootsel },
Gpio24 { name: vbus_detect },
Gpio25 { name: led },
Gpio26 { name: gpio26 },
Gpio27 { name: gpio27 },
Gpio28 { name: gpio28 },
Gpio29 { name: batt_sense },
);