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
3434version = " 1.0.2"
3535
3636[dev-dependencies ]
37+ stm32g0xx-hal = { path = " ." , features = [" defmt" , " rt" ] }
38+
3739cortex-m-rt = " 0.7.5"
3840cortex-m-semihosting = " 0.5.0"
39- defmt-rtt = " 0.4.0"
41+ defmt = " 0.3"
42+ defmt-rtt = " 0.4"
4043panic-halt = " 1.0.0"
4144panic-semihosting = " 0.6.0"
4245rtic = { version = " 2.1.1" , features = [" thumbv6-backend" ] }
Original file line number Diff line number Diff line change 33#![ no_main]
44#![ no_std]
55
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;
1110
11+ use cortex_m_rt:: entry;
1212use hal:: i2c:: Config ;
1313use hal:: prelude:: * ;
1414use hal:: stm32;
15- use rt:: entry;
16- use sh:: hprintln;
1715
1816#[ entry]
1917fn main ( ) -> ! {
@@ -31,8 +29,8 @@ fn main() -> ! {
3129 let buf: [ u8 ; 1 ] = [ 0 ] ;
3230 loop {
3331 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) ,
3634 }
3735 }
3836}
Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ pub trait Instance:
8989{
9090}
9191
92+ impl Instance for crate :: stm32:: I2C1 { }
93+ impl Instance for crate :: stm32:: I2C2 { }
94+
9295/// I2C SDA pin
9396pub trait SDAPin < I2C > {
9497 fn setup ( & self ) ;
You can’t perform that action at this time.
0 commit comments