Skip to content

Commit 5f89233

Browse files
committed
Update examples
1 parent 7d8e871 commit 5f89233

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

examples/can-echo.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![no_main]
55
#![no_std]
66

7+
use bxcan::Fifo;
78
use panic_halt as _;
89

910
use bxcan::filter::Mask32;
@@ -45,7 +46,7 @@ fn main() -> ! {
4546

4647
// Configure filters so that can frames can be received.
4748
let mut filters = can1.modify_filters();
48-
filters.enable_bank(0, Mask32::accept_all());
49+
filters.enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
4950

5051
#[cfg(feature = "connectivity")]
5152
let _can2 = {
@@ -65,7 +66,7 @@ fn main() -> ! {
6566
// A total of 28 filters are shared between the two CAN instances.
6667
// Split them equally between CAN1 and CAN2.
6768
let mut slave_filters = filters.set_split(14).slave_filters();
68-
slave_filters.enable_bank(14, Mask32::accept_all());
69+
slave_filters.enable_bank(14, Fifo::Fifo0, Mask32::accept_all());
6970
can2
7071
};
7172

examples/can-loopback.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
#![no_main]
55
#![no_std]
66

7-
use bxcan::{
8-
filter::{ListEntry16, ListEntry32, Mask16},
9-
ExtendedId, Frame, StandardId,
10-
};
7+
use bxcan::{filter::{ListEntry16, ListEntry32, Mask16}, ExtendedId, Frame, StandardId, Fifo};
118
use panic_halt as _;
129

1310
use cortex_m_rt::entry;
@@ -50,6 +47,7 @@ fn main() -> ! {
5047
// TODO: Make this accept also ID 2
5148
filters.enable_bank(
5249
0,
50+
Fifo::Fifo0,
5351
[
5452
// accepts 0 and 1
5553
Mask16::frames_with_std_id(StandardId::new(0).unwrap(), StandardId::new(1).unwrap()),
@@ -61,6 +59,7 @@ fn main() -> ! {
6159
// 2x 29bit id filter bank: Matches 4, 5
6260
filters.enable_bank(
6361
1,
62+
Fifo::Fifo0,
6463
[
6564
ListEntry32::data_frames_with_id(ExtendedId::new(4).unwrap()),
6665
ListEntry32::data_frames_with_id(ExtendedId::new(5).unwrap()),
@@ -70,6 +69,7 @@ fn main() -> ! {
7069
// 4x 11bit id filter bank: Matches 8, 9, 10, 11
7170
filters.enable_bank(
7271
2,
72+
Fifo::Fifo0,
7373
[
7474
ListEntry16::data_frames_with_id(StandardId::new(8).unwrap()),
7575
ListEntry16::data_frames_with_id(StandardId::new(9).unwrap()),

examples/can-rtic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ fn enqueue_frame(queue: &mut BinaryHeap<PriorityFrame, Max, 16>, frame: Frame) {
5353
#[rtic::app(device = stm32f1xx_hal::pac)]
5454
mod app {
5555
use super::{enqueue_frame, PriorityFrame};
56-
use bxcan::{filter::Mask32, ExtendedId, Frame, Interrupts, Rx, StandardId, Tx};
56+
use bxcan::{filter::Mask32, ExtendedId, Frame, Interrupts, StandardId, Tx, Rx0, Fifo};
5757
use heapless::binary_heap::{BinaryHeap, Max};
5858
use stm32f1xx_hal::{can::Can, pac::CAN1, prelude::*};
5959

6060
#[local]
6161
struct Local {
6262
can_tx: Tx<Can<CAN1>>,
63-
can_rx: Rx<Can<CAN1>>,
63+
can_rx: Rx0<Can<CAN1>>,
6464
}
6565
#[shared]
6666
struct Shared {
@@ -101,7 +101,7 @@ mod app {
101101
.set_bit_timing(0x001c_0000)
102102
.leave_disabled();
103103

104-
can.modify_filters().enable_bank(0, Mask32::accept_all());
104+
can.modify_filters().enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
105105

106106
// Sync to the bus and start normal operation.
107107
can.enable_interrupts(

0 commit comments

Comments
 (0)