generated from luke-else/esp32-std-template
Removed log file
This commit is contained in:
parent
79cb335c51
commit
278444b620
24
src/main.rs
24
src/main.rs
@ -1,12 +1,12 @@
|
||||
#![allow(unused)]
|
||||
|
||||
use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
|
||||
use esp_idf_hal::{
|
||||
self,
|
||||
i2c::{I2cConfig, I2cDriver},
|
||||
prelude::Peripherals,
|
||||
units::Hertz,
|
||||
i2c::{I2cConfig, I2cDriver}
|
||||
};
|
||||
use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
|
||||
|
||||
mod error;
|
||||
use error::Error;
|
||||
@ -17,7 +17,7 @@ mod gps;
|
||||
use gps::{gpsdata, GPS};
|
||||
|
||||
mod display;
|
||||
use display::{DisplayError, Display};
|
||||
use display::{Display, DisplayError};
|
||||
use ssd1306::prelude::*;
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
@ -39,15 +39,12 @@ fn main() -> Result<(), Error> {
|
||||
|
||||
// Setup I2C driver
|
||||
let config = I2cConfig::new().baudrate(Hertz(921600));
|
||||
let i2c = I2cDriver::new(
|
||||
peripherals.i2c0,
|
||||
sda,
|
||||
scl,
|
||||
&config
|
||||
).map_err(|err| Error::EspError(err))?;
|
||||
let i2c =
|
||||
I2cDriver::new(peripherals.i2c0, sda, scl, &config).map_err(|err| Error::EspError(err))?;
|
||||
|
||||
let mut gps: GPS = GPS::new(peripherals.uart0, gps_rx)?;
|
||||
let mut display: Display<DisplaySize128x64> = Display::new(i2c, DisplaySize128x64, DisplayRotation::Rotate0)?;
|
||||
let mut display: Display<DisplaySize128x64> =
|
||||
Display::new(i2c, DisplaySize128x64, DisplayRotation::Rotate0)?;
|
||||
let mut app_state = appstate::AppState::default();
|
||||
|
||||
loop {
|
||||
@ -55,11 +52,10 @@ fn main() -> Result<(), Error> {
|
||||
|
||||
// Get the latest data from GPS module and flush to Display
|
||||
match gps.poll() {
|
||||
Ok(res) => {display.draw(&res.get_speed().as_str())?},
|
||||
Ok(res) => display.draw(&res.get_speed().as_str())?,
|
||||
Err(e) => {
|
||||
display.draw("NO\nGPS\nDATA");
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user