Some import cleanups
This commit is contained in:
parent
f37b18c205
commit
fedcb6629d
|
@ -1,30 +1,10 @@
|
|||
use arrayvec::ArrayString;
|
||||
use core::fmt::Write;
|
||||
use cortex_m::asm;
|
||||
use cortex_m_rt::{entry, exception};
|
||||
use embedded_graphics::{
|
||||
drawable::Drawable, fonts::Text, image::Image, pixelcolor::BinaryColor, pixelcolor::Rgb565,
|
||||
prelude::*, primitives::rectangle::Rectangle, primitives::Line, style::PrimitiveStyleBuilder,
|
||||
style::TextStyleBuilder,
|
||||
};
|
||||
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use profont::{ProFont12Point, ProFont14Point, ProFont9Point};
|
||||
use rtt_target::{rprintln, rtt_init_print};
|
||||
use st7735_lcd::Orientation;
|
||||
use stm32f1xx_hal::{
|
||||
delay::Delay,
|
||||
gpio::{gpioa, gpiob, gpioc, Alternate, Floating, Input, Output, PushPull},
|
||||
pac,
|
||||
prelude::*,
|
||||
qei, rcc,
|
||||
spi::{Mode, Phase, Polarity, Spi, Spi1NoRemap},
|
||||
stm32,
|
||||
timer::{Tim3PartialRemap, Timer},
|
||||
pac, qei,
|
||||
spi::{Spi, Spi1NoRemap},
|
||||
timer::Tim3PartialRemap,
|
||||
};
|
||||
use tinybmp::Bmp;
|
||||
|
||||
use crate::profiles;
|
||||
|
||||
mod confirm_profile;
|
||||
mod profile_selection;
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
use embedded_graphics::{
|
||||
drawable::Drawable, fonts::Text, pixelcolor::BinaryColor, pixelcolor::Rgb565, prelude::*,
|
||||
primitives::rectangle::Rectangle, primitives::Line, style::PrimitiveStyleBuilder,
|
||||
style::TextStyleBuilder,
|
||||
drawable::Drawable, fonts::Text, pixelcolor::Rgb565, prelude::*,
|
||||
primitives::rectangle::Rectangle, style::PrimitiveStyleBuilder, style::TextStyleBuilder,
|
||||
};
|
||||
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use profont::ProFont12Point;
|
||||
|
||||
use st7735_lcd::Orientation;
|
||||
use stm32f1xx_hal::{
|
||||
delay::Delay,
|
||||
gpio::{gpioa, gpiob, gpioc, Alternate, Floating, Input, Output, PushPull},
|
||||
pac,
|
||||
prelude::*,
|
||||
qei, rcc,
|
||||
spi::{Mode, Phase, Polarity, Spi, Spi1NoRemap},
|
||||
stm32,
|
||||
timer::{Tim3PartialRemap, Timer},
|
||||
};
|
||||
use stm32f1xx_hal::prelude::*;
|
||||
|
||||
use crate::application::App;
|
||||
use crate::profiles;
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
use arrayvec::ArrayString;
|
||||
use core::fmt::Write;
|
||||
use cortex_m::asm;
|
||||
use cortex_m_rt::{entry, exception};
|
||||
use embedded_graphics::{
|
||||
drawable::Drawable, fonts::Text, image::Image, pixelcolor::BinaryColor, pixelcolor::Rgb565,
|
||||
prelude::*, primitives::rectangle::Rectangle, primitives::Line, style::PrimitiveStyleBuilder,
|
||||
drawable::Drawable, fonts::Text, pixelcolor::Rgb565, prelude::*,
|
||||
primitives::rectangle::Rectangle, primitives::Line, style::PrimitiveStyleBuilder,
|
||||
style::TextStyleBuilder,
|
||||
};
|
||||
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use profont::{ProFont12Point, ProFont14Point, ProFont9Point};
|
||||
use rtt_target::{rprintln, rtt_init_print};
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
|
||||
use st7735_lcd::Orientation;
|
||||
use stm32f1xx_hal::{
|
||||
delay::Delay,
|
||||
|
@ -22,7 +17,6 @@ use stm32f1xx_hal::{
|
|||
stm32,
|
||||
timer::{Tim3PartialRemap, Timer},
|
||||
};
|
||||
use tinybmp::Bmp;
|
||||
|
||||
use crate::application::App;
|
||||
use crate::profiles;
|
||||
|
|
|
@ -1,31 +1,15 @@
|
|||
use arrayvec::ArrayString;
|
||||
use core::fmt::Write;
|
||||
use cortex_m::asm;
|
||||
use cortex_m_rt::{entry, exception};
|
||||
use embedded_graphics::{
|
||||
drawable::Drawable, fonts::Text, image::Image, pixelcolor::BinaryColor, pixelcolor::Rgb565,
|
||||
prelude::*, primitives::rectangle::Rectangle, primitives::Line, style::PrimitiveStyleBuilder,
|
||||
style::TextStyleBuilder,
|
||||
};
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use profont::{ProFont12Point, ProFont14Point, ProFont9Point};
|
||||
use rtt_target::{rprintln, rtt_init_print};
|
||||
use st7735_lcd::Orientation;
|
||||
use stm32f1xx_hal::{
|
||||
delay::Delay,
|
||||
gpio::{gpioa, gpiob, gpioc, Alternate, Floating, Input, Output, PushPull},
|
||||
pac,
|
||||
prelude::*,
|
||||
qei, rcc,
|
||||
spi::{Mode, Phase, Polarity, Spi, Spi1NoRemap},
|
||||
qei,
|
||||
spi::{Mode, Phase, Polarity, Spi},
|
||||
stm32,
|
||||
timer::{Tim3PartialRemap, Timer},
|
||||
timer::Timer,
|
||||
};
|
||||
use tinybmp::Bmp;
|
||||
|
||||
use crate::application::App;
|
||||
use crate::profiles;
|
||||
|
||||
pub fn setup(cp: cortex_m::peripheral::Peripherals, dp: stm32::Peripherals) -> App {
|
||||
// Take ownership over the raw flash and rcc devices and convert them into the corresponding
|
||||
|
|
|
@ -1,27 +1,12 @@
|
|||
use arrayvec::ArrayString;
|
||||
use core::fmt::Write;
|
||||
use cortex_m::asm;
|
||||
use cortex_m_rt::{entry, exception};
|
||||
use embedded_graphics::{
|
||||
drawable::Drawable, fonts::Text, image::Image, pixelcolor::BinaryColor, pixelcolor::Rgb565,
|
||||
prelude::*, primitives::rectangle::Rectangle, primitives::Line, style::PrimitiveStyleBuilder,
|
||||
style::TextStyleBuilder,
|
||||
drawable::Drawable, image::Image, pixelcolor::Rgb565, prelude::*,
|
||||
primitives::rectangle::Rectangle, style::PrimitiveStyleBuilder,
|
||||
};
|
||||
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use profont::{ProFont12Point, ProFont14Point, ProFont9Point};
|
||||
use rtt_target::{rprintln, rtt_init_print};
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
|
||||
use st7735_lcd::Orientation;
|
||||
use stm32f1xx_hal::{
|
||||
delay::Delay,
|
||||
gpio::{gpioa, gpiob, gpioc, Alternate, Floating, Input, Output, PushPull},
|
||||
pac,
|
||||
prelude::*,
|
||||
qei, rcc,
|
||||
spi::{Mode, Phase, Polarity, Spi, Spi1NoRemap},
|
||||
stm32,
|
||||
timer::{Tim3PartialRemap, Timer},
|
||||
};
|
||||
use stm32f1xx_hal::prelude::*;
|
||||
use tinybmp::Bmp;
|
||||
|
||||
use crate::application::App;
|
||||
|
|
86
src/main.rs
86
src/main.rs
|
@ -2,28 +2,12 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use arrayvec::ArrayString;
|
||||
use core::fmt::Write;
|
||||
use cortex_m::asm;
|
||||
use cortex_m_rt::{entry, exception};
|
||||
use embedded_graphics::{
|
||||
drawable::Drawable, fonts::Text, image::Image, pixelcolor::BinaryColor, pixelcolor::Rgb565,
|
||||
prelude::*, primitives::rectangle::Rectangle, style::PrimitiveStyleBuilder,
|
||||
style::TextStyleBuilder,
|
||||
};
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use profont::{ProFont12Point, ProFont9Point};
|
||||
|
||||
use rtt_target::{rprintln, rtt_init_print};
|
||||
use st7735_lcd::Orientation;
|
||||
use stm32f1xx_hal::{
|
||||
delay::Delay,
|
||||
pac,
|
||||
prelude::*,
|
||||
qei::QeiOptions,
|
||||
spi::{Mode, Phase, Polarity, Spi},
|
||||
timer::Timer,
|
||||
};
|
||||
use tinybmp::Bmp;
|
||||
|
||||
use stm32f1xx_hal::pac;
|
||||
|
||||
mod application;
|
||||
mod max6675;
|
||||
|
@ -38,71 +22,9 @@ fn main() -> ! {
|
|||
// Get access to the device specific peripherals from the peripheral access crate
|
||||
let dp = pac::Peripherals::take().unwrap();
|
||||
|
||||
let mut app = application::setup(cp, dp);
|
||||
let app = application::setup(cp, dp);
|
||||
|
||||
app.run()
|
||||
|
||||
/*
|
||||
|
||||
let mut disp = st7735_lcd::ST7735::new(spi, dc, rst, true, false, 160, 128);
|
||||
disp_cs.set_low().unwrap();
|
||||
disp.init(&mut delay).unwrap();
|
||||
disp.set_orientation(&Orientation::LandscapeSwapped)
|
||||
.unwrap();
|
||||
|
||||
let style_black = PrimitiveStyleBuilder::new()
|
||||
.fill_color(Rgb565::BLACK)
|
||||
.build();
|
||||
Rectangle::new(Point::new(0, 0), Point::new(160, 128))
|
||||
.into_styled(style_black)
|
||||
.draw(&mut disp)
|
||||
.unwrap();
|
||||
|
||||
let bmp = Bmp::from_slice(include_bytes!("logo.bmp")).unwrap();
|
||||
let image = Image::new(&bmp, Point::new(16, 0));
|
||||
image.draw(&mut disp).unwrap();
|
||||
|
||||
let (_spi, _dc, _rst) = disp.release();
|
||||
spi = _spi;
|
||||
dc = _dc;
|
||||
rst = _rst;
|
||||
disp_cs.set_high().unwrap();
|
||||
|
||||
let text_lager = TextStyleBuilder::new(ProFont12Point)
|
||||
.text_color(Rgb565::WHITE)
|
||||
.build();
|
||||
|
||||
loop {
|
||||
let temp = max6675::read(&mut spi, &mut max_cs).unwrap();
|
||||
rprintln!("T: {}", temp);
|
||||
|
||||
// Create a fixed buffer of length 12
|
||||
let mut buf = ArrayString::<[_; 10]>::new();
|
||||
// Output `Value: 12.35`
|
||||
write!(&mut buf, "T: {}", qei.count() / 4).expect("Failed to write to buffer");
|
||||
|
||||
disp_cs.set_low().unwrap();
|
||||
let mut disp = st7735_lcd::ST7735::new(spi, dc, rst, true, false, 160, 128);
|
||||
|
||||
Rectangle::new(Point::new(0, 100), Point::new(160, 128))
|
||||
.into_styled(style_black)
|
||||
.draw(&mut disp)
|
||||
.unwrap();
|
||||
|
||||
Text::new(&buf, Point::new(60, 100))
|
||||
.into_styled(text_lager)
|
||||
.draw(&mut disp)
|
||||
.unwrap();
|
||||
|
||||
let (_spi, _dc, _rst) = disp.release();
|
||||
spi = _spi;
|
||||
dc = _dc;
|
||||
rst = _rst;
|
||||
disp_cs.set_high().unwrap();
|
||||
|
||||
delay.delay_ms(250u16);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#[exception]
|
||||
|
|
Loading…
Reference in New Issue