Skip to content

Commit 85eb0fd

Browse files
authored
Merge pull request #379 from stm32-rs/update-deps
update & clean deps
2 parents 1f799bd + 9ad8da0 commit 85eb0fd

File tree

5 files changed

+36
-41
lines changed

5 files changed

+36
-41
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md merge=union

Cargo.toml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cortex-m-rt = "0.7"
2121
nb = "1"
2222
stm32f1 = "0.14.0"
2323
embedded-dma = "0.1.2"
24-
bxcan = ">=0.4, <0.6"
24+
bxcan = "0.6"
2525
cast = { default-features = false, version = "0.3.0" }
2626
void = { default-features = false, version = "1.0.2" }
2727
embedded-hal = { features = ["unproven"], version = "0.2.6" }
@@ -32,21 +32,14 @@ optional = true
3232

3333
[dev-dependencies]
3434
panic-halt = "0.2.0"
35-
panic-semihosting = "0.5.2"
35+
panic-semihosting = "0.5.6"
3636
panic-itm = "0.4.1"
37-
cortex-m-rtic = "0.6.0-rc.2"
38-
cortex-m-semihosting = "0.3.3"
39-
heapless = "0.7.7"
40-
m = "0.1.1"
37+
cortex-m-rtic = "1.0.0"
38+
cortex-m-semihosting = "0.3.7"
39+
heapless = "0.7.9"
4140
mfrc522 = "0.2.0"
4241
usb-device = "0.2.8"
4342
usbd-serial = "0.1.1"
44-
byteorder = { default-features = false, version = "1.4.3" }
45-
cobs = { default-features = false, version = "0.1.4" }
46-
crc16 = { default-features = false, version = "0.4.0" }
47-
either = { default-features = false, version = "1.6.1" }
48-
serde = { default-features = false, version = "1.0.130"}
49-
serde_derive = "1.0.130"
5043

5144
[features]
5245
device-selected = []

examples/can-echo.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ fn main() -> ! {
3636
let tx = gpioa.pa12.into_alternate_push_pull(&mut gpioa.crh);
3737
can.assign_pins((tx, rx), &mut afio.mapr);
3838

39-
bxcan::Can::new(can)
39+
// APB1 (PCLK1): 8MHz, Bit rate: 125kBit/s, Sample Point 87.5%
40+
// Value was calculated with http://www.bittiming.can-wiki.info/
41+
bxcan::Can::builder(can)
42+
.set_bit_timing(0x001c_0003)
43+
.leave_disabled()
4044
};
4145

