Skip to content

Commit dec6e36

Browse files
committed
Initial commit
1 parent a6207ca commit dec6e36

File tree

5 files changed

+329
-0
lines changed

5 files changed

+329
-0
lines changed

components/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
"SPI_CLK": "p19",
3232
"SPI_CS": "p17"
3333
},
34+
"NRF52840_FEATHER": {
35+
"SPI_MOSI": "p20",
36+
"SPI_MISO": "p21",
37+
"SPI_CLK": "p19",
38+
"SPI_CS": "p17"
39+
},
3440
"HEXIWEAR": {
3541
"SPI_MOSI": "PTD6",
3642
"SPI_MISO": "PTD7",

platform/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@
212212
"crash-capture-enabled": true,
213213
"fatal-error-auto-reboot-enabled": true
214214
},
215+
"NRF52840_FEATHER": {
216+
"crash-capture-enabled": true,
217+
"fatal-error-auto-reboot-enabled": true
218+
},
215219
"NUCLEO_L476RG": {
216220
"crash-capture-enabled": true,
217221
"fatal-error-auto-reboot-enabled": true
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
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 PORT_SHIFT 3
55+
56+
///> define macro producing for example Px_y = NRF_GPIO_PIN_MAP(x, y)
57+
#define PinDef(port_num, pin_num) P##port_num##_##pin_num = NRF_GPIO_PIN_MAP(port_num, pin_num)
58+
59+
60+
typedef enum {
61+
PinDef(0 , 0), // P0_0 = 0...
62+
PinDef(0 , 1),
63+
PinDef(0 , 2),
64+
PinDef(0 , 3),
65+
PinDef(0 , 4),
66+
PinDef(0 , 5),
67+
PinDef(0 , 6),
68+
PinDef(0 , 7),
69+
PinDef(0 , 8),
70+
PinDef(0 , 9),
71+
PinDef(0 , 10),
72+
PinDef(0 , 11),
73+
PinDef(0 , 12),
74+
PinDef(0 , 13),
75+
PinDef(0 , 14),
76+
PinDef(0 , 15),
77+
PinDef(0 , 16),
78+
PinDef(0 , 17),
79+
PinDef(0 , 18),
80+
PinDef(0 , 19),
81+
PinDef(0 , 20),
82+
PinDef(0 , 21),
83+
PinDef(0 , 22),
84+
PinDef(0 , 23),
85+
PinDef(0 , 24),
86+
PinDef(0 , 25),
87+
PinDef(0 , 26),
88+
PinDef(0 , 27),
89+
PinDef(0 , 28),
90+
PinDef(0 , 29),
91+
PinDef(0 , 30),
92+
PinDef(0 , 31),
93+
94+
PinDef(1 , 0), //P1_1 = 32...
95+
PinDef(1 , 1),
96+
PinDef(1 , 2),
97+
PinDef(1 , 3),
98+
PinDef(1 , 4),
99+
PinDef(1 , 5),
100+
PinDef(1 , 6),
101+
PinDef(1 , 7),
102+
PinDef(1 , 8),
103+
PinDef(1 , 9),
104+
PinDef(1 , 10),
105+
PinDef(1 , 11),
106+
PinDef(1 , 12),
107+
PinDef(1 , 13),
108+
PinDef(1 , 14),
109+
PinDef(1 , 15),
110+
111+
// Port0
112+
p0 = P0_0,
113+
p1 = P0_1,
114+
p2 = P0_2,
115+
p3 = P0_3,
116+
p4 = P0_4,
117+
p5 = P0_5,
118+
p6 = P0_6,
119+
p7 = P0_7,
120+
p8 = P0_8,
121+
p9 = P0_9,
122+
p10 = P0_10,
123+
p11 = P0_11,
124+
p12 = P0_12,
125+
p13 = P0_13,
126+
p14 = P0_14,
127+
p15 = P0_15,
128+
p16 = P0_16,
129+
p17 = P0_17,
130+
p18 = P0_18,
131+
p19 = P0_19,
132+
p20 = P0_20,
133+
p21 = P0_21,
134+
p22 = P0_22,
135+
p23 = P0_23,
136+
p24 = P0_24,
137+
p25 = P0_25,
138+
p26 = P0_26,
139+
p27 = P0_27,
140+
p28 = P0_28,
141+
p29 = P0_29,
142+
p30 = P0_30,
143+
p31 = P0_31,
144+
145+
// Port1
146+
p32 = P1_0,
147+
p33 = P1_1,
148+
p34 = P1_2,
149+
p35 = P1_3,
150+
p36 = P1_4,
151+
p37 = P1_5,
152+
p38 = P1_6,
153+
p39 = P1_7,
154+
p40 = P1_8,
155+
p41 = P1_9,
156+
p42 = P1_10,
157+
p43 = P1_11,
158+
p44 = P1_12,
159+
p45 = P1_13,
160+
p46 = P1_14,
161+
p47 = P1_15,
162+
// Not connected
163+
NC = (int)0xFFFFFFFF,
164+
165+
LED1 = p47, // Red Led
166+
LED2 = p42, // Blue LED
167+
LED3 = p16, // NEO_PIXEL
168+
169+
LED_RED = LED1,
170+
LED_BLUE = LED2,
171+
PIN_NEOPIXEL = LED3,
172+
173+
// Other pins
174+
PIN_AREF = p31,
175+
PIN_VBAT = p29,
176+
PIN_NFC1 = p9,
177+
PIN_NFC2 = p10,
178+
179+
BUTTON = p32, // UserSW
180+
// BUTTON2 = p29, // on Base Dock Grove#2
181+
// BUTTON3 = p31, // on Base Dock Grove#3
182+
// BUTTON4 = p3, // on Base Dock Grove#4
183+
184+
RX_PIN_NUMBER = p24,
185+
TX_PIN_NUMBER = p25,
186+
CTS_PIN_NUMBER = NC,
187+
RTS_PIN_NUMBER = NC,
188+
189+
// mBed interface Pins
190+
USBTX = TX_PIN_NUMBER,
191+
USBRX = RX_PIN_NUMBER,
192+
STDIO_UART_TX = TX_PIN_NUMBER,
193+
STDIO_UART_RX = RX_PIN_NUMBER,
194+
STDIO_UART_CTS = CTS_PIN_NUMBER,
195+
STDIO_UART_RTS = RTS_PIN_NUMBER,
196+
197+
SPI_PSELMOSI0 = p13,
198+
SPI_PSELMISO0 = p15,
199+
SPI_PSELSS0 = p17,
200+
SPI_PSELSCK0 = p14,
201+
202+
// SPI_PSELMOSI1 = p12,
203+
// SPI_PSELMISO1 = p13,
204+
// SPI_PSELSS1 = p11,
205+
// SPI_PSELSCK1 = p14,
206+
207+
// SPIS_PSELMOSI = p12,
208+
// SPIS_PSELMISO = p13,
209+
// SPIS_PSELSS = p11,
210+
// SPIS_PSELSCK = p14,
211+
212+
I2C_SDA0 = p12,
213+
I2C_SCL0 = p11,
214+
215+
A0 = p4,
216+
A1 = p5,
217+
A4 = p2,
218+
A5 = p3,
219+
220+
D2 = PIN_NFC2,
221+
D5 = p40,
222+
D6 = p7,
223+
D9 = p26,
224+
D10 = p27,
225+
D11 = p6,
226+
D12 = p8,
227+
D13 = p41,
228+
229+
/**** QSPI pins ****/
230+
QSPI1_IO0 = P0_17,
231+
QSPI1_IO1 = P0_22,
232+
QSPI1_IO2 = P0_23,
233+
QSPI1_IO3 = P0_21,
234+
QSPI1_SCK = P0_19,
235+
QSPI1_CSN = P0_20,
236+
237+
/**** QSPI FLASH pins ****/
238+
// QSPI_FLASH1_IO0 = QSPI1_IO0,
239+
// QSPI_FLASH1_IO1 = QSPI1_IO1,
240+
// QSPI_FLASH1_IO2 = QSPI1_IO2,
241+
// QSPI_FLASH1_IO3 = QSPI1_IO3,
242+
// QSPI_FLASH1_SCK = QSPI1_SCK,
243+
// QSPI_FLASH1_CSN = QSPI1_CSN
244+
245+
} PinName;
246+
247+
typedef enum {
248+
PullNone = 0,
249+
PullDown = 1,
250+
PullUp = 3,
251+
PullDefault = PullUp
252+
} PinMode;
253+
254+
#ifdef __cplusplus
255+
}
256+
#endif
257+
258+
#endif
Lines changed: 38 additions & 0 deletions
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5668,6 +5668,29 @@
56685668
"full", "bare-metal"
56695669
]
56705670
},
5671+
"NRF52840_FEATHER": {
5672+
"supported_form_factors": [
5673+
"ARDUINO"
5674+
],
5675+
"inherits": [
5676+
"MCU_NRF52840"
5677+
],
5678+
"detect_code": [
5679+
"1102"
5680+
],
5681+
"macros_add": [
5682+
"CONFIG_GPIO_AS_PINRESET"
5683+
],
5684+
"config": {
5685+
"enable-objects-extensions": {
5686+
"help": "Enable inclusion of objects_extensions.h",
5687+
"value": false
5688+
}
5689+
},
5690+
"supported_application_profiles": [
5691+
"full", "bare-metal"
5692+
]
5693+
},
56715694
"ARDUINO_NANO33BLE": {
56725695
"inherits": [
56735696
"MCU_NRF52840"

0 commit comments

Comments
 (0)