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)]
|
#![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::{
|
use esp_idf_hal::{
|
||||||
self,
|
self,
|
||||||
|
i2c::{I2cConfig, I2cDriver},
|
||||||
prelude::Peripherals,
|
prelude::Peripherals,
|
||||||
units::Hertz,
|
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;
|
mod error;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
@ -17,7 +17,7 @@ mod gps;
|
|||||||
use gps::{gpsdata, GPS};
|
use gps::{gpsdata, GPS};
|
||||||
|
|
||||||
mod display;
|
mod display;
|
||||||
use display::{DisplayError, Display};
|
use display::{Display, DisplayError};
|
||||||
use ssd1306::prelude::*;
|
use ssd1306::prelude::*;
|
||||||
|
|
||||||
fn main() -> Result<(), Error> {
|
fn main() -> Result<(), Error> {
|
||||||
@ -39,15 +39,12 @@ fn main() -> Result<(), Error> {
|
|||||||
|
|
||||||
// Setup I2C driver
|
// Setup I2C driver
|
||||||
let config = I2cConfig::new().baudrate(Hertz(921600));
|
let config = I2cConfig::new().baudrate(Hertz(921600));
|
||||||
let i2c = I2cDriver::new(
|
let i2c =
|
||||||
peripherals.i2c0,
|
I2cDriver::new(peripherals.i2c0, sda, scl, &config).map_err(|err| Error::EspError(err))?;
|
||||||
sda,
|
|
||||||
scl,
|
|
||||||
&config
|
|
||||||
).map_err(|err| Error::EspError(err))?;
|
|
||||||
|
|
||||||
let mut gps: GPS = GPS::new(peripherals.uart0, gps_rx)?;
|
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();
|
let mut app_state = appstate::AppState::default();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -55,11 +52,10 @@ fn main() -> Result<(), Error> {
|
|||||||
|
|
||||||
// Get the latest data from GPS module and flush to Display
|
// Get the latest data from GPS module and flush to Display
|
||||||
match gps.poll() {
|
match gps.poll() {
|
||||||
Ok(res) => {display.draw(&res.get_speed().as_str())?},
|
Ok(res) => display.draw(&res.get_speed().as_str())?,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
display.draw("NO\nGPS\nDATA");
|
display.draw("NO\nGPS\nDATA");
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user