File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,19 +112,23 @@ impl Board {
112112 InputConfig :: default ( ) . with_pull ( Pull :: Down ) ,
113113 ) ;
114114
115- let Ok ( i2c) = esp_hal:: i2c:: master:: I2c :: new (
115+ let i2c = esp_hal:: i2c:: master:: I2c :: new (
116116 peripherals. I2C0 ,
117117 esp_hal:: i2c:: master:: Config :: default ( )
118118 . with_frequency ( esp_hal:: time:: Rate :: from_khz ( 400 ) ) ,
119- ) else {
120- log:: error!( "Rfid task error while creating Spi instance!" ) ;
121- panic ! ( )
119+ ) ;
120+
121+ let i2c = match i2c {
122+ Ok ( i2c) => {
123+ let i2c = i2c
124+ . with_sda ( peripherals. GPIO8 )
125+ . with_scl ( peripherals. GPIO9 )
126+ . into_async ( ) ;
127+
128+ SharedI2C :: new ( Some ( i2c) )
129+ }
130+ Err ( _) => SharedI2C :: new ( None ) ,
122131 } ;
123- let i2c = i2c
124- . with_sda ( peripherals. GPIO8 )
125- . with_scl ( peripherals. GPIO9 )
126- . into_async ( ) ;
127- let i2c = SharedI2C :: new ( i2c) ;
128132
129133 Board {
130134 timg0,
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pub const LOG_SEND_INTERVAL_MS: u64 = 5000;
1616
1717pub const BATTERY_SEND_INTERVAL_MS : u64 = 60000 ;
1818
19+ #[ allow( dead_code) ]
1920pub const SCROLL_TICKER_INVERVAL_MS : u64 = 500 ;
2021pub const LCD_INSPECTION_FRAME_TIME : u64 = 1000 / 30 ;
2122
You can’t perform that action at this time.
0 commit comments