Skip to content

Commit 4df33db

Browse files
committed
Fix ls0xx display driver sample
1 parent e90c58a commit 4df33db

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

samples/drivers/display/README.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,35 @@ List of Arduino-based display shields
4646
- :ref:`ssd1306_128_shield`
4747
- :ref:`st7789v_generic`
4848
- :ref:`waveshare_epaper`
49+
50+
Changes for ls0xx Display
51+
*************************
52+
53+
To run the sample on an Adafruit Sharp memory display 2.7 inch (ls0xx) on a STM32H7B0 board, ensure the following:
54+
55+
1. Modify the device tree snippet to match the display configuration.
56+
2. Ensure the `buf_desc.width` is set to 400 in the sample code.
57+
3. Check the return value of `display_get_capabilities()` in the sample code.
58+
59+
Example device tree snippet:
60+
61+
.. code-block:: dts
62+
63+
&spi2 {
64+
pinctrl-0 = <&spi2_sck_pb10 &spi2_miso_pc2_c &spi2_mosi_pc1>;
65+
cs-gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
66+
pinctrl-names = "default";
67+
status = "okay";
68+
69+
ls0xx_ls027b7dh01: ls0xx@0 {
70+
compatible = "sharp,ls0xx";
71+
spi-max-frequency = <2000000>;
72+
reg = <0>;
73+
width = <400>;
74+
height = <240>;
75+
extcomin-gpios = <&gpioc 3 GPIO_ACTIVE_HIGH>;
76+
extcomin-frequency = <60>; /* required if extcomin-gpios is defined */
77+
disp-en-gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
78+
};
79+
80+
};

samples/drivers/display/src/main.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,15 @@ int main(void)
199199
#endif
200200
}
201201

202-
LOG_INF("Display sample for %s", display_dev->name);
203-
display_get_capabilities(display_dev, &capabilities);
202+
LOG_INF("Display sample for %s", display_dev->name);
203+
if (display_get_capabilities(display_dev, &capabilities) != 0) {
204+
LOG_ERR("Failed to get display capabilities. Aborting sample.");
205+
#ifdef CONFIG_ARCH_POSIX
206+
posix_exit_main(1);
207+
#else
208+
return 0;
209+
#endif
210+
}
204211

205212
if (capabilities.screen_info & SCREEN_INFO_MONO_VTILED) {
206213
rect_w = 16;
@@ -297,6 +304,10 @@ int main(void)
297304
buf_desc.width = capabilities.x_resolution;
298305
buf_desc.height = h_step;
299306

307+
if (strcmp(display_dev->name, "ls0xx") == 0) {
308+
buf_desc.width = 400;
309+
}
310+
300311
for (int idx = 0; idx < capabilities.y_resolution; idx += h_step) {
301312
/*
302313
* Tweaking the height value not to draw outside of the display.

0 commit comments

Comments
 (0)