Merge pull request #79 from embassy-rs/update-embassy
Update Embassy, to new PIO API.
This commit is contained in:
commit
a3d6aa5d7d
12
Cargo.toml
12
Cargo.toml
@ -12,7 +12,7 @@ firmware-logs = []
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-time = { version = "0.1.0" }
|
embassy-time = { version = "0.1.0" }
|
||||||
embassy-sync = { version = "0.1.0" }
|
embassy-sync = { version = "0.2.0" }
|
||||||
embassy-futures = { version = "0.1.0" }
|
embassy-futures = { version = "0.1.0" }
|
||||||
embassy-net-driver-channel = { version = "0.1.0" }
|
embassy-net-driver-channel = { version = "0.1.0" }
|
||||||
atomic-polyfill = "0.1.5"
|
atomic-polyfill = "0.1.5"
|
||||||
@ -28,11 +28,11 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.10" }
|
|||||||
num_enum = { version = "0.5.7", default-features = false }
|
num_enum = { version = "0.5.7", default-features = false }
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["cyw43-pio"]
|
members = ["cyw43-pio"]
|
||||||
|
5
ci.sh
5
ci.sh
@ -1,7 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
export CARGO_TARGET_DIR=$(pwd)/target
|
||||||
export DEFMT_LOG=trace
|
export DEFMT_LOG=trace
|
||||||
|
|
||||||
# build examples
|
# build examples
|
||||||
@ -18,3 +20,6 @@ cargo build --target thumbv6m-none-eabi --features 'log'
|
|||||||
cargo build --target thumbv6m-none-eabi --features 'defmt'
|
cargo build --target thumbv6m-none-eabi --features 'defmt'
|
||||||
cargo build --target thumbv6m-none-eabi --features 'log,firmware-logs'
|
cargo build --target thumbv6m-none-eabi --features 'log,firmware-logs'
|
||||||
cargo build --target thumbv6m-none-eabi --features 'defmt,firmware-logs'
|
cargo build --target thumbv6m-none-eabi --features 'defmt,firmware-logs'
|
||||||
|
|
||||||
|
(cd cyw43-pio; cargo build --target thumbv6m-none-eabi --features '')
|
||||||
|
(cd cyw43-pio; cargo build --target thumbv6m-none-eabi --features 'overclock')
|
||||||
|
@ -3,9 +3,15 @@ name = "cyw43-pio"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
# If disabled, SPI runs at 31.25MHz
|
||||||
|
# If enabled, SPI runs at 62.5MHz, which is 25% higher than 50Mhz which is the maximum according to the CYW43439 datasheet.
|
||||||
|
overclock = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cyw43 = { path = "../" }
|
cyw43 = { path = "../" }
|
||||||
embassy-rp = { version = "0.1.0", features = ["unstable-traits", "nightly", "unstable-pac", "time-driver"] }
|
embassy-rp = { version = "0.1.0", features = ["unstable-traits", "nightly", "unstable-pac", "time-driver"] }
|
||||||
pio-proc = "0.2"
|
pio-proc = "0.2"
|
||||||
pio = "0.2.1"
|
pio = "0.2.1"
|
||||||
|
fixed = "1.23.1"
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
@ -6,49 +6,80 @@ use core::slice;
|
|||||||
|
|
||||||
use cyw43::SpiBusCyw43;
|
use cyw43::SpiBusCyw43;
|
||||||
use embassy_rp::dma::Channel;
|
use embassy_rp::dma::Channel;
|
||||||
use embassy_rp::gpio::{Drive, Output, Pin, Pull, SlewRate};
|
use embassy_rp::gpio::{Drive, Level, Output, Pin, Pull, SlewRate};
|
||||||
use embassy_rp::pio::{PioStateMachine, ShiftDirection};
|
use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine};
|
||||||
use embassy_rp::relocate::RelocatedProgram;
|
use embassy_rp::relocate::RelocatedProgram;
|
||||||
use embassy_rp::{pio_instr_util, Peripheral};
|
use embassy_rp::{pio_instr_util, Peripheral, PeripheralRef};
|
||||||
use pio::Wrap;
|
use fixed::FixedU32;
|
||||||
use pio_proc::pio_asm;
|
use pio_proc::pio_asm;
|
||||||
|
|
||||||
pub struct PioSpi<CS: Pin, SM, DMA> {
|
pub struct PioSpi<'d, CS: Pin, PIO: Instance, const SM: usize, DMA> {
|
||||||
cs: Output<'static, CS>,
|
cs: Output<'d, CS>,
|
||||||
sm: SM,
|
sm: StateMachine<'d, PIO, SM>,
|
||||||
dma: DMA,
|
irq: Irq<'d, PIO, 0>,
|
||||||
|
dma: PeripheralRef<'d, DMA>,
|
||||||
wrap_target: u8,
|
wrap_target: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<CS, SM, DMA> PioSpi<CS, SM, DMA>
|
impl<'d, CS, PIO, const SM: usize, DMA> PioSpi<'d, CS, PIO, SM, DMA>
|
||||||
where
|
where
|
||||||
SM: PioStateMachine,
|
|
||||||
DMA: Channel,
|
DMA: Channel,
|
||||||
CS: Pin,
|
CS: Pin,
|
||||||
|
PIO: Instance,
|
||||||
{
|
{
|
||||||
pub fn new<DIO, CLK>(mut sm: SM, cs: Output<'static, CS>, dio: DIO, clk: CLK, dma: DMA) -> Self
|
pub fn new<DIO, CLK>(
|
||||||
|
common: &mut Common<'d, PIO>,
|
||||||
|
mut sm: StateMachine<'d, PIO, SM>,
|
||||||
|
irq: Irq<'d, PIO, 0>,
|
||||||
|
cs: Output<'d, CS>,
|
||||||
|
dio: DIO,
|
||||||
|
clk: CLK,
|
||||||
|
dma: impl Peripheral<P = DMA> + 'd,
|
||||||
|
) -> Self
|
||||||
where
|
where
|
||||||
DIO: Pin,
|
DIO: PioPin,
|
||||||
CLK: Pin,
|
CLK: PioPin,
|
||||||
{
|
{
|
||||||
|
#[cfg(feature = "overclock")]
|
||||||
let program = pio_asm!(
|
let program = pio_asm!(
|
||||||
".side_set 1"
|
".side_set 1"
|
||||||
|
|
||||||
".wrap_target"
|
".wrap_target"
|
||||||
// write out x-1 bits
|
// write out x-1 bits
|
||||||
"lp:",
|
"lp:"
|
||||||
"out pins, 1 side 0"
|
"out pins, 1 side 0"
|
||||||
"jmp x-- lp side 1"
|
"jmp x-- lp side 1"
|
||||||
// switch directions
|
// switch directions
|
||||||
"set pindirs, 0 side 0"
|
"set pindirs, 0 side 0"
|
||||||
// these nops seem to be necessary for fast clkdiv
|
"nop side 1" // necessary for clkdiv=1.
|
||||||
"nop side 1"
|
|
||||||
"nop side 0"
|
"nop side 0"
|
||||||
"nop side 1"
|
|
||||||
// read in y-1 bits
|
// read in y-1 bits
|
||||||
"lp2:"
|
"lp2:"
|
||||||
"in pins, 1 side 0"
|
"in pins, 1 side 1"
|
||||||
"jmp y-- lp2 side 1"
|
"jmp y-- lp2 side 0"
|
||||||
|
|
||||||
|
// wait for event and irq host
|
||||||
|
"wait 1 pin 0 side 0"
|
||||||
|
"irq 0 side 0"
|
||||||
|
|
||||||
|
".wrap"
|
||||||
|
);
|
||||||
|
#[cfg(not(feature = "overclock"))]
|
||||||
|
let program = pio_asm!(
|
||||||
|
".side_set 1"
|
||||||
|
|
||||||
|
".wrap_target"
|
||||||
|
// write out x-1 bits
|
||||||
|
"lp:"
|
||||||
|
"out pins, 1 side 0"
|
||||||
|
"jmp x-- lp side 1"
|
||||||
|
// switch directions
|
||||||
|
"set pindirs, 0 side 0"
|
||||||
|
"nop side 0"
|
||||||
|
// read in y-1 bits
|
||||||
|
"lp2:"
|
||||||
|
"in pins, 1 side 1"
|
||||||
|
"jmp y-- lp2 side 0"
|
||||||
|
|
||||||
// wait for event and irq host
|
// wait for event and irq host
|
||||||
"wait 1 pin 0 side 0"
|
"wait 1 pin 0 side 0"
|
||||||
@ -59,68 +90,59 @@ where
|
|||||||
|
|
||||||
let relocated = RelocatedProgram::new(&program.program);
|
let relocated = RelocatedProgram::new(&program.program);
|
||||||
|
|
||||||
let mut pin_io = sm.make_pio_pin(dio);
|
let mut pin_io: embassy_rp::pio::Pin<PIO> = common.make_pio_pin(dio);
|
||||||
pin_io.set_pull(Pull::Down);
|
pin_io.set_pull(Pull::None);
|
||||||
pin_io.set_schmitt(true);
|
pin_io.set_schmitt(true);
|
||||||
pin_io.set_input_sync_bypass(true);
|
pin_io.set_input_sync_bypass(true);
|
||||||
|
pin_io.set_drive_strength(Drive::_12mA);
|
||||||
|
pin_io.set_slew_rate(SlewRate::Fast);
|
||||||
|
|
||||||
let mut pin_clk = sm.make_pio_pin(clk);
|
let mut pin_clk = common.make_pio_pin(clk);
|
||||||
pin_clk.set_drive_strength(Drive::_12mA);
|
pin_clk.set_drive_strength(Drive::_12mA);
|
||||||
pin_clk.set_slew_rate(SlewRate::Fast);
|
pin_clk.set_slew_rate(SlewRate::Fast);
|
||||||
|
|
||||||
sm.write_instr(relocated.origin() as usize, relocated.code());
|
let mut cfg = Config::default();
|
||||||
|
cfg.use_program(&common.load_program(&relocated), &[&pin_clk]);
|
||||||
|
cfg.set_out_pins(&[&pin_io]);
|
||||||
|
cfg.set_in_pins(&[&pin_io]);
|
||||||
|
cfg.set_set_pins(&[&pin_io]);
|
||||||
|
cfg.shift_out.direction = ShiftDirection::Left;
|
||||||
|
cfg.shift_out.auto_fill = true;
|
||||||
|
//cfg.shift_out.threshold = 32;
|
||||||
|
cfg.shift_in.direction = ShiftDirection::Left;
|
||||||
|
cfg.shift_in.auto_fill = true;
|
||||||
|
//cfg.shift_in.threshold = 32;
|
||||||
|
|
||||||
// theoretical maximum according to data sheet, 100Mhz Pio => 50Mhz SPI Freq
|
#[cfg(feature = "overclock")]
|
||||||
sm.set_clkdiv(0x0140);
|
{
|
||||||
|
// 125mhz Pio => 62.5Mhz SPI Freq. 25% higher than theoretical maximum according to
|
||||||
|
// data sheet, but seems to work fine.
|
||||||
|
cfg.clock_divider = FixedU32::from_bits(0x0100);
|
||||||
|
}
|
||||||
|
|
||||||
// same speed as pico-sdk, 62.5Mhz
|
#[cfg(not(feature = "overclock"))]
|
||||||
// sm.set_clkdiv(0x0200);
|
{
|
||||||
|
// same speed as pico-sdk, 62.5Mhz
|
||||||
|
// This is actually the fastest we can go without overclocking.
|
||||||
|
// According to data sheet, the theoretical maximum is 100Mhz Pio => 50Mhz SPI Freq.
|
||||||
|
// However, the PIO uses a fractional divider, which works by introducing jitter when
|
||||||
|
// the divider is not an integer. It does some clocks at 125mhz and others at 62.5mhz
|
||||||
|
// so that it averages out to the desired frequency of 100mhz. The 125mhz clock cycles
|
||||||
|
// violate the maximum from the data sheet.
|
||||||
|
cfg.clock_divider = FixedU32::from_bits(0x0200);
|
||||||
|
}
|
||||||
|
|
||||||
// 32 Mhz
|
sm.set_config(&cfg);
|
||||||
// sm.set_clkdiv(0x03E8);
|
|
||||||
|
|
||||||
// 16 Mhz
|
sm.set_pin_dirs(Direction::Out, &[&pin_clk, &pin_io]);
|
||||||
// sm.set_clkdiv(0x07d0);
|
sm.set_pins(Level::Low, &[&pin_clk, &pin_io]);
|
||||||
|
|
||||||
// 8Mhz
|
|
||||||
// sm.set_clkdiv(0x0a_00);
|
|
||||||
|
|
||||||
// 1Mhz
|
|
||||||
// sm.set_clkdiv(0x7d_00);
|
|
||||||
|
|
||||||
// slowest possible
|
|
||||||
// sm.set_clkdiv(0xffff_00);
|
|
||||||
|
|
||||||
sm.set_autopull(true);
|
|
||||||
// sm.set_pull_threshold(32);
|
|
||||||
sm.set_autopush(true);
|
|
||||||
// sm.set_push_threshold(32);
|
|
||||||
|
|
||||||
sm.set_out_pins(&[&pin_io]);
|
|
||||||
sm.set_in_base_pin(&pin_io);
|
|
||||||
|
|
||||||
sm.set_set_pins(&[&pin_clk]);
|
|
||||||
pio_instr_util::set_pindir(&mut sm, 0b1);
|
|
||||||
sm.set_set_pins(&[&pin_io]);
|
|
||||||
pio_instr_util::set_pindir(&mut sm, 0b1);
|
|
||||||
|
|
||||||
sm.set_sideset_base_pin(&pin_clk);
|
|
||||||
sm.set_sideset_count(1);
|
|
||||||
|
|
||||||
sm.set_out_shift_dir(ShiftDirection::Left);
|
|
||||||
sm.set_in_shift_dir(ShiftDirection::Left);
|
|
||||||
|
|
||||||
let Wrap { source, target } = relocated.wrap();
|
|
||||||
sm.set_wrap(source, target);
|
|
||||||
|
|
||||||
// pull low for startup
|
|
||||||
pio_instr_util::set_pin(&mut sm, 0);
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cs,
|
cs,
|
||||||
sm,
|
sm,
|
||||||
dma,
|
irq,
|
||||||
wrap_target: target,
|
dma: dma.into_ref(),
|
||||||
|
wrap_target: relocated.wrap().target,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,18 +154,22 @@ where
|
|||||||
#[cfg(feature = "defmt")]
|
#[cfg(feature = "defmt")]
|
||||||
defmt::trace!("write={} read={}", write_bits, read_bits);
|
defmt::trace!("write={} read={}", write_bits, read_bits);
|
||||||
|
|
||||||
let mut dma = Peripheral::into_ref(&mut self.dma);
|
unsafe {
|
||||||
pio_instr_util::set_x(&mut self.sm, write_bits as u32);
|
pio_instr_util::set_x(&mut self.sm, write_bits as u32);
|
||||||
pio_instr_util::set_y(&mut self.sm, read_bits as u32);
|
pio_instr_util::set_y(&mut self.sm, read_bits as u32);
|
||||||
pio_instr_util::set_pindir(&mut self.sm, 0b1);
|
pio_instr_util::set_pindir(&mut self.sm, 0b1);
|
||||||
pio_instr_util::exec_jmp(&mut self.sm, self.wrap_target);
|
pio_instr_util::exec_jmp(&mut self.sm, self.wrap_target);
|
||||||
|
}
|
||||||
|
|
||||||
self.sm.set_enable(true);
|
self.sm.set_enable(true);
|
||||||
|
|
||||||
self.sm.dma_push(dma.reborrow(), write).await;
|
self.sm.tx().dma_push(self.dma.reborrow(), write).await;
|
||||||
|
|
||||||
let mut status = 0;
|
let mut status = 0;
|
||||||
self.sm.dma_pull(dma.reborrow(), slice::from_mut(&mut status)).await;
|
self.sm
|
||||||
|
.rx()
|
||||||
|
.dma_pull(self.dma.reborrow(), slice::from_mut(&mut status))
|
||||||
|
.await;
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,27 +181,32 @@ where
|
|||||||
#[cfg(feature = "defmt")]
|
#[cfg(feature = "defmt")]
|
||||||
defmt::trace!("write={} read={}", write_bits, read_bits);
|
defmt::trace!("write={} read={}", write_bits, read_bits);
|
||||||
|
|
||||||
let mut dma = Peripheral::into_ref(&mut self.dma);
|
unsafe {
|
||||||
pio_instr_util::set_y(&mut self.sm, read_bits as u32);
|
pio_instr_util::set_y(&mut self.sm, read_bits as u32);
|
||||||
pio_instr_util::set_x(&mut self.sm, write_bits as u32);
|
pio_instr_util::set_x(&mut self.sm, write_bits as u32);
|
||||||
pio_instr_util::set_pindir(&mut self.sm, 0b1);
|
pio_instr_util::set_pindir(&mut self.sm, 0b1);
|
||||||
pio_instr_util::exec_jmp(&mut self.sm, self.wrap_target);
|
pio_instr_util::exec_jmp(&mut self.sm, self.wrap_target);
|
||||||
|
}
|
||||||
|
|
||||||
// self.cs.set_low();
|
// self.cs.set_low();
|
||||||
self.sm.set_enable(true);
|
self.sm.set_enable(true);
|
||||||
|
|
||||||
self.sm.dma_push(dma.reborrow(), slice::from_ref(&cmd)).await;
|
self.sm.tx().dma_push(self.dma.reborrow(), slice::from_ref(&cmd)).await;
|
||||||
self.sm.dma_pull(dma.reborrow(), read).await;
|
self.sm.rx().dma_pull(self.dma.reborrow(), read).await;
|
||||||
|
|
||||||
let mut status = 0;
|
let mut status = 0;
|
||||||
self.sm.dma_pull(dma.reborrow(), slice::from_mut(&mut status)).await;
|
self.sm
|
||||||
|
.rx()
|
||||||
|
.dma_pull(self.dma.reborrow(), slice::from_mut(&mut status))
|
||||||
|
.await;
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<CS, SM, DMA> SpiBusCyw43 for PioSpi<CS, SM, DMA>
|
impl<'d, CS, PIO, const SM: usize, DMA> SpiBusCyw43 for PioSpi<'d, CS, PIO, SM, DMA>
|
||||||
where
|
where
|
||||||
CS: Pin,
|
CS: Pin,
|
||||||
SM: PioStateMachine,
|
PIO: Instance,
|
||||||
DMA: Channel,
|
DMA: Channel,
|
||||||
{
|
{
|
||||||
async fn cmd_write(&mut self, write: &[u32]) -> u32 {
|
async fn cmd_write(&mut self, write: &[u32]) -> u32 {
|
||||||
@ -193,7 +224,6 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn wait_for_event(&mut self) {
|
async fn wait_for_event(&mut self) {
|
||||||
self.sm.wait_irq(0).await;
|
self.irq.wait().await;
|
||||||
self.sm.clear_irq(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cyw43 = { path = "../../", features = ["defmt", "firmware-logs"] }
|
cyw43 = { path = "../../", features = ["defmt", "firmware-logs"] }
|
||||||
cyw43-pio = { path = "../../cyw43-pio", features = ["defmt"] }
|
cyw43-pio = { path = "../../cyw43-pio", features = ["defmt", "overclock"] }
|
||||||
embassy-executor = { version = "0.1.0", features = ["defmt", "integrated-timers", "executor-thread", "arch-cortex-m"] }
|
embassy-executor = { version = "0.2.0", features = ["defmt", "integrated-timers", "executor-thread", "arch-cortex-m"] }
|
||||||
embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] }
|
embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] }
|
||||||
embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] }
|
embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] }
|
||||||
embassy-net = { version = "0.1.0", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "unstable-traits", "nightly"] }
|
embassy-net = { version = "0.1.0", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "unstable-traits", "nightly"] }
|
||||||
@ -27,14 +27,14 @@ heapless = "0.7.15"
|
|||||||
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-net-driver = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-net-driver = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
|
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "82f7e104d90a6628d1873017ea5ef6a7afb3b3f7" }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = 2
|
debug = 2
|
||||||
@ -48,7 +48,7 @@ debug = 1
|
|||||||
debug-assertions = false
|
debug-assertions = false
|
||||||
incremental = false
|
incremental = false
|
||||||
lto = 'fat'
|
lto = 'fat'
|
||||||
opt-level = 'z'
|
opt-level = 's'
|
||||||
overflow-checks = false
|
overflow-checks = false
|
||||||
|
|
||||||
# do not optimize proc-macro crates = faster builds from scratch
|
# do not optimize proc-macro crates = faster builds from scratch
|
||||||
|
@ -12,8 +12,8 @@ use embassy_executor::Spawner;
|
|||||||
use embassy_net::tcp::TcpSocket;
|
use embassy_net::tcp::TcpSocket;
|
||||||
use embassy_net::{Config, Stack, StackResources};
|
use embassy_net::{Config, Stack, StackResources};
|
||||||
use embassy_rp::gpio::{Level, Output};
|
use embassy_rp::gpio::{Level, Output};
|
||||||
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25};
|
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
|
||||||
use embassy_rp::pio::{Pio0, PioPeripheral, PioStateMachineInstance, Sm0};
|
use embassy_rp::pio::Pio;
|
||||||
use embedded_io::asynch::Write;
|
use embedded_io::asynch::Write;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
@ -28,11 +28,7 @@ macro_rules! singleton {
|
|||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn wifi_task(
|
async fn wifi_task(
|
||||||
runner: cyw43::Runner<
|
runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>,
|
||||||
'static,
|
|
||||||
Output<'static, PIN_23>,
|
|
||||||
PioSpi<PIN_25, PioStateMachineInstance<Pio0, Sm0>, DMA_CH0>,
|
|
||||||
>,
|
|
||||||
) -> ! {
|
) -> ! {
|
||||||
runner.run().await
|
runner.run().await
|
||||||
}
|
}
|
||||||
@ -60,10 +56,8 @@ async fn main(spawner: Spawner) {
|
|||||||
|
|
||||||
let pwr = Output::new(p.PIN_23, Level::Low);
|
let pwr = Output::new(p.PIN_23, Level::Low);
|
||||||
let cs = Output::new(p.PIN_25, Level::High);
|
let cs = Output::new(p.PIN_25, Level::High);
|
||||||
|
let mut pio = Pio::new(p.PIO0);
|
||||||
let (_, sm, _, _, _) = p.PIO0.split();
|
let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0);
|
||||||
let dma = p.DMA_CH0;
|
|
||||||
let spi = PioSpi::new(sm, cs, p.PIN_24, p.PIN_29, dma);
|
|
||||||
|
|
||||||
let state = singleton!(cyw43::State::new());
|
let state = singleton!(cyw43::State::new());
|
||||||
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
||||||
|
@ -12,8 +12,8 @@ use embassy_executor::Spawner;
|
|||||||
use embassy_net::tcp::TcpSocket;
|
use embassy_net::tcp::TcpSocket;
|
||||||
use embassy_net::{Config, Stack, StackResources};
|
use embassy_net::{Config, Stack, StackResources};
|
||||||
use embassy_rp::gpio::{Level, Output};
|
use embassy_rp::gpio::{Level, Output};
|
||||||
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25};
|
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
|
||||||
use embassy_rp::pio::{Pio0, PioPeripheral, PioStateMachineInstance, Sm0};
|
use embassy_rp::pio::Pio;
|
||||||
use embedded_io::asynch::Write;
|
use embedded_io::asynch::Write;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
@ -28,11 +28,7 @@ macro_rules! singleton {
|
|||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn wifi_task(
|
async fn wifi_task(
|
||||||
runner: cyw43::Runner<
|
runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>,
|
||||||
'static,
|
|
||||||
Output<'static, PIN_23>,
|
|
||||||
PioSpi<PIN_25, PioStateMachineInstance<Pio0, Sm0>, DMA_CH0>,
|
|
||||||
>,
|
|
||||||
) -> ! {
|
) -> ! {
|
||||||
runner.run().await
|
runner.run().await
|
||||||
}
|
}
|
||||||
@ -60,10 +56,8 @@ async fn main(spawner: Spawner) {
|
|||||||
|
|
||||||
let pwr = Output::new(p.PIN_23, Level::Low);
|
let pwr = Output::new(p.PIN_23, Level::Low);
|
||||||
let cs = Output::new(p.PIN_25, Level::High);
|
let cs = Output::new(p.PIN_25, Level::High);
|
||||||
|
let mut pio = Pio::new(p.PIO0);
|
||||||
let (_, sm, _, _, _) = p.PIO0.split();
|
let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0);
|
||||||
let dma = p.DMA_CH0;
|
|
||||||
let spi = PioSpi::new(sm, cs, p.PIN_24, p.PIN_29, dma);
|
|
||||||
|
|
||||||
let state = singleton!(cyw43::State::new());
|
let state = singleton!(cyw43::State::new());
|
||||||
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
||||||
|
@ -11,8 +11,8 @@ use defmt::*;
|
|||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_net::Stack;
|
use embassy_net::Stack;
|
||||||
use embassy_rp::gpio::{Level, Output};
|
use embassy_rp::gpio::{Level, Output};
|
||||||
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25};
|
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
|
||||||
use embassy_rp::pio::{Pio0, PioPeripheral, PioStateMachineInstance, Sm0};
|
use embassy_rp::pio::Pio;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
@ -26,11 +26,7 @@ macro_rules! singleton {
|
|||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn wifi_task(
|
async fn wifi_task(
|
||||||
runner: cyw43::Runner<
|
runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>,
|
||||||
'static,
|
|
||||||
Output<'static, PIN_23>,
|
|
||||||
PioSpi<PIN_25, PioStateMachineInstance<Pio0, Sm0>, DMA_CH0>,
|
|
||||||
>,
|
|
||||||
) -> ! {
|
) -> ! {
|
||||||
runner.run().await
|
runner.run().await
|
||||||
}
|
}
|
||||||
@ -58,10 +54,8 @@ async fn main(spawner: Spawner) {
|
|||||||
|
|
||||||
let pwr = Output::new(p.PIN_23, Level::Low);
|
let pwr = Output::new(p.PIN_23, Level::Low);
|
||||||
let cs = Output::new(p.PIN_25, Level::High);
|
let cs = Output::new(p.PIN_25, Level::High);
|
||||||
|
let mut pio = Pio::new(p.PIO0);
|
||||||
let (_, sm, _, _, _) = p.PIO0.split();
|
let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0);
|
||||||
let dma = p.DMA_CH0;
|
|
||||||
let spi = PioSpi::new(sm, cs, p.PIN_24, p.PIN_29, dma);
|
|
||||||
|
|
||||||
let state = singleton!(cyw43::State::new());
|
let state = singleton!(cyw43::State::new());
|
||||||
let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
||||||
|
Loading…
Reference in New Issue
Block a user