42-
// APB1 (PCLK1): 8MHz, Bit rate: 125kBit/s, Sample Point 87.5%
43-
// Value was calculated with http://www.bittiming.can-wiki.info/
44-
can1.modify_config().set_bit_timing(0x001c_0003);
45-
4646
// Configure filters so that can frames can be received.
4747
let mut filters = can1.modify_filters();
4848
filters.enable_bank(0, Mask32::accept_all());
@@ -56,11 +56,11 @@ fn main() -> ! {
5656
let tx = gpiob.pb6.into_alternate_push_pull(&mut gpiob.crl);
5757
can.assign_pins((tx, rx), &mut afio.mapr);
5858

59-
let mut can2 = bxcan::Can::new(can);
60-
6159
// APB1 (PCLK1): 8MHz, Bit rate: 125kBit/s, Sample Point 87.5%
6260
// Value was calculated with http://www.bittiming.can-wiki.info/
63-
can2.modify_config().set_bit_timing(0x001c_0003);
61+
let mut can2 = bxcan::Can::builder(can)
62+
.set_bit_timing(0x001c_0003)
63+
.leave_disabled();
6464

6565
// A total of 28 filters are shared between the two CAN instances.
6666
// Split them equally between CAN1 and CAN2.
@@ -77,7 +77,7 @@ fn main() -> ! {
7777
//let mut can = _can2;
7878

7979
// Split the peripheral into transmitter and receiver parts.
80-
block!(can.enable()).unwrap();
80+
block!(can.enable_non_blocking()).unwrap();
8181

8282
// Echo back received packages in sequence.
8383
// See the `can-rtfm` example for an echo implementation that adheres to

examples/can-loopback.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ fn main() -> ! {
3131
#[cfg(feature = "connectivity")]
3232
let can = Can::new(dp.CAN1);
3333

34-
let mut can = bxcan::Can::new(can);
35-
3634
// Use loopback mode: No pins need to be assigned to peripheral.
3735
// APB1 (PCLK1): 8MHz, Bit rate: 500Bit/s, Sample Point 87.5%
3836
// Value was calculated with http://www.bittiming.can-wiki.info/
39-
can.modify_config()
37+
let mut can = bxcan::Can::builder(can)
4038
.set_bit_timing(0x001c_0000)
4139
.set_loopback(true)
42-
.set_silent(true);
40+
.set_silent(true)
41+
.leave_disabled();
4342

4443
let mut filters = can.modify_filters();
4544
assert!(filters.num_banks() > 3);
@@ -83,7 +82,7 @@ fn main() -> ! {
8382
drop(filters);
8483

8584
// Sync to the bus and start normal operation.
86-
block!(can.enable()).ok();
85+
block!(can.enable_non_blocking()).ok();
8786

8887
// Some messages shall pass the filters.
8988
for &id in &[0, 1, 2, 8, 9, 10, 11] {

examples/can-rtic.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ mod app {
9595
let mut afio = cx.device.AFIO.constrain();
9696
can.assign_pins((can_tx_pin, can_rx_pin), &mut afio.mapr);
9797

98-
let mut can = bxcan::Can::new(can);
99-
10098
// APB1 (PCLK1): 16MHz, Bit rate: 1000kBit/s, Sample Point 87.5%
10199
// Value was calculated with http://www.bittiming.can-wiki.info/
102-
can.modify_config().set_bit_timing(0x001c_0000);
100+
let mut can = bxcan::Can::builder(can)
101+
.set_bit_timing(0x001c_0000)
102+
.leave_disabled();
103103

104104
can.modify_filters().enable_bank(0, Mask32::accept_all());
105105

106106
// Sync to the bus and start normal operation.
107107
can.enable_interrupts(
108108
Interrupts::TRANSMIT_MAILBOX_EMPTY | Interrupts::FIFO0_MESSAGE_PENDING,
109109
);
110-
nb::block!(can.enable()).unwrap();
110+
nb::block!(can.enable_non_blocking()).unwrap();
111111

112112
let (can_tx, can_rx) = can.split();
113113

@@ -213,17 +213,19 @@ mod app {
213213
(&mut tx_queue, &mut tx_count).lock(|tx_queue, tx_count| {
214214
while let Some(frame) = tx_queue.peek() {
215215
match tx.transmit(&frame.0) {
216-
Ok(None) => {
217-
// Frame was successfully placed into a transmit buffer.
218-
tx_queue.pop();
219-
*tx_count += 1;
220-
}
221-
Ok(Some(pending_frame)) => {
222-
// A lower priority frame was replaced with our high priority frame.
223-
// Put the low priority frame back in the transmit queue.
224-
tx_queue.pop();
225-
enqueue_frame(tx_queue, pending_frame);
226-
}
216+
Ok(status) => match status.dequeued_frame() {
217+
None => {
218+
// Frame was successfully placed into a transmit buffer.
219+
tx_queue.pop();
220+
*tx_count += 1;
221+
}
222+
Some(pending_frame) => {
223+
// A lower priority frame was replaced with our high priority frame.
224+
// Put the low priority frame back in the transmit queue.
225+
tx_queue.pop();
226+
enqueue_frame(tx_queue, pending_frame.clone());
227+
}
228+
},
227229
Err(nb::Error::WouldBlock) => break,
228230
Err(_) => unreachable!(),
229231
}

0 commit comments

Comments
 (0)