Skip to content

Commit 573a454

Browse files
committed
Rename 'disp' to 'display' for easier reading
1 parent 5124028 commit 573a454

File tree

10 files changed

+78
-74
lines changed

10 files changed

+78
-74
lines changed

examples/graphics.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,37 @@ fn main() -> ! {
6464
1000,
6565
);
6666

67-
let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
67+
let mut display: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
6868

69-
disp.init().unwrap();
70-
disp.flush().unwrap();
69+
display.init().unwrap();
70+
display.flush().unwrap();
7171

7272
Line::new(Point::new(8, 16 + 16), Point::new(8 + 16, 16 + 16))
7373
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
74-
.draw(&mut disp)
74+
.draw(&mut display)
7575
.unwrap();
7676

7777
Line::new(Point::new(8, 16 + 16), Point::new(8 + 8, 16))
7878
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
79-
.draw(&mut disp)
79+
.draw(&mut display)
8080
.unwrap();
8181

8282
Line::new(Point::new(8 + 16, 16 + 16), Point::new(8 + 8, 16))
8383
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
84-
.draw(&mut disp)
84+
.draw(&mut display)
8585
.unwrap();
8686

8787
Rectangle::new(Point::new(48, 16), Point::new(48 + 16, 16 + 16))
8888
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
89-
.draw(&mut disp)
89+
.draw(&mut display)
9090
.unwrap();
9191

9292
Circle::new(Point::new(96, 16 + 8), 8)
9393
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
94-
.draw(&mut disp)
94+
.draw(&mut display)
9595
.unwrap();
9696

97-
disp.flush().unwrap();
97+
display.flush().unwrap();
9898

9999
loop {}
100100
}

examples/graphics_128x32.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ fn main() -> ! {
5454
1000,
5555
);
5656

57-
let mut disp: GraphicsMode<_> = Builder::new()
57+
let mut display: GraphicsMode<_> = Builder::new()
5858
.with_size(DisplaySize::Display128x32)
5959
.connect_i2c(i2c)
6060
.into();
61-
disp.init().unwrap();
62-
disp.flush().unwrap();
61+
display.init().unwrap();
62+
display.flush().unwrap();
6363

6464
let yoffset = 8;
6565

@@ -68,30 +68,30 @@ fn main() -> ! {
6868
Point::new(8 + 16, 16 + yoffset),
6969
)
7070
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
71-
.draw(&mut disp)
71+
.draw(&mut display)
7272
.unwrap();
7373

7474
Line::new(Point::new(8, 16 + yoffset), Point::new(8 + 8, yoffset))
7575
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
76-
.draw(&mut disp)
76+
.draw(&mut display)
7777
.unwrap();
7878

7979
Line::new(Point::new(8 + 16, 16 + yoffset), Point::new(8 + 8, yoffset))
8080
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
81-
.draw(&mut disp)
81+
.draw(&mut display)
8282
.unwrap();
8383

8484
Rectangle::new(Point::new(48, yoffset), Point::new(48 + 16, 16 + yoffset))
8585
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
86-
.draw(&mut disp)
86+
.draw(&mut display)
8787
.unwrap();
8888

8989
Circle::new(Point::new(96, yoffset + 8), 8)
9090
.into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
91-
.draw(&mut disp)
91+
.draw(&mut display)
9292
.unwrap();
9393

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

9696
loop {}
9797
}

examples/image.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,18 @@ fn main() -> ! {
6969
1000,
7070
);
7171

72-
let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
72+
let mut display: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
7373

74-
disp.init().unwrap();
75-
disp.flush().unwrap();
74+
display.init().unwrap();
75+
display.flush().unwrap();
7676

7777
let im: ImageRawLE<BinaryColor> = ImageRawLE::new(include_bytes!("./rust.raw"), 64, 64);
7878

79-
Image::new(&im, Point::new(32, 0)).draw(&mut disp).unwrap();
79+
Image::new(&im, Point::new(32, 0))
80+
.draw(&mut display)
81+
.unwrap();
8082

81-
disp.flush().unwrap();
83+
display.flush().unwrap();
8284

8385
loop {}
8486
}

