@@ -40,13 +40,13 @@ fn main() -> ! {
4040 let tx = gpioa. pa12 . into_alternate ( ) ;
4141
4242 let can = Can :: new ( dp. CAN1 , & mut rcc. apb1 , ( tx, rx) ) ;
43- bxcan:: Can :: new ( can)
43+
44+ bxcan:: Can :: builder ( can)
45+ // APB1 (PCLK1): 130MHz, Bit rate: 512kBit/s, Sample Point 87.5%
46+ // Value was calculated with http://www.bittiming.can-wiki.info/
47+ . set_bit_timing ( 0x001e_000b )
48+ . enable ( )
4449 } ;
45- can1. configure ( |config| {
46- // APB1 (PCLK1): 130MHz, Bit rate: 512kBit/s, Sample Point 87.5%
47- // Value was calculated with http://www.bittiming.can-wiki.info/
48- config. set_bit_timing ( 0x001e_000b ) ;
49- } ) ;
5050
5151 // Configure filters so that can frames can be received.
5252 let mut filters = can1. modify_filters ( ) ;
@@ -58,12 +58,11 @@ fn main() -> ! {
5858
5959 let can = Can :: new ( dp. CAN2 , & mut rcc. apb1 , ( tx, rx) ) ;
6060
61- let mut can2 = bxcan:: Can :: new ( can) ;
62- can2. configure ( |config| {
61+ let can2 = bxcan:: Can :: builder ( can)
6362 // APB1 (PCLK1): 130MHz, Bit rate: 512kBit/s, Sample Point 87.5%
6463 // Value was calculated with http://www.bittiming.can-wiki.info/
65- config . set_bit_timing ( 0x001e_000b ) ;
66- } ) ;
64+ . set_bit_timing ( 0x001e_000b )
65+ . enable ( ) ;
6766
6867 // A total of 28 filters are shared between the two CAN instances.
6968 // Split them equally between CAN1 and CAN2.
@@ -80,9 +79,6 @@ fn main() -> ! {
8079 let mut can = can1;
8180 //let mut can = can2;
8281
83- // Split the peripheral into transmitter and receiver parts.
84- block ! ( can. enable( ) ) . unwrap ( ) ;
85-
8682 // Echo back received packages in sequence.
8783 // See the `can-rtfm` example for an echo implementation that adheres to
8884 // correct frame ordering based on the transfer id.
0 commit comments