Skip to content

Commit 8a28d3a

Browse files
committed
variants: add nrf52840dk
Add varints folder and pinmapping for nRF52840dk Signed-off-by: Mike Szczys <[email protected]>
1 parent a88eda6 commit 8a28d3a

File tree

3 files changed

+127
-1
lines changed

3 files changed

+127
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/ {
2+
zephyr,user {
3+
d0_gpios = <&arduino_header 6 0>; /* Digital */
4+
d1_gpios = <&arduino_header 7 0>;
5+
d2_gpios = <&arduino_header 8 0>;
6+
d3_gpios = <&arduino_header 9 0>;
7+
d4_gpios = <&arduino_header 10 0>;
8+
d5_gpios = <&arduino_header 11 0>;
9+
d6_gpios = <&arduino_header 12 0>;
10+
d7_gpios = <&arduino_header 13 0>;
11+
d8_gpios = <&arduino_header 14 0>;
12+
d9_gpios = <&arduino_header 15 0>;
13+
d10_gpios = <&arduino_header 16 0>;
14+
d11_gpios = <&arduino_header 17 0>;
15+
d12_gpios = <&arduino_header 18 0>;
16+
d13_gpios = <&arduino_header 19 0>;
17+
d14_gpios = <&arduino_header 20 0>;
18+
d15_gpios = <&arduino_header 21 0>;
19+
d16_gpios = <&arduino_header 0 0>; /* Analog */
20+
d17_gpios = <&arduino_header 1 0>;
21+
d18_gpios = <&arduino_header 2 0>;
22+
d19_gpios = <&arduino_header 3 0>;
23+
d20_gpios = <&arduino_header 4 0>;
24+
d21_gpios = <&arduino_header 5 0>;
25+
d22_gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
26+
};
27+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2022 Mike Szczys
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __NRF52840DK_NRF52840_PINMAP_H__
8+
#define __NRF52840DK_NRF52840_PINMAP_H__
9+
10+
#include <zephyr/drivers/gpio.h>
11+
#include <zephyr/drivers/i2c.h>
12+
#include <zephyr/zephyr.h>
13+
14+
#define LED_BUILTIN 22
15+
16+
static struct gpio_dt_spec d0 =
17+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d0_gpios);
18+
static struct gpio_dt_spec d1 =
19+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d1_gpios);
20+
static struct gpio_dt_spec d2 =
21+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d2_gpios);
22+
static struct gpio_dt_spec d3 =
23+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d3_gpios);
24+
static struct gpio_dt_spec d4 =
25+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d4_gpios);
26+
static struct gpio_dt_spec d5 =
27+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d5_gpios);
28+
static struct gpio_dt_spec d6 =
29+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d6_gpios);
30+
static struct gpio_dt_spec d7 =
31+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d7_gpios);
32+
static struct gpio_dt_spec d8 =
33+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d8_gpios);
34+
static struct gpio_dt_spec d9 =
35+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d9_gpios);
36+
static struct gpio_dt_spec d10 =
37+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d10_gpios);
38+
static struct gpio_dt_spec d11 =
39+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d11_gpios);
40+
static struct gpio_dt_spec d12 =
41+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d12_gpios);
42+
static struct gpio_dt_spec d13 =
43+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d13_gpios);
44+
static struct gpio_dt_spec d14 =
45+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d13_gpios);
46+
static struct gpio_dt_spec d15 =
47+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d15_gpios);
48+
static struct gpio_dt_spec d16 =
49+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d16_gpios);
50+
static struct gpio_dt_spec d17 =
51+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d17_gpios);
52+
static struct gpio_dt_spec d18 =
53+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d18_gpios);
54+
static struct gpio_dt_spec d19 =
55+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d19_gpios);
56+
static struct gpio_dt_spec d20 =
57+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d20_gpios);
58+
static struct gpio_dt_spec d21 =
59+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d21_gpios);
60+
static struct gpio_dt_spec d22 =
61+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d22_gpios); /* LED0 */
62+
63+
static struct gpio_dt_spec *arduino_pins[23] = {
64+
&d0, &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9, &d10,
65+
&d11, &d12, &d13, &d14, &d15, &d16, &d17, &d18, &d19, &d20, &d21,
66+
&d22};
67+
68+
enum digitalPins {
69+
D0,
70+
D1,
71+
D2,
72+
D3,
73+
D4,
74+
D5,
75+
D6,
76+
D7,
77+
D8,
78+
D9,
79+
D10,
80+
D11,
81+
D12,
82+
D13,
83+
D14,
84+
D15,
85+
D16,
86+
D17,
87+
D18,
88+
D19,
89+
D20,
90+
D21,
91+
D22 /* LED0 */
92+
};
93+
94+
const static struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(arduino_i2c));
95+
96+
#endif

variants/variants.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
#endif // CONFIG_BOARD_ARDUINO_NANO_33_BLE_SENSE
77
#ifdef CONFIG_BOARD_ARDUINO_NANO_33_IOT
88
#include <arduino_nano_33_iot_pinmap.h>
9-
#endif // CONFIG_BOARD_ARDUINO_NANO_33_IOT
9+
#endif /* CONFIG_BOARD_ARDUINO_NANO_33_IOT */
10+
#ifdef CONFIG_BOARD_NRF52840DK_NRF52840
11+
#include "nrf52840dk_nrf52840_pinmap.h"
12+
#endif /* CONFIG_BOARD_NRF52840DK_NRF52840 */

0 commit comments

Comments
 (0)