Remove dead code
This commit is contained in:
parent
b444326c1c
commit
bc9e24c0c9
@ -122,241 +122,4 @@ pub fn draw_seven_segment(
|
|||||||
write_pixel(frame, width, x + 3, y + 4, color);
|
write_pixel(frame, width, x + 3, y + 4, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sixteen Segments
|
|
||||||
//
|
|
||||||
// a1 a2
|
|
||||||
// f h i jb
|
|
||||||
// f i j b
|
|
||||||
// f hij b
|
|
||||||
// g1 g2
|
|
||||||
// e klm c
|
|
||||||
// e k l m c
|
|
||||||
// ek l mc
|
|
||||||
// d1 d2
|
|
||||||
|
|
||||||
pub struct SixteenSegment {
|
|
||||||
a1: bool,
|
|
||||||
a2: bool,
|
|
||||||
b: bool,
|
|
||||||
c: bool,
|
|
||||||
d1: bool,
|
|
||||||
d2: bool,
|
|
||||||
e: bool,
|
|
||||||
f: bool,
|
|
||||||
g1: bool,
|
|
||||||
g2: bool,
|
|
||||||
h: bool,
|
|
||||||
i: bool,
|
|
||||||
j: bool,
|
|
||||||
k: bool,
|
|
||||||
l: bool,
|
|
||||||
m: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sixteen_segment_font() -> BTreeMap<char, SixteenSegment> {
|
|
||||||
let mut font = BTreeMap::new();
|
|
||||||
font.insert(
|
|
||||||
'*',
|
|
||||||
SixteenSegment {
|
|
||||||
a1: true,
|
|
||||||
a2: true,
|
|
||||||
b: true,
|
|
||||||
c: true,
|
|
||||||
d1: true,
|
|
||||||
d2: true,
|
|
||||||
e: true,
|
|
||||||
f: true,
|
|
||||||
g1: true,
|
|
||||||
g2: true,
|
|
||||||
h: true,
|
|
||||||
i: true,
|
|
||||||
j: true,
|
|
||||||
k: true,
|
|
||||||
l: true,
|
|
||||||
m: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
font.insert(
|
|
||||||
'0',
|
|
||||||
SixteenSegment {
|
|
||||||
a1: true,
|
|
||||||
a2: true,
|
|
||||||
b: true,
|
|
||||||
c: true,
|
|
||||||
d1: true,
|
|
||||||
d2: true,
|
|
||||||
e: true,
|
|
||||||
f: true,
|
|
||||||
g1: false,
|
|
||||||
g2: false,
|
|
||||||
h: false,
|
|
||||||
i: false,
|
|
||||||
j: false,
|
|
||||||
k: false,
|
|
||||||
l: false,
|
|
||||||
m: false,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
font.insert(
|
|
||||||
'1',
|
|
||||||
SixteenSegment {
|
|
||||||
a1: false,
|
|
||||||
a2: false,
|
|
||||||
b: true,
|
|
||||||
c: true,
|
|
||||||
d1: false,
|
|
||||||
d2: false,
|
|
||||||
e: false,
|
|
||||||
f: false,
|
|
||||||
g1: false,
|
|
||||||
g2: false,
|
|
||||||
h: false,
|
|
||||||
i: false,
|
|
||||||
j: true,
|
|
||||||
k: false,
|
|
||||||
l: false,
|
|
||||||
m: false,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
font.insert(
|
|
||||||
'2',
|
|
||||||
SixteenSegment {
|
|
||||||
a1: true,
|
|
||||||
a2: true,
|
|
||||||
b: false,
|
|
||||||
c: false,
|
|
||||||
d1: false,
|
|
||||||
d2: false,
|
|
||||||
e: false,
|
|
||||||
f: false,
|
|
||||||
g1: false,
|
|
||||||
g2: false,
|
|
||||||
h: false,
|
|
||||||
i: false,
|
|
||||||
j: true,
|
|
||||||
k: false,
|
|
||||||
l: false,
|
|
||||||
m: false,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
font
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn draw_sixteen_segment(
|
|
||||||
c: char,
|
|
||||||
font: &BTreeMap<char, SixteenSegment>,
|
|
||||||
frame: &mut [u8],
|
|
||||||
width: usize,
|
|
||||||
x: usize,
|
|
||||||
y: usize,
|
|
||||||
color: (u8, u8, u8),
|
|
||||||
) {
|
|
||||||
let segments = font.get(&c).unwrap();
|
|
||||||
if segments.a1 {
|
|
||||||
write_pixel(frame, width, x + 1, y, color);
|
|
||||||
write_pixel(frame, width, x + 2, y, color);
|
|
||||||
write_pixel(frame, width, x + 3, y, color);
|
|
||||||
}
|
|
||||||
if segments.a2 {
|
|
||||||
write_pixel(frame, width, x + 5, y, color);
|
|
||||||
write_pixel(frame, width, x + 6, y, color);
|
|
||||||
write_pixel(frame, width, x + 7, y, color);
|
|
||||||
}
|
|
||||||
if segments.b {
|
|
||||||
write_pixel(frame, width, x + 8, y + 1, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 2, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 3, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 4, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 5, color);
|
|
||||||
}
|
|
||||||
if segments.c {
|
|
||||||
write_pixel(frame, width, x + 8, y + 7, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 8, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 9, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 10, color);
|
|
||||||
write_pixel(frame, width, x + 8, y + 11, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if segments.d1 {
|
|
||||||
write_pixel(frame, width, x + 1, y + 12, color);
|
|
||||||
write_pixel(frame, width, x + 2, y + 12, color);
|
|
||||||
write_pixel(frame, width, x + 3, y + 12, color);
|
|
||||||
}
|
|
||||||
if segments.d2 {
|
|
||||||
write_pixel(frame, width, x + 5, y + 12, color);
|
|
||||||
write_pixel(frame, width, x + 6, y + 12, color);
|
|
||||||
write_pixel(frame, width, x + 7, y + 12, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if segments.e {
|
|
||||||
write_pixel(frame, width, x, y + 7, color);
|
|
||||||
write_pixel(frame, width, x, y + 8, color);
|
|
||||||
write_pixel(frame, width, x, y + 9, color);
|
|
||||||
write_pixel(frame, width, x, y + 10, color);
|
|
||||||
write_pixel(frame, width, x, y + 11, color);
|
|
||||||
}
|
|
||||||
if segments.f {
|
|
||||||
write_pixel(frame, width, x, y + 1, color);
|
|
||||||
write_pixel(frame, width, x, y + 2, color);
|
|
||||||
write_pixel(frame, width, x, y + 3, color);
|
|
||||||
write_pixel(frame, width, x, y + 4, color);
|
|
||||||
write_pixel(frame, width, x, y + 5, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if segments.g1 {
|
|
||||||
write_pixel(frame, width, x + 1, y + 6, color);
|
|
||||||
write_pixel(frame, width, x + 2, y + 6, color);
|
|
||||||
write_pixel(frame, width, x + 3, y + 6, color);
|
|
||||||
}
|
|
||||||
if segments.g2 {
|
|
||||||
write_pixel(frame, width, x + 5, y + 6, color);
|
|
||||||
write_pixel(frame, width, x + 6, y + 6, color);
|
|
||||||
write_pixel(frame, width, x + 7, y + 6, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if segments.h {
|
|
||||||
write_pixel(frame, width, x + 1, y + 1, color);
|
|
||||||
write_pixel(frame, width, x + 1, y + 2, color);
|
|
||||||
write_pixel(frame, width, x + 2, y + 3, color);
|
|
||||||
write_pixel(frame, width, x + 3, y + 4, color);
|
|
||||||
write_pixel(frame, width, x + 3, y + 5, color);
|
|
||||||
}
|
|
||||||
if segments.i {
|
|
||||||
write_pixel(frame, width, x + 4, y + 1, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 2, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 3, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 4, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 5, color);
|
|
||||||
}
|
|
||||||
if segments.j {
|
|
||||||
write_pixel(frame, width, x + 7, y + 1, color);
|
|
||||||
write_pixel(frame, width, x + 7, y + 2, color);
|
|
||||||
write_pixel(frame, width, x + 6, y + 3, color);
|
|
||||||
write_pixel(frame, width, x + 5, y + 4, color);
|
|
||||||
write_pixel(frame, width, x + 5, y + 5, color);
|
|
||||||
}
|
|
||||||
if segments.k {
|
|
||||||
write_pixel(frame, width, x + 3, y + 7, color);
|
|
||||||
write_pixel(frame, width, x + 3, y + 8, color);
|
|
||||||
write_pixel(frame, width, x + 2, y + 9, color);
|
|
||||||
write_pixel(frame, width, x + 1, y + 10, color);
|
|
||||||
write_pixel(frame, width, x + 1, y + 11, color);
|
|
||||||
}
|
|
||||||
if segments.l {
|
|
||||||
write_pixel(frame, width, x + 4, y + 7, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 8, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 9, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 10, color);
|
|
||||||
write_pixel(frame, width, x + 4, y + 11, color);
|
|
||||||
}
|
|
||||||
if segments.m {
|
|
||||||
write_pixel(frame, width, x + 5, y + 7, color);
|
|
||||||
write_pixel(frame, width, x + 5, y + 8, color);
|
|
||||||
write_pixel(frame, width, x + 6, y + 9, color);
|
|
||||||
write_pixel(frame, width, x + 7, y + 10, color);
|
|
||||||
write_pixel(frame, width, x + 7, y + 11, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user