mirror of
https://gitlab.com/feliix42/embedded-plots.git
synced 2024-11-22 01:46:30 +00:00
Update heapless to use const generics
This commit is contained in:
parent
bf000bde09
commit
5fd842c0cd
2 changed files with 4 additions and 4 deletions
|
@ -16,7 +16,7 @@ categories = ["embedded","visualization","no-std","graphics"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embedded-graphics = "0.6.0"
|
embedded-graphics = "0.6.0"
|
||||||
itertools = {version = "0.9.0", default-features = false}
|
itertools = {version = "0.9.0", default-features = false}
|
||||||
heapless = "0.5.6"
|
heapless = "0.7.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
embedded-graphics-simulator = "0.2.1"
|
embedded-graphics-simulator = "0.2.1"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use heapless::{consts::*, String};
|
use heapless::String;
|
||||||
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
@ -173,7 +173,7 @@ impl<'a, C, F> Drawable<C> for DrawableAxis<'a, C, F>
|
||||||
Line { start: Point { x, y: y - tick_size as i32 }, end: Point { x, y: y + tick_size as i32 } }
|
Line { start: Point { x, y: y - tick_size as i32 }, end: Point { x, y: y + tick_size as i32 } }
|
||||||
.into_styled(PrimitiveStyle::with_stroke(color, thickness as u32))
|
.into_styled(PrimitiveStyle::with_stroke(color, thickness as u32))
|
||||||
.draw(display)?;
|
.draw(display)?;
|
||||||
let mut buf: String::<U8> = String::new();
|
let mut buf: String::<8> = String::new();
|
||||||
write!(buf, "{}", mark).unwrap();
|
write!(buf, "{}", mark).unwrap();
|
||||||
Text::new(&buf, Point { x: x + 2, y: y + 2 }).into_styled(text_style).draw(display)?;
|
Text::new(&buf, Point { x: x + 2, y: y + 2 }).into_styled(text_style).draw(display)?;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ impl<'a, C, F> Drawable<C> for DrawableAxis<'a, C, F>
|
||||||
Line { start: Point { x: x - tick_size as i32, y }, end: Point { x: x + tick_size as i32, y } }
|
Line { start: Point { x: x - tick_size as i32, y }, end: Point { x: x + tick_size as i32, y } }
|
||||||
.into_styled(PrimitiveStyle::with_stroke(color, thickness as u32))
|
.into_styled(PrimitiveStyle::with_stroke(color, thickness as u32))
|
||||||
.draw(display)?;
|
.draw(display)?;
|
||||||
let mut buf: String::<U8> = String::new();
|
let mut buf: String::<8> = String::new();
|
||||||
write!(buf, "{}", mark).unwrap();
|
write!(buf, "{}", mark).unwrap();
|
||||||
let tick_val = Text::new(&buf, Point { x, y }).into_styled(text_style);
|
let tick_val = Text::new(&buf, Point { x, y }).into_styled(text_style);
|
||||||
let tick_val = tick_val.translate(Point { x: -(tick_val.size().width as i32) - 2, y: 2 });
|
let tick_val = tick_val.translate(Point { x: -(tick_val.size().width as i32) - 2, y: 2 });
|
||||||
|
|
Loading…
Reference in a new issue