Skip to content

Commit e08d0e8

Browse files
committed
Create const variables instead of hardcoding values
1 parent 7bc03d0 commit e08d0e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ pub trait Pcd8544 {
5454
}
5555

5656
fn set_position(&mut self, x: u8, y: u8) {
57-
assert!(x <= 84);
58-
assert!(y < 6);
57+
assert!(usize::from(x) < DISPLAY_WIDTH);
58+
assert!(usize::from(y) < DISPLAY_HEIGHT);
5959

6060
self.command(0x40 + y);
6161
self.command(0x80 + x);
@@ -74,7 +74,7 @@ pub trait Pcd8544 {
7474

7575
fn clear(&mut self) {
7676
self.set_position(0, 0);
77-
self.data(&[0u8; 6 * 84]);
77+
self.data(&[0u8; BUFFER_SIZE]);
7878
self.set_position(0, 0);
7979
}
8080
}

0 commit comments

Comments
 (0)