1111use cortex_m:: interrupt:: free as disable_interrupts;
1212use rtic:: app;
1313use stm32f0xx_hal:: {
14- gpio:: gpioa:: { PA10 , PA11 , PA12 , PA2 , PA3 , PA9 , PA15 } ,
14+ gpio:: gpioa:: { PA10 , PA11 , PA12 , PA15 , PA2 , PA3 , PA9 } ,
1515 gpio:: gpiob:: { PB0 , PB1 , PB3 , PB4 , PB5 } ,
1616 gpio:: gpiof:: { PF0 , PF1 } ,
17- gpio:: { Alternate , Input , Output , Floating , PullUp , PushPull , AF1 } ,
17+ gpio:: { Alternate , Floating , Input , Output , PullUp , PushPull , AF1 } ,
1818 pac,
1919 prelude:: * ,
2020 serial,
@@ -83,7 +83,7 @@ const APP: () = {
8383 /// The external interrupt peripheral
8484 exti : pac:: EXTI ,
8585 /// Our PS/2 keyboard decoder
86- kb : pc_keyboard:: Keyboard < pc_keyboard:: layouts:: Uk105Key , pc_keyboard:: ScancodeSet2 >
86+ kb : pc_keyboard:: Keyboard < pc_keyboard:: layouts:: Uk105Key , pc_keyboard:: ScancodeSet2 > ,
8787 }
8888
8989 /// The entry point to our application.
@@ -165,7 +165,7 @@ const APP: () = {
165165 led_power. set_low ( ) . unwrap ( ) ;
166166
167167 // Set EXTI15 to use PORT A (PA15)
168- dp. SYSCFG . exticr4 . write ( |w| w. exti15 ( ) . pa15 ( ) ) ;
168+ dp. SYSCFG . exticr4 . write ( |w| w. exti15 ( ) . pa15 ( ) ) ;
169169
170170 // Enable EXTI15 interrupt as external falling edge
171171 dp. EXTI . imr . modify ( |_r, w| w. mr15 ( ) . set_bit ( ) ) ;
@@ -192,7 +192,11 @@ const APP: () = {
192192 ps2_dat0,
193193 ps2_dat1,
194194 exti : dp. EXTI ,
195- kb : pc_keyboard:: Keyboard :: new ( pc_keyboard:: layouts:: Uk105Key , pc_keyboard:: ScancodeSet2 , pc_keyboard:: HandleControl :: MapLettersToUnicode )
195+ kb : pc_keyboard:: Keyboard :: new (
196+ pc_keyboard:: layouts:: Uk105Key ,
197+ pc_keyboard:: ScancodeSet2 ,
198+ pc_keyboard:: HandleControl :: MapLettersToUnicode ,
199+ ) ,
196200 }
197201 }
198202
@@ -214,13 +218,21 @@ const APP: () = {
214218 /// It fires when there is a falling edge on the PS/2 Keyboard clock pin.
215219 #[ task( binds = EXTI4_15 , resources=[ ps2_clk0, ps2_dat0, exti, kb] ) ]
216220 fn exti4_15_interrupt ( ctx : exti4_15_interrupt:: Context ) {
217- match ctx. resources . kb . add_bit ( ctx. resources . ps2_dat0 . is_high ( ) . unwrap ( ) ) {
221+ match ctx
222+ . resources
223+ . kb
224+ . add_bit ( ctx. resources . ps2_dat0 . is_high ( ) . unwrap ( ) )
225+ {
218226 Err ( e) => {
219227 defmt:: warn!( "Error decoding kb: {}" , e as usize ) ;
220228 }
221229 Ok ( None ) => { }
222230 Ok ( Some ( evt) ) => {
223- defmt:: info!( "Got event core={}, state={}" , evt. code as usize , evt. state as usize ) ;
231+ defmt:: info!(
232+ "Got event core={}, state={}" ,
233+ evt. code as usize ,
234+ evt. state as usize
235+ ) ;
224236 }
225237 }
226238 // Clear the pending flag
0 commit comments