Skip to content

Commit 733ac89

Browse files
committed
fixed troubleshooting
1 parent 015ea19 commit 733ac89

3 files changed

Lines changed: 56 additions & 245 deletions

File tree

docs/MIGRATION.md

Lines changed: 0 additions & 216 deletions
This file was deleted.

src/_troubleshooting.rs

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,41 @@
3333
//! known by the display controller and must be manually set by the user as
3434
//! `Builder` settings when the display is initialized.
3535
//!
36-
//! To make it easier to identify the correct settings the `mipidsi` crate
36+
//! To make it easier to identify the correct settings the `lcd-async` crate
3737
//! provides a [`TestImage`](crate::TestImage), which can be used to verify the
3838
//! color settings and adjust them in case they are incorrect.
3939
//!
4040
//! ```
4141
//! use embedded_graphics::prelude::*;
42-
//! use mipidsi::{Builder, TestImage, models::ILI9486Rgb666};
43-
//!
44-
//! # let di = mipidsi::_mock::MockDisplayInterface;
45-
//! # let rst = mipidsi::_mock::MockOutputPin;
46-
//! # let mut delay = mipidsi::_mock::MockDelay;
47-
//! let mut display = Builder::new(ILI9486Rgb666, di)
42+
//! use embedded_graphics::pixelcolor::Rgb565;
43+
//! use lcd_async::{Builder, TestImage, models::ILI9341Rgb565, raw_framebuf::RawFrameBuf};
44+
//!
45+
//! # tokio_test::block_on(async {
46+
//! # let di = lcd_async::_mock::MockDisplayInterface;
47+
//! # let rst = lcd_async::_mock::MockOutputPin;
48+
//! # let mut delay = lcd_async::_mock::MockDelay;
49+
//! let mut display = Builder::new(ILI9341Rgb565, di)
4850
//! .reset_pin(rst)
4951
//! .init(&mut delay)
50-
//! .unwrap();;
52+
//! .await
53+
//! .unwrap();
54+
//!
55+
//! // Create framebuffer for drawing
56+
//! const WIDTH: usize = 240;
57+
//! const HEIGHT: usize = 320;
58+
//! let mut buffer = [0u8; WIDTH * HEIGHT * 2]; // 2 bytes per pixel for RGB565
59+
//! let mut framebuf = RawFrameBuf::<Rgb565, _>::new(&mut buffer[..], WIDTH, HEIGHT);
60+
//!
61+
//! // Draw test image to framebuffer
62+
//! TestImage::new().draw(&mut framebuf)?;
63+
//!
64+
//! // IMPORTANT: After drawing to the framebuffer, you must send it to the display!
65+
//! // This is the key step that actually updates the screen.
66+
//! // display.show_raw_data(0, 0, WIDTH as u16, HEIGHT as u16, &buffer).await.unwrap();
5167
//!
52-
//! TestImage::new().draw(&mut display)?;
68+
//! // For a complete working example, see: examples/spi-st7789-esp32-c3/src/main.rs
5369
//! # Ok::<(), core::convert::Infallible>(())
70+
//! # });
5471
//! ```
5572
//!
5673
//! The expected output from drawing the test image is:
@@ -67,13 +84,16 @@
6784
//!
6885
//! ```
6986
//! # use embedded_graphics::prelude::*;
70-
//! # use mipidsi::{Builder, TestImage, models::ILI9486Rgb666};
87+
//! # use embedded_graphics::pixelcolor::Rgb565;
88+
//! # use lcd_async::{Builder, TestImage, models::ILI9341Rgb565, raw_framebuf::RawFrameBuf};
7189
//! #
72-
//! # let di = mipidsi::_mock::MockDisplayInterface;
73-
//! # let mut delay = mipidsi::_mock::MockDelay;
74-
//! # let mut display = Builder::new(ILI9486Rgb666, di)
75-
//! .color_order(mipidsi::options::ColorOrder::Bgr)
76-
//! # .init(&mut delay).unwrap();
90+
//! # tokio_test::block_on(async {
91+
//! # let di = lcd_async::_mock::MockDisplayInterface;
92+
//! # let mut delay = lcd_async::_mock::MockDelay;
93+
//! # let mut display = Builder::new(ILI9341Rgb565, di)
94+
//! .color_order(lcd_async::options::ColorOrder::Bgr)
95+
//! # .init(&mut delay).await.unwrap();
96+
//! # });
7797
//! ```
7898
//!
7999
//! ### Wrong color inversion
@@ -82,13 +102,16 @@
82102
//!
83103
//! ```
84104
//! # use embedded_graphics::prelude::*;
85-
//! # use mipidsi::{Builder, TestImage, models::ILI9486Rgb666};
105+
//! # use embedded_graphics::pixelcolor::Rgb565;
106+
//! # use lcd_async::{Builder, TestImage, models::ILI9341Rgb565, raw_framebuf::RawFrameBuf};
86107
//! #
87-
//! # let di = mipidsi::_mock::MockDisplayInterface;
88-
//! # let mut delay = mipidsi::_mock::MockDelay;
89-
//! # let mut display = Builder::new(ILI9486Rgb666, di)
90-
//! .invert_colors(mipidsi::options::ColorInversion::Inverted)
91-
//! # .init(&mut delay).unwrap();
108+
//! # tokio_test::block_on(async {
109+
//! # let di = lcd_async::_mock::MockDisplayInterface;
110+
//! # let mut delay = lcd_async::_mock::MockDelay;
111+
//! # let mut display = Builder::new(ILI9341Rgb565, di)
112+
//! .invert_colors(lcd_async::options::ColorInversion::Inverted)
113+
//! # .init(&mut delay).await.unwrap();
114+
//! # });
92115
//! ```
93116
//!
94117
//! ### Wrong subpixel order and color inversion
@@ -97,12 +120,15 @@
97120
//!
98121
//! ```
99122
//! # use embedded_graphics::prelude::*;
100-
//! # use mipidsi::{Builder, TestImage, models::ILI9486Rgb666};
123+
//! # use embedded_graphics::pixelcolor::Rgb565;
124+
//! # use lcd_async::{Builder, TestImage, models::ILI9341Rgb565, raw_framebuf::RawFrameBuf};
101125
//! #
102-
//! # let di = mipidsi::_mock::MockDisplayInterface;
103-
//! # let mut delay = mipidsi::_mock::MockDelay;
104-
//! # let mut display = Builder::new(ILI9486Rgb666, di)
105-
//! .color_order(mipidsi::options::ColorOrder::Bgr)
106-
//! .invert_colors(mipidsi::options::ColorInversion::Inverted)
107-
//! # .init(&mut delay).unwrap();
126+
//! # tokio_test::block_on(async {
127+
//! # let di = lcd_async::_mock::MockDisplayInterface;
128+
//! # let mut delay = lcd_async::_mock::MockDelay;
129+
//! # let mut display = Builder::new(ILI9341Rgb565, di)
130+
//! .color_order(lcd_async::options::ColorOrder::Bgr)
131+
//! .invert_colors(lcd_async::options::ColorInversion::Inverted)
132+
//! # .init(&mut delay).await.unwrap();
133+
//! # });
108134
//! ```

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
//!
5656
//! ## Troubleshooting
5757
//!
58-
//! If you experience issues such as blank screens or incorrect colors, refer to the troubleshooting section in the README or open an issue on the repository.
58+
//! Refer to the [troubleshooting guide](_troubleshooting)
59+
//! if you experience problems like a blank screen or incorrect colors.
5960
//!
6061
//! ## License
6162
//!

0 commit comments

Comments
 (0)