1/*
2 * Copyright (c) 2018-2020 Nordic Semiconductor ASA
3 * Copyright (c) 2020 Circuit Dojo LLC
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7#include "sparkfun_thing_plus_nrf9160_common-pinctrl.dtsi"
8#include <zephyr/dt-bindings/input/input-event-codes.h>
9
10/ {
11	model = "Sparkfun nRF9160 Thing Plus";
12	compatible = "sparkfun,thing-plus-nrf9160";
13
14	chosen {
15		zephyr,console = &uart0;
16		zephyr,shell-uart = &uart0;
17		zephyr,uart-mcumgr = &uart0;
18	};
19
20	leds {
21		compatible = "gpio-leds";
22		blue_led: led_0 {
23			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
24			label = "Blue LED (D7)";
25		};
26	};
27
28	pwmleds {
29		compatible = "pwm-leds";
30		pwm_led0: pwm_led_0 {
31			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
32		};
33	};
34
35	buttons {
36		compatible = "gpio-keys";
37		button0: button_0 {
38			gpios = <&gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
39			label = "Switch 1";
40			zephyr,code = <INPUT_KEY_0>;
41		};
42	};
43
44	/* TPS63031 Buck/Boost converter (provides 3.3V) */
45	pwr-3v3 {
46		compatible = "regulator-fixed";
47		regulator-name = "pwr-3v3";
48		enable-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
49		regulator-always-on;
50	};
51
52	/* These aliases are provided for compatibility with samples */
53	aliases {
54		led0 = &blue_led;
55		bootloader-led0 = &blue_led;
56		pwm-led0 = &pwm_led0;
57		sw0 = &button0;
58		mcuboot-button0 = &button0;
59		mcuboot-led0 = &blue_led;
60		watchdog0 = &wdt0;
61		accel0 = &lis2dh;
62	};
63
64	/* Used for accessing other pins */
65	feather_header: feather_connector {
66		compatible = "adafruit-feather-header";
67		#gpio-cells = <2>;
68		gpio-map-mask = <0xffffffff 0xffffffc0>;
69		gpio-map-pass-thru = <0 0x3f>;
70		gpio-map = <12 0 &gpio0 26 0>,  /* SDA */
71		<13 0 &gpio0 27 0>,  /* SCL */
72		<14 0 &gpio0 29 0>,  /* PWM3 */
73		<15 0 &gpio0 30 0>,  /* PWM3 */
74		<16 0 &gpio0 0 0>,   /* PWM1 */
75		<17 0 &gpio0 1 0>,   /* PWM1 */
76		<18 0 &gpio0 2 0>,   /* PWM1 */
77		<19 0 &gpio0 3 0>,   /* PWM0 */
78		<20 0 &gpio0 4 0>,   /* PWM1 */
79		/* 11 not connected */
80		<10 0 &gpio0 24 0>,  /* TX */
81		<9 0 &gpio0 23 0>,   /* RX */
82		<8 0 &gpio0 22 0>,   /* MISO */
83		<7 0 &gpio0 21 0>,   /* MOSI */
84		<6 0 &gpio0 19 0>,   /* SCK */
85		<5 0 &gpio0 18 0>,   /* SS */
86		<4 0 &gpio0 17 0>,   /* ADC4 = AIN6 */
87		<3 0 &gpio0 16 0>,   /* ADC3 = AIN5 */
88		<2 0 &gpio0 15 0>,   /* ADC2 = AIN4 */
89		<1 0 &gpio0 14 0>,   /* ADC1 = AIN2 */
90		<0 0 &gpio0 13 0>;   /* ADC0 = AIN1 */
91	};
92};
93
94&adc {
95	status = "okay";
96};
97
98&gpiote {
99	status = "okay";
100};
101
102&gpio0 {
103	status = "okay";
104};
105
106&uart0 {
107	status = "okay";
108	current-speed = <115200>;
109	pinctrl-0 = <&uart0_default>;
110	pinctrl-1 = <&uart0_sleep>;
111	pinctrl-names = "default", "sleep";
112};
113
114&uart1 {
115	current-speed = <115200>;
116	pinctrl-0 = <&uart1_default>;
117	pinctrl-1 = <&uart1_sleep>;
118	pinctrl-names = "default", "sleep";
119};
120
121&uart2 {
122	pinctrl-0 = <&uart2_default>;
123	pinctrl-1 = <&uart2_sleep>;
124	pinctrl-names = "default", "sleep";
125};
126
127&i2c1 {
128	compatible = "nordic,nrf-twim";
129	status = "okay";
130
131	pinctrl-0 = <&i2c1_default>;
132	pinctrl-1 = <&i2c1_sleep>;
133	pinctrl-names = "default", "sleep";
134	pcf85063a@51 {
135		compatible = "nxp,pcf85063a";
136		reg = <0x51>;
137	};
138
139	lis2dh: lis2dh@18 {
140		compatible = "st,lis2dh";
141		reg = <0x18>;
142		irq-gpios = <&gpio0 29 0>;
143	};
144
145};
146
147&pwm0 {
148	status = "okay";
149	pinctrl-0 = <&pwm0_default>;
150	pinctrl-1 = <&pwm0_sleep>;
151	pinctrl-names = "default", "sleep";
152};
153
154&spi3 {
155	compatible = "nordic,nrf-spim";
156	status = "okay";
157	cs-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
158	pinctrl-0 = <&spi3_default>;
159	pinctrl-1 = <&spi3_sleep>;
160	pinctrl-names = "default", "sleep";
161	w25q32jv: w25q32jv@0 {
162		compatible = "jedec,spi-nor";
163		reg = <0>;
164		spi-max-frequency = <40000000>;
165		wp-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
166		hold-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
167		size = <0x2000000>;
168		has-dpd;
169		t-enter-dpd = <3000>;
170		t-exit-dpd = <30000>;
171		jedec-id = [ ef 40 16 ];
172	};
173};
174
175/ {
176	vbatt {
177		compatible = "voltage-divider";
178		io-channels = <&adc 7>;
179		output-ohms = <100000>;
180		full-ohms = <(100000 + 100000)>;
181		power-gpios = <&gpio0 25 0>;
182	};
183};
184
185/* Include default memory partition configuration file */
186#include <common/nordic/nrf91xx_partition.dtsi>
187