File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,12 @@ default-features = false
34
34
version = " 1.0.2"
35
35
36
36
[dev-dependencies ]
37
+ stm32g0xx-hal = { path = " ." , features = [" defmt" , " rt" ] }
38
+
37
39
cortex-m-rt = " 0.7.5"
38
40
cortex-m-semihosting = " 0.5.0"
39
- defmt-rtt = " 0.4.0"
41
+ defmt = " 0.3"
42
+ defmt-rtt = " 0.4"
40
43
panic-halt = " 1.0.0"
41
44
panic-semihosting = " 0.6.0"
42
45
rtic = { version = " 2.1.1" , features = [" thumbv6-backend" ] }
Original file line number Diff line number Diff line change 3
3
#![ no_main]
4
4
#![ no_std]
5
5
6
- extern crate cortex_m;
7
- extern crate cortex_m_rt as rt;
8
- extern crate cortex_m_semihosting as sh;
9
- extern crate panic_halt;
10
- extern crate stm32g0xx_hal as hal;
6
+ use cortex_m_semihosting as _;
7
+ use defmt_rtt as _;
8
+ use panic_halt as _;
9
+ use stm32g0xx_hal as hal;
11
10
11
+ use cortex_m_rt:: entry;
12
12
use hal:: i2c:: Config ;
13
13
use hal:: prelude:: * ;
14
14
use hal:: stm32;
15
- use rt:: entry;
16
- use sh:: hprintln;
17
15
18
16
#[ entry]
19
17
fn main ( ) -> ! {
@@ -31,8 +29,8 @@ fn main() -> ! {
31
29
let buf: [ u8 ; 1 ] = [ 0 ] ;
32
30
loop {
33
31
match i2c. write ( 0x3c , & buf) {
34
- Ok ( _) => hprintln ! ( "ok" ) ,
35
- Err ( err) => hprintln ! ( "error: {:?}" , err) ,
32
+ Ok ( _) => defmt :: println !( "ok" ) ,
33
+ Err ( err) => defmt :: println !( "error: {:?}" , err) ,
36
34
}
37
35
}
38
36
}
Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ pub trait Instance:
89
89
{
90
90
}
91
91
92
+ impl Instance for crate :: stm32:: I2C1 { }
93
+ impl Instance for crate :: stm32:: I2C2 { }
94
+
92
95
/// I2C SDA pin
93
96
pub trait SDAPin < I2C > {
94
97
fn setup ( & self ) ;
You can’t perform that action at this time.
0 commit comments