Skip to content

Commit 6d2847f

Browse files
committed
add new clue variant
1 parent 4a8253b commit 6d2847f

File tree

3 files changed

+291
-0
lines changed

3 files changed

+291
-0
lines changed

boards.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,60 @@ cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
219219
cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView)
220220
cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
221221

222+
223+
# ---------------------------------------------
224+
# Clue nRF52840
225+
# ---------------------------------------------
226+
cluenrf52840.name=Adafruit Clue
227+
228+
# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App
229+
cluenrf52840.vid.0=0x239A
230+
cluenrf52840.pid.0=0x8072
231+
cluenrf52840.vid.1=0x239A
232+
cluenrf52840.pid.1=0x0072
233+
cluenrf52840.vid.2=0x239A
234+
cluenrf52840.pid.2=0x0071
235+
cluenrf52840.vid.3=0x239A
236+
cluenrf52840.pid.3=0x8071
237+
238+
# Upload
239+
cluenrf52840.bootloader.tool=bootburn
240+
cluenrf52840.upload.tool=nrfutil
241+
cluenrf52840.upload.protocol=nrfutil
242+
cluenrf52840.upload.use_1200bps_touch=true
243+
cluenrf52840.upload.wait_for_upload_port=true
244+
cluenrf52840.upload.maximum_size=815104
245+
cluenrf52840.upload.maximum_data_size=248832
246+
247+
# Build
248+
cluenrf52840.build.mcu=cortex-m4
249+
cluenrf52840.build.f_cpu=64000000
250+
cluenrf52840.build.board=NRF52840_CLUE
251+
cluenrf52840.build.core=nRF5
252+
cluenrf52840.build.variant=clue_nrf52840
253+
cluenrf52840.build.usb_manufacturer="Adafruit LLC"
254+
cluenrf52840.build.usb_product="Adafruit Clue"
255+
cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
256+
cluenrf52840.build.ldscript=nrf52840_s140_v6.ld
257+
cluenrf52840.build.vid=0x239A
258+
cluenrf52840.build.pid=0x8071
259+
260+
# SofDevice Menu
261+
cluenrf52840.menu.softdevice.s140v6=0.2.13 SoftDevice s140 6.1.1
262+
cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140
263+
cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1
264+
cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
265+
266+
# Debug Menu
267+
cluenrf52840.menu.debug.l0=Level 0 (Release)
268+
cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
269+
cluenrf52840.menu.debug.l1=Level 1 (Error Message)
270+
cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
271+
cluenrf52840.menu.debug.l2=Level 2 (Full Debug)
272+
cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
273+
cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView)
274+
cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
275+
222276
# ----------------------------------
223277
# Bluefruit Metro nRF52840 Express
224278
# ----------------------------------

variants/clue_nrf52840/variant.cpp

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
Copyright (c) 2018, Adafruit Industries (adafruit.com)
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
See the GNU Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#include "variant.h"
22+
#include "wiring_constants.h"
23+
#include "wiring_digital.h"
24+
#include "nrf.h"
25+
26+
const uint32_t g_ADigitalPinMap[] =
27+
{
28+
// D0 .. D20
29+
4, // D0 is P0.04 (GPIO D0 / AIN2 / UART RX)
30+
5, // D1 is P0.05 (GPIO D1 / AIN3 / UART TX)
31+
3, // D2 is P0.03 (GPIO D2 / AIN4)
32+
28, // D3 is P0.28 (GPIO D3 / AIN5)
33+
2, // D4 is P0.02 (GPIO D4 / AIN6)
34+
34, // D5 is P1.02 (GPIO D5 / Left button)
35+
41, // D6 is P1.09 (GPIO D6)
36+
7, // D7 is P0.07 (GPIO D7)
37+
39, // D8 is P1.07 (GPIO D8)
38+
27, // D9 is P0.27 (GPIO D9)
39+
30, // D10 is P0.30 (GPIO D10 / AIN7)
40+
42, // D11 is P1.10 (GPIO D11 / Right Button)
41+
31, // D12 is P0.31 (GPIO D12 / AIN0)
42+
8, // D13 is P0.08 (GPIO D13 / SCK)
43+
6, // D14 is P0.06 (GPIO D14 / MISO)
44+
26, // D15 is P0.26 (GPIO D15 / MOSI)
45+
29, // D16 is P0.29 (GPIO D16 / AIN1)
46+
33, // D17 is P1.01 (Red LED)
47+
16, // D18 is P0.16 (NeoPixel)
48+
25, // D19 is P0.25 (GPIO D19 / SCL)
49+
24, // D20 is P0.24 (GPIO D20 / SDA)
50+
51+
// D21..D28 (A0 to A7)
52+
31, // D12 is P0.31 (GPIO D12 / AIN0)
53+
29, // D16 is P0.29 (GPIO D16 / AIN1)
54+
4, // D0 is P0.04 (GPIO D0 / AIN2 / UART RX)
55+
5, // D1 is P0.05 (GPIO D1 / AIN3 / UART TX)
56+
3, // D2 is P0.03 (GPIO D2 / AIN4)
57+
28, // D3 is P0.28 (GPIO D3 / AIN5)
58+
2, // D4 is P0.02 (GPIO D4 / AIN6)
59+
30, // D10 is P0.30 (GPIO D10 / AIN7)
60+
61+
// D29 .. D34 - TFT control
62+
14, // P0.14 (TFT SCK)
63+
15, // P0.15 (TFT MOSI)
64+
12, // P0.12 (TFT CS)
65+
13, // P0.13 (TFT DC)
66+
35, // P1.03 (TFT RESET)
67+
37, // P1.05 (TFT LITE)
68+
69+
// 35 & 36 - PDM mic
70+
40, // D35 is P1.08 (PDM DAT)
71+
43, // D36 is P1.11 (PDM CLK)
72+
73+
// QSPI pins (not exposed via any header / test point)
74+
19, // D37 is P0.19 (QSPI CLK)
75+
20, // D38 is P0.20 (QSPI CS)
76+
17, // D39 is P0.17 (QSPI Data 0)
77+
22, // D40 is P0.22 (QSPI Data 1)
78+
23, // D41 is P0.23 (QSPI Data 2)
79+
21, // D42 is P0.21 (QSPI Data 3)
80+
};
81+
82+
void initVariant()
83+
{
84+
// LED1
85+
pinMode(PIN_LED1, OUTPUT);
86+
ledOff(PIN_LED1);
87+
}
88+

