@@ -29,10 +29,10 @@ use embedded_graphics::{
2929use panic_halt as _;
3030use ssd1306:: { prelude:: * , Ssd1306 } ;
3131use stm32f1xx_hal:: {
32- delay:: Delay ,
3332 prelude:: * ,
3433 spi:: { Mode , Phase , Polarity , Spi } ,
3534 stm32,
35+ timer:: Timer ,
3636} ;
3737
3838#[ entry]
@@ -41,21 +41,21 @@ fn main() -> ! {
4141 let dp = stm32:: Peripherals :: take ( ) . unwrap ( ) ;
4242
4343 let mut flash = dp. FLASH . constrain ( ) ;
44- let mut rcc = dp. RCC . constrain ( ) ;
44+ let rcc = dp. RCC . constrain ( ) ;
4545
4646 let clocks = rcc. cfgr . freeze ( & mut flash. acr ) ;
4747
48- let mut afio = dp. AFIO . constrain ( & mut rcc . apb2 ) ;
48+ let mut afio = dp. AFIO . constrain ( ) ;
4949
50- let mut gpioa = dp. GPIOA . split ( & mut rcc . apb2 ) ;
51- let mut gpiob = dp. GPIOB . split ( & mut rcc . apb2 ) ;
50+ let mut gpioa = dp. GPIOA . split ( ) ;
51+ let mut gpiob = dp. GPIOB . split ( ) ;
5252
5353 // SPI1
5454 let sck = gpioa. pa5 . into_alternate_push_pull ( & mut gpioa. crl ) ;
5555 let miso = gpioa. pa6 ;
5656 let mosi = gpioa. pa7 . into_alternate_push_pull ( & mut gpioa. crl ) ;
5757
58- let mut delay = Delay :: new ( cp. SYST , clocks) ;
58+ let mut delay = Timer :: syst ( cp. SYST , & clocks) . delay ( ) ;
5959
6060 let mut rst = gpiob. pb0 . into_push_pull_output ( & mut gpiob. crl ) ;
6161 let dc = gpiob. pb1 . into_push_pull_output ( & mut gpiob. crl ) ;
@@ -68,9 +68,8 @@ fn main() -> ! {
6868 polarity : Polarity :: IdleLow ,
6969 phase : Phase :: CaptureOnFirstTransition ,
7070 } ,
71- 8 . mhz ( ) ,
71+ 8 . MHz ( ) ,
7272 clocks,
73- & mut rcc. apb2 ,
7473 ) ;
7574
7675 let interface = display_interface_spi:: SPIInterfaceNoCS :: new ( spi, dc) ;
@@ -123,6 +122,6 @@ fn main() -> ! {
123122}
124123
125124#[ exception]
126- fn HardFault ( ef : & ExceptionFrame ) -> ! {
125+ unsafe fn HardFault ( ef : & ExceptionFrame ) -> ! {
127126 panic ! ( "{:#?}" , ef) ;
128127}
0 commit comments