1/*
2 * Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f412Xg.dtsi>
9#include <st/f4/stm32f412r(e-g)tx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "MXChip AZ3166 IoT Developer Kit";
14	compatible = "mxchip,az3166_iotdevkit";
15
16	aliases {
17		led0 = &user_led;
18		pwm-led0 = &blue_pwm_led;
19		sw0 = &button_a;
20
21		red-led = &red_led;
22		green-led = &green_led;
23		blue-led = &blue_led;
24
25		red-pwm-led = &red_pwm_led;
26		green-pwm-led = &green_pwm_led;
27		blue-pwm-led = &blue_pwm_led;
28	};
29
30	chosen {
31		zephyr,console = &usart6;
32		zephyr,shell-uart = &usart6;
33		zephyr,sram = &sram0;
34		zephyr,flash = &flash0;
35		zephyr,display = &ssd1306;
36	};
37
38	leds {
39		compatible = "gpio-leds";
40		green_led: green_led {
41			gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>;
42			label = "Green";
43		};
44		red_led: red_led {
45			gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>;
46			label = "Red";
47		};
48		blue_led: blue_led {
49			gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>;
50			label = "Blue";
51		};
52		wifi_led: wifi_led {
53			gpios = <&gpiob 2 GPIO_ACTIVE_HIGH>;
54			label = "Wi-Fi";
55		};
56		azure_led: azure_led {
57			gpios = <&gpioa 15 GPIO_ACTIVE_HIGH>;
58			label = "Azure";
59		};
60		user_led: user_led {
61			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
62			label = "User";
63		};
64	};
65
66	pwmleds {
67		compatible = "pwm-leds";
68		red_pwm_led: red_pwm_led {
69			pwms = <&pwm3 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
70		};
71		green_pwm_led: green_pwm_led {
72			pwms = <&pwm2 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
73		};
74		blue_pwm_led: blue_pwm_led {
75			pwms = <&pwm3 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
76		};
77	};
78
79	buttons {
80		compatible = "gpio-keys";
81		button_a: button_a {
82			gpios = <&gpioa 4 (GPIO_ACTIVE_LOW | GPIO_PULL_DOWN)>;
83			label = "Button A";
84			zephyr,code = <INPUT_KEY_A>;
85		};
86
87		button_b: button_b {
88			gpios = <&gpioa 10 (GPIO_ACTIVE_LOW | GPIO_PULL_DOWN)>;
89			label = "Button B";
90			zephyr,code = <INPUT_KEY_B>;
91		};
92	};
93
94};
95
96&clk_lsi {
97	status = "okay";
98};
99
100&clk_hse {
101	clock-frequency = <DT_FREQ_M(26)>;
102	status = "okay";
103};
104
105&pll {
106	div-m = <13>;
107	mul-n = <96>;
108	div-p = <2>;
109	div-q = <4>;
110	clocks = <&clk_hse>;
111	status = "okay";
112};
113
114&rcc {
115	clocks = <&pll>;
116	clock-frequency = <DT_FREQ_M(96)>;
117	ahb-prescaler = <1>;
118	apb1-prescaler = <2>;
119	apb2-prescaler = <1>;
120};
121
122&usart1 {
123	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
124	pinctrl-names = "default";
125	current-speed = <115200>;
126	status = "okay";
127};
128
129
130&usart6 {
131	pinctrl-0 = <&usart6_tx_pa11 &usart6_rx_pa12>;
132	pinctrl-names = "default";
133	current-speed = <115200>;
134	status = "okay";
135};
136
137&i2c1 {
138	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
139	pinctrl-names = "default";
140	clock-frequency = <I2C_BITRATE_FAST>;
141	status = "okay";
142
143	lsm6dsl@6a {
144		compatible = "st,lsm6dsl";
145		reg = <0x6a>;
146	};
147
148	hts221@5f {
149		compatible = "st,hts221";
150		reg = <0x5f>;
151	};
152
153	lis2mdl@1e {
154		compatible = "st,lis2mdl";
155		reg = <0x1e>;
156	};
157
158	lps22hb-press@5c {
159		compatible = "st,lps22hb-press";
160		reg = <0x5c>;
161	};
162
163	ssd1306: ssd1306@3c {
164		compatible = "solomon,ssd1306fb";
165		reg = <0x3c>;
166		width = <128>;
167		height = <64>;
168		segment-offset = <0>;
169		page-offset = <0>;
170		display-offset = <0>;
171		multiplex-ratio = <63>;
172		segment-remap;
173		com-invdir;
174		prechargep = <0x22>;
175		inversion-on;
176
177		reset-gpios = <&gpioa 8 GPIO_ACTIVE_HIGH>;
178	};
179};
180
181&spi1 {
182	pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
183	pinctrl-names = "default";
184	status = "okay";
185};
186
187&timers2 {
188	st,prescaler = <10000>;
189	status = "okay";
190
191	pwm2: pwm {
192		status = "okay";
193		pinctrl-0 = <&tim2_ch2_pb3>;
194		pinctrl-names = "default";
195	};
196};
197
198&timers3 {
199	st,prescaler = <10000>;
200	status = "okay";
201
202	pwm3: pwm {
203		status = "okay";
204		pinctrl-0 = <&tim3_ch1_pb4 &tim3_ch2_pc7>;
205		pinctrl-names = "default";
206	};
207};
208
209&rtc {
210	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
211		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
212	status = "okay";
213};
214