Skip to content

Commit 225f1de

Browse files
author
Chris Trowbridge
committed
Add support files for target EP_AGORA
1 parent 7095c31 commit 225f1de

File tree

3 files changed

+353
-0
lines changed

3 files changed

+353
-0
lines changed
Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
/*
2+
* PinNames.h
3+
*
4+
* PinNames file for the Agora project (originally copied from the NRF52840_DK).
5+
*
6+
* Copyright (c) 2019 Embedded Planet, Inc.
7+
*/
8+
9+
#ifndef MBED_PINNAMES_H
10+
#define MBED_PINNAMES_H
11+
12+
#include "cmsis.h"
13+
#include "nrf_gpio.h"
14+
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
typedef enum {
20+
PIN_INPUT,
21+
PIN_OUTPUT
22+
} PinDirection;
23+
24+
#define PORT_SHIFT 3
25+
26+
///> define macro producing for example Px_y = NRF_GPIO_PIN_MAP(x, y)
27+
#define PinDef(port_num, pin_num) P##port_num##_##pin_num = NRF_GPIO_PIN_MAP(port_num, pin_num)
28+
29+
30+
typedef enum {
31+
PinDef(0, 0), // P0_0 = 0...
32+
PinDef(0, 1),
33+
PinDef(0, 2),
34+
PinDef(0, 3),
35+
PinDef(0, 4),
36+
PinDef(0, 5),
37+
PinDef(0, 6),
38+
PinDef(0, 7),
39+
PinDef(0, 8),
40+
PinDef(0, 9),
41+
PinDef(0, 10),
42+
PinDef(0, 11),
43+
PinDef(0, 12),
44+
PinDef(0, 13),
45+
PinDef(0, 14),
46+
PinDef(0, 15),
47+
PinDef(0, 16),
48+
PinDef(0, 17),
49+
PinDef(0, 18),
50+
PinDef(0, 19),
51+
PinDef(0, 20),
52+
PinDef(0, 21),
53+
PinDef(0, 22),
54+
PinDef(0, 23),
55+
PinDef(0, 24),
56+
PinDef(0, 25),
57+
PinDef(0, 26),
58+
PinDef(0, 27),
59+
PinDef(0, 28),
60+
PinDef(0, 29),
61+
PinDef(0, 30),
62+
PinDef(0, 31),
63+
64+
PinDef(1, 0), //P1_1 = 32...
65+
PinDef(1, 1),
66+
PinDef(1, 2),
67+
PinDef(1, 3),
68+
PinDef(1, 4),
69+
PinDef(1, 5),
70+
PinDef(1, 6),
71+
PinDef(1, 7),
72+
PinDef(1, 8),
73+
PinDef(1, 9),
74+
PinDef(1, 10),
75+
PinDef(1, 11),
76+
PinDef(1, 12),
77+
PinDef(1, 13),
78+
PinDef(1, 14),
79+
PinDef(1, 15),
80+
81+
// Port0
82+
p0 = P0_0,
83+
p1 = P0_1,
84+
p2 = P0_2,
85+
p3 = P0_3,
86+
p4 = P0_4,
87+
p5 = P0_5,
88+
p6 = P0_6,
89+
p7 = P0_7,
90+
p8 = P0_8,
91+
p9 = P0_9,
92+
p10 = P0_10,
93+
p11 = P0_11,
94+
p12 = P0_12,
95+
p13 = P0_13,
96+
p14 = P0_14,
97+
p15 = P0_15,
98+
p16 = P0_16,
99+
p17 = P0_17,
100+
p18 = P0_18,
101+
p19 = P0_19,
102+
p20 = P0_20,
103+
p21 = P0_21,
104+
p22 = P0_22,
105+
p23 = P0_23,
106+
p24 = P0_24,
107+
p25 = P0_25,
108+
p26 = P0_26,
109+
p27 = P0_27,
110+
p28 = P0_28,
111+
p29 = P0_29,
112+
p30 = P0_30,
113+
p31 = P0_31,
114+
115+
// Port1
116+
p32 = P1_0,
117+
p33 = P1_1,
118+
p34 = P1_2,
119+
p35 = P1_3,
120+
p36 = P1_4,
121+
p37 = P1_5,
122+
p38 = P1_6,
123+
p39 = P1_7,
124+
p40 = P1_8,
125+
p41 = P1_9,
126+
p42 = P1_10,
127+
p43 = P1_11,
128+
p44 = P1_12,
129+
p45 = P1_13,
130+
p46 = P1_14,
131+
p47 = P1_15,
132+
133+
SPI_PSELMOSI0 = P1_13,
134+
SPI_PSELMISO0 = P1_14,
135+
SPI_PSELSS0 = P1_12,
136+
SPI_PSELSCK0 = P1_15,
137+
138+
SPI_PSELMOSI1 = P1_2,
139+
SPI_PSELMISO1 = P1_3,
140+
SPI_PSELSS1 = P1_1,
141+
SPI_PSELSCK1 = P1_4,
142+
143+
SPIS_PSELMOSI = P1_2,
144+
SPIS_PSELMISO = P1_3,
145+
SPIS_PSELSS = P1_1,
146+
SPIS_PSELSCK = P1_4,
147+
148+
I2C_SDA0 = p26,
149+
I2C_SCL0 = p27,
150+
151+
D0 = P1_1,
152+
D1 = P1_2,
153+
D2 = P1_3,
154+
D3 = P1_4,
155+
D4 = P1_5,
156+
D5 = P1_6,
157+
D6 = P1_7,
158+
D7 = P1_8,
159+
160+
D8 = P1_10,
161+
D9 = P1_11,
162+
D10 = P1_12,
163+
D11 = P1_13,
164+
D12 = P1_14,
165+
D13 = P1_15,
166+
167+
D14 = p26,
168+
D15 = p27,
169+
170+
A0 = p3,
171+
A1 = p4,
172+
A2 = p28,
173+
A3 = p29,
174+
A4 = p30,
175+
A5 = p31,
176+
177+
/**** QSPI pins ****/
178+
QSPI1_IO0 = P0_20,
179+
QSPI1_IO1 = P0_21,
180+
QSPI1_IO2 = P0_22,
181+
QSPI1_IO3 = P0_23,
182+
QSPI1_SCK = P0_19,
183+
QSPI1_CSN = P0_17,
184+
185+
/* Agora-specific pins */
186+
187+
// Battery
188+
PIN_NAME_BATTERY = P0_2,
189+
PIN_NAME_BATTERY_MONITOR_ENABLE = P1_11,
190+
191+
// Board ID
192+
PIN_NAME_BOARD_ID = P0_3,
193+
PIN_NAME_BOARD_ID_DISABLE = P1_6,
194+
195+
// NFC
196+
PIN_NAME_NFC1 = P0_9,
197+
PIN_NAME_NFC2 = P0_10,
198+
199+
// DEBUG UART
200+
PIN_NAME_DEBUG_RX = P0_11,
201+
PIN_NAME_DEBUG_TX = P0_13,
202+
203+
// LoRa
204+
PIN_NAME_LORA_SSN = P1_12,
205+
PIN_NAME_LORA_MOSI = P1_13,
206+
PIN_NAME_LORA_MISO = P1_14,
207+
PIN_NAME_LORA_SCLK = P1_15,
208+
PIN_NAME_LORA_RESETN = P1_10,
209+
PIN_NAME_LORA_DIO0 = P1_7,
210+
PIN_NAME_LORA_DIO1 = P1_9,
211+
PIN_NAME_LORA_DIO2 = P0_12,
212+
PIN_NAME_LORA_DIO3 = P0_16,
213+
PIN_NAME_LORA_DIO4 = P0_14,
214+
215+
// Cell
216+
PIN_NAME_CELL_POWER_ENABLE = P0_28,
217+
PIN_NAME_CELL_ON_OFF = P0_30,
218+
PIN_NAME_CELL_HW_SHUTDOWN = P0_24,
219+
PIN_NAME_CELL_RX = P1_1,
220+
PIN_NAME_CELL_TX = P1_2,
221+
PIN_NAME_CELL_DTR = P0_7,
222+
PIN_NAME_CELL_DSR = P1_3,
223+
PIN_NAME_CELL_DCD = P0_15,
224+
PIN_NAME_CELL_RTS = P1_4,
225+
PIN_NAME_CELL_CTS = P1_5,
226+
227+
// Sensors (I2C)
228+
PIN_NAME_SENSOR_POWER_ENABLE = P0_31,
229+
PIN_NAME_SDA = P0_26,
230+
PIN_NAME_SCL = P0_27,
231+
232+
// Sensor interrupts
233+
PIN_NAME_INT_ACCEL = P1_8,
234+
PIN_NAME_INT_LIGHT_TOF = P0_4,
235+
236+
// Microphone (I2S)
237+
PIN_NAME_I2S_SD = P0_25,
238+
PIN_NAME_I2S_SCK = P0_6,
239+
PIN_NAME_I2S_WS = P0_8,
240+
241+
// QSPI
242+
PIN_NAME_QSPI_IO0 = P0_20,
243+
PIN_NAME_QSPI_IO1 = P0_21,
244+
PIN_NAME_QSPI_IO2 = P0_22,
245+
PIN_NAME_QSPI_IO3 = P0_23,
246+
PIN_NAME_QSPI_CSN = P0_17,
247+
PIN_NAME_QSPI_CLK = P0_19,
248+
249+
// Miscellaneous I/O
250+
PIN_NAME_PUSH_BUTTON = P0_29,
251+
PIN_NAME_LED_RED = P0_5,
252+
PIN_NAME_BT840_RESETN = P0_18,
253+
PIN_NAME_BT840_SWO = P1_0,
254+
255+
/* mbed pins */
256+
257+
// used by mbed for default serial out on printf statements
258+
RX_PIN_NUMBER = PIN_NAME_DEBUG_RX,
259+
TX_PIN_NUMBER = PIN_NAME_DEBUG_TX,
260+
USBRX = PIN_NAME_DEBUG_RX,
261+
USBTX = PIN_NAME_DEBUG_TX,
262+
STDIO_UART_RX = PIN_NAME_DEBUG_RX,
263+
STDIO_UART_TX = PIN_NAME_DEBUG_TX,
264+
265+
MDMTXD = PIN_NAME_CELL_TX,
266+
MDMRXD = PIN_NAME_CELL_RX,
267+
MDMCTS = PIN_NAME_CELL_CTS,
268+
MDMDCD = PIN_NAME_CELL_DCD,
269+
MDMDSR = PIN_NAME_CELL_DSR,
270+
MDMDTR = PIN_NAME_CELL_DTR,
271+
MDMRTS = PIN_NAME_CELL_RTS,
272+
273+
/**** QSPI FLASH pins ****/
274+
QSPI_FLASH1_IO0 = PIN_NAME_QSPI_IO0,
275+
QSPI_FLASH1_IO1 = PIN_NAME_QSPI_IO1,
276+
QSPI_FLASH1_IO2 = PIN_NAME_QSPI_IO2,
277+
QSPI_FLASH1_IO3 = PIN_NAME_QSPI_IO3,
278+
QSPI_FLASH1_SCK = PIN_NAME_QSPI_CLK,
279+
QSPI_FLASH1_CSN = PIN_NAME_QSPI_CSN,
280+
281+
SPI_MOSI = PIN_NAME_QSPI_IO0,
282+
SPI_MISO = PIN_NAME_QSPI_IO1,
283+
SPI_SCK = PIN_NAME_QSPI_CLK,
284+
SPI_CS = PIN_NAME_QSPI_CSN,
285+
286+
// LED
287+
LED1 = PIN_NAME_LED_RED,
288+
LED2 = LED1,
289+
290+
// Not connected
291+
NC = (int)0xFFFFFFFF,
292+
293+
// Compiler complains unless these are specified
294+
STDIO_UART_CTS = NC,
295+
STDIO_UART_RTS = NC,
296+
MDMRI = NC
297+
} PinName;
298+
299+
typedef enum {
300+
PullNone = 0,
301+
PullDown = 1,
302+
PullUp = 3,
303+
PullDefault = PullUp
304+
} PinMode;
305+
306+
#define ACTIVE_HIGH_POLARITY 1
307+
#define ACTIVE_LOW_POLARITY 0
308+
309+
#define MDM_PIN_POLARITY ACTIVE_HIGH_POLARITY
310+
311+
#ifdef __cplusplus
312+
}
313+
#endif
314+
315+
#endif

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/TARGET_EP_AGORA/custom_board.h

Whitespace-only changes.
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

0 commit comments

Comments
 (0)