Skip to content

Commit bfa2e1d

Browse files
committed
variants: add nrf52840dk
Add varints folder and pinmapping for nRF52840dk Signed-off-by: Mike Szczys <mike@golioth.io>
1 parent bf7dcdf commit bfa2e1d

File tree

3 files changed

+124
-1
lines changed

3 files changed

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

variants/variants.h

Lines changed: 4 additions & 1 deletion
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)