1/*
2 * Copyright (c) 2023 Felipe Neves
3 * Copyright (c) 2024 DNDG srl
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/ {
9	leds {
10		compatible = "gpio-leds";
11
12		status_led_1: led_1 {
13			gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
14		};
15		status_led_2: led_2 {
16			gpios = <&gpioi 1 GPIO_ACTIVE_HIGH>;
17		};
18		status_led_3: led_3 {
19			gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
20		};
21		status_led_4: led_4 {
22			gpios = <&gpioh 15 GPIO_ACTIVE_HIGH>;
23		};
24		led_reset: led_g {
25			gpios = <&gpioh 12 GPIO_ACTIVE_HIGH>;
26		};
27		led_reset_red: led_r {
28			gpios = <&gpioh 11 GPIO_ACTIVE_HIGH>;
29		};
30		led_user: led_b {
31			gpios = <&gpioe 5 GPIO_ACTIVE_HIGH>;
32		};
33	};
34
35	relays {
36		compatible = "gpio-power-switches";
37
38		output_d0: d0 {
39			gpios = <&gpioi 6 GPIO_ACTIVE_HIGH>;
40		};
41		output_d1: d1 {
42			gpios = <&gpioi 5 GPIO_ACTIVE_HIGH>;
43		};
44		output_d2: d2 {
45			gpios = <&gpioi 7 GPIO_ACTIVE_HIGH>;
46		};
47		output_d3: d3 {
48			gpios = <&gpioi 4 GPIO_ACTIVE_HIGH>;
49		};
50	};
51
52	gpio_keys {
53		compatible = "gpio-keys";
54
55		user_button: button {
56			gpios = <&gpioe 4 GPIO_ACTIVE_HIGH>;
57			zephyr,code = <INPUT_KEY_WAKEUP>;
58		};
59	};
60
61	aliases {
62		sw0 = &user_button;
63		led0 = &status_led_1;
64		led1 = &status_led_2;
65		led2 = &status_led_3;
66		led3 = &status_led_4;
67		relay1 = &output_d0;
68		relay2 = &output_d1;
69		relay3 = &output_d2;
70		relay4 = &output_d3;
71	};
72};
73
74&rcc {
75	d1cpre = <1>;
76	hpre = <2>;
77	d1ppre = <2>;
78	d2ppre1 = <2>;
79	d2ppre2 = <2>;
80	d3ppre = <2>;
81};
82
83&rtc {
84	status = "okay";
85};
86
87&mailbox {
88	status = "okay";
89};
90
91&rng {
92	status = "okay";
93};
94
95&usart3 {
96	pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11 &usart3_cts_pb13 &usart3_de_pb14>;
97	pinctrl-names = "default";
98	current-speed = <115200>;
99	/* The RS485 is often used with the ModBus protocol. */
100	modbus0 {
101		compatible = "zephyr,modbus-serial";
102		de-gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
103		re-gpios = <&gpiob 13 GPIO_ACTIVE_LOW>;
104	};
105};
106
107&adc1 {
108	pinctrl-0 = <&adc1_inp0_pa0_c &adc1_inp6_pf12>;
109	pinctrl-names = "default";
110	st,adc-clock-source = "SYNC";
111	st,adc-prescaler = <4>;
112	vref-mv = <10000>;
113
114	#address-cells = <1>;
115	#size-cells = <0>;
116
117	a0: channel@0 {
118		reg = <0>;
119		zephyr,gain = "ADC_GAIN_1";
120		zephyr,reference = "ADC_REF_INTERNAL";
121		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
122		zephyr,resolution = <16>;
123	};
124
125	a2: channel@6 {
126		reg = <6>;
127		zephyr,gain = "ADC_GAIN_1";
128		zephyr,reference = "ADC_REF_INTERNAL";
129		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
130		zephyr,resolution = <16>;
131	};
132
133};
134
135&adc2 {
136	pinctrl-0 = <&adc2_inp9_pb0>;
137	pinctrl-names = "default";
138	st,adc-clock-source = "SYNC";
139	st,adc-prescaler = <4>;
140	vref-mv = <10000>;
141
142	#address-cells = <1>;
143	#size-cells = <0>;
144
145	a3: channel@9 {
146		reg = <9>;
147		zephyr,gain = "ADC_GAIN_1";
148		zephyr,reference = "ADC_REF_INTERNAL";
149		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
150		zephyr,resolution = <16>;
151	};
152};
153
154&adc3 {
155	pinctrl-0 = <&adc3_inp6_pf10 &adc3_inp7_pf8 &adc3_inp8_pf6 &adc3_inp9_pf4 &adc3_inp0_pc2_c>;
156	pinctrl-names = "default";
157	st,adc-clock-source = "SYNC";
158	st,adc-prescaler = <4>;
159	vref-mv = <10000>;
160
161	#address-cells = <1>;
162	#size-cells = <0>;
163
164	a1: channel@0 {
165		reg = <0>;
166		zephyr,gain = "ADC_GAIN_1";
167		zephyr,reference = "ADC_REF_INTERNAL";
168		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
169		zephyr,resolution = <16>;
170	};
171
172	a4: channel@6 {
173		reg = <6>;
174		zephyr,gain = "ADC_GAIN_1";
175		zephyr,reference = "ADC_REF_INTERNAL";
176		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
177		zephyr,resolution = <16>;
178	};
179
180	a5: channel@7 {
181		reg = <7>;
182		zephyr,gain = "ADC_GAIN_1";
183		zephyr,reference = "ADC_REF_INTERNAL";
184		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
185		zephyr,resolution = <16>;
186	};
187
188	a6: channel@8 {
189		reg = <8>;
190		zephyr,gain = "ADC_GAIN_1";
191		zephyr,reference = "ADC_REF_INTERNAL";
192		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
193		zephyr,resolution = <16>;
194	};
195
196	a7: channel@9 {
197		reg = <9>;
198		zephyr,gain = "ADC_GAIN_1";
199		zephyr,reference = "ADC_REF_INTERNAL";
200		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
201		zephyr,resolution = <16>;
202	};
203};
204