Skip to content

Commit 01339a1

Browse files
jacobrosenthalsandeepmistry
authored andcommitted
Add TinyBLE variant (sandeepmistry#112)
* first pass at tinyble variant * TinyBLE: fix name * TinyBLE: board fixes * TinyBLE: fix crystal * TinyBLE: board fixes * TinyBLE: fix pins * TinyBLE: add to tests * TinyBLE: fix default programmer * TinyBLE: fix default programmer * fix NUM_DIGITAL_PINS based on current understand of rules * Add SDA and SCL pin constants to variant definitions
1 parent f124e5e commit 01339a1

File tree

6 files changed

+217
-0
lines changed

6 files changed

+217
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ script:
3232
- buildExampleSketch sandeepmistry:nRF5:nRF51Dongle:version=1_1_0 01.Basics Blink
3333
- buildExampleSketch sandeepmistry:nRF5:Blend2 01.Basics Blink
3434
- buildExampleSketch sandeepmistry:nRF5:BLENano2 01.Basics Blink
35+
- buildExampleSketch sandeepmistry:nRF5:TinyBLE 01.Basics Blink

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Does not require a custom bootloader on the device.
2929
* [RedBearLab nRF51822](http://redbearlab.com/redbearlab-nrf51822/)
3030
* [Waveshare BLE400](http://www.waveshare.com/wiki/BLE400)
3131
* [ng-beacon](https://github.com/urish/ng-beacon)
32+
* [TinyBLE](https://www.seeedstudio.com/Seeed-Tiny-BLE-BLE-%2B-6DOF-Mbed-Platform-p-2268.html)
3233

3334
## Installing
3435

boards.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,47 @@ nRF51Dongle.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130
442442
nRF51Dongle.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_{build.chip}.ld
443443

444444

445+
TinyBLE.name= TinyBLE
446+
447+
TinyBLE.upload.tool=sandeepmistry:openocd
448+
TinyBLE.upload.protocol=cmsis-dap
449+
450+
TinyBLE.upload.target=nrf51
451+
TinyBLE.upload.maximum_size=262144
452+
TinyBLE.upload.setup_command=transport select swd;
453+
454+
TinyBLE.bootloader.tool=sandeepmistry:openocd
455+
456+
TinyBLE.build.mcu=cortex-m0
457+
TinyBLE.build.f_cpu=16000000
458+
TinyBLE.build.board=TINYBLE
459+
TinyBLE.build.core=nRF5
460+
TinyBLE.build.variant=TinyBLE
461+
TinyBLE.build.variant_system_lib=
462+
TinyBLE.build.extra_flags=-DNRF51
463+
TinyBLE.build.float_flags=
464+
TinyBLE.build.ldscript=nrf51_xxaa.ld
465+
466+
TinyBLE.build.lfclk_flags=-DUSE_LFXO
467+
468+
TinyBLE.menu.softdevice.none=None
469+
TinyBLE.menu.softdevice.none.softdevice=none
470+
471+
TinyBLE.menu.softdevice.s110=S110
472+
TinyBLE.menu.softdevice.s110.softdevice=s110
473+
TinyBLE.menu.softdevice.s110.softdeviceversion=8.0.0
474+
TinyBLE.menu.softdevice.s110.upload.maximum_size=151552
475+
TinyBLE.menu.softdevice.s110.build.extra_flags=-DNRF51 -DS110 -DNRF51_S110
476+
TinyBLE.menu.softdevice.s110.build.ldscript=armgcc_s110_nrf51822_xxaa.ld
477+
478+
TinyBLE.menu.softdevice.s130=S130
479+
TinyBLE.menu.softdevice.s130.softdevice=s130
480+
TinyBLE.menu.softdevice.s130.softdeviceversion=2.0.1
481+
TinyBLE.menu.softdevice.s130.upload.maximum_size=151552
482+
TinyBLE.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130
483+
TinyBLE.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxaa.ld
484+
485+
445486
OSHChip.name=OSHChip
446487

447488
OSHChip.upload.tool=sandeepmistry:openocd

variants/TinyBLE/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/TinyBLE/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/TinyBLE/variant.h

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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_TINYBLE_
18+
#define _VARIANT_TINYBLE_
19+
20+
/** Master clock frequency */
21+
#define VARIANT_MCK (16000000ul)
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 (32u)
36+
//3 LEDS, 1 Button, 4 exposed pins
37+
#define NUM_DIGITAL_PINS (8u)
38+
#define NUM_ANALOG_INPUTS (4u)
39+
#define NUM_ANALOG_OUTPUTS (0u)
40+
41+
// LEDs
42+
#define PIN_LED1 (21)
43+
#define PIN_LED2 (22)
44+
#define PIN_LED3 (23)
45+
46+
#define LED_BUILTIN PIN_LED1
47+
48+
// Buttons
49+
#define PIN_BUTTON (17)
50+
51+
/*
52+
* Analog pins
53+
*/
54+
#define PIN_A0 (3)
55+
#define PIN_A1 (4)
56+
#define PIN_A2 (5)
57+
#define PIN_A3 (6)
58+
59+
static const uint8_t A0 = PIN_A0 ;
60+
static const uint8_t A1 = PIN_A1 ;
61+
static const uint8_t A2 = PIN_A2 ;
62+
static const uint8_t A3 = PIN_A3 ;
63+
#define ADC_RESOLUTION 10
64+
65+
/*
66+
* SPI Interfaces
67+
*/
68+
#define SPI_INTERFACES_COUNT 1
69+
70+
#define PIN_SPI_MISO (3)
71+
#define PIN_SPI_MOSI (4)
72+
#define PIN_SPI_SCK (5)
73+
74+
static const uint8_t SS = 6 ;
75+
static const uint8_t MOSI = PIN_SPI_MOSI ;
76+
static const uint8_t MISO = PIN_SPI_MISO ;
77+
static const uint8_t SCK = PIN_SPI_SCK ;
78+
79+
/*
80+
* Wire Interfaces
81+
*/
82+
#define WIRE_INTERFACES_COUNT 1
83+
84+
//MPU6050_INT_PIN (20)
85+
#define PIN_WIRE_SDA (12)
86+
#define PIN_WIRE_SCL (13)
87+
88+
static const uint8_t SDA = PIN_WIRE_SDA;
89+
static const uint8_t SCL = PIN_WIRE_SCL;
90+
91+
/*
92+
* Serial interfaces
93+
*/
94+
// Serial
95+
#define PIN_SERIAL_RX (11)
96+
#define PIN_SERIAL_TX (9)
97+
98+
#ifdef __cplusplus
99+
}
100+
#endif
101+
102+
#endif

0 commit comments

Comments
 (0)