Skip to content

Commit d0d3462

Browse files
authored
Merge pull request #11846 from manchoz/manchoz_makerdiary-nrf52840-mdk
Add support for Makerdiary nRF52840-MDK
2 parents f51cc64 + 1804b40 commit d0d3462

File tree

3 files changed

+301
-0
lines changed

3 files changed

+301
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
/*
2+
* Copyright (c) 2016 Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this list
9+
* of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
12+
* integrated circuit in a product or a software update for such product, must reproduce
13+
* the above copyright notice, this list of conditions and the following disclaimer in
14+
* the documentation and/or other materials provided with the distribution.
15+
*
16+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
17+
* used to endorse or promote products derived from this software without specific prior
18+
* written permission.
19+
*
20+
* 4. This software, with or without modification, must only be used with a
21+
* Nordic Semiconductor ASA integrated circuit.
22+
*
23+
* 5. Any software provided in binary or object form under this license must not be reverse
24+
* engineered, decompiled, modified and/or disassembled.
25+
*
26+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
30+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
*/
38+
39+
#ifndef MBED_PINNAMES_H
40+
#define MBED_PINNAMES_H
41+
42+
#include "cmsis.h"
43+
#include "nrf_gpio.h"
44+
45+
#ifdef __cplusplus
46+
extern "C" {
47+
#endif
48+
49+
typedef enum {
50+
PIN_INPUT,
51+
PIN_OUTPUT
52+
} PinDirection;
53+
54+
///> define macro producing for example Px_y = NRF_GPIO_PIN_MAP(x, y)
55+
#define PinDef(port_num, pin_num) P##port_num##_##pin_num = NRF_GPIO_PIN_MAP(port_num, pin_num)
56+
57+
58+
typedef enum {
59+
PinDef(0 , 0), // P0_0 = 0...
60+
PinDef(0 , 1),
61+
PinDef(0 , 2),
62+
PinDef(0 , 3),
63+
PinDef(0 , 4),
64+
PinDef(0 , 5),
65+
PinDef(0 , 6),
66+
PinDef(0 , 7),
67+
PinDef(0 , 8),
68+
PinDef(0 , 9),
69+
PinDef(0 , 10),
70+
PinDef(0 , 11),
71+
PinDef(0 , 12),
72+
PinDef(0 , 13),
73+
PinDef(0 , 14),
74+
PinDef(0 , 15),
75+
PinDef(0 , 16),
76+
PinDef(0 , 17),
77+
PinDef(0 , 18),
78+
PinDef(0 , 19),
79+
PinDef(0 , 20),
80+
PinDef(0 , 21),
81+
PinDef(0 , 22),
82+
PinDef(0 , 23),
83+
PinDef(0 , 24),
84+
PinDef(0 , 25),
85+
PinDef(0 , 26),
86+
PinDef(0 , 27),
87+
PinDef(0 , 28),
88+
PinDef(0 , 29),
89+
PinDef(0 , 30),
90+
PinDef(0 , 31),
91+
92+
PinDef(1 , 0), //P1_1 = 32...
93+
PinDef(1 , 1),
94+
PinDef(1 , 2),
95+
PinDef(1 , 3),
96+
PinDef(1 , 4),
97+
PinDef(1 , 5),
98+
PinDef(1 , 6),
99+
PinDef(1 , 7),
100+
PinDef(1 , 8),
101+
PinDef(1 , 9),
102+
PinDef(1 , 10),
103+
PinDef(1 , 11),
104+
PinDef(1 , 12),
105+
PinDef(1 , 13),
106+
PinDef(1 , 14),
107+
PinDef(1 , 15),
108+
109+
// Port0
110+
p0 = P0_0,
111+
p1 = P0_1,
112+
p2 = P0_2,
113+
p3 = P0_3,
114+
p4 = P0_4,
115+
p5 = P0_5,
116+
p6 = P0_6,
117+
p7 = P0_7,
118+
p8 = P0_8,
119+
p9 = P0_9,
120+
p10 = P0_10,
121+
p11 = P0_11,
122+
p12 = P0_12,
123+
p13 = P0_13,
124+
p14 = P0_14,
125+
p15 = P0_15,
126+
p16 = P0_16,
127+
p17 = P0_17,
128+
p18 = P0_18,
129+
p19 = P0_19,
130+
p20 = P0_20,
131+
p21 = P0_21,
132+
p22 = P0_22,
133+
p23 = P0_23,
134+
p24 = P0_24,
135+
p25 = P0_25,
136+
p26 = P0_26,
137+
p27 = P0_27,
138+
p28 = P0_28,
139+
p29 = P0_29,
140+
p30 = P0_30,
141+
p31 = P0_31,
142+
143+
// Port1
144+
p32 = P1_0,
145+
p33 = P1_1,
146+
p34 = P1_2,
147+
p35 = P1_3,
148+
p36 = P1_4,
149+
p37 = P1_5,
150+
p38 = P1_6,
151+
p39 = P1_7,
152+
p40 = P1_8,
153+
p41 = P1_9,
154+
p42 = P1_10,
155+
p43 = P1_11,
156+
p44 = P1_12,
157+
p45 = P1_13,
158+
p46 = P1_14,
159+
p47 = P1_15,
160+
161+
162+
LED_RED = p23,
163+
LED_GREEN = p22,
164+
LED_BLUE = p24,
165+
166+
LED1 = LED_RED,
167+
LED2 = LED_GREEN,
168+
LED3 = LED_BLUE,
169+
170+
BUTTON_USER = p32,
171+
BUTTON_GROVE1 = p27, // on Base Dock Grove#1
172+
BUTTON_GROVE2 = p29, // on Base Dock Grove#2
173+
BUTTON_GROVE3 = p31, // on Base Dock Grove#3
174+
BUTTON_GROVE4 = p3, // on Base Dock Grove#4
175+
176+
BUTTON1 = BUTTON_GROVE1, // on Base Dock Grove#1
177+
BUTTON2 = BUTTON_GROVE2, // on Base Dock Grove#2
178+
BUTTON3 = BUTTON_GROVE3, // on Base Dock Grove#3
179+
BUTTON4 = BUTTON_GROVE4, // on Base Dock Grove#4
180+
USR_BTN = BUTTON_USER, // on Board
181+
182+
RX_PIN_NUMBER = p19,
183+
TX_PIN_NUMBER = p20,
184+
185+
// mBed interface Pins
186+
USBTX = TX_PIN_NUMBER,
187+
USBRX = RX_PIN_NUMBER,
188+
STDIO_UART_TX = TX_PIN_NUMBER,
189+
STDIO_UART_RX = RX_PIN_NUMBER,
190+
191+
SPI_PSELMOSI0 = p15,
192+
SPI_PSELMISO0 = p16,
193+
SPI_PSELSS0 = p17,
194+
SPI_PSELSCK0 = p21,
195+
196+
SPI_PSELMOSI1 = p12,
197+
SPI_PSELMISO1 = p13,
198+
SPI_PSELSS1 = p11,
199+
SPI_PSELSCK1 = p14,
200+
201+
SPIS_PSELMOSI = p12,
202+
SPIS_PSELMISO = p13,
203+
SPIS_PSELSS = p11,
204+
SPIS_PSELSCK = p14,
205+
206+
I2C_SDA0 = p26,
207+
I2C_SCL0 = p27,
208+
209+
A0 = p2,
210+
A1 = p3,
211+
A4 = p28,
212+
A5 = p29,
213+
A6 = p30,
214+
A7 = p31,
215+
216+
/**** QSPI pins ****/
217+
QSPI1_IO0 = P1_5,
218+
QSPI1_IO1 = P1_4,
219+
QSPI1_IO2 = P1_2,
220+
QSPI1_IO3 = P1_1,
221+
QSPI1_SCK = P1_3,
222+
QSPI1_CSN = P1_6,
223+
224+
/**** QSPI FLASH pins ****/
225+
QSPI_FLASH1_IO0 = QSPI1_IO0,
226+
QSPI_FLASH1_IO1 = QSPI1_IO1,
227+
QSPI_FLASH1_IO2 = QSPI1_IO2,
228+
QSPI_FLASH1_IO3 = QSPI1_IO3,
229+
QSPI_FLASH1_SCK = QSPI1_SCK,
230+
QSPI_FLASH1_CSN = QSPI1_CSN,
231+
232+
// Not connected
233+
NC = (int)0xFFFFFFFF,
234+
CTS_PIN_NUMBER = NC,
235+
RTS_PIN_NUMBER = NC,
236+
STDIO_UART_CTS = CTS_PIN_NUMBER,
237+
STDIO_UART_RTS = RTS_PIN_NUMBER
238+
239+
} PinName;
240+
241+
typedef enum {
242+
PullNone = 0,
243+
PullDown = 1,
244+
PullUp = 3,
245+
PullDefault = PullUp
246+
} PinMode;
247+
248+
#ifdef __cplusplus
249+
}
250+
#endif
251+
252+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches.
2+
// Check the 'features' section of the target description in 'targets.json' for more details.
3+
/* mbed Microcontroller Library
4+
* Copyright (c) 2006-2013 ARM Limited
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
#ifndef MBED_DEVICE_H
19+
#define MBED_DEVICE_H
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
#include "objects.h"
37+
38+
#endif

targets/targets.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7872,6 +7872,17 @@
78727872
"console-uart-flow-control": null
78737873
}
78747874
},
7875+
"MAKERDIARY_NRF52840_MDK": {
7876+
"inherits": ["MCU_NRF52840"],
7877+
"release_versions": ["5"],
7878+
"device_name": "nRF52840_xxAA",
7879+
"detect_code": ["1026"],
7880+
"device_has_remove": ["ITM"],
7881+
"macros_add": [
7882+
"CONFIG_GPIO_AS_PINRESET",
7883+
"NRF52_ERRATA_20"
7884+
]
7885+
},
78757886
"BLUEPILL_F103C8": {
78767887
"inherits": ["FAMILY_STM32"],
78777888
"core": "Cortex-M3",

0 commit comments

Comments
 (0)