1/*
2 * Copyright (c) 2024 Nikola Trifunovic <nikola@trifunovic.at>
3 * Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
4 * Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org>
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8/dts-v1/;
9
10#include <espressif/esp32/esp32_pico_d4.dtsi>
11#include "m5stack_atom_lite-pinctrl.dtsi"
12#include "grove_connectors.dtsi"
13#include <zephyr/dt-bindings/input/input-event-codes.h>
14#include <zephyr/dt-bindings/led/led.h>
15#include <zephyr/dt-bindings/led/worldsemi_ws2812c.h>
16#include <espressif/partitions_0x1000_amp.dtsi>
17
18/ {
19	model = "M5Stack ATOM Lite PROCPU";
20	compatible = "m5stack,m5stack-atom-lite";
21
22	chosen {
23		zephyr,sram = &sram1;
24		zephyr,console = &uart0;
25		zephyr,shell-uart = &uart0;
26		zephyr,flash = &flash0;
27		zephyr,code-partition = &slot0_partition;
28		zephyr,bt-hci = &esp32_bt_hci;
29	};
30
31	aliases {
32		sw0 = &user_button_0;
33		watchdog0 = &wdt0;
34		i2c-0 = &i2c0;
35		led-strip = &status_rgb_led;
36	};
37
38	leds {
39		compatible = "gpio-leds";
40
41		ir_led: led_0 {
42			gpios =  <&gpio0 12 GPIO_ACTIVE_HIGH>;
43			label = "Infrared LED";
44		};
45	};
46
47	gpio_keys {
48		compatible = "gpio-keys";
49
50		user_button_0: button_0 {
51			label = "User button 0";
52			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; // G39
53			zephyr,code = <INPUT_KEY_0>;
54		};
55	};
56};
57
58&uart0 {
59	status = "okay";
60	current-speed = <115200>;
61	pinctrl-0 = <&uart0_default>;
62	pinctrl-names = "default";
63};
64
65&i2c0 {
66	status = "okay";
67	clock-frequency = <I2C_BITRATE_FAST>;
68	pinctrl-0 = <&i2c0_default>;
69	pinctrl-names = "default";
70	sda-gpios = <&gpio0 25 GPIO_OPEN_DRAIN>;
71	scl-gpios = <&gpio0 21 GPIO_OPEN_DRAIN>;
72
73};
74
75&i2c1 {
76	status = "okay";
77	clock-frequency = <I2C_BITRATE_FAST>;
78	pinctrl-0 = <&i2c1_default>;
79	pinctrl-names = "default";
80	sda-gpios = <&gpio0 26 GPIO_OPEN_DRAIN>;
81	scl-gpios = <&gpio1 0 GPIO_OPEN_DRAIN>;
82};
83
84
85&timer0 {
86	status = "okay";
87};
88
89&timer1 {
90	status = "okay";
91};
92
93&timer2 {
94	status = "okay";
95};
96
97&timer3 {
98	status = "okay";
99};
100
101&trng0 {
102	status = "okay";
103};
104
105&spi2 {
106	#address-cells = <1>;
107	#size-cells = <0>;
108	pinctrl-0 = <&spim2_default>;
109	pinctrl-names = "default";
110};
111
112/* used for SK6812 */
113&spi3 {
114	#address-cells = <1>;
115	#size-cells = <0>;
116	status = "okay";
117	line-idle-low;
118	pinctrl-0 = <&spim3_ws2812_led>;
119	pinctrl-names = "default";
120
121	status_rgb_led: ws2812@0 {
122		compatible = "worldsemi,ws2812-spi";
123		reg = <0>;
124		spi-max-frequency = <WS2812C_SPI_FREQ>;
125
126		chain-length = <1>;
127		color-mapping =	<LED_COLOR_ID_GREEN>,
128			<LED_COLOR_ID_RED>,
129			<LED_COLOR_ID_BLUE>;
130		spi-one-frame = <WS2812C_ONE_FRAME>;
131		spi-zero-frame = <WS2812C_ZERO_FRAME>;
132	};
133};
134
135&gpio0 {
136	status = "okay";
137};
138
139&gpio1 {
140	status = "okay";
141};
142
143&wdt0 {
144	status = "okay";
145};
146
147&esp32_bt_hci {
148	status = "okay";
149};
150