Skip to content

Commit f4eed5a

Browse files
committed
Add generic variant
1 parent b55cc34 commit f4eed5a

File tree

4 files changed

+217
-0
lines changed

4 files changed

+217
-0
lines changed

boards.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# License along with this library; if not, write to the Free Software
1616
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717

18+
menu.chip=Chip
1819
menu.softdevice=Softdevice
1920
menu.version=Version
2021

@@ -132,3 +133,44 @@ BLENano.menu.softdevice.s130.softdeviceversion=2.0.0
132133
BLENano.menu.softdevice.s130.upload.maximum_size=151552
133134
BLENano.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130
134135
BLENano.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_{build.chip}.ld
136+
137+
138+
Generic_nRF51822.name=Generic nRF51822
139+
140+
Generic_nRF51822.upload.tool=sandeepmistry:openocd
141+
Generic_nRF51822.upload.target=nrf51
142+
Generic_nRF51822.upload.maximum_size=262144
143+
144+
Generic_nRF51822.bootloader.tool=sandeepmistry:openocd
145+
146+
Generic_nRF51822.build.mcu=cortex-m0
147+
Generic_nRF51822.build.f_cpu=16000000
148+
Generic_nRF51822.build.board=GENERIC
149+
Generic_nRF51822.build.core=nRF5
150+
Generic_nRF51822.build.variant=Generic
151+
Generic_nRF51822.build.variant_system_lib=
152+
Generic_nRF51822.build.extra_flags=-DNRF51
153+
Generic_nRF51822.build.float_flags=
154+
Generic_nRF51822.build.ldscript=nrf51_{build.chip}.ld
155+
156+
Generic_nRF51822.menu.chip.xxaa=16 kB RAM, 256 kB flash (xxaa)
157+
Generic_nRF51822.menu.chip.xxaa.build.chip=xxaa
158+
Generic_nRF51822.menu.chip.xxac=32 kB RAM, 256 kB flash (xxac)
159+
Generic_nRF51822.menu.chip.xxac.build.chip=xxac
160+
161+
Generic_nRF51822.menu.softdevice.none=None
162+
Generic_nRF51822.menu.softdevice.none.softdevice=none
163+
164+
Generic_nRF51822.menu.softdevice.s110=S110
165+
Generic_nRF51822.menu.softdevice.s110.softdevice=s110
166+
Generic_nRF51822.menu.softdevice.s110.softdeviceversion=8.0.0
167+
Generic_nRF51822.menu.softdevice.s110.upload.maximum_size=151552
168+
Generic_nRF51822.menu.softdevice.s110.build.extra_flags=-DNRF51 -DS110 -DNRF51_S110
169+
Generic_nRF51822.menu.softdevice.s110.build.ldscript=armgcc_s110_nrf51822_{build.chip}.ld
170+
171+
Generic_nRF51822.menu.softdevice.s130=S130
172+
Generic_nRF51822.menu.softdevice.s130.softdevice=s130
173+
Generic_nRF51822.menu.softdevice.s130.softdeviceversion=2.0.0
174+
Generic_nRF51822.menu.softdevice.s130.upload.maximum_size=151552
175+
Generic_nRF51822.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130
176+
Generic_nRF51822.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_{build.chip}.ld

variants/Generic/pins_arduino.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
This library is free software; you can redistribute it and/or
4+
modify it under the terms of the GNU Lesser General Public
5+
License as published by the Free Software Foundation; either
6+
version 2.1 of the License, or (at your option) any later version.
7+
This library is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
See the GNU Lesser General Public License for more details.
11+
You should have received a copy of the GNU Lesser General Public
12+
License along with this library; if not, write to the Free Software
13+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14+
*/
15+
16+
// API compatibility
17+
#include "variant.h"

variants/Generic/variant.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
See the GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#include "variant.h"
21+
22+
const uint32_t g_ADigitalPinMap[] = {
23+
0,
24+
1,
25+
2,
26+
3,
27+
4,
28+
5,
29+
6,
30+
7,
31+
8,
32+
9,
33+
10,
34+
11,
35+
12,
36+
13,
37+
14,
38+
15,
39+
16,
40+
17,
41+
18,
42+
19,
43+
20,
44+
21,
45+
22,
46+
23,
47+
24,
48+
25,
49+
26,
50+
27,
51+
28,
52+
29,
53+
30,
54+
31
55+
};

variants/Generic/variant.h

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
This library is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
See the GNU Lesser General Public License for more details.
12+
You should have received a copy of the GNU Lesser General Public
13+
License along with this library; if not, write to the Free Software
14+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15+
*/
16+
17+
#ifndef _VARIANT_GENERIC_
18+
#define _VARIANT_GENERIC_
19+
20+
/** Master clock frequency */
21+
#ifdef NRF52
22+
#define VARIANT_MCK (64000000ul)
23+
#else
24+
#define VARIANT_MCK (16000000ul)
25+
#endif
26+
27+
/*----------------------------------------------------------------------------
28+
* Headers
29+
*----------------------------------------------------------------------------*/
30+
31+
#include "WVariant.h"
32+
33+
#ifdef __cplusplus
34+
extern "C"
35+
{
36+
#endif // __cplusplus
37+
38+
// Number of pins defined in PinDescription array
39+
#define PINS_COUNT (31u)
40+
#define NUM_DIGITAL_PINS (31u)
41+
#define NUM_ANALOG_INPUTS (6u)
42+
#define NUM_ANALOG_OUTPUTS (0u)
43+
44+
// LEDs
45+
#define PIN_LED (13)
46+
#define LED_BUILTIN PIN_LED
47+
48+
/*
49+
* Analog pins
50+
*/
51+
#define PIN_A0 (1)
52+
#define PIN_A1 (2)
53+
#define PIN_A2 (3)
54+
#define PIN_A3 (4)
55+
#define PIN_A4 (5)
56+
#define PIN_A5 (6)
57+
58+
static const uint8_t A0 = PIN_A0 ;
59+
static const uint8_t A1 = PIN_A1 ;
60+
static const uint8_t A2 = PIN_A2 ;
61+
static const uint8_t A3 = PIN_A3 ;
62+
static const uint8_t A4 = PIN_A4 ;
63+
static const uint8_t A5 = PIN_A5 ;
64+
#ifdef NRF52
65+
#define ADC_RESOLUTION 14
66+
#else
67+
#define ADC_RESOLUTION 10
68+
#endif
69+
70+
/*
71+
* Serial interfaces
72+
*/
73+
// Serial
74+
#define PIN_SERIAL_RX (0)
75+
#define PIN_SERIAL_TX (1)
76+
77+
/*
78+
* SPI Interfaces
79+
*/
80+
#define SPI_INTERFACES_COUNT 1
81+
82+
#define PIN_SPI_MISO (22)
83+
#define PIN_SPI_MOSI (23)
84+
#define PIN_SPI_SCK (24)
85+
86+
static const uint8_t SS = 25 ;
87+
static const uint8_t MOSI = PIN_SPI_MOSI ;
88+
static const uint8_t MISO = PIN_SPI_MISO ;
89+
static const uint8_t SCK = PIN_SPI_SCK ;
90+
91+
/*
92+
* Wire Interfaces
93+
*/
94+
#define WIRE_INTERFACES_COUNT 1
95+
96+
#define PIN_WIRE_SDA (20u)
97+
#define PIN_WIRE_SCL (21u)
98+
99+
#ifdef __cplusplus
100+
}
101+
#endif
102+
103+
#endif

0 commit comments

Comments
 (0)