NINA-B1 series - System integration manual
UBX-15026175 - R16
Software
Page 22 of 63
C1-Public
2.2.3.2.2
Pin mapping
Create a folder with the same name as the JSON object created in section 2.2.3.2.1. The folder is
located in:
\mbed-os\targets\TARGET_NORDIC\TARGET_NRF5\TARGET_MCU_NRF52832\.
For EVK-NINA-B1, the folder is called
TARGET_EVK_NINA_B1
.
In this new folder, there should be two files,
device.h
and
PinNames.h
.
1)
device.h
contains the
#include object.h
as shown in Figure 9.
Figure 9: Example code for device.h
2)
PinNames.h
declares and defines a couple of enumerations to configure the custom pin mapping.
Figure 6 and Figure 7 show the contents of the
PinNames.h
file in the case of EVK-NINA-B1.
Figure 10: Example code of PinNames.h file for EVK-NINA-B1
#ifndef
MBED_DEVICE_H
#define
MBED_DEVICE_H
#include
"objects.h"
#endif
#ifndef
MBED_PINNAMES_H
#define
MBED_PINNAMES_H
#include
"cmsis.h"
#ifdef
__cplusplus
extern
"C"
{
#endif
typedef
enum
{
PIN_INPUT,
PIN_OUTPUT
} PinDirection;
#define
PORT_SHIFT 3
typedef
enum
{
// nRF52 pin names
p0 = 0,
p1 = 1,
p2 = 2,
p3 = 3,
p4 = 4,
p5 = 5,
p6 = 6,
p7 = 7,
p8 = 8,
p9 = 9,
p10 = 10,
p11 = 11,
p12 = 12,
p13 = 13,
p14 = 14,
p15 = 15,
p16 = 16,
p17 = 17,
p18 = 18,
p19 = 19,
p20 = 20,
p21 = 21,
p22 = 22,
p23 = 23,
p24 = 24,
p25 = 25,
p26 = 26,
p27 = 27,
p28 = 28,
p29 = 29,
p30 = 30,
p31 = 31,
NC = (
int
)0xFFFFFFFF,
// Not connected