examples/image_spi.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,23 @@ fn main() -> ! {
6565
&mut rcc.apb2,
6666
);
6767

68-
let mut disp: GraphicsMode<_> = Builder::new().connect_spi(spi, dc, cs).into();
68+
let mut display: GraphicsMode<_> = Builder::new().connect_spi(spi, dc, cs).into();
6969

7070
// If you aren't using the Chip Select pin, use this instead:
71-
// let mut disp: GraphicsMode<_> = Builder::new()
71+
// let mut display: GraphicsMode<_> = Builder::new()
7272
// .connect_spi(spi, dc, sh1106::builder::NoOutputPin::new())
7373
// .into();
7474

75-
disp.init().unwrap();
76-
disp.flush().unwrap();
75+
display.init().unwrap();
76+
display.flush().unwrap();
7777

7878
let im: ImageRawLE<BinaryColor> = ImageRawLE::new(include_bytes!("./rust.raw"), 64, 64);
7979

80-
Image::new(&im, Point::new(32, 0)).draw(&mut disp).unwrap();
80+
Image::new(&im, Point::new(32, 0))
81+
.draw(&mut display)
82+
.unwrap();
8183

82-
disp.flush().unwrap();
84+
display.flush().unwrap();
8385

8486
loop {}
8587
}

examples/pixelsquare.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,36 @@ fn main() -> ! {
6464
1000,
6565
);
6666

67-
let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
67+
let mut display: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
6868

69-
disp.init().unwrap();
70-
disp.flush().unwrap();
69+
display.init().unwrap();
70+
display.flush().unwrap();
7171

7272
// Top side
73-
disp.set_pixel(0, 0, 1);
74-
disp.set_pixel(1, 0, 1);
75-
disp.set_pixel(2, 0, 1);
76-
disp.set_pixel(3, 0, 1);
73+
display.set_pixel(0, 0, 1);
74+
display.set_pixel(1, 0, 1);
75+
display.set_pixel(2, 0, 1);
76+
display.set_pixel(3, 0, 1);
7777

7878
// Right side
79-
disp.set_pixel(3, 0, 1);
80-
disp.set_pixel(3, 1, 1);
81-
disp.set_pixel(3, 2, 1);
82-
disp.set_pixel(3, 3, 1);
79+
display.set_pixel(3, 0, 1);
80+
display.set_pixel(3, 1, 1);
81+
display.set_pixel(3, 2, 1);
82+
display.set_pixel(3, 3, 1);
8383

8484
// Bottom side
85-
disp.set_pixel(0, 3, 1);
86-
disp.set_pixel(1, 3, 1);
87-
disp.set_pixel(2, 3, 1);
88-
disp.set_pixel(3, 3, 1);
85+
display.set_pixel(0, 3, 1);
86+
display.set_pixel(1, 3, 1);
87+
display.set_pixel(2, 3, 1);
88+
display.set_pixel(3, 3, 1);
8989

9090
// Left side
91-
disp.set_pixel(0, 0, 1);
92-
disp.set_pixel(0, 1, 1);
93-
disp.set_pixel(0, 2, 1);
94-
disp.set_pixel(0, 3, 1);
91+
display.set_pixel(0, 0, 1);
92+
display.set_pixel(0, 1, 1);
93+
display.set_pixel(0, 2, 1);
94+
display.set_pixel(0, 3, 1);
9595

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

9898
loop {}
9999
}

examples/rotation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,31 @@ fn main() -> ! {
6969
1000,
7070
);
7171

72-
let mut disp: GraphicsMode<_> = Builder::new()
72+
let mut display: GraphicsMode<_> = Builder::new()
7373
// Set initial rotation at 90 degrees clockwise
7474
.with_rotation(DisplayRotation::Rotate90)
7575
.connect_i2c(i2c)
7676
.into();
7777

78-
disp.init().unwrap();
79-
disp.flush().unwrap();
78+
display.init().unwrap();
79+
display.flush().unwrap();
8080

8181
// Contrived example to test builder and instance methods. Sets rotation to 270 degress
8282
// or 90 degress counterclockwise
83-
disp.set_rotation(DisplayRotation::Rotate270).unwrap();
83+
display.set_rotation(DisplayRotation::Rotate270).unwrap();
8484

