Skip to content

Commit b3ee458

Browse files
committed
Rename 'disp' to 'display' for easier reading
1 parent 8397e45 commit b3ee458

File tree

6 files changed

+56
-56
lines changed

6 files changed

+56
-56
lines changed

examples/bmp.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ fn main() -> ! {
7272
&mut rcc.apb2,
7373
);
7474

75-
let mut disp = Ssd1331::new(spi, dc, DisplayRotation::Rotate0);
75+
let mut display = Ssd1331::new(spi, dc, DisplayRotation::Rotate0);
7676

77-
disp.reset(&mut rst, &mut delay).unwrap();
78-
disp.init().unwrap();
79-
disp.flush().unwrap();
77+
display.reset(&mut rst, &mut delay).unwrap();
78+
display.init().unwrap();
79+
display.flush().unwrap();
8080

81-
let (w, h) = disp.dimensions();
81+
let (w, h) = display.dimensions();
8282

8383
let bmp =
8484
Bmp::from_slice(include_bytes!("./rust-pride.bmp")).expect("Failed to load BMP image");
@@ -91,9 +91,9 @@ fn main() -> ! {
9191
(h as u32 - bmp.size().height) as i32 / 2,
9292
));
9393

94-
moved.draw(&mut disp).unwrap();
94+
moved.draw(&mut display).unwrap();
9595

96-
disp.flush().unwrap();
96+
display.flush().unwrap();
9797

9898
loop {}
9999
}

examples/graphics.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,32 @@ fn main() -> ! {
7474
&mut rcc.apb2,
7575
);
7676

77-
let mut disp = Ssd1331::new(spi, dc, Rotate0);
77+
let mut display = Ssd1331::new(spi, dc, Rotate0);
7878

79-
disp.reset(&mut rst, &mut delay).unwrap();
80-
disp.init().unwrap();
81-
disp.flush().unwrap();
79+
display.reset(&mut rst, &mut delay).unwrap();
80+
display.init().unwrap();
81+
display.flush().unwrap();
8282

8383
Triangle::new(
8484
Point::new(8, 16 + 16),
8585
Point::new(8 + 16, 16 + 16),
8686
Point::new(8 + 8, 16),
8787
)
8888
.into_styled(PrimitiveStyle::with_stroke(Rgb565::RED, 1))
89-
.draw(&mut disp)
89+
.draw(&mut display)
9090
.unwrap();
9191

9292
Rectangle::with_corners(Point::new(36, 16), Point::new(36 + 16, 16 + 16))
9393
.into_styled(PrimitiveStyle::with_stroke(Rgb565::GREEN, 1))
94-
.draw(&mut disp)
94+
.draw(&mut display)
9595
.unwrap();
9696

9797
Circle::new(Point::new(64, 16), 16)
9898
.into_styled(PrimitiveStyle::with_stroke(Rgb565::BLUE, 1))
99-
.draw(&mut disp)
99+
.draw(&mut display)
100100
.unwrap();
101101

102-
disp.flush().unwrap();
102+
display.flush().unwrap();
103103

104104
loop {}
105105
}

examples/image.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ fn main() -> ! {
7777
&mut rcc.apb2,
7878
);
7979

80-
let mut disp = Ssd1331::new(spi, dc, Rotate0);
80+
let mut display = Ssd1331::new(spi, dc, Rotate0);
8181

82-
disp.reset(&mut rst, &mut delay).unwrap();
83-
disp.init().unwrap();
84-
disp.flush().unwrap();
82+
display.reset(&mut rst, &mut delay).unwrap();
83+
display.init().unwrap();
84+
display.flush().unwrap();
8585

8686
// Loads an 86x64px image encoded in LE (Little Endian) format. This image is a 16BPP image of
8787
// the Rust mascot, Ferris.
8888
let im = ImageRawLE::new(include_bytes!("./ferris.raw"), 86);
8989

9090
Image::new(&im, Point::new((96 - 86) / 2, 0))
91-
.draw(&mut disp)
91+
.draw(&mut display)
9292
.unwrap();
9393

94-
disp.flush().unwrap();
94+
display.flush().unwrap();
9595

9696
loop {}
9797
}

examples/pixelsquare.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,42 +69,42 @@ fn main() -> ! {
6969
&mut rcc.apb2,
7070
);
7171

72-
let mut disp = Ssd1331::new(spi, dc, Rotate0);
72+
let mut display = Ssd1331::new(spi, dc, Rotate0);
7373

74-
disp.reset(&mut rst, &mut delay).unwrap();
75-
disp.init().unwrap();
76-
disp.flush().unwrap();
74+
display.reset(&mut rst, &mut delay).unwrap();
75+
display.init().unwrap();
76+
display.flush().unwrap();
7777

