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/kernel.h>
11
+ #include <zephyr/drivers/i2c.h>
12
+ #include <zephyr/device.h>
13
+
14
+ #define LED_BUILTIN 8
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
+
61
+ static struct gpio_dt_spec * arduino_pins [22 ] = {
62
+ & d0 , & d1 , & d2 , & d3 , & d4 , & d5 , & d6 , & d7 , & d8 , & d9 , & d10 ,
63
+ & d11 , & d12 , & d13 , & d14 , & d15 , & d16 , & d17 , & d18 , & d19 , & d20 , & d21 };
64
+
65
+ enum digitalPins {
66
+ D0 ,
67
+ D1 ,
68
+ D2 ,
69
+ D3 ,
70
+ D4 ,
71
+ D5 ,
72
+ D6 ,
73
+ D7 ,
74
+ D8 ,
75
+ D9 ,
76
+ D10 ,
77
+ D11 ,
78
+ D12 ,
79
+ D13 ,
80
+ D14 ,
81
+ D15 ,
82
+ D16 ,
83
+ D17 ,
84
+ D18 ,
85
+ D19 ,
86
+ D20 ,
87
+ D21
88
+ };
89
+
90
+ const static struct device * i2c_dev = DEVICE_DT_GET (DT_NODELABEL (sercom0 ));
0 commit comments