Skip to content

Commit b6c7f4c

Browse files
bors[bot]Fomys
andauthored
Merge #426
426: Bump bxcan r=burrbull a=Fomys This pull request bump the version of bxcan from 0.6 to [0.7](https://github.com/stm32-rs/bxcan/releases/tag/v0.7.0), which introduce the second can FIFO. All CAN example are updated to use the new version of bxcan. (I don't know how to add label, but this is a breaking change) Co-authored-by: Louis Chauvet <louis.chauvet@free.fr>
2 parents e921293 + 7ed6e7b commit b6c7f4c

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717
- Passing the `Clock` parameter to `Serial` by reference.
1818
- `Serial::usart1/2/3` -> `Serial::new`.
1919
- `Serial` implements `Write<WORD>` and `Read<WORD>` for `WORD` simultaneously as u8 and u16.
20+
- Bump bxcan version to [v0.7.0](https://github.com/stm32-rs/bxcan/releases/tag/v0.7.0)
2021

2122
### Added
2223

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cortex-m-rt = "0.7.1"
2323
nb = "1"
2424
stm32f1 = "0.14.0"
2525
embedded-dma = "0.2.0"
26-
bxcan = "0.6"
26+
bxcan = "0.7"
2727
void = { default-features = false, version = "1.0.2" }
2828
embedded-hal = { features = ["unproven"], version = "0.2.7" }
2929
fugit = "0.3.5"

examples/can-echo.rs

Lines changed: 4 additions & 3 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 = {
@@ -58,14 +59,14 @@ fn main() -> ! {
5859

5960
// APB1 (PCLK1): 8MHz, Bit rate: 125kBit/s, Sample Point 87.5%
6061
// Value was calculated with http://www.bittiming.can-wiki.info/
61-
let mut can2 = bxcan::Can::builder(can)
62+
let can2 = bxcan::Can::builder(can)
6263
.set_bit_timing(0x001c_0003)
6364
.leave_disabled();
6465

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use bxcan::{
88
filter::{ListEntry16, ListEntry32, Mask16},
9-
ExtendedId, Frame, StandardId,
9+
ExtendedId, Fifo, Frame, StandardId,
1010
};
1111
use panic_halt as _;
1212

@@ -50,6 +50,7 @@ fn main() -> ! {
5050
// TODO: Make this accept also ID 2
5151
filters.enable_bank(
5252
0,
53+
Fifo::Fifo0,
5354
[
5455
// accepts 0 and 1
5556
Mask16::frames_with_std_id(StandardId::new(0).unwrap(), StandardId::new(1).unwrap()),
@@ -61,6 +62,7 @@ fn main() -> ! {
6162
// 2x 29bit id filter bank: Matches 4, 5
6263
filters.enable_bank(
6364
1,
65+
Fifo::Fifo0,
6466
[
6567
ListEntry32::data_frames_with_id(ExtendedId::new(4).unwrap()),
6668
ListEntry32::data_frames_with_id(ExtendedId::new(5).unwrap()),
@@ -70,6 +72,7 @@ fn main() -> ! {
7072
// 4x 11bit id filter bank: Matches 8, 9, 10, 11
7173
filters.enable_bank(
7274
2,
75+
Fifo::Fifo0,
7376
[
7477
ListEntry16::data_frames_with_id(StandardId::new(8).unwrap()),
7578
ListEntry16::data_frames_with_id(StandardId::new(9).unwrap()),

examples/can-rtic.rs

Lines changed: 5 additions & 4 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, Fifo, Frame, Interrupts, Rx0, StandardId, Tx};
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,15 +101,16 @@ 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()
105+
.enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
105106

106107
// Sync to the bus and start normal operation.
107108
can.enable_interrupts(
108109
Interrupts::TRANSMIT_MAILBOX_EMPTY | Interrupts::FIFO0_MESSAGE_PENDING,
109110
);
110111
nb::block!(can.enable_non_blocking()).unwrap();
111112

112-
let (can_tx, can_rx) = can.split();
113+
let (can_tx, can_rx, _) = can.split();
113114

114115
let can_tx_queue = BinaryHeap::new();
115116

0 commit comments

Comments
 (0)