1/*
2 * Copyright (c) 2024 Kickmaker
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/c0/stm32c011X6.dtsi>
9#include <st/c0/stm32c011f(4-6)ux-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics STM32C0116-DK Discovery board";
14	compatible = "st,stm32c011f6-dk";
15
16	chosen {
17		zephyr,console = &usart1;
18		zephyr,shell-uart = &usart1;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21	};
22
23	leds: leds {
24		compatible = "gpio-leds";
25		green_led_3: led_3 {
26			gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
27			label = "User LD3";
28		};
29	};
30
31	pwmleds {
32		compatible = "pwm-leds";
33
34		green_pwm_led: green_pwm_led {
35			pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
36		};
37	};
38
39	gpio_keys {
40		compatible = "gpio-keys";
41		reset_button: button {
42			label = "reset button";
43			gpios = <&gpiof 2 GPIO_ACTIVE_LOW>;
44			status = "okay";
45			zephyr,code = <INPUT_KEY_0>;
46		};
47	};
48
49	adc-keys {
50		compatible = "adc-keys";
51		io-channels = <&adc1 8>;
52		keyup-threshold-mv = <3300>;
53
54		select_key {
55			press-thresholds-mv = <0>;
56			zephyr,code = <INPUT_KEY_ENTER>;
57		};
58
59		left_key {
60			press-thresholds-mv = <670>;
61			zephyr,code = <INPUT_KEY_LEFT>;
62		};
63
64		down_key {
65			press-thresholds-mv = <1320>;
66			zephyr,code = <INPUT_KEY_DOWN>;
67		};
68
69		up_key {
70			press-thresholds-mv = <2010>;
71			zephyr,code = <INPUT_KEY_UP>;
72		};
73
74		right_key {
75			press-thresholds-mv = <2650>;
76			zephyr,code = <INPUT_KEY_RIGHT>;
77		};
78	};
79
80	aliases {
81		led0 = &green_led_3;
82		pwm-led0 = &green_pwm_led;
83		sw0 = &reset_button;
84		watchdog0 = &iwdg;
85		die-temp0 = &die_temp;
86		volt-sensor0 = &vref;
87	};
88};
89
90&clk_hsi {
91	status = "okay";
92};
93
94&rcc {
95	clocks = <&clk_hsi>;
96	clock-frequency = <DT_FREQ_M(48)>;
97	ahb-prescaler = <1>;
98	apb1-prescaler = <1>;
99};
100
101&pinctrl {
102	remap-pa11;
103	remap-pa12;
104};
105
106&usart1 {
107	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
108	pinctrl-names = "default";
109	current-speed = <115200>;
110	status = "okay";
111};
112
113&usart2 {
114	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
115	pinctrl-names = "default";
116	current-speed = <115200>;
117	status = "okay";
118};
119
120&rtc {
121	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>,
122		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
123	status = "okay";
124};
125
126&iwdg {
127	status = "okay";
128};
129
130&timers1 {
131	st,prescaler = <10000>;
132	status = "okay";
133
134	pwm1: pwm {
135		pinctrl-0 = <&tim1_ch3_pb6>;
136		pinctrl-names = "default";
137		status = "okay";
138	};
139};
140
141&adc1 {
142	pinctrl-0 = <&adc1_in8_pa8>;
143	pinctrl-names = "default";
144	st,adc-clock-source = <SYNC>;
145	st,adc-prescaler = <2>;
146	status = "okay";
147
148	#address-cells = <1>;
149	#size-cells = <0>;
150
151	channel@8 {
152		reg = <0x8>;
153		zephyr,gain = "ADC_GAIN_1";
154		zephyr,reference = "ADC_REF_INTERNAL";
155		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
156		zephyr,resolution = <12>;
157		zephyr,vref-mv = <3300>;
158	};
159
160};
161
162&die_temp {
163	status = "okay";
164};
165
166&vref {
167	status = "okay";
168};
169
170&dma1 {
171	status = "okay";
172};
173
174&dmamux1 {
175	status = "okay";
176};
177