From 278444b620de53134e99305db6869be8562ac425 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Mon, 13 Nov 2023 18:32:04 +0000 Subject: [PATCH] Removed log file --- src/main.rs | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4073ce4..e22ff1c 100644 --- a/src/main.rs +++ b/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, - prelude::Peripherals, + 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> { @@ -34,20 +34,17 @@ fn main() -> Result<(), Error> { // Define program's pins + addresses let scl = pins.gpio22; let sda = pins.gpio21; - let gps_rx = pins.gpio16; + let gps_rx = pins.gpio16; let _lcd_address: u8 = 0x3C; - + // 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 = Display::new(i2c, DisplaySize128x64, DisplayRotation::Rotate0)?; + let mut display: Display = + 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"); - }, + } } - } -} \ No newline at end of file +}