1/*
2 * Copyright (c) 2024 Eve Redero
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include "st/f4/stm32f405Xg.dtsi"
9#include "st/f4/stm32f405vgtx-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11#include <zephyr/dt-bindings/display/ili9xxx.h>
12
13/ {
14	model = "ST ST25DV Discovery Kit with MB1283";
15	compatible = "st,st25dv_mb1283_disco", "st,stm32f405", "st,stm32f4";
16
17	chosen {
18		zephyr,console = &usart6;
19		zephyr,shell-uart = &usart6;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,display = &ili9341;
23	};
24
25	leds {
26		compatible = "gpio-leds";
27		orange_led: led_1 {
28			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
29		};
30		yellow_led: led_2 {
31			gpios = <&gpioc 4 GPIO_ACTIVE_HIGH>;
32		};
33	};
34
35	buttons: gpio_keys {
36		compatible = "gpio-keys";
37		blue_button: button_1 {
38			gpios = <&gpioc 14 GPIO_ACTIVE_LOW>;
39			zephyr,code = <INPUT_KEY_0>;
40		};
41		sel_button: button_2 {
42			gpios = <&gpioe 8 GPIO_ACTIVE_LOW>;
43			zephyr,code = <INPUT_KEY_ENTER>;
44		};
45		left_button: button_3 {
46			gpios = <&gpioe 9 GPIO_ACTIVE_LOW>;
47			zephyr,code = <INPUT_KEY_LEFT>;
48		};
49		right_button: button_4 {
50			gpios = <&gpioe 11 GPIO_ACTIVE_LOW>;
51			zephyr,code = <INPUT_KEY_RIGHT>;
52		};
53		up_button: button_5 {
54			gpios = <&gpioe 10 GPIO_ACTIVE_LOW>;
55			zephyr,code = <INPUT_KEY_UP>;
56		};
57		down_button: button_6 {
58			gpios = <&gpioe 12 GPIO_ACTIVE_LOW>;
59			zephyr,code = <INPUT_KEY_DOWN>;
60		};
61	};
62
63	aliases {
64		led0 = &orange_led;
65		sw0 = &blue_button;
66	};
67
68	mipi_dbi {
69		compatible = "zephyr,mipi-dbi-spi";
70		reset-gpios = <&gpioc 1 GPIO_ACTIVE_HIGH>;
71		dc-gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
72		spi-dev = <&spi2>;
73		#address-cells = <1>;
74		#size-cells = <0>;
75		write-only;
76
77		ili9341: ili9341@0 {
78			compatible = "ilitek,ili9341";
79			mipi-max-frequency = <DT_FREQ_M(20)>;
80			reg = <0>;
81			pixel-format = <ILI9XXX_PIXEL_FORMAT_RGB888>;
82			rotation = <0>;
83			width = <240>;
84			height = <320>;
85			duplex = <0x800>;
86	    };
87	};
88};
89
90&clk_lsi {
91	status = "okay";
92};
93
94&clk_hse {
95	clock-frequency = <DT_FREQ_M(8)>;
96	status = "okay";
97};
98
99&pll {
100	div-m = <4>;
101	mul-n = <168>;
102	div-p = <2>;
103	div-q = <7>;
104	clocks = <&clk_hse>;
105	status = "okay";
106};
107
108&rcc {
109	clocks = <&pll>;
110	clock-frequency = <DT_FREQ_M(168)>;
111	ahb-prescaler = <1>;
112	apb1-prescaler = <4>;
113	apb2-prescaler = <2>;
114};
115
116&usart6 {
117	pinctrl-0 = <&usart6_tx_pc6 &usart6_rx_pc7>;
118	pinctrl-names = "default";
119	current-speed = <115200>;
120	status = "okay";
121};
122
123&rtc {
124	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
125		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
126	status = "okay";
127};
128
129&spi2 { /* Max 20 Mbit/s */
130	#address-cells = <1>;
131	#size-cells = <0>;
132	pinctrl-0 = <&spi2_mosi_pc3 &spi2_sck_pb13>;
133	cs-gpios = <&gpiob 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
134	pinctrl-names = "default";
135	status = "okay";
136};
137
138
139&i2c1 {
140	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
141	pinctrl-names = "default";
142	status = "okay";
143	clock-frequency = <I2C_BITRATE_FAST>;
144
145	stmpe811: stmpe811@41 {
146		compatible = "st,stmpe811";
147		status = "okay";
148		reg = <0x41>;
149		int-gpios = <&gpiob 5 GPIO_ACTIVE_LOW>;
150		screen-width = <240>;
151		screen-height = <320>;
152		raw-x-min = <240>;
153		raw-y-min = <200>;
154		raw-x-max = <3680>;
155		raw-y-max = <3800>;
156		panel-driver-settling-time-us = <1000>;
157		touch-detect-delay-us = <5000>;
158		touch-average-control = <8>;
159		tracking-index = <127>;
160	};
161};
162
163zephyr_udc0: &usbotg_fs {
164	pinctrl-0 = <&usb_otg_fs_id_pa10 &usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
165	pinctrl-names = "default";
166	status = "okay";
167};
168