Fix I2S examples (#2139)
* Fix I2S examples * Fix remaining examples * Mention asymmetric variant of the `dma_buffers!` macro in the migration guide
This commit is contained in:
parent
9f5a57d819
commit
312746fb14
@ -85,8 +85,8 @@ To avoid confusion with the `Rtc::current_time` wall clock time APIs, we've rena
|
||||
|
||||
## RX/TX Order
|
||||
|
||||
Previously, our API was pretty inconsitent with the RX/TX ordering, and different peripherals had different order. Now, all
|
||||
the peripherals use rx-tx. Make sure your methods are expecting the rigth RX/TX order, for example an SPI DMA app should be updated to:
|
||||
Previously, our API was pretty inconsistent with the RX/TX ordering, and different peripherals had different order. Now, all
|
||||
the peripherals use rx-tx. Make sure your methods are expecting the right RX/TX order, for example an SPI DMA app should be updated to:
|
||||
|
||||
```diff
|
||||
- let (tx_buffer, tx_descriptors, rx_buffer, rx_descriptors) = dma_buffers!(4);
|
||||
@ -103,6 +103,13 @@ let dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer).unwrap();
|
||||
.unwrap();
|
||||
```
|
||||
|
||||
When using the asymmetric variant of the macro to create DMA buffers and descriptors make sure to swap the order of parameters
|
||||
|
||||
```diff
|
||||
- let (tx_buffer, tx_descriptors, _, _) = dma_buffers!(32000, 0);
|
||||
+ let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000);
|
||||
```
|
||||
|
||||
## Removed UART constructors
|
||||
|
||||
The `Uart::new_with_default_pins` and `Uart::new_async_with_default_pins` constructors
|
||||
|
||||
@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) {
|
||||
#[cfg(not(any(feature = "esp32", feature = "esp32s2")))]
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
let (rx_buffer, rx_descriptors, _, tx_descriptors) = dma_buffers!(0, 4092 * 4);
|
||||
let (rx_buffer, rx_descriptors, _, tx_descriptors) = dma_buffers!(4092 * 4, 0);
|
||||
|
||||
let i2s = I2s::new(
|
||||
peripherals.I2S0,
|
||||
|
||||
@ -67,7 +67,7 @@ async fn main(_spawner: Spawner) {
|
||||
#[cfg(not(any(feature = "esp32", feature = "esp32s2")))]
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
let (_, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(32000, 0);
|
||||
let (_, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000);
|
||||
|
||||
let i2s = I2s::new(
|
||||
peripherals.I2S0,
|
||||
|
||||
@ -33,7 +33,7 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
|
||||
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(0, 32000);
|
||||
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32000, 0);
|
||||
|
||||
let dma = Dma::new(peripherals.DMA);
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
@ -44,7 +44,7 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
|
||||
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(32000, 0);
|
||||
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000);
|
||||
|
||||
let dma = Dma::new(peripherals.DMA);
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
@ -38,7 +38,7 @@ fn main() -> ! {
|
||||
#[cfg(not(any(feature = "esp32", feature = "esp32s2")))]
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
let (mut rx_buffer, rx_descriptors, _, tx_descriptors) = dma_buffers!(0, 4 * 4092);
|
||||
let (mut rx_buffer, rx_descriptors, _, tx_descriptors) = dma_buffers!(4 * 4092, 0);
|
||||
|
||||
// Here we test that the type is
|
||||
// 1) reasonably simple (or at least this will flag changes that may make it
|
||||
|
||||
@ -59,7 +59,7 @@ fn main() -> ! {
|
||||
#[cfg(not(any(feature = "esp32", feature = "esp32s2")))]
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
let (_, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(32000, 0);
|
||||
let (_, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000);
|
||||
|
||||
let i2s = I2s::new(
|
||||
peripherals.I2S0,
|
||||
|
||||
@ -49,7 +49,7 @@ fn main() -> ! {
|
||||
let dma = Dma::new(peripherals.DMA);
|
||||
let channel = dma.channel0;
|
||||
|
||||
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(0, 32678);
|
||||
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32678, 0);
|
||||
|
||||
let channel = channel.configure(false, DmaPriority::Priority0);
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ fn main() -> ! {
|
||||
let dma = Dma::new(peripherals.DMA);
|
||||
let channel = dma.channel0;
|
||||
|
||||
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(32678, 0);
|
||||
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32678);
|
||||
|
||||
let channel = channel.configure(false, DmaPriority::Priority0);
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ fn main() -> ! {
|
||||
|
||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
|
||||
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(0, 32000);
|
||||
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32000, 0);
|
||||
|
||||
let dma = Dma::new(peripherals.DMA);
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
@ -37,7 +37,7 @@ fn main() -> ! {
|
||||
|
||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
|
||||
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(32000, 0);
|
||||
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000);
|
||||
|
||||
let dma = Dma::new(peripherals.DMA);
|
||||
let dma_channel = dma.channel0;
|
||||
|
||||
@ -75,7 +75,7 @@ fn main() -> ! {
|
||||
}
|
||||
}
|
||||
|
||||
let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(256, 320);
|
||||
let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = dma_buffers!(320, 256);
|
||||
let mut dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer).unwrap();
|
||||
let mut dma_tx_buf = DmaTxBuf::new(tx_descriptors, tx_buffer).unwrap();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user