Skip to content

Commit 47c478c

Browse files
Merge pull request #237 from kalkyl/i2s-static
Add 'static lifetime bounds to I2S DMA buffers
2 parents 7d5f2cd + 3a838b0 commit 47c478c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nrf-hal-common/src/i2s.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl I2S {
267267
pub fn rx<W, B>(mut self, mut buffer: B) -> Result<Transfer<B>, Error>
268268
where
269269
W: SupportedWordSize,
270-
B: WriteBuffer<Word = W>,
270+
B: WriteBuffer<Word = W> + 'static,
271271
{
272272
let (ptr, len) = unsafe { buffer.write_buffer() };
273273
if ptr as u32 % 4 != 0 {
@@ -300,8 +300,8 @@ impl I2S {
300300
) -> Result<TransferFullDuplex<TxB, RxB>, Error>
301301
where
302302
W: SupportedWordSize,
303-
TxB: ReadBuffer<Word = W>,
304-
RxB: WriteBuffer<Word = W>,
303+
TxB: ReadBuffer<Word = W> + 'static,
304+
RxB: WriteBuffer<Word = W> + 'static,
305305
{
306306
let (rx_ptr, rx_len) = unsafe { rx_buffer.write_buffer() };
307307
let (tx_ptr, tx_len) = unsafe { tx_buffer.read_buffer() };
@@ -345,7 +345,7 @@ impl I2S {
345345
pub fn tx<W, B>(mut self, buffer: B) -> Result<Transfer<B>, Error>
346346
where
347347
W: SupportedWordSize,
348-
B: ReadBuffer<Word = W>,
348+
B: ReadBuffer<Word = W> + 'static,
349349
{
350350
let (ptr, len) = unsafe { buffer.read_buffer() };
351351
if ptr as u32 % 4 != 0 {
@@ -602,6 +602,7 @@ pub enum I2SEvent {
602602

603603
/// A DMA transfer
604604
pub struct Transfer<B> {
605+
// FIXME: Always `Some`, only using `Option` here to allow moving fields out of `inner`.
605606
inner: Option<Inner<B>>,
606607
}
607608

@@ -635,6 +636,7 @@ impl<B> Drop for Transfer<B> {
635636
}
636637
/// A full duplex DMA transfer
637638
pub struct TransferFullDuplex<TxB, RxB> {
639+
// FIXME: Always `Some`, only using `Option` here to allow moving fields out of `inner`.
638640
inner: Option<InnerFullDuplex<TxB, RxB>>,
639641
}
640642

0 commit comments

Comments
 (0)