Skip to content

Commit 32ebbe0

Browse files
authored
Merge pull request sandeepmistry#211 from ntavish/hackaBLE
add support for Electronut labs hackaBLE module
2 parents 0e28d67 + c10b4d4 commit 32ebbe0

File tree

6 files changed

+244
-0
lines changed

6 files changed

+244
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ script:
3434
- buildExampleSketch sandeepmistry:nRF5:BLENano2 01.Basics Blink
3535
- buildExampleSketch sandeepmistry:nRF5:TinyBLE 01.Basics Blink
3636
- buildExampleSketch sandeepmistry:nRF5:bluey 01.Basics Blink
37+
- buildExampleSketch sandeepmistry:nRF5:hackaBLE 01.Basics Blink

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Does not require a custom bootloader on the device.
1616
* [RedBear Blend 2](https://github.com/redbear/nRF5x#blend-2)
1717
* [RedBear Nano 2](https://github.com/redbear/nRF5x#ble-nano-2)
1818
* [Bluey](https://github.com/electronut/ElectronutLabs-bluey)
19+
* [hackaBLE](https://github.com/electronut/ElectronutLabs-hackaBLE)
1920

2021
### nRF51
2122
* [Plain nRF51 MCU](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822)

boards.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,43 @@ bluey.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT
100100

101101

102102

103+
hackaBLE.name=Electronut labs hackaBLE
104+
105+
hackaBLE.upload.tool=sandeepmistry:openocd
106+
hackaBLE.upload.target=nrf52
107+
hackaBLE.upload.maximum_size=524288
108+
109+
hackaBLE.bootloader.tool=sandeepmistry:openocd
110+
111+
hackaBLE.build.mcu=cortex-m4
112+
hackaBLE.build.f_cpu=16000000
113+
hackaBLE.build.board=ELECTRONUT_HACKABLE
114+
hackaBLE.build.core=nRF5
115+
hackaBLE.build.variant=hackaBLE
116+
hackaBLE.build.variant_system_lib=
117+
hackaBLE.build.extra_flags=-DNRF52
118+
hackaBLE.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
119+
hackaBLE.build.ldscript=nrf52_xxaa.ld
120+
121+
hackaBLE.menu.softdevice.none=None
122+
hackaBLE.menu.softdevice.none.softdevice=none
123+
hackaBLE.menu.softdevice.none.softdeviceversion=
124+
125+
hackaBLE.menu.softdevice.s132=S132
126+
hackaBLE.menu.softdevice.s132.softdevice=s132
127+
hackaBLE.menu.softdevice.s132.softdeviceversion=2.0.1
128+
hackaBLE.menu.softdevice.s132.upload.maximum_size=409600
129+
hackaBLE.menu.softdevice.s132.build.extra_flags=-DNRF52 -DS132 -DNRF51_S132
130+
hackaBLE.menu.softdevice.s132.build.ldscript=armgcc_s132_nrf52832_xxaa.ld
131+
132+
hackaBLE.menu.lfclk.lfxo=Crystal Oscillator
133+
hackaBLE.menu.lfclk.lfxo.build.lfclk_flags=-DUSE_LFXO
134+
hackaBLE.menu.lfclk.lfrc=RC Oscillator
135+
hackaBLE.menu.lfclk.lfrc.build.lfclk_flags=-DUSE_LFRC
136+
hackaBLE.menu.lfclk.lfsynt=Synthesized
137+
hackaBLE.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT
138+
139+
103140
Blend2.name=RedBear Blend 2
104141

105142
Blend2.vid.0=0x0204

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

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
/*
23+
Top view
24+
RX - D0 | P0.14 P0.27 | D7 - SDA
25+
Tx - D1 | P0.13 P0.26 | D8 - SCL
26+
D2 | P0.12 P0.25 | D9
27+
SS - D3 | P0.11 AIN3/P0.05 | D10 - A3
28+
MISO - D4 | P0.08 AIN2/P0.04 | D11 - A2
29+
MOSI - D5 | P0.07 AIN1/P0.03 | D12 - A1
30+
SCK - D6 | P0.06 AIN0/P0.02 | D13 - A0
31+
| NFC2/P0.10 Vin |
32+
| NFC1/P0.09 Gnd |
33+
34+
35+
Bottom view (smt pads)
36+
D19 | P0.24 P0.23 | D14
37+
A4 - D20 | P0.28/AIN4 P0.22 | D15
38+
A5 - D21 | P0.29/AIN5 P0.18 | D16
39+
A6 - D22 | P0.30/AIN6 P0.16 | D17
40+
A7 - D23 | P0.31/AIN7 P0.15 | D18
41+
42+
43+
LEDs
44+
Red - P0.19 | D24
45+
Green - P0.19 | D25
46+
Blue - P0.19 | D26 - LED_BUILTIN
47+
48+
*/
49+
50+
const uint32_t g_ADigitalPinMap[] = {
51+
14,
52+
13,
53+
12,
54+
11,
55+
8,
56+
7,
57+
6,
58+
27,
59+
26,
60+
25,
61+
5,
62+
4,
63+
3,
64+
2,
65+
23,
66+
22,
67+
18,
68+
16,
69+
15,
70+
24,
71+
28,
72+
29,
73+
30,
74+
31,
75+
19,
76+
20,
77+
17,
78+
};

variants/hackaBLE/variant.h

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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_ELECTRONUT_HACKABLE_
18+
#define _VARIANT_ELECTRONUT_HACKABLE_
19+
20+
/** Master clock frequency */
21+
#define VARIANT_MCK (64000000ul)
22+
23+
/*----------------------------------------------------------------------------
24+
* Headers
25+
*----------------------------------------------------------------------------*/
26+
27+
#include "WVariant.h"
28+
29+
#ifdef __cplusplus
30+
extern "C"
31+
{
32+
#endif // __cplusplus
33+
34+
// Number of pins defined in PinDescription array
35+
#define PINS_COUNT (27u)
36+
#define NUM_DIGITAL_PINS (27u)
37+
#define NUM_ANALOG_INPUTS (8u)
38+
#define NUM_ANALOG_OUTPUTS (0u)
39+
40+
// LEDs
41+
#define PIN_LEDR (24)
42+
#define PIN_LEDG (25)
43+
#define PIN_LEDB (26)
44+
#define LED_BUILTIN PIN_LEDB
45+
46+
/*
47+
* Analog pins
48+
*/
49+
#define PIN_A0 (13)
50+
#define PIN_A1 (12)
51+
#define PIN_A2 (11)
52+
#define PIN_A3 (10)
53+
#define PIN_A4 (20)
54+
#define PIN_A5 (21)
55+
#define PIN_A6 (22)
56+
#define PIN_A7 (23)
57+
58+
static const uint8_t A0 = PIN_A0 ; // AIN0 / AREF / P0.02
59+
static const uint8_t A1 = PIN_A1 ; // AIN1
60+
static const uint8_t A2 = PIN_A2 ; // AIN2
61+
static const uint8_t A3 = PIN_A3 ; // AIN3
62+
static const uint8_t A4 = PIN_A4 ; // AIN4
63+
static const uint8_t A5 = PIN_A5 ; // AIN5
64+
static const uint8_t A6 = PIN_A6 ; // AIN6
65+
static const uint8_t A7 = PIN_A7 ; // AIN7
66+
#define ADC_RESOLUTION 10
67+
68+
// Other pins
69+
#define PIN_AREF (PIN_A0)
70+
static const uint8_t AREF = PIN_AREF;
71+
72+
/*
73+
* Serial interfaces
74+
*/
75+
// Serial
76+
#define PIN_SERIAL_RX (0)
77+
#define PIN_SERIAL_TX (1)
78+
79+
/*
80+
* SPI Interfaces
81+
*/
82+
#define SPI_INTERFACES_COUNT 1
83+
84+
#define PIN_SPI_MISO (4)
85+
#define PIN_SPI_MOSI (3)
86+
#define PIN_SPI_SCK (5)
87+
#define PIN_SPI_SS (3)
88+
89+
static const uint8_t SS = PIN_SPI_SS ;
90+
static const uint8_t MOSI = PIN_SPI_MOSI ;
91+
static const uint8_t MISO = PIN_SPI_MISO ;
92+
static const uint8_t SCK = PIN_SPI_SCK ;
93+
94+
/*
95+
* Wire Interfaces
96+
*/
97+
#define WIRE_INTERFACES_COUNT 1
98+
99+
#define PIN_WIRE_SDA (7)
100+
#define PIN_WIRE_SCL (8)
101+
102+
#ifdef __cplusplus
103+
}
104+
#endif
105+
106+
/*----------------------------------------------------------------------------
107+
* Arduino objects - C++ only
108+
*----------------------------------------------------------------------------*/
109+
110+
#endif

0 commit comments

Comments
 (0)