Skip to content

Commit

Permalink
Update tests and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Nov 13, 2024
1 parent a07c374 commit 2ffdd51
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 43 deletions.
10 changes: 3 additions & 7 deletions examples/src/bin/embassy_parl_io_rx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ async fn main(_spawner: Spawner) {
peripherals.GPIO4,
);

let parl_io = ParlIoRxOnly::new(
peripherals.PARL_IO,
dma.channel0.into_async(),
rx_descriptors,
1.MHz(),
)
.unwrap();
let parl_io = ParlIoRxOnly::new(peripherals.PARL_IO, dma.channel0, rx_descriptors, 1.MHz())
.unwrap()
.into_async();

let mut parl_io_rx = parl_io
.rx
Expand Down
10 changes: 3 additions & 7 deletions examples/src/bin/embassy_parl_io_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ async fn main(_spawner: Spawner) {

let mut pin_conf = TxPinConfigWithValidPin::new(tx_pins, peripherals.GPIO5);

let parl_io = ParlIoTxOnly::new(
peripherals.PARL_IO,
dma.channel0.into_async(),
tx_descriptors,
1.MHz(),
)
.unwrap();
let parl_io = ParlIoTxOnly::new(peripherals.PARL_IO, dma.channel0, tx_descriptors, 1.MHz())
.unwrap()
.into_async();

let mut clock_pin = ClkOutPin::new(peripherals.GPIO8);

Expand Down
2 changes: 1 addition & 1 deletion examples/src/bin/lcd_cam_ov2640.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn main() -> ! {
);

let lcd_cam = LcdCam::new(peripherals.LCD_CAM);
let camera = Camera::new(lcd_cam.cam, dma.channel0.rx, cam_data_pins, 20u32.MHz())
let camera = Camera::new(lcd_cam.cam, dma.channel0, cam_data_pins, 20u32.MHz())
.with_master_clock(cam_xclk)
.with_pixel_clock(cam_pclk)
.with_ctrl_pins(cam_vsync, cam_href);
Expand Down
2 changes: 1 addition & 1 deletion examples/src/bin/lcd_i8080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn main() -> ! {
let lcd_cam = LcdCam::new(peripherals.LCD_CAM);
let i8080 = I8080::new(
lcd_cam.lcd,
dma.channel0.tx,
dma.channel0,
tx_pins,
20.MHz(),
Config::default(),
Expand Down
5 changes: 2 additions & 3 deletions hil-test/tests/dma_mem2mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
#![no_main]

use esp_hal::{
dma::{AnyGdmaChannel, Channel, Dma, DmaError, Mem2Mem},
dma::{AnyGdmaChannel, Dma, DmaChannelConvert, DmaError, Mem2Mem},
dma_buffers,
dma_buffers_chunk_size,
dma_descriptors,
Blocking,
};
use hil_test as _;

Expand All @@ -25,7 +24,7 @@ cfg_if::cfg_if! {
}

struct Context {
channel: Channel<'static, Blocking, AnyGdmaChannel>,
channel: AnyGdmaChannel,
dma_peripheral: DmaPeripheralType,
}

Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/embassy_interrupt_spi_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ mod test {

pub struct SpiPeripherals {
pub spi: SPI2,
pub dma_channel: Channel<'static, Blocking, DmaChannel>,
pub dma_channel: DmaChannel,
}

#[embassy_executor::task]
Expand Down
5 changes: 2 additions & 3 deletions hil-test/tests/i2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@

use esp_hal::{
delay::Delay,
dma::{Channel, Dma},
dma::Dma,
dma_buffers,
gpio::{AnyPin, NoPin, Pin},
i2s::master::{DataFormat, I2s, I2sTx, Standard},
peripherals::I2S0,
prelude::*,
Async,
Blocking,
};
use hil_test as _;

Expand Down Expand Up @@ -105,7 +104,7 @@ mod tests {

struct Context {
dout: AnyPin,
dma_channel: Channel<'static, Blocking, DmaChannel0>,
dma_channel: DmaChannel0,
i2s: I2S0,
}

Expand Down
5 changes: 2 additions & 3 deletions hil-test/tests/parl_io_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#[cfg(esp32c6)]
use esp_hal::parl_io::{TxPinConfigWithValidPin, TxSixteenBits};
use esp_hal::{
dma::{Channel, Dma, DmaChannel0},
dma::{Dma, DmaChannel0},
gpio::{
interconnect::{InputSignal, OutputSignal},
NoPin,
Expand All @@ -27,13 +27,12 @@ use esp_hal::{
},
peripherals::PARL_IO,
prelude::*,
Blocking,
};
use hil_test as _;

struct Context {
parl_io: PARL_IO,
dma_channel: Channel<'static, DmaChannel0, Blocking>,
dma_channel: DmaChannel0,
clock: OutputSignal,
valid: OutputSignal,
clock_loopback: InputSignal,
Expand Down
20 changes: 11 additions & 9 deletions hil-test/tests/parl_io_tx_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#[cfg(esp32c6)]
use esp_hal::parl_io::{TxPinConfigWithValidPin, TxSixteenBits};
use esp_hal::{
dma::{Channel, Dma, DmaChannel0},
dma::{Dma, DmaChannel0},
gpio::{
interconnect::{InputSignal, OutputSignal},
NoPin,
Expand All @@ -29,13 +29,12 @@ use esp_hal::{
},
peripherals::PARL_IO,
prelude::*,
Async,
};
use hil_test as _;

struct Context {
parl_io: PARL_IO,
dma_channel: Channel<'static, DmaChannel0, Async>,
dma_channel: DmaChannel0,
clock: OutputSignal,
valid: OutputSignal,
clock_loopback: InputSignal,
Expand All @@ -61,7 +60,7 @@ mod tests {
let pcnt = Pcnt::new(peripherals.PCNT);
let pcnt_unit = pcnt.unit0;
let dma = Dma::new(peripherals.DMA);
let dma_channel = dma.channel0.into_async();
let dma_channel = dma.channel0;

let parl_io = peripherals.PARL_IO;

Expand Down Expand Up @@ -91,8 +90,9 @@ mod tests {
let mut pins = TxPinConfigIncludingValidPin::new(pins);
let mut clock_pin = ClkOutPin::new(ctx.clock);

let pio =
ParlIoTxOnly::new(ctx.parl_io, ctx.dma_channel, tx_descriptors, 10.MHz()).unwrap();
let pio = ParlIoTxOnly::new(ctx.parl_io, ctx.dma_channel, tx_descriptors, 10.MHz())
.unwrap()
.into_async();

let mut pio = pio
.tx
Expand Down Expand Up @@ -152,8 +152,9 @@ mod tests {

let mut clock_pin = ClkOutPin::new(ctx.clock);

let pio =
ParlIoTxOnly::new(ctx.parl_io, ctx.dma_channel, tx_descriptors, 10.MHz()).unwrap();
let pio = ParlIoTxOnly::new(ctx.parl_io, ctx.dma_channel, tx_descriptors, 10.MHz())
.unwrap()
.into_async();

let mut pio = pio
.tx
Expand All @@ -166,7 +167,8 @@ mod tests {
)
.unwrap();

// use a PCNT unit to count the negitive clock edges only when valid is high
// use a PCNT unit to count the negitive clock edges only when
// valid is high
let clock_unit = ctx.pcnt_unit;
clock_unit.channel0.set_edge_signal(ctx.clock_loopback);
clock_unit.channel0.set_ctrl_signal(ctx.valid_loopback);
Expand Down
4 changes: 2 additions & 2 deletions hil-test/tests/qspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#[cfg(pcnt)]
use esp_hal::pcnt::{channel::EdgeMode, unit::Unit, Pcnt};
use esp_hal::{
dma::{Channel, Dma, DmaRxBuf, DmaTxBuf},
dma::{Dma, DmaRxBuf, DmaTxBuf},
dma_buffers,
gpio::{AnyPin, Input, Level, Output, Pull},
prelude::*,
Expand Down Expand Up @@ -43,7 +43,7 @@ struct Context {
spi: Spi<'static, Blocking>,
#[cfg(pcnt)]
pcnt: esp_hal::peripherals::PCNT,
dma_channel: Channel<'static, Blocking, DmaChannel0>,
dma_channel: DmaChannel0,
gpios: [AnyPin; 3],
}

Expand Down
8 changes: 4 additions & 4 deletions hil-test/tests/spi_full_duplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use embedded_hal::spi::SpiBus;
#[cfg(pcnt)]
use embedded_hal_async::spi::SpiBus as SpiBusAsync;
use esp_hal::{
dma::{Channel, Dma, DmaDescriptor, DmaRxBuf, DmaTxBuf},
dma::{Dma, DmaDescriptor, DmaRxBuf, DmaTxBuf},
dma_buffers,
gpio::{Level, NoPin},
peripheral::Peripheral,
Expand All @@ -37,7 +37,7 @@ cfg_if::cfg_if! {

struct Context {
spi: Spi<'static, Blocking>,
dma_channel: Channel<'static, Blocking, DmaChannel>,
dma_channel: DmaChannel,
// Reuse the really large buffer so we don't run out of DRAM with many tests
rx_buffer: &'static mut [u8],
rx_descriptors: &'static mut [DmaDescriptor],
Expand Down Expand Up @@ -424,9 +424,9 @@ mod tests {
let dma_tx_buf = DmaTxBuf::new(tx_descriptors, tx_buffer).unwrap();
let mut spi = ctx
.spi
.into_async()
.with_dma(ctx.dma_channel)
.with_buffers(dma_rx_buf, dma_tx_buf);
.with_buffers(dma_rx_buf, dma_tx_buf)
.into_async();

ctx.pcnt_unit.channel0.set_edge_signal(ctx.pcnt_source);
ctx.pcnt_unit
Expand Down
4 changes: 2 additions & 2 deletions hil-test/tests/spi_slave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#![no_main]

use esp_hal::{
dma::{Channel, Dma},
dma::Dma,
dma_buffers,
gpio::{Input, Level, Output, Pull},
peripheral::Peripheral,
Expand All @@ -28,7 +28,7 @@ cfg_if::cfg_if! {

struct Context {
spi: Spi<'static, Blocking>,
dma_channel: Channel<'static, Blocking, DmaChannel>,
dma_channel: DmaChannel,
bitbang_spi: BitbangSpi,
}

Expand Down

0 comments on commit 2ffdd51

Please sign in to comment.