35
35
36
36
fn alloc_frame ( id : Id , data : & [ u8 ] ) -> Box < CanFramePool , Init > {
37
37
let frame_box = CanFramePool :: alloc ( ) . unwrap ( ) ;
38
- frame_box. init ( Frame :: new ( id, data) )
38
+ frame_box. init ( Frame :: new ( id, data) . unwrap ( ) )
39
39
}
40
40
41
41
#[ app( device = stm32f1xx_hal:: pac, peripherals = true ) ]
@@ -90,10 +90,10 @@ const APP: () = {
90
90
#[ cfg( feature = "connectivity" ) ]
91
91
let ( mut filters, _) = can. split_filters ( 0 ) . unwrap ( ) ;
92
92
filters
93
- . add ( & Filter :: new_standard ( 0 ) . with_mask ( 0 ) . allow_remote ( ) )
93
+ . add ( & Filter :: new ( Id :: Standard ( 0 ) ) . with_mask ( 0 ) . allow_remote ( ) )
94
94
. unwrap ( ) ;
95
95
filters
96
- . add ( & Filter :: new_extended ( 0 ) . with_mask ( 0 ) . allow_remote ( ) )
96
+ . add ( & Filter :: new ( Id :: Extended ( 0 ) ) . with_mask ( 0 ) . allow_remote ( ) )
97
97
. unwrap ( ) ;
98
98
99
99
let mut can_rx = can. take_rx ( filters) . unwrap ( ) ;
@@ -123,25 +123,25 @@ const APP: () = {
123
123
// Enqueue some messages. Higher ID means lower priority.
124
124
tx_queue. lock ( |tx_queue| {
125
125
tx_queue
126
- . push ( alloc_frame ( Id :: new_standard ( 9 ) , & [ 0 , 1 , 2 , 4 ] ) )
126
+ . push ( alloc_frame ( Id :: Standard ( 9 ) , & [ 0 , 1 , 2 , 4 ] ) )
127
127
. unwrap ( ) ;
128
128
tx_queue
129
- . push ( alloc_frame ( Id :: new_standard ( 9 ) , & [ 0 , 1 , 2 , 4 ] ) )
129
+ . push ( alloc_frame ( Id :: Standard ( 9 ) , & [ 0 , 1 , 2 , 4 ] ) )
130
130
. unwrap ( ) ;
131
131
tx_queue
132
- . push ( alloc_frame ( Id :: new_standard ( 8 ) , & [ 0 , 1 , 2 , 4 ] ) )
132
+ . push ( alloc_frame ( Id :: Standard ( 8 ) , & [ 0 , 1 , 2 , 4 ] ) )
133
133
. unwrap ( ) ;
134
134
135
135
// Extended frames have lower priority than standard frames.
136
136
tx_queue
137
- . push ( alloc_frame ( Id :: new_extended ( 8 ) , & [ 0 , 1 , 2 , 4 ] ) )
137
+ . push ( alloc_frame ( Id :: Extended ( 8 ) , & [ 0 , 1 , 2 , 4 ] ) )
138
138
. unwrap ( ) ;
139
139
tx_queue
140
- . push ( alloc_frame ( Id :: new_extended ( 7 ) , & [ 0 , 1 , 2 , 4 ] ) )
140
+ . push ( alloc_frame ( Id :: Extended ( 7 ) , & [ 0 , 1 , 2 , 4 ] ) )
141
141
. unwrap ( ) ;
142
142
143
143
tx_queue
144
- . push ( alloc_frame ( Id :: new_standard ( 7 ) , & [ 0 , 1 , 2 , 4 ] ) )
144
+ . push ( alloc_frame ( Id :: Standard ( 7 ) , & [ 0 , 1 , 2 , 4 ] ) )
145
145
. unwrap ( ) ;
146
146
} ) ;
147
147
@@ -155,13 +155,13 @@ const APP: () = {
155
155
if tx_count >= 3 {
156
156
tx_queue. lock ( |tx_queue| {
157
157
tx_queue
158
- . push ( alloc_frame ( Id :: new_standard ( 3 ) , & [ 0 , 1 , 2 , 4 ] ) )
158
+ . push ( alloc_frame ( Id :: Standard ( 3 ) , & [ 0 , 1 , 2 , 4 ] ) )
159
159
. unwrap ( ) ;
160
160
tx_queue
161
- . push ( alloc_frame ( Id :: new_standard ( 2 ) , & [ 0 , 1 , 2 , 4 ] ) )
161
+ . push ( alloc_frame ( Id :: Standard ( 2 ) , & [ 0 , 1 , 2 , 4 ] ) )
162
162
. unwrap ( ) ;
163
163
tx_queue
164
- . push ( alloc_frame ( Id :: new_standard ( 1 ) , & [ 0 , 1 , 2 , 4 ] ) )
164
+ . push ( alloc_frame ( Id :: Standard ( 1 ) , & [ 0 , 1 , 2 , 4 ] ) )
165
165
. unwrap ( ) ;
166
166
} ) ;
167
167
break ;
0 commit comments