alpha
Login
or
Join now
arthomnix.dev
/
eepy
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
eepy-gui: make framebuffer public
author
arthomnix
date
1 year ago
(Feb 7, 2025, 4:14 PM UTC)
commit
549facc8
549facc873c0e0effa6e766696ec8e044b051a16
parent
8d820067
8d820067df4fb43d637c15b6c117da30048725cf
+7
-7
1 changed file
Expand all
Collapse all
Unified
Split
eepy-gui
src
draw_target.rs
+7
-7
eepy-gui/src/draw_target.rs
Reviewed
···
8
8
use tp370pgh01::{DIM_X, DIM_Y, IMAGE_BYTES};
9
9
10
10
pub struct EpdDrawTarget {
11
11
-
buf: [u8; IMAGE_BYTES],
11
11
+
pub framebuffer: [u8; IMAGE_BYTES],
12
12
}
13
13
14
14
impl Dimensions for EpdDrawTarget {
···
35
35
let j = 1 << (bit_index & 0x07);
36
36
37
37
match colour {
38
38
-
BinaryColor::Off => self.buf[i] &= !j,
39
39
-
BinaryColor::On => self.buf[i] |= j,
38
38
+
BinaryColor::Off => self.framebuffer[i] &= !j,
39
39
+
BinaryColor::On => self.framebuffer[i] |= j,
40
40
}
41
41
}
42
42
···
45
45
46
46
fn clear(&mut self, colour: Self::Color) -> Result<(), Self::Error> {
47
47
match colour {
48
48
-
BinaryColor::Off => self.buf.copy_from_slice(&[0; IMAGE_BYTES]),
49
49
-
BinaryColor::On => self.buf.copy_from_slice(&[u8::MAX; IMAGE_BYTES]),
48
48
+
BinaryColor::Off => self.framebuffer.copy_from_slice(&[0; IMAGE_BYTES]),
49
49
+
BinaryColor::On => self.framebuffer.copy_from_slice(&[u8::MAX; IMAGE_BYTES]),
50
50
}
51
51
52
52
Ok(())
···
56
56
impl EpdDrawTarget {
57
57
pub const fn new() -> Self {
58
58
Self {
59
59
-
buf: [0; IMAGE_BYTES]
59
59
+
framebuffer: [0; IMAGE_BYTES]
60
60
}
61
61
}
62
62
63
63
pub fn refresh(&self, fast_refresh: bool, block_mode: RefreshBlockMode) {
64
64
-
write_image(&self.buf);
64
64
+
write_image(&self.framebuffer);
65
65
refresh(fast_refresh, block_mode);
66
66
}
67
67
}