7878
let white = 0xffff;
7979
let red = 0xf800;
8080
let green = 0x07e0;
8181
let blue = 0x001f;
8282

8383
// Top side
84-
disp.set_pixel(0, 0, white);
85-
disp.set_pixel(1, 0, white);
86-
disp.set_pixel(2, 0, white);
87-
disp.set_pixel(3, 0, white);
84+
display.set_pixel(0, 0, white);
85+
display.set_pixel(1, 0, white);
86+
display.set_pixel(2, 0, white);
87+
display.set_pixel(3, 0, white);
8888

8989
// Right side
90-
disp.set_pixel(3, 0, red);
91-
disp.set_pixel(3, 1, red);
92-
disp.set_pixel(3, 2, red);
93-
disp.set_pixel(3, 3, red);
90+
display.set_pixel(3, 0, red);
91+
display.set_pixel(3, 1, red);
92+
display.set_pixel(3, 2, red);
93+
display.set_pixel(3, 3, red);
9494

9595
// Bottom side
96-
disp.set_pixel(0, 3, green);
97-
disp.set_pixel(1, 3, green);
98-
disp.set_pixel(2, 3, green);
99-
disp.set_pixel(3, 3, green);
96+
display.set_pixel(0, 3, green);
97+
display.set_pixel(1, 3, green);
98+
display.set_pixel(2, 3, green);
99+
display.set_pixel(3, 3, green);
100100

101101
// Left side
102-
disp.set_pixel(0, 0, blue);
103-
disp.set_pixel(0, 1, blue);
104-
disp.set_pixel(0, 2, blue);
105-
disp.set_pixel(0, 3, blue);
102+
display.set_pixel(0, 0, blue);
103+
display.set_pixel(0, 1, blue);
104+
display.set_pixel(0, 2, blue);
105+
display.set_pixel(0, 3, blue);
106106

107-
disp.flush().unwrap();
107+
display.flush().unwrap();
108108

109109
loop {}
110110
}

examples/rotation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ fn main() -> ! {
7575
);
7676

7777
// Initialise the display with a default rotation of 90 degrees
78-
let mut disp = Ssd1331::new(spi, dc, DisplayRotation::Rotate90);
78+
let mut display = Ssd1331::new(spi, dc, DisplayRotation::Rotate90);
7979

80-
disp.reset(&mut rst, &mut delay).unwrap();
81-
disp.init().unwrap();
82-
disp.flush().unwrap();
80+
display.reset(&mut rst, &mut delay).unwrap();
81+
display.init().unwrap();
82+
display.flush().unwrap();
8383

8484
// Set a new rotation of 270 degrees
85-
disp.set_rotation(DisplayRotation::Rotate270).unwrap();
85+
display.set_rotation(DisplayRotation::Rotate270).unwrap();
8686

8787
// Load a 1BPP 64x64px image with LE (Little Endian) encoding of the Rust logo, white foreground
8888
// black background
8989
let im = ImageRawLE::<BinaryColor>::new(include_bytes!("./rust.raw"), 64);
9090

9191
// Use `color_converted` to create a wrapper that converts BinaryColors to Rgb565 colors to send
9292
// to the display.
93-
im.draw(&mut disp.color_converted()).unwrap();
93+
im.draw(&mut display.color_converted()).unwrap();
9494

95-
disp.flush().unwrap();
95+
display.flush().unwrap();
9696

9797
loop {}
9898
}

examples/text.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ fn main() -> ! {
7878
&mut rcc.apb2,
7979
);
8080

81-
let mut disp = Ssd1331::new(spi, dc, Rotate0);
81+
let mut display = Ssd1331::new(spi, dc, Rotate0);
8282

83-
disp.reset(&mut rst, &mut delay).unwrap();
84-
disp.init().unwrap();
85-
disp.flush().unwrap();
83+
display.reset(&mut rst, &mut delay).unwrap();
84+
display.init().unwrap();
85+
display.flush().unwrap();
8686

8787
let white_style = MonoTextStyleBuilder::new()
8888
.font(&FONT_6X10)
8989
.text_color(Rgb565::WHITE)
9090
.build();
9191

9292
Text::with_baseline("Hello world!", Point::zero(), white_style, Baseline::Top)
93-
.draw(&mut disp)
93+
.draw(&mut display)
9494
.unwrap();
9595

9696
// Red with a small amount of green creates a deep orange colour
@@ -106,10 +106,10 @@ fn main() -> ! {
106106
rust_style,
107107
Baseline::Top,
108108
)
109-
.draw(&mut disp)
109+
.draw(&mut display)
110110
.unwrap();
111111

112-
disp.flush().unwrap();
112+
display.flush().unwrap();
113113

114114
loop {}
115115
}

0 commit comments

Comments
 (0)