Skip to content

Commit 427a8e6

Browse files
committed
Change demos to use arrays instead of slices
1 parent 46f8bd2 commit 427a8e6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

examples/i2s-controller-demo/src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ use {
3333
#[rtic::app(device = crate::hal::pac, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
3434
const APP: () = {
3535
struct Resources {
36-
signal_buf: &'static [i16],
37-
mute_buf: &'static [i16],
36+
signal_buf: &'static [i16; 32],
37+
mute_buf: &'static [i16; 32],
3838
#[init(None)]
3939
queue: Option<Queue<State, U256>>,
4040
producer: Producer<'static, State, U256>,
@@ -47,7 +47,7 @@ const APP: () = {
4747
btn1: Pin<Input<PullUp>>,
4848
btn2: Pin<Input<PullUp>>,
4949
led: Pin<Output<PushPull>>,
50-
transfer: Option<Transfer<&'static [i16]>>,
50+
transfer: Option<Transfer<&'static [i16; 32]>>,
5151
}
5252

5353
#[init(resources = [queue], spawn = [tick])]
@@ -74,8 +74,8 @@ const APP: () = {
7474
// Configure I2S controller
7575
let mck_pin = p0.p0_28.into_push_pull_output(Level::Low).degrade();
7676
let sck_pin = p0.p0_29.into_push_pull_output(Level::Low).degrade();
77-
let lrck_pin = p0.p0_31.into_push_pull_output(Level::Low).degrade();
7877
let sdout_pin = p0.p0_30.into_push_pull_output(Level::Low).degrade();
78+
let lrck_pin = p0.p0_31.into_push_pull_output(Level::Low).degrade();
7979

8080
let i2s = I2S::new_controller(
8181
ctx.device.I2S,
@@ -126,9 +126,9 @@ const APP: () = {
126126
led: p0.p0_13.into_push_pull_output(Level::High).degrade(),
127127
uarte,
128128
uarte_timer: Timer::new(ctx.device.TIMER0),
129-
transfer: i2s.tx(&MUTE_BUF[..]).ok(),
130-
signal_buf: &SIGNAL_BUF[..],
131-
mute_buf: &MUTE_BUF[..],
129+
transfer: i2s.tx(&**MUTE_BUF).ok(),
130+
signal_buf: &**SIGNAL_BUF,
131+
mute_buf: &**MUTE_BUF,
132132
}
133133
}
134134

examples/i2s-peripheral-demo/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const RED: [u8; 9] = [0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x10, 0xFF];
3030
const APP: () = {
3131
struct Resources {
3232
rgb: Spim<SPIM0>,
33-
transfer: Option<Transfer<&'static mut [i16]>>,
33+
transfer: Option<Transfer<&'static mut [i16; 128]>>,
3434
}
3535

3636
#[init]
@@ -80,7 +80,7 @@ const APP: () = {
8080
);
8181
init::LateResources {
8282
rgb,
83-
transfer: i2s.rx(&mut RX_BUF[..]).ok(),
83+
transfer: i2s.rx(&mut **RX_BUF).ok(),
8484
}
8585
}
8686

0 commit comments

Comments
 (0)