8000 Add micro:bit V2 variant · sandeepmistry/arduino-nRF5@4c9101d · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c9101d

Browse files
jhmaloneysandeepmistry
authored andcommitted
Add micro:bit V2 variant
1 parent 28c3855 commit 4c9101d

File tree

5 files changed

+188
-0
lines changed

5 files changed

+188
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ script:
4242
- buildExampleSketch sandeepmistry:nRF5:DWM1001-DEV 01.Basics Blink
4343
- buildExampleSketch sandeepmistry:nRF5:SeeedArchLink 01.Basics Blink
4444
- buildExampleSketch sandeepmistry:nRF5:Generic_nRF52833 01.Basics Blink
45+
- buildExampleSketch sandeepmistry:nRF5:BBCmicrobitV2 01.Basics Blink

boards.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,39 @@ Generic_nRF52833.menu.lfclk.lfsynt=Synthesized
5454
Generic_nRF52833.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT
5555

5656

57+
BBCmicrobitV2.name=BBC micro:bit V2
58+
59+
BBCmicrobitV2.vid.0=0x0d28
60+
BBCmicrobitV2.pid.0=0x0204
61+
62+
BBCmicrobitV2.upload.tool=sandeepmistry:openocd
63+
BBCmicrobitV2.upload.protocol=cmsis-dap
64+
BBCmicrobitV2.upload.target=nrf52
65+
BBCmicrobitV2.upload.maximum_size=524288
66+
BBCmicrobitV2.upload.setup_command=transport select swd;
67+
BBCmicrobitV2.upload.use_1200bps_touch=false
68+
BBCmicrobitV2.upload.wait_for_upload_port=false
69+
BBCmicrobitV2.upload.native_usb=false
70+
71+
BBCmicrobitV2.bootloader.tool=sandeepmistry:openocd
72+
73+
BBCmicrobitV2.build.mcu=cortex-m4
74+
BBCmicrobitV2.build.f_cpu=64000000
75+
BBCmicrobitV2.build.board=BBC_MICROBIT_V2
76+
BBCmicrobitV2.build.core=nRF5
77+
BBCmicrobitV2.build.variant=BBCmicrobitV2
78+
BBCmicrobitV2.build.variant_system_lib=
79+
BBCmicrobitV2.build.extra_flags=-DNRF52833_XXAA
80+
BBCmicrobitV2.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
81+
BBCmicrobitV2.build.ldscript=nrf52833_xxaa.ld
82+
83+
BBCmicrobitV2.build.lfclk_flags=-DUSE_LFSYNT
84+
85+
BBCmicrobitV2.menu.softdevice.none=None
86+
BBCmicrobitV2.menu.softdevice.none.softdevice=none
87+
BBCmicrobitV2.menu.softdevice.none.softdeviceversion=
88+
89+
5790
# nRF52832 variants
5891
###################
5992

variants/BBCmicrobitV2/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/BBCmicrobitV2/variant.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* Pins for micro:bit V2 */
2+
3+
#include "variant.h"
4+
5+
const uint32_t g_ADigitalPinMap[] = {
6+
// 0 - 4
7+
2, // A0, LEFT PAD
8+
3, // A1, MIDDLE PAD
9+
4, // A2, RIGHT PAD
10+
31, // A3, COL3
11+
28, // A4, COL1
12+
13+
// 5 - 9
14+
14, // BTN A
15+
37, // COL4, P1.05
16+
11, // COL2
17+
10, // NFC2
18+
9, // NFC1
19+
20+
// 10-16
21+
30, // A5, COL5
22+
23, // BTN B
23+
12,
24+
17, // SCK
25+
1, // MISO
26+
13, // MOSI
27+
34, // P1.02
28+
29+
// 17 + 18
30+
(uint32_t)-1, // 3.3V
31+
(uint32_t)-1, // 3.3V
32+
33+
// 19 + 20
34+
26, // SCL
35+
32, // SDA, P1.00
36+
37+
// 21 - 25
38+
21, // ROW1
39+
22, // ROW2
40+
15, // ROW3
41+
24, // ROW4
42+
19, // ROW5
43+
44+
// 26 - 29
45+
36, // LOGO (touch sensor)
46+
0, // SPEAKER (Note: Must use synthesized LF clock to make this pin available)
47+
20, // RUN_MIC
48+
5, // A6, MIC_IN
49+
50+
// 30 - 31
51+
16, // I2C_INT_SDA
52+
8, // I2C_INT_SCL
53+
54+
// 32 - 34
55+
25, // COMBINED_SENSOR_INT
56+
40, // RX, P1.08
57+
6, // TX
58+
59+
};

variants/BBCmicrobitV2/variant.h

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#ifndef _MICROBIT_V2_
2+
#define _MICROBIT_V2_
3+
4+
// Master clock frequency
5+
6+
#define VARIANT_MCK (64000000ul)
7+
8+
#include "WVariant.h"
9+
10+
#ifdef __cplusplus
11+
extern "C"
12+
{
13+
#endif // __cplusplus
14+
15+
// Number of pins defined in PinDescription array
16+
17+
#define PINS_COUNT (35)
18+
#define NUM_DIGITAL_PINS (35)
19+
#define NUM_ANALOG_INPUTS (7)
20+
#define NUM_ANALOG_OUTPUTS (0)
21+
22+
// LEDs
23+
24+
#define PIN_LED (13)
25+
#define LED_BUILTIN PIN_LED
26+
27+
// Buttons
10000 28+
29+
#define PIN_BUTTON_A (5)
30+
#define PIN_BUTTON_B (11)
31+
32+
// Analog pins
33+
34+
#define PIN_A0 (0)
35+
#define PIN_A1 (1)
36+
#define PIN_A2 (2)
37+
#define PIN_A3 (3)
38+
#define PIN_A4 (4)
39+
#define PIN_A5 (10)
40+
#define PIN_A6 (29)
41+
42+
#define ADC_RESOLUTION 10
43+
static const uint8_t A0 = PIN_A0;
44+
static const uint8_t A1 = PIN_A1;
45+
static const uint8_t A2 = PIN_A2;
46+
static const uint8_t A3 = PIN_A3;
47+
static const uint8_t A4 = PIN_A4;
48+
static const uint8_t A5 = PIN_A5;
49+
static const uint8_t A6 = PIN_A6;
50+
51+
// Serial
52+
53+
#define PIN_SERIAL_RX (33)
54+
#define PIN_SERIAL_TX (34)
55+
56+
// SPI
57+
58+
#define SPI_INTERFACES_COUNT 1
59+
60+
#define PIN_SPI_MISO (14)
61+
#define PIN_SPI_MOSI (15)
62+
#define PIN_SPI_SCK (13)
63+
64+
// Wire Interfaces (external and internal)
65+
66+
#define WIRE_INTERFACES_COUNT 2
67+
68+
#define PIN_WIRE_SDA (20)
69+
#define PIN_WIRE_SCL (19)
70+
71+
#define PIN_WIRE1_SDA (30)
72+
#define PIN_WIRE1_SCL (31)
73+
74+
#ifdef __cplusplus
75+
}
76+
#endif // __cplusplus
77+
78+
#endif

0 commit comments

Comments
 (0)
0