style: clean up.
This commit is contained in:
parent
1c20412933
commit
d944fc1de3
@ -10,7 +10,7 @@ opt-level = "s"
|
|||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = true # Symbols are nice and they don't increase the size on Flash
|
debug = true # Symbols are nice and they don't increase the size on Flash
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
pio = ["esp-idf-sys/pio"]
|
pio = ["esp-idf-sys/pio"]
|
||||||
@ -21,7 +21,6 @@ embedded-graphics = "0.7.1"
|
|||||||
embedded-hal = "1.0.0-alpha.8"
|
embedded-hal = "1.0.0-alpha.8"
|
||||||
esp-idf-hal = "0.37.3"
|
esp-idf-hal = "0.37.3"
|
||||||
esp-idf-sys = {version = "0.31.5", features = ["binstart"]}
|
esp-idf-sys = {version = "0.31.5", features = ["binstart"]}
|
||||||
log = "0.4.16"
|
|
||||||
ssd1306 = "0.7.0"
|
ssd1306 = "0.7.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use esp_idf_sys as _;
|
use esp_idf_sys as _;
|
||||||
use log::*;
|
|
||||||
use std::{thread, time::Duration};
|
use std::{thread, time::Duration};
|
||||||
|
|
||||||
mod beep;
|
mod beep;
|
||||||
@ -23,7 +22,7 @@ fn main() {
|
|||||||
let gpio10 = peripherals.pins.gpio10;
|
let gpio10 = peripherals.pins.gpio10;
|
||||||
|
|
||||||
println!("Starting screen");
|
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 || {
|
thread::spawn(move || {
|
||||||
let mut blink =
|
let mut blink =
|
||||||
@ -51,7 +50,7 @@ fn main() {
|
|||||||
.into_output()
|
.into_output()
|
||||||
.expect("Failed to set GPIO2 as output"),
|
.expect("Failed to set GPIO2 as output"),
|
||||||
);
|
);
|
||||||
while true {
|
loop {
|
||||||
if dc_out_ctl.state {
|
if dc_out_ctl.state {
|
||||||
dc_out_ctl.off().expect("Failed to turn DC_OUT_CTL off");
|
dc_out_ctl.off().expect("Failed to turn DC_OUT_CTL off");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use anyhow::{Result, Error};
|
use anyhow::{Result};
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
mono_font::{ascii::FONT_10X20, MonoTextStyle},
|
mono_font::{ascii::FONT_10X20, MonoTextStyle},
|
||||||
pixelcolor::Rgb565,
|
pixelcolor::Rgb565,
|
||||||
@ -13,7 +13,6 @@ use esp_idf_hal::{
|
|||||||
i2c::{self, Master, I2C0},
|
i2c::{self, Master, I2C0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use log::info;
|
|
||||||
use ssd1306::{
|
use ssd1306::{
|
||||||
mode::{BufferedGraphicsMode, DisplayConfig},
|
mode::{BufferedGraphicsMode, DisplayConfig},
|
||||||
prelude::I2CInterface,
|
prelude::I2CInterface,
|
||||||
@ -46,7 +45,7 @@ impl Screen {
|
|||||||
let di = ssd1306::I2CDisplayInterface::new(i2c);
|
let di = ssd1306::I2CDisplayInterface::new(i2c);
|
||||||
|
|
||||||
let mut delay = delay::Ets;
|
let mut delay = delay::Ets;
|
||||||
delay.delay_ms(10_u32);
|
delay.delay_ms(10_u32)?;
|
||||||
|
|
||||||
let mut display = ssd1306::Ssd1306::new(
|
let mut display = ssd1306::Ssd1306::new(
|
||||||
di,
|
di,
|
||||||
@ -64,12 +63,12 @@ impl Screen {
|
|||||||
|
|
||||||
let mut instance = Screen { display };
|
let mut instance = Screen { display };
|
||||||
|
|
||||||
instance.drawBoot()?;
|
instance.draw_boot()?;
|
||||||
|
|
||||||
Ok(instance)
|
Ok(instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn drawBoot(&mut self) -> Result<()>
|
pub fn draw_boot(&mut self) -> Result<()>
|
||||||
{
|
{
|
||||||
println!("LED rendering done");
|
println!("LED rendering done");
|
||||||
self.display.clear();
|
self.display.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user