|
1 | 1 | # Migration Guide from 1.0.0-rc.1 to {{currentVersion}} |
| 2 | + |
| 3 | +## RMT Changes |
| 4 | + |
| 5 | +Several details of the driver structs and their methods have changed: |
| 6 | + |
| 7 | +- `SingleShotTxTransaction` has been renamed to `TxTransaction`. |
| 8 | +- All `Channel` and `ChannelCreator` methods that take their arguments (channels and pins) by value now return them on failure; this might require changed to error handling. Changed methods are |
| 9 | + - `ChannelCreator<'_, _, _>::configure_tx` and `ChannelCreator<'_, _, _>::configure_rx`, |
| 10 | + - `Channel<'_, Blocking, Tx>::transmit`, |
| 11 | + - `Channel<'_, Blocking, Tx>::transmit_continuously`, |
| 12 | + - `Channel<'_, Blocking, Rx>::receive`. |
| 13 | +- The `ChannelCreator::configure_tx` and `ChannelCreator::configure_rx` methods now take the configuration by reference. |
| 14 | + |
| 15 | +```diff |
| 16 | +-let mut tx = rmt.channel0.configure_tx(tx_pin, TxChannelConfig::default()); |
| 17 | +-let mut rx = rmt.channel2.configure_rx(rx_pin, RxChannelConfig::default()); |
| 18 | ++let mut tx = rmt.channel0.configure_tx(tx_pin, &TxChannelConfig::default()); |
| 19 | ++let mut rx = rmt.channel2.configure_rx(rx_pin, &RxChannelConfig::default()); |
| 20 | + |
| 21 | +-let tx_transaction: SingleShotTxTransaction<'_, PulseCode> = tx.transmit(&data)?; |
| 22 | ++let tx_transaction: TxTransaction<'_, PulseCode> = match tx.transmit(&data) { |
| 23 | ++ Ok(t) => t, |
| 24 | ++ Err((e, channel)) => { |
| 25 | ++ // Now, the `channel` is not lost permanently, but can continue to be used |
| 26 | ++ // (e.g. to retry configuration with different parameters) |
| 27 | ++ e? |
| 28 | ++ } |
| 29 | ++}; |
| 30 | +``` |
| 31 | + |
0 commit comments