Skip to content

Commit b4ffd9a

Browse files
authored
Merge pull request #3605 from TsungtaWu/master
Add DELTA_DFCM_NNN50 platform
2 parents dec3f01 + c6e0b9c commit b4ffd9a

File tree

4 files changed

+270
-0
lines changed

4 files changed

+270
-0
lines changed
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2017 Nordic Semiconductor
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+
#ifndef MBED_PINNAMES_H
17+
#define MBED_PINNAMES_H
18+
19+
#include "cmsis.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
typedef enum {
26+
PIN_INPUT,
27+
PIN_OUTPUT
28+
} PinDirection;
29+
30+
#define PORT_SHIFT 3
31+
32+
typedef enum {
33+
p0 = 0,
34+
p1 = 1,
35+
p2 = 2,
36+
p3 = 3,
37+
p4 = 4,
38+
p5 = 5,
39+
p6 = 6,
40+
p7 = 7,
41+
p8 = 8,
42+
p9 = 9,
43+
p10 = 10,
44+
p11 = 11,
45+
p12 = 12,
46+
p13 = 13,
47+
p14 = 14,
48+
p15 = 15,
49+
p16 = 16,
50+
p17 = 17,
51+
p18 = 18,
52+
p19 = 19,
53+
p20 = 20,
54+
p21 = 21,
55+
p22 = 22,
56+
p23 = 23,
57+
p24 = 24,
58+
p25 = 25,
59+
p26 = 26,
60+
p27 = 27,
61+
p28 = 28,
62+
p29 = 29,
63+
p30 = 30,
64+
p31 = 31,
65+
66+
//NORMAL PINS...
67+
P0_0 = p0,
68+
P0_1 = p1,
69+
P0_2 = p2,
70+
P0_3 = p3,
71+
P0_4 = p4,
72+
P0_5 = p5,
73+
P0_6 = p6,
74+
P0_7 = p7,
75+
76+
P0_8 = p8,
77+
P0_9 = p9,
78+
P0_10 = p10,
79+
P0_11 = p11,
80+
P0_12 = p12,
81+
P0_13 = p13,
82+
P0_14 = p14,
83+
P0_15 = p15,
84+
85+
P0_16 = p16,
86+
P0_17 = p17,
87+
P0_18 = p18,
88+
P0_19 = p19,
89+
P0_20 = p20,
90+
P0_21 = p21,
91+
P0_22 = p22,
92+
P0_23 = p23,
93+
94+
P0_24 = p24,
95+
P0_25 = p25,
96+
P0_26 = p26,
97+
P0_27 = p27,
98+
P0_28 = p28,
99+
P0_29 = p29,
100+
P0_30 = p30,
101+
P0_31 = p31,
102+
103+
LED1 = p13,
104+
LED2 = p23,
105+
LED3 = p24,
106+
LED4 = p25,
107+
108+
BUTTON1 = p20,
109+
BUTTON2 = p21,
110+
BUTTON3 = p22,
111+
BUTTON4 = p0,
112+
113+
RX_PIN_NUMBER = p16,
114+
TX_PIN_NUMBER = p17,
115+
CTS_PIN_NUMBER = p20,
116+
RTS_PIN_NUMBER = p21,
117+
118+
// mBed interface Pins
119+
USBTX = TX_PIN_NUMBER,
120+
USBRX = RX_PIN_NUMBER,
121+
122+
SPI_PSELMOSI0 = p15,
123+
SPI_PSELMISO0 = p9,
124+
SPI_PSELSS0 = p29,
125+
SPI_PSELSCK0 = p11,
126+
127+
SPI_PSELMOSI1 = p17,
128+
SPI_PSELMISO1 = p20,
129+
SPI_PSELSS1 = p16,
130+
SPI_PSELSCK1 = p21,
131+
132+
SPIS_PSELMOSI = p17,
133+
SPIS_PSELMISO = p20,
134+
SPIS_PSELSS = p16,
135+
SPIS_PSELSCK = p21,
136+
137+
I2C_SDA0 = p31,
138+
I2C_SCL0 = p30,
139+
140+
D0 = p16,
141+
D1 = p17,
142+
D2 = p20,
143+
D3 = p21,
144+
D4 = p22,
145+
D5 = p0,
146+
D6 = p13,
147+
D7 = p23,
148+
149+
D8 = p24,
150+
D9 = p25,
151+
D10 = p29,
152+
D11 = p15,
153+
D12 = p9,
154+
D13 = p11,
155+
156+
D14 = p30,
157+
D15 = p31,
158+
159+
A0 = p3,
160+
A1 = p4,
161+
A2 = p5,
162+
A3 = p6,
163+
A4 = p26,
164+
A5 = p27,
165+
166+
// Not connected
167+
NC = (int)0xFFFFFFFF
168+
} PinName;
169+
170+
typedef enum {
171+
PullNone = 0,
172+
PullDown = 1,
173+
PullUp = 3,
174+
PullDefault = PullUp
175+
} PinMode;
176+
177+
#ifdef __cplusplus
178+
}
179+
#endif
180+
181+
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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-2017 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+
#include "objects.h"
22+
23+
#endif
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2017 ARM Limited
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+
#include "cmsis.h"
18+
#include "PinNames.h"
19+
20+
void mbed_sdk_init()
21+
{
22+
char* debug_date = __DATE__;
23+
char* debug_time = __TIME__;
24+
25+
// Default RF switch setting, pull p19 to low and p28 to high for turning antenna switch to BLE radiated path
26+
NRF_GPIO->PIN_CNF[p19] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)
27+
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
28+
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
29+
| (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
30+
| (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
31+
NRF_GPIO->PIN_CNF[p28] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)
32+
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
33+
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
34+
| (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
35+
| (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
36+
37+
NRF_GPIO->OUTCLR = (GPIO_OUTCLR_PIN19_Clear << GPIO_OUTCLR_PIN19_Pos);
38+
NRF_GPIO->OUTSET = (GPIO_OUTCLR_PIN28_High << GPIO_OUTCLR_PIN28_Pos);
39+
40+
// Config External Crystal to 32MHz
41+
NRF_CLOCK->XTALFREQ = 0x00;
42+
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
43+
NRF_CLOCK->TASKS_HFCLKSTART = 1;
44+
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {
45+
// Do nothing.
46+
}
47+
48+
}

targets/targets.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,24 @@
16291629
"extra_labels_add": ["DELTA_DFCM_NNN40"],
16301630
"macros_add": ["TARGET_DELTA_DFCM_NNN40", "TARGET_NRF_LFCLK_RC"]
16311631
},
1632+
"DELTA_DFCM_NNN50": {
1633+
"supported_form_factors": ["ARDUINO"],
1634+
"inherits": ["MCU_NRF51_32K_UNIFIED"],
1635+
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"],
1636+
"device_name": "nRF51822_xxAC"
1637+
},
1638+
"DELTA_DFCM_NNN50_BOOT": {
1639+
"supported_form_factors": ["ARDUINO"],
1640+
"inherits": ["MCU_NRF51_32K_BOOT"],
1641+
"extra_labels_add": ["DELTA_DFCM_NNN50"],
1642+
"macros_add": ["TARGET_DELTA_DFCM_NNN50"]
1643+
},
1644+
"DELTA_DFCM_NNN50_OTA": {
1645+
"supported_form_factors": ["ARDUINO"],
1646+
"inherits": ["MCU_NRF51_32K_OTA"],
1647+
"extra_labels_add": ["DELTA_DFCM_NNN50"],
1648+
"macros_add": ["TARGET_DELTA_DFCM_NNN50"]
1649+
},
16321650
"NRF51_DK_LEGACY": {
16331651
"supported_form_factors": ["ARDUINO"],
16341652
"inherits": ["MCU_NRF51_32K"],

0 commit comments

Comments
 (0)