File tree 1 file changed +48
-0
lines changed
1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ //! This is not intended to be used on a real system
2
+ #![ no_main]
3
+ #![ no_std]
4
+
5
+ #[ allow( unused) ]
6
+ use panic_halt;
7
+
8
+ use stm32f0xx_hal as hal;
9
+
10
+ use crate :: hal:: gpio:: Unused ;
11
+ use crate :: hal:: i2c:: I2c ;
12
+ use crate :: hal:: prelude:: * ;
13
+ use crate :: hal:: serial:: Serial ;
14
+ use crate :: hal:: spi:: Spi ;
15
+ use crate :: hal:: spi:: { Mode , Phase , Polarity } ;
16
+ use crate :: hal:: stm32;
17
+
18
+ use cortex_m_rt:: entry;
19
+ #[ entry]
20
+ fn main ( ) -> ! {
21
+ const MODE : Mode = Mode {
22
+ polarity : Polarity :: IdleHigh ,
23
+ phase : Phase :: CaptureOnSecondTransition ,
24
+ } ;
25
+
26
+ if let Some ( p) = stm32:: Peripherals :: take ( ) {
27
+ let rcc = p. RCC . constrain ( ) ;
28
+ let clocks = rcc. cfgr . freeze ( ) ;
29
+
30
+ let _ = Spi :: spi1 (
31
+ p. SPI1 ,
32
+ ( Unused :: new ( ) , Unused :: new ( ) , Unused :: new ( ) ) ,
33
+ MODE ,
34
+ 100_000 . hz ( ) ,
35
+ clocks,
36
+ ) ;
37
+ let _ = Serial :: usart1 (
38
+ p. USART1 ,
39
+ ( Unused :: new ( ) , Unused :: new ( ) ) ,
40
+ 115_200 . bps ( ) ,
41
+ clocks,
42
+ ) ;
43
+ let _ = I2c :: i2c1 ( p. I2C1 , ( Unused :: new ( ) , Unused :: new ( ) ) , 400 . khz ( ) ) ;
44
+ }
45
+ loop {
46
+ continue ;
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments