Skip to content

Commit e7649db

Browse files
committed
feat: implement the rest of oled display code
1 parent 46d3bdd commit e7649db

6 files changed

Lines changed: 271 additions & 513 deletions

File tree

src/board.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff 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,

src/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub const LOG_SEND_INTERVAL_MS: u64 = 5000;
1616

1717
pub const BATTERY_SEND_INTERVAL_MS: u64 = 60000;
1818

19+
#[allow(dead_code)]
1920
pub const SCROLL_TICKER_INVERVAL_MS: u64 = 500;
2021
pub const LCD_INSPECTION_FRAME_TIME: u64 = 1000 / 30;
2122

0 commit comments

Comments
 (0)