Skip to content

Commit a053543

Browse files
soburifabiobaltieri
authored andcommitted
boards: riscv: longan_nano: add configuration for LCD
Add configuration for built-in display. LCD has a Sitronix ST7735S controller that is connected to the SPI bus. Using it with the ST7735R driver. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
1 parent 62abf16 commit a053543

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

boards/riscv/longan_nano/longan_nano-common.dtsi

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
zephyr,shell-uart = &usart0;
1111
zephyr,sram = &sram0;
1212
zephyr,flash = &flash0;
13+
zephyr,display = &lcd0;
1314
sdhc0 = &sdhc0;
1415
};
1516

@@ -99,6 +100,49 @@
99100
pinctrl-names = "default";
100101
};
101102

103+
&spi0 {
104+
status = "okay";
105+
pinctrl-0 = <&spi0_default>;
106+
pinctrl-names = "default";
107+
108+
cs-gpios = <&gpiob 2 GPIO_ACTIVE_LOW>;
109+
110+
/* longan nano has LCD with st7735s controller.
111+
* It can use with st7735r driver.
112+
*/
113+
lcd0: lcd@0 {
114+
compatible = "sitronix,st7735r";
115+
reg = <0>;
116+
status = "okay";
117+
reset-gpios = <&gpiob 1 GPIO_ACTIVE_LOW>;
118+
cmd-data-gpios = <&gpiob 0 GPIO_ACTIVE_LOW>;
119+
width = <160>;
120+
height = <80>;
121+
inversion-on;
122+
rgb-is-inverted;
123+
x-offset = <1>;
124+
y-offset = <26>;
125+
pwctr1 = [62 02 04];
126+
pwctr2 = [C0];
127+
pwctr3 = [0D 00];
128+
pwctr4 = [8D 6A];
129+
pwctr5 = [8D EE];
130+
invctr = <3>;
131+
frmctr1 = [05 3A 3A];
132+
frmctr2 = [05 3A 3A];
133+
frmctr3 = [05 3A 3A 05 3A 3A];
134+
vmctr1 = <14>;
135+
gamctrp1 = [10 0E 02 03 0E 07 02 07 0A 12 27 37 00 0D 0E 10];
136+
gamctrn1 = [10 0E 03 03 0F 06 02 08 0A 13 26 36 00 0D 0E 10];
137+
colmod = <5>;
138+
madctl = <120>;
139+
caset = [00 01 00 a0];
140+
raset = [00 1a 00 69];
141+
142+
spi-max-frequency = <4000000>;
143+
};
144+
};
145+
102146
&spi1 {
103147
status = "okay";
104148
pinctrl-0 = <&spi1_default>;

boards/riscv/longan_nano/longan_nano-pinctrl.dtsi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
};
2525
};
2626

27+
spi0_default: spi0_default {
28+
group1 {
29+
pinmux = <SPI0_NSS_PA4_OUT_NORMP>, <SPI0_SCK_PA5_OUT_NORMP>,
30+
<SPI0_MISO_PA6_INP_NORMP>, <SPI0_MOSI_PA7_OUT_NORMP>;
31+
};
32+
};
33+
2734
spi1_default: spi1_default {
2835
group1 {
2936
pinmux = <SPI1_MISO_PB14_INP>, <SPI1_SCK_PB13_OUT>,

0 commit comments

Comments
 (0)