2020-12-17 23:23:15 +00:00
|
|
|
use embedded_graphics::{
|
|
|
|
pixelcolor::Rgb565,
|
|
|
|
prelude::*,
|
|
|
|
};
|
|
|
|
|
2020-12-18 17:01:19 +00:00
|
|
|
use embedded_graphics_simulator::{
|
|
|
|
SimulatorDisplay,
|
|
|
|
Window,
|
|
|
|
OutputSettingsBuilder
|
|
|
|
};
|
|
|
|
|
2020-12-20 11:11:06 +00:00
|
|
|
use embedded_plots::curve::{PlotPoint, Curve};
|
2020-12-17 23:23:15 +00:00
|
|
|
|
|
|
|
fn main() -> Result<(), core::convert::Infallible> {
|
|
|
|
let mut display: SimulatorDisplay<Rgb565> = SimulatorDisplay::new(Size::new(480, 272));
|
|
|
|
|
2020-12-17 23:32:58 +00:00
|
|
|
let data = vec![
|
2020-12-19 14:09:32 +00:00
|
|
|
PlotPoint{x: 0,y: 0},
|
|
|
|
PlotPoint{x: 1,y: 1},
|
|
|
|
PlotPoint{x: 2,y: 1},
|
|
|
|
PlotPoint{x: 3,y: 0},
|
|
|
|
];
|
2020-12-20 11:11:06 +00:00
|
|
|
Curve::new(data.as_slice())
|
2020-12-19 14:09:32 +00:00
|
|
|
.into_drawable_curve(&(0..3),&(0..1),&Point{x: 20, y: 20}, &Point{x:450,y:250},RgbColor::WHITE)
|
2020-12-17 23:23:15 +00:00
|
|
|
.draw(&mut display)?;
|
|
|
|
|
|
|
|
let output_settings = OutputSettingsBuilder::new()
|
|
|
|
.build();
|
|
|
|
Window::new("Hello World", &output_settings).show_static(&display);
|
|
|
|
|
|
|
|
Ok(())
|
2020-12-17 21:45:34 +00:00
|
|
|
}
|