pub struct FrameLine(/* private fields */);
Expand description
A single frame on the screen. Contains a private [Rgb565; 64]
.
Implementations§
Source§impl FrameLine
impl FrameLine
Sourcepub fn from_slice(bytes: &[u8; 128]) -> Self
pub fn from_slice(bytes: &[u8; 128]) -> Self
Create a new FrameLine
instance, given a slice of bytes.
Examples found in repository?
examples/blink.rs (line 55)
16fn main() {
17 const ON: [u8; 128] = [0xFF; 128];
18 const RED: [u8; 128] = [
19 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00,
20 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8,
21 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00,
22 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8,
23 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00,
24 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8,
25 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00,
26 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8,
27 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8,
28 ];
29 const BLUE: [u8; 128] = [
30 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F,
31 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00,
32 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F,
33 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36 0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F,
37 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00,
38 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00,
39 ];
40 const GREEN: [u8; 128] = [
41 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0x00,
44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0,
46 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07,
47 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 ];
51 const OFF: [u8; 128] = [0x00; 128];
52
53 let mut screen = Screen::open("/dev/fb1").unwrap();
54
55 let on_frame = FrameLine::from_slice(&ON);
56 let off_frame = FrameLine::from_slice(&OFF);
57
58 let red_frame = FrameLine::from_slice(&RED);
59 let green_frame = FrameLine::from_slice(&GREEN);
60 let blue_frame = FrameLine::from_slice(&BLUE);
61
62 screen.write_frame(&on_frame);
63 thread::sleep(Duration::from_millis(100));
64 screen.write_frame(&off_frame);
65 thread::sleep(Duration::from_millis(100));
66 screen.write_frame(&on_frame);
67 thread::sleep(Duration::from_millis(100));
68 screen.write_frame(&off_frame);
69 thread::sleep(Duration::from_millis(100));
70 screen.write_frame(&on_frame);
71 thread::sleep(Duration::from_millis(100));
72 screen.write_frame(&off_frame);
73 thread::sleep(Duration::from_millis(100));
74
75 for _ in 0..=9 {
76 screen.write_frame(&red_frame);
77 thread::sleep(Duration::from_millis(1_500));
78 screen.write_frame(&green_frame);
79 thread::sleep(Duration::from_millis(1_500));
80 screen.write_frame(&blue_frame);
81 thread::sleep(Duration::from_millis(1_500));
82 }
83
84 screen.write_frame(&off_frame);
85}
Sourcepub fn from_pixels(pixels: &[PixelColor; 64]) -> Self
pub fn from_pixels(pixels: &[PixelColor; 64]) -> Self
Create a new FrameLine
instance, given a slice of PixelColor
.
Trait Implementations§
impl Copy for FrameLine
Auto Trait Implementations§
impl Freeze for FrameLine
impl RefUnwindSafe for FrameLine
impl Send for FrameLine
impl Sync for FrameLine
impl Unpin for FrameLine
impl UnwindSafe for FrameLine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more