style: clean up.

This commit is contained in:
Ivan Li 2022-05-03 11:11:36 +08:00
parent 1c20412933
commit d944fc1de3
3 changed files with 7 additions and 10 deletions

View File

@ -10,7 +10,7 @@ opt-level = "s"
[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"
opt-level = "z"
[features]
pio = ["esp-idf-sys/pio"]
@ -21,7 +21,6 @@ embedded-graphics = "0.7.1"
embedded-hal = "1.0.0-alpha.8"
esp-idf-hal = "0.37.3"
esp-idf-sys = {version = "0.31.5", features = ["binstart"]}
log = "0.4.16"
ssd1306 = "0.7.0"
[build-dependencies]

View File

@ -1,5 +1,4 @@
use esp_idf_sys as _;
use log::*;
use std::{thread, time::Duration};
mod beep;
@ -23,7 +22,7 @@ fn main() {
let gpio10 = peripherals.pins.gpio10;
println!("Starting screen");
let mut screen = screen::Screen::new(i2c0, gpio9, gpio10).expect("Failed to create screen");
screen::Screen::new(i2c0, gpio9, gpio10).expect("Failed to create screen");
thread::spawn(move || {
let mut blink =
@ -51,7 +50,7 @@ fn main() {
.into_output()
.expect("Failed to set GPIO2 as output"),
);
while true {
loop {
if dc_out_ctl.state {
dc_out_ctl.off().expect("Failed to turn DC_OUT_CTL off");
} else {

View File

@ -1,4 +1,4 @@
use anyhow::{Result, Error};
use anyhow::{Result};
use embedded_graphics::{
mono_font::{ascii::FONT_10X20, MonoTextStyle},
pixelcolor::Rgb565,
@ -13,7 +13,6 @@ use esp_idf_hal::{
i2c::{self, Master, I2C0},
prelude::*,
};
use log::info;
use ssd1306::{
mode::{BufferedGraphicsMode, DisplayConfig},
prelude::I2CInterface,
@ -46,7 +45,7 @@ impl Screen {
let di = ssd1306::I2CDisplayInterface::new(i2c);
let mut delay = delay::Ets;
delay.delay_ms(10_u32);
delay.delay_ms(10_u32)?;
let mut display = ssd1306::Ssd1306::new(
di,
@ -64,12 +63,12 @@ impl Screen {
let mut instance = Screen { display };
instance.drawBoot()?;
instance.draw_boot()?;
Ok(instance)
}
pub fn drawBoot(&mut self) -> Result<()>
pub fn draw_boot(&mut self) -> Result<()>
{
println!("LED rendering done");
self.display.clear();