Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update firmware and modernize generation scripts #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ version = "0.1.0"
edition = "2021"

[dependencies]
embedded-hal = "1.0.0-rc.1"
embedded-hal = "1.0.0"
embedded-hal-async = "1.0.0-rc.1"
defmt = "0.3"
futures = { version = "0.3.28", default-features = false }
heapless = "0.7.16"
heapless = "0.8.0"
align-data = "0.1.0"
num_enum = { version = "0.6.1", default-features = false }
embassy-time = { version = "0.1.2" }
embassy-net-driver-channel = { version = "0.1.0" }
num_enum = { version = "0.7.3", default-features = false }
embassy-time = { version = "0.3.2" }
embassy-net-driver-channel = { version = "0.3.0" }
2 changes: 1 addition & 1 deletion example/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ build-std = ["core"]
#build-std-features = ["panic_immediate_abort"]

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run --chip nrf5340"
runner = "probe-rs run --chip nrf5340_xxAA --allow-erase-all"

[build]
target = "thumbv8m.main-none-eabihf"
Expand Down
29 changes: 12 additions & 17 deletions example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,23 @@ edition = "2021"

[dependencies]
nrf70 = { path = ".." }
embassy-executor = { version = "0.2.0", features = [
"nightly",
embassy-executor = { version = "0.6.0", features = [
"defmt",
"arch-cortex-m",
"executor-thread",
"integrated-timers",
"task-arena-size-32768"
] }
embassy-time = { version = "0.1.2", features = [
"nightly",
embassy-time = { version = "0.3.2", features = [
"defmt",
"defmt-timestamp-uptime",
"unstable-traits",
] }
embassy-sync = { version = "0.2.0" }
embassy-nrf = { version = "0.1.0", features = [
"nightly",
embassy-nrf = { version = "0.2.0", features = [
"defmt",
"nrf5340-app-s",
"gpiote",
"time-driver-rtc1",
"unstable-traits",
"unstable-pac",
] }
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
Expand All @@ -43,15 +39,14 @@ align-data = "0.1.0"
num_enum = { version = "0.6.1", default-features = false }

[patch.crates-io]
embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-nrf = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-macros = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "26870082427b64d3ca42691c55a2cded5eadc548" }
embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-nrf = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "0ef06cc19b61c8196fea941514ec313a0f15d145" }

# embassy-embedded-hal = { path = "/home/dirbaio/embassy/embassy/embassy-embedded-hal" }
# embassy-executor = { path = "/home/dirbaio/embassy/embassy/embassy-executor" }
Expand Down
66 changes: 66 additions & 0 deletions example/src/bin/dk5340-shield.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//! This uses the nRF7002-EK shield with a nRF5340-DK.

#![no_std]
#![no_main]
#![deny(unused_must_use)]

use defmt::*;
use defmt_rtt as _; // global logger
use embassy_executor::Spawner;
use embassy_nrf::bind_interrupts;
use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
use embassy_nrf::spim::{self, Spim};
use embassy_time::{Delay, Duration, Timer};
use embedded_hal_bus::spi::ExclusiveDevice;
use nrf70::SpiBus;
use {embassy_nrf as _, panic_probe as _};

bind_interrupts!(struct Irqs {
SERIAL0 => spim::InterruptHandler<embassy_nrf::peripherals::SERIAL0>;
});

#[embassy_executor::task]
async fn blink_task(led: AnyPin) -> ! {
let mut led = Output::new(led, Level::High, OutputDrive::Standard);
loop {
led.set_high();
Timer::after(Duration::from_millis(250)).await;
led.set_low();
Timer::after(Duration::from_millis(250)).await;
}
}

#[embassy_executor::main]
async fn main(spawner: Spawner) {
info!("Hello World!");
let config: embassy_nrf::config::Config = Default::default();
let p = embassy_nrf::init(config);
spawner.spawn(blink_task(p.P0_28.degrade())).unwrap();

// TODO: the 5340dk datasheet says you should only use P0.13-P0.18 for QSPI, but these are allowed in the hal?
let sck = p.P1_15;
let csn = p.P1_12;
let dio0 = p.P1_13;
let dio1 = p.P1_14;
let _dio2 = p.P1_10;
let _dio3 = p.P1_11;

// TODO: COEX pins
let bucken = Output::new(p.P1_00, Level::Low, OutputDrive::HighDrive);
let iovdd_ctl = Output::new(p.P1_01.degrade(), Level::Low, OutputDrive::Standard);
let host_irq = Input::new(p.P1_09.degrade(), Pull::None);

// TODO: QSPI

let mut config = spim::Config::default();
config.frequency = spim::Frequency::M8;
let spim = Spim::new(p.SERIAL0, Irqs, sck, dio1, dio0, config);
let csn = Output::new(csn, Level::High, OutputDrive::HighDrive);
let spi = ExclusiveDevice::new(spim, csn, Delay);
let bus = SpiBus::new(spi);

let mut state = nrf70::State::new();
let (device, control, mut runner) = nrf70::new(&mut state, bus, bucken, iovdd_ctl, host_irq).await;

runner.run().await;
}
3 changes: 3 additions & 0 deletions example/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![no_std]
#![no_main]
#![deny(unused_must_use)]
3 changes: 0 additions & 3 deletions example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![deny(unused_must_use)]
#![feature(async_fn_in_trait)]
#![feature(impl_trait_projections)]

use defmt::*;
use defmt_rtt as _; // global logger
Expand Down
Loading