variants/clue_nrf52840/variant.h

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
Copyright (c) 2018, Adafruit Industries (adafruit.com)
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
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+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef _VARIANT_CLUE52840_
20+
#define _VARIANT_CLUE52840_
21+
22+
/** Master clock frequency */
23+
#define VARIANT_MCK (64000000ul)
24+
25+
//#define USE_LFXO // Board uses 32khz crystal for LF
26+
#define USE_LFRC // Board uses RC for LF
27+
28+
/*----------------------------------------------------------------------------
29+
* Headers
30+
*----------------------------------------------------------------------------*/
31+
32+
#include "WVariant.h"
33+
34+
#ifdef __cplusplus
35+
extern "C"
36+
{
37+
#endif // __cplusplus
38+
39+
// Number of pins defined in PinDescription array
40+
#define PINS_COUNT (43)
41+
#define NUM_DIGITAL_PINS (43)
42+
#define NUM_ANALOG_INPUTS (8)
43+
#define NUM_ANALOG_OUTPUTS (0)
44+
45+
// LEDs
46+
#define PIN_LED1 (17)
47+
#define PIN_NEOPIXEL (18)
48+
49+
#define LED_BUILTIN PIN_LED1
50+
51+
#define LED_RED PIN_LED1
52+
#define LED_BLUE PIN_LED1
53+
54+
#define LED_STATE_ON 1 // State when LED is litted
55+
56+
// Buttons
57+
#define PIN_BUTTON1 (5)
58+
#define PIN_BUTTON2 (11)
59+
60+
// Microphone
61+
#define PIN_PDM_DIN 35
62+
#define PIN_PDM_CLK 36
63+
#define PIN_PDM_PWR -1 // not used
64+
65+
/*
66+
* Analog pins
67+
*/
68+
#define PIN_A0 (21)
69+
#define PIN_A1 (22)
70+
#define PIN_A2 (23)
71+
#define PIN_A3 (24)
72+
#define PIN_A4 (25)
73+
#define PIN_A5 (26)
74+
#define PIN_A6 (27)
75+
#define PIN_A7 (28)
76+
77+
static const uint8_t A0 = PIN_A0 ;
78+
static const uint8_t A1 = PIN_A1 ;
79+
static const uint8_t A2 = PIN_A2 ;
80+
static const uint8_t A3 = PIN_A3 ;
81+
static const uint8_t A4 = PIN_A4 ;
82+
static const uint8_t A5 = PIN_A5 ;
83+
static const uint8_t A6 = PIN_A6 ;
84+
static const uint8_t A7 = PIN_A7 ;
85+
#define ADC_RESOLUTION 14
86+
87+
/*
88+
* Serial interfaces
89+
*/
90+
// Serial
91+
#define PIN_SERIAL_RX (0)
92+
#define PIN_SERIAL_TX (1)
93+
94+
/*
95+
* SPI Interfaces
96+
*/
97+
#define SPI_INTERFACES_COUNT 2
98+
99+
#define PIN_SPI_MISO (14)
100+
#define PIN_SPI_MOSI (15)
101+
#define PIN_SPI_SCK (13)
102+
103+
static const uint8_t SS = (16);
104+
static const uint8_t MOSI = PIN_SPI_MOSI ;
105+
static const uint8_t MISO = PIN_SPI_MISO ;
106+
static const uint8_t SCK = PIN_SPI_SCK ;
107+
108+
109+
#define PIN_SPI1_MISO (35)
110+
#define PIN_SPI1_MOSI (30)
111+
#define PIN_SPI1_SCK (29)
112+
113+
static const uint8_t SS1 = (31);
114+
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
115+
static const uint8_t MISO1 = PIN_SPI1_MISO ;
116+
static const uint8_t SCK1 = PIN_SPI1_SCK ;
117+
118+
119+
/*
120+
* Wire Interfaces
121+
*/
122+
#define WIRE_INTERFACES_COUNT 1
123+
124+
#define PIN_WIRE_SDA (20)
125+
#define PIN_WIRE_SCL (19)
126+
127+
// QSPI Pins
128+
#define PIN_QSPI_SCK 37
129+
#define PIN_QSPI_CS 38
130+
#define PIN_QSPI_IO0 39
131+
#define PIN_QSPI_IO1 40
132+
#define PIN_QSPI_IO2 41
133+
#define PIN_QSPI_IO3 42
134+
135+
// On-board QSPI Flash
136+
#define EXTERNAL_FLASH_DEVICES GD25Q16C
137+
138+
#define USB_MSC_BLOCK_SIZE 512
139+
#define USB_MSC_BLOCK_COUNT ((2*1024*1024) / USB_MSC_BLOCK_SIZE)
140+
141+
#ifdef __cplusplus
142+
}
143+
#endif
144+
145+
/*----------------------------------------------------------------------------
146+
* Arduino objects - C++ only
147+
*----------------------------------------------------------------------------*/
148+
149+
#endif

0 commit comments

Comments
 (0)