diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-04-02 01:29:52 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-04-02 11:08:03 +0200 |
| commit | c8936edb6c13eb099dfb31a4a51be2dd3bb4661e (patch) | |
| tree | 0dd904e9264bc0e15ab54490cf2caa91717d9d1f /examples/stm32f4 | |
| parent | e0f0430e2cb04f373f3e93e7abd27eba39d3eb7f (diff) | |
stm32/can: simplify bxcan api, merging bx::* into the main structs.
The bx::* separate structs (Can, Rx, Tx) and separate `Instance` trait
are a relic from the `bxcan` crate. Remove them, move the functionality
into the main structs.
Diffstat (limited to 'examples/stm32f4')
| -rw-r--r-- | examples/stm32f4/src/bin/can.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/examples/stm32f4/src/bin/can.rs b/examples/stm32f4/src/bin/can.rs index 71b9453eb..cedc057a7 100644 --- a/examples/stm32f4/src/bin/can.rs +++ b/examples/stm32f4/src/bin/can.rs | |||
| @@ -35,17 +35,12 @@ async fn main(_spawner: Spawner) { | |||
| 35 | 35 | ||
| 36 | let mut can = Can::new(p.CAN1, p.PA11, p.PA12, Irqs); | 36 | let mut can = Can::new(p.CAN1, p.PA11, p.PA12, Irqs); |
| 37 | 37 | ||
| 38 | can.as_mut() | 38 | can.modify_filters().enable_bank(0, Fifo::Fifo0, Mask32::accept_all()); |
| 39 | .modify_filters() | ||
| 40 | .enable_bank(0, Fifo::Fifo0, Mask32::accept_all()); | ||
| 41 | 39 | ||
| 42 | can.as_mut() | 40 | can.modify_config() |
| 43 | .modify_config() | ||
| 44 | .set_loopback(true) // Receive own frames | 41 | .set_loopback(true) // Receive own frames |
| 45 | .set_silent(true) | 42 | .set_silent(true) |
| 46 | .leave_disabled(); | 43 | .set_bitrate(1_000_000); |
| 47 | |||
| 48 | can.set_bitrate(1_000_000); | ||
| 49 | 44 | ||
| 50 | can.enable().await; | 45 | can.enable().await; |
| 51 | 46 | ||
