Skip to content

Commit 89de89c

Browse files
committed
variants: add support for arduino_mkrzero
Adds support for the arduino mkr zero board. Tested with LED_Blink sample. I am not sure about the inbuilt LED pin number though, hence this pinmap just uses D7 for demo purposes Signed-off-by: Dhruva Gole <goledhruva@gmail.com>
1 parent 8a28d3a commit 89de89c

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2022 Dhruva Gole <goledhruva@gmail.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/ {
7+
zephyr,user {
8+
d0_gpios = <&arduino_mkr_header 0 0>;
9+
d1_gpios = <&arduino_mkr_header 1 0>;
10+
d2_gpios = <&arduino_mkr_header 2 0>;
11+
d3_gpios = <&arduino_mkr_header 3 0>;
12+
d4_gpios = <&arduino_mkr_header 4 0>;
13+
d5_gpios = <&arduino_mkr_header 5 0>;
14+
d6_gpios = <&arduino_mkr_header 6 0>;
15+
d7_gpios = <&arduino_mkr_header 7 0>;
16+
d8_gpios = <&arduino_mkr_header 8 0>;
17+
d9_gpios = <&arduino_mkr_header 9 0>;
18+
d10_gpios = <&arduino_mkr_header 10 0>;
19+
d11_gpios = <&arduino_mkr_header 11 0>;
20+
d12_gpios = <&arduino_mkr_header 12 0>;
21+
d13_gpios = <&arduino_mkr_header 13 0>;
22+
d14_gpios = <&arduino_mkr_header 14 0>; /* D14 / A0 */
23+
d15_gpios = <&arduino_mkr_header 15 0>;
24+
d16_gpios = <&arduino_mkr_header 16 0>;
25+
d17_gpios = <&arduino_mkr_header 17 0>;
26+
d18_gpios = <&arduino_mkr_header 18 0>; /* D18 / A4 / I2C-SDA */
27+
d19_gpios = <&arduino_mkr_header 19 0>; /* D19 / A5 / I2C-SCL */
28+
d20_gpios = <&arduino_mkr_header 20 0>;
29+
d21_gpios = <&arduino_mkr_header 21 0>;
30+
};
31+
};
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright (c) 2022 Dhruva Gole
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/zephyr.h>
11+
12+
#define LED_BUILTIN 7
13+
14+
static struct gpio_dt_spec d0 =
15+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d0_gpios);
16+
static struct gpio_dt_spec d1 =
17+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d1_gpios);
18+
static struct gpio_dt_spec d2 =
19+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d2_gpios);
20+
static struct gpio_dt_spec d3 =
21+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d3_gpios);
22+
static struct gpio_dt_spec d4 =
23+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d4_gpios);
24+
static struct gpio_dt_spec d5 =
25+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d5_gpios);
26+
static struct gpio_dt_spec d6 =
27+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d6_gpios);
28+
static struct gpio_dt_spec d7 =
29+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d7_gpios);
30+
static struct gpio_dt_spec d8 =
31+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d8_gpios);
32+
static struct gpio_dt_spec d9 =
33+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d9_gpios);
34+
static struct gpio_dt_spec d10 =
35+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d10_gpios);
36+
static struct gpio_dt_spec d11 =
37+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d11_gpios);
38+
static struct gpio_dt_spec d12 =
39+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d12_gpios);
40+
static struct gpio_dt_spec d13 =
41+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d13_gpios);
42+
static struct gpio_dt_spec d14 =
43+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d13_gpios);
44+
static struct gpio_dt_spec d15 =
45+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d15_gpios);
46+
static struct gpio_dt_spec d16 =
47+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d16_gpios);
48+
static struct gpio_dt_spec d17 =
49+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d17_gpios);
50+
static struct gpio_dt_spec d18 =
51+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d18_gpios);
52+
static struct gpio_dt_spec d19 =
53+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d19_gpios);
54+
static struct gpio_dt_spec d20 =
55+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d20_gpios);
56+
static struct gpio_dt_spec d21 =
57+
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), d21_gpios);
58+
59+
static struct gpio_dt_spec *arduino_pins[22] = {
60+
&d0, &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9, &d10,
61+
&d11, &d12, &d13, &d14, &d15, &d16, &d17, &d18, &d19, &d20, &d21};
62+
63+
enum digitalPins {
64+
D0,
65+
D1,
66+
D2,
67+
D3,
68+
D4,
69+
D5,
70+
D6,
71+
D7,
72+
D8,
73+
D9,
74+
D10,
75+
D11,
76+
D12,
77+
D13,
78+
D14,
79+
D15,
80+
D16,
81+
D17,
82+
D18,
83+
D19,
84+
D20,
85+
D21
86+
};

variants/variants.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
#ifdef CONFIG_BOARD_NRF52840DK_NRF52840
1111
#include "nrf52840dk_nrf52840_pinmap.h"
1212
#endif /* CONFIG_BOARD_NRF52840DK_NRF52840 */
13+
#ifdef CONFIG_BOARD_ARDUINO_MKRZERO
14+
#include "arduino_mkrzero_pinmap.h"
15+
#endif // CONFIG_BOARD_ARDUINO_MKRZERO

0 commit comments

Comments
 (0)