85-
let (w, h) = disp.get_dimensions();
85+
let (w, h) = display.get_dimensions();
8686

8787
let im: ImageRawLE<BinaryColor> = ImageRawLE::new(include_bytes!("./rust.raw"), 64, 64);
8888

8989
Image::new(
9090
&im,
9191
Point::new(w as i32 / 2 - 64 / 2, h as i32 / 2 - 64 / 2),
9292
)
93-
.draw(&mut disp)
93+
.draw(&mut display)
9494
.unwrap();
9595

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

9898
loop {}
9999
}

examples/text.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ fn main() -> ! {
6565
1000,
6666
);
6767

68-
let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
68+
let mut display: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
6969

70-
disp.init().unwrap();
71-
disp.flush().unwrap();
70+
display.init().unwrap();
71+
display.flush().unwrap();
7272

7373
Text::new("Hello world!", Point::zero())
7474
.into_styled(TextStyle::new(Font6x8, BinaryColor::On))
75-
.draw(&mut disp)
75+
.draw(&mut display)
7676
.unwrap();
7777

7878
Text::new("Hello Rust!", Point::new(0, 16))
7979
.into_styled(TextStyle::new(Font6x8, BinaryColor::On))
80-
.draw(&mut disp)
80+
.draw(&mut display)
8181
.unwrap();
8282

83-
disp.flush().unwrap();
83+
display.flush().unwrap();
8484

8585
loop {}
8686
}

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
//! ```rust,ignore
1313
//! let i2c = I2c::i2c1(/* snip */);
1414
//!
15-
//! let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
16-
//! disp.init();
15+
//! let mut display: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
16+
//! display.init();
1717
//!
18-
//! disp.set_pixel(10, 20, 1);
18+
//! display.set_pixel(10, 20, 1);
1919
//! ```
2020
//!
2121
//! See the [example](https://github.com/jamwaffles/sh1106/blob/master/examples/graphics_i2c.rs)
@@ -72,17 +72,17 @@
7272
//! &mut rcc.apb1,
7373
//! );
7474
//!
75-
//! let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
75+
//! let mut display: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
7676
//!
77-
//! disp.init().unwrap();
78-
//! disp.flush().unwrap();
79-
//! disp.draw(Font6x8::render_str("Hello world!", 1u8.into()).into_iter());
80-
//! disp.draw(
77+
//! display.init().unwrap();
78+
//! display.flush().unwrap();
79+
//! display.draw(Font6x8::render_str("Hello world!", 1u8.into()).into_iter());
80+
//! display.draw(
8181
//! Font6x8::render_str("Hello Rust!")
8282
//! .translate(Coord::new(0, 16))
8383
//! .into_iter(),
8484
//! );
85-
//! disp.flush().unwrap();
85+
//! display.flush().unwrap();
8686
//! }
8787
//! ```
8888

src/mode/graphics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<DI> GraphicsMode<DI>
5555
where
5656
DI: DisplayInterface,
5757
{
58-
/// Clear the display buffer. You need to call `disp.flush()` for any effect on the screen
58+
/// Clear the display buffer. You need to call `display.flush()` for any effect on the screen
5959
pub fn clear(&mut self) {
6060
self.buffer = [0; BUFFER_SIZE];
6161
}

src/properties.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ where
141141
/// DisplaySize::Display128x64,
142142
/// DisplayRotation::Rotate0,
143143
/// );
144-
/// assert_eq!(disp.get_dimensions(), (128, 64));
144+
/// assert_eq!(display.get_dimensions(), (128, 64));
145145
///
146146
/// # let interface = FakeInterface {};
147147
/// let rotated_disp = DisplayProperties::new(
148148
/// interface,
149149
/// DisplaySize::Display128x64,
150150
/// DisplayRotation::Rotate90,
151151
/// );
152-
/// assert_eq!(rotated_disp.get_dimensions(), (64, 128));
152+
/// assert_eq!(rotated_display.get_dimensions(), (64, 128));
153153
/// ```
154154
pub fn get_dimensions(&self) -> (u8, u8) {
155155
let (w, h) = self.display_size.dimensions();

0 commit comments

Comments
 (0)