diff options
Diffstat (limited to 'lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h')
-rw-r--r-- | lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h new file mode 100644 index 000000000..5c7566a93 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Stephane D'Alu | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* Board identifier. */ | ||
21 | #define BOARD_NRF52_DK | ||
22 | #define BOARD_NAME "nRF52 DK" | ||
23 | |||
24 | /* Board oscillators-related settings. */ | ||
25 | #define NRF5_XTAL_VALUE 32000000 | ||
26 | #define NRF5_LFCLK_SOURCE 1 | ||
27 | |||
28 | /* | ||
29 | * GPIO pins. | ||
30 | */ | ||
31 | /* Defined by board */ | ||
32 | #define BTN1 13U | ||
33 | #define BTN2 14U | ||
34 | #define BTN3 15U | ||
35 | #define BTN4 16U | ||
36 | #define LED1 17U | ||
37 | #define LED2 18U | ||
38 | #define LED3 19U | ||
39 | #define LED4 20U | ||
40 | #define UART_RTS 5U | ||
41 | #define UART_TX 6U | ||
42 | #define UART_CTS 7U | ||
43 | #define UART_RX 8U | ||
44 | #define NFC1 9U | ||
45 | #define NFC2 10U | ||
46 | #define I2C_SCL 27U | ||
47 | #define I2C_SDA 26U | ||
48 | |||
49 | /* Our definitions */ | ||
50 | #define SPI_SCK 25U | ||
51 | #define SPI_MOSI 24U | ||
52 | #define SPI_MISO 23U | ||
53 | #define SPI_SS 22U | ||
54 | |||
55 | /* Analog input */ | ||
56 | #define AIN0 2U | ||
57 | #define AIN1 3U | ||
58 | #define AIN2 4U | ||
59 | #define AIN3 5U | ||
60 | #define AIN4 28U | ||
61 | #define AIN5 29U | ||
62 | #define AIN6 30U | ||
63 | #define AIN7 31U | ||
64 | #define AREF0 AIN0 | ||
65 | #define AREF1 AIN1 | ||
66 | |||
67 | /* | ||
68 | * IO pins assignments. | ||
69 | */ | ||
70 | /* Defined by board */ | ||
71 | #define IOPORT1_BTN1 13U | ||
72 | #define IOPORT1_BTN2 14U | ||
73 | #define IOPORT1_BTN3 15U | ||
74 | #define IOPORT1_BTN4 16U | ||
75 | #define IOPORT1_LED1 17U | ||
76 | #define IOPORT1_LED2 18U | ||
77 | #define IOPORT1_LED3 19U | ||
78 | #define IOPORT1_LED4 20U | ||
79 | #define IOPORT1_UART_RTS 5U | ||
80 | #define IOPORT1_UART_TX 6U | ||
81 | #define IOPORT1_UART_CTS 7U | ||
82 | #define IOPORT1_UART_RX 8U | ||
83 | #define IOPORT1_NFC1 9U | ||
84 | #define IOPORT1_NFC2 10U | ||
85 | #define IOPORT1_I2C_SCL 27U | ||
86 | #define IOPORT1_I2C_SDA 26U | ||
87 | #define IOPORT1_RESET 21U | ||
88 | |||
89 | /* Our definitions */ | ||
90 | #define IOPORT1_SPI_SCK 25U | ||
91 | #define IOPORT1_SPI_MOSI 24U | ||
92 | #define IOPORT1_SPI_MISO 23U | ||
93 | #define IOPORT1_SPI_SS 22U | ||
94 | |||
95 | /* Analog inpupt */ | ||
96 | #define IOPORT1_AIN0 2U | ||
97 | #define IOPORT1_AIN1 3U | ||
98 | #define IOPORT1_AIN2 4U | ||
99 | #define IOPORT1_AIN3 5U | ||
100 | #define IOPORT1_AIN4 28U | ||
101 | #define IOPORT1_AIN5 29U | ||
102 | #define IOPORT1_AIN6 30U | ||
103 | #define IOPORT1_AIN7 31U | ||
104 | #define IOPORT1_AREF0 IOPORT1_AIN0 | ||
105 | #define IOPORT1_AREF1 IOPORT1_AIN1 | ||
106 | |||
107 | /* Arduino naming */ | ||
108 | #define IOPORT1_A0 3U | ||
109 | #define IOPORT1_A1 4U | ||
110 | #define IOPORT1_A2 28U | ||
111 | #define IOPORT1_A3 39U | ||
112 | #define IOPORT1_A4 30U | ||
113 | #define IOPORT1_A5 31U | ||
114 | #define IOPORT1_D0 11U | ||
115 | #define IOPORT1_D1 12U | ||
116 | #define IOPORT1_D2 13U | ||
117 | #define IOPORT1_D3 14U | ||
118 | #define IOPORT1_D4 15U | ||
119 | #define IOPORT1_D5 16U | ||
120 | #define IOPORT1_D6 17U | ||
121 | #define IOPORT1_D7 18U | ||
122 | #define IOPORT1_D8 19U | ||
123 | #define IOPORT1_D9 20U | ||
124 | #define IOPORT1_D10 22U | ||
125 | #define IOPORT1_D11 23U | ||
126 | #define IOPORT1_D12 24U | ||
127 | #define IOPORT1_D13 25U | ||
128 | |||
129 | |||
130 | /* | ||
131 | * IO lines assignments. | ||
132 | */ | ||
133 | /* Board defined */ | ||
134 | #define LINE_BTN1 PAL_LINE(IOPORT1, IOPORT1_BTN1) | ||
135 | #define LINE_BTN2 PAL_LINE(IOPORT1, IOPORT1_BTN2) | ||
136 | #define LINE_BTN3 PAL_LINE(IOPORT1, IOPORT1_BTN3) | ||
137 | #define LINE_BTN4 PAL_LINE(IOPORT1, IOPORT1_BTN4) | ||
138 | #define LINE_LED1 PAL_LINE(IOPORT1, IOPORT1_LED1) | ||
139 | #define LINE_LED2 PAL_LINE(IOPORT1, IOPORT1_LED2) | ||
140 | #define LINE_LED3 PAL_LINE(IOPORT1, IOPORT1_LED3) | ||
141 | #define LINE_LED4 PAL_LINE(IOPORT1, IOPORT1_LED4) | ||
142 | #define LINE_UART_RTS PAL_LINE(IOPORT1, IOPORT1_UART_RTS) | ||
143 | #define LINE_UART_TX PAL_LINE(IOPORT1, IOPORT1_UART_TX) | ||
144 | #define LINE_UART_CTS PAL_LINE(IOPORT1, IOPORT1_UART_CTS) | ||
145 | #define LINE_UART_RX PAL_LINE(IOPORT1, IOPORT1_UART_RX) | ||
146 | #define LINE_NFC1 PAL_LINE(IOPORT1, IOPORT1_NFC1) | ||
147 | #define LINE_NFC2 PAL_LINE(IOPORT1, IOPORT1_NFC2) | ||
148 | #define LINE_I2C_SCL PAL_LINE(IOPORT1, IOPORT1_I2C_SCL) | ||
149 | #define LINE_I2C_SDA PAL_LINE(IOPORT1, IOPORT1_I2C_SDA) | ||
150 | |||
151 | /* Our definitions */ | ||
152 | #define LINE_SPI_SCK PAL_LINE(IOPORT1, IOPORT1_SPI_SCK) | ||
153 | #define LINE_SPI_MOSI PAL_LINE(IOPORT1, IOPORT1_SPI_MOSI) | ||
154 | #define LINE_SPI_MISO PAL_LINE(IOPORT1, IOPORT1_SPI_MISO) | ||
155 | #define LINE_SPI_SS PAL_LINE(IOPORT1, IOPORT1_SPI_SS) | ||
156 | |||
157 | /* Analog line */ | ||
158 | #define LINE_AIN0 PAL_LINE(IOPORT1, IOPORT1_AIN0) | ||
159 | #define LINE_AIN1 PAL_LINE(IOPORT1, IOPORT1_AIN1) | ||
160 | #define LINE_AIN2 PAL_LINE(IOPORT1, IOPORT1_AIN2) | ||
161 | #define LINE_AIN3 PAL_LINE(IOPORT1, IOPORT1_AIN3) | ||
162 | #define LINE_AIN4 PAL_LINE(IOPORT1, IOPORT1_AIN4) | ||
163 | #define LINE_AIN5 PAL_LINE(IOPORT1, IOPORT1_AIN5) | ||
164 | #define LINE_AIN6 PAL_LINE(IOPORT1, IOPORT1_AIN6) | ||
165 | #define LINE_AIN7 PAL_LINE(IOPORT1, IOPORT1_AIN7) | ||
166 | #define LINE_AREF0 PAL_LINE(IOPORT1, IOPORT1_AREF0) | ||
167 | #define LINE_AREF1 PAL_LINE(IOPORT1, IOPORT1_AREF1) | ||
168 | |||
169 | /* Arduino naming */ | ||
170 | #define LINE_A0 PAL_LINE(IOPORT1, IOPORT1_A0) | ||
171 | #define LINE_A1 PAL_LINE(IOPORT1, IOPORT1_A1) | ||
172 | #define LINE_A2 PAL_LINE(IOPORT1, IOPORT1_A2) | ||
173 | #define LINE_A3 PAL_LINE(IOPORT1, IOPORT1_A3) | ||
174 | #define LINE_A4 PAL_LINE(IOPORT1, IOPORT1_A4) | ||
175 | #define LINE_A5 PAL_LINE(IOPORT1, IOPORT1_A5) | ||
176 | #define LINE_D0 PAL_LINE(IOPORT1, IOPORT1_D0) | ||
177 | #define LINE_D1 PAL_LINE(IOPORT1, IOPORT1_D1) | ||
178 | #define LINE_D2 PAL_LINE(IOPORT1, IOPORT1_D2) | ||
179 | #define LINE_D3 PAL_LINE(IOPORT1, IOPORT1_D3) | ||
180 | #define LINE_D4 PAL_LINE(IOPORT1, IOPORT1_D4) | ||
181 | #define LINE_D5 PAL_LINE(IOPORT1, IOPORT1_D5) | ||
182 | #define LINE_D6 PAL_LINE(IOPORT1, IOPORT1_D6) | ||
183 | #define LINE_D7 PAL_LINE(IOPORT1, IOPORT1_D7) | ||
184 | #define LINE_D8 PAL_LINE(IOPORT1, IOPORT1_D8) | ||
185 | #define LINE_D9 PAL_LINE(IOPORT1, IOPORT1_D9) | ||
186 | #define LINE_D10 PAL_LINE(IOPORT1, IOPORT1_D10) | ||
187 | #define LINE_D11 PAL_LINE(IOPORT1, IOPORT1_D11) | ||
188 | #define LINE_D12 PAL_LINE(IOPORT1, IOPORT1_D12) | ||
189 | #define LINE_D13 PAL_LINE(IOPORT1, IOPORT1_D13) | ||
190 | |||
191 | #if !defined(_FROM_ASM_) | ||
192 | #ifdef __cplusplus | ||
193 | extern "C" { | ||
194 | #endif | ||
195 | void boardInit(void); | ||
196 | #ifdef __cplusplus | ||
197 | } | ||
198 | #endif | ||
199 | #endif /* _FROM_ASM_ */ | ||
200 | |||
201 | #endif /* _BOARD_H_ */ | ||