Skip to content
Snippets Groups Projects
Commit 56b8b99c authored by Benjamin Koch's avatar Benjamin Koch
Browse files

copy over my previous changes and adjust paths in Cargo.toml

parent a5ce6742
No related branches found
No related tags found
No related merge requests found
/target/
This diff is collapsed.
...@@ -6,16 +6,16 @@ license = "MIT OR Apache-2.0" ...@@ -6,16 +6,16 @@ license = "MIT OR Apache-2.0"
[dependencies] [dependencies]
embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal", features = ["defmt"] } embassy-embedded-hal = { version = "0.1.0", path = "./embassy/embassy-embedded-hal", features = ["defmt"] }
embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } embassy-sync = { version = "0.2.0", path = "./embassy/embassy-sync", features = ["defmt"] }
embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } embassy-executor = { version = "0.2.0", path = "./embassy/embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["nightly", "unstable-traits", "defmt", "defmt-timestamp-uptime"] } embassy-time = { version = "0.1.0", path = "./embassy/embassy-time", features = ["nightly", "unstable-traits", "defmt", "defmt-timestamp-uptime"] }
embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } embassy-rp = { version = "0.1.0", path = "./embassy/embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } embassy-usb = { version = "0.1.0", path = "./embassy/embassy-usb", features = ["defmt"] }
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet"] } embassy-net = { version = "0.1.0", path = "./embassy/embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } embassy-futures = { version = "0.1.0", path = "./embassy/embassy-futures" }
embassy-usb-logger = { version = "0.1.0", path = "../../embassy-usb-logger" } embassy-usb-logger = { version = "0.1.0", path = "./embassy/embassy-usb-logger" }
embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["time", "defmt"] } embassy-lora = { version = "0.1.0", path = "./embassy/embassy-lora", features = ["time", "defmt"] }
lora-phy = { version = "1" } lora-phy = { version = "1" }
lorawan-device = { version = "0.10.0", default-features = false, features = ["async", "external-lora-phy"] } lorawan-device = { version = "0.10.0", default-features = false, features = ["async", "external-lora-phy"] }
lorawan = { version = "0.7.3", default-features = false, features = ["default-crypto"] } lorawan = { version = "0.7.3", default-features = false, features = ["default-crypto"] }
......
nix-shell -p rustup udev.dev pkg-config openssl.dev
cargo install probe-rs-cli
cargo install probe-rs-debugger
# https://github.com/raspberrypi/picoprobe
# https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
cargo run --bin blinky
...@@ -27,6 +27,7 @@ async fn main(_spawner: Spawner) { ...@@ -27,6 +27,7 @@ async fn main(_spawner: Spawner) {
let level = adc.read(&mut p28).await; let level = adc.read(&mut p28).await;
info!("Pin 28 ADC: {}", level); info!("Pin 28 ADC: {}", level);
let temp = adc.read_temperature().await; let temp = adc.read_temperature().await;
//info!("Temp: {}", temp);
info!("Temp: {} degrees", convert_to_celsius(temp)); info!("Temp: {} degrees", convert_to_celsius(temp));
Timer::after(Duration::from_secs(1)).await; Timer::after(Duration::from_secs(1)).await;
} }
...@@ -34,5 +35,5 @@ async fn main(_spawner: Spawner) { ...@@ -34,5 +35,5 @@ async fn main(_spawner: Spawner) {
fn convert_to_celsius(raw_temp: u16) -> f32 { fn convert_to_celsius(raw_temp: u16) -> f32 {
// According to chapter 4.9.5. Temperature Sensor in RP2040 datasheet // According to chapter 4.9.5. Temperature Sensor in RP2040 datasheet
27.0 - (raw_temp as f32 * 3.3 / 4096.0 - 0.706) / 0.001721 as f32 27.0 - (raw_temp as f32 * 3.0522 / 4096.0 - 0.706) / 0.001721 as f32
} }
...@@ -12,7 +12,7 @@ use {defmt_rtt as _, panic_probe as _}; ...@@ -12,7 +12,7 @@ use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]
async fn main(_spawner: Spawner) { async fn main(_spawner: Spawner) {
let p = embassy_rp::init(Default::default()); let p = embassy_rp::init(Default::default());
let mut led = Output::new(p.PIN_25, Level::Low); let mut led = Output::new(p.PIN_4, Level::Low);
loop { loop {
info!("led on!"); info!("led on!");
......
...@@ -22,16 +22,16 @@ use {defmt_rtt as _, panic_probe as _}; ...@@ -22,16 +22,16 @@ use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]
async fn main(_spawner: Spawner) { async fn main(_spawner: Spawner) {
let p = embassy_rp::init(Default::default()); let p = embassy_rp::init(Default::default());
let mut led = Output::new(p.PIN_25, Level::Low); let mut led = Output::new(p.PIN_4, Level::Low);
let mut async_input = Input::new(p.PIN_16, Pull::None); let mut async_input = Input::new(p.PIN_11, Pull::Up);
loop { loop {
info!("wait_for_high. Turn on LED"); info!("wait_for_high. Turn on LED");
led.set_high(); led.set_high();
async_input.wait_for_high().await; async_input.wait_for_low().await;
info!("done wait_for_high. Turn off LED"); info!("done wait_for_low. Turn off LED");
led.set_low(); led.set_low();
Timer::after(Duration::from_secs(2)).await; Timer::after(Duration::from_secs(2)).await;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment