diff --git a/.travis.yml b/.travis.yml index d76123dd..9a5c2676 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,3 +33,4 @@ script: - buildExampleSketch sandeepmistry:nRF5:Blend2 01.Basics Blink - buildExampleSketch sandeepmistry:nRF5:BLENano2 01.Basics Blink - buildExampleSketch sandeepmistry:nRF5:TinyBLE 01.Basics Blink + - buildExampleSketch sandeepmistry:nRF5:bluey 01.Basics Blink diff --git a/README.md b/README.md index a9244be6..b3fc0e2c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Does not require a custom bootloader on the device. * [Shenzhen Taida Century Technology nRF52 low cost development board](https://www.aliexpress.com/item/NRF52832-high-cost-development-board-gold-core-board/32725601299.html) * [RedBear Blend 2](https://github.com/redbear/nRF5x#blend-2) * [RedBear Nano 2](https://github.com/redbear/nRF5x#ble-nano-2) + * [Bluey](https://github.com/electronut/ElectronutLabs-bluey) ### nRF51 * [Plain nRF51 MCU](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822) diff --git a/boards.txt b/boards.txt index 338a3078..9df22849 100644 --- a/boards.txt +++ b/boards.txt @@ -60,6 +60,44 @@ Generic_nRF52832.menu.lfclk.lfsynt=Synthesized Generic_nRF52832.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT + +bluey.name=Electronut labs bluey + +bluey.upload.tool=sandeepmistry:openocd +bluey.upload.target=nrf52 +bluey.upload.maximum_size=524288 + +bluey.bootloader.tool=sandeepmistry:openocd + +bluey.build.mcu=cortex-m4 +bluey.build.f_cpu=16000000 +bluey.build.board=ELECTRONUT_BLUEY +bluey.build.core=nRF5 +bluey.build.variant=bluey +bluey.build.variant_system_lib= +bluey.build.extra_flags=-DNRF52 +bluey.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 +bluey.build.ldscript=nrf52_xxaa.ld + +bluey.menu.softdevice.none=None +bluey.menu.softdevice.none.softdevice=none + +bluey.menu.softdevice.s132=S132 +bluey.menu.softdevice.s132.softdevice=s132 +bluey.menu.softdevice.s132.softdeviceversion=2.0.1 +bluey.menu.softdevice.s132.upload.maximum_size=409600 +bluey.menu.softdevice.s132.build.extra_flags=-DNRF52 -DS132 -DNRF51_S132 +bluey.menu.softdevice.s132.build.ldscript=armgcc_s132_nrf52832_xxaa.ld + +bluey.menu.lfclk.lfxo=Crystal Oscillator +bluey.menu.lfclk.lfxo.build.lfclk_flags=-DUSE_LFXO +bluey.menu.lfclk.lfrc=RC Oscillator +bluey.menu.lfclk.lfrc.build.lfclk_flags=-DUSE_LFRC +bluey.menu.lfclk.lfsynt=Synthesized +bluey.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT + + + Blend2.name=RedBear Blend 2 Blend2.vid.0=0x0204 diff --git a/variants/bluey/pins_arduino.h b/variants/bluey/pins_arduino.h new file mode 100644 index 00000000..3ef4d4a9 --- /dev/null +++ b/variants/bluey/pins_arduino.h @@ -0,0 +1,17 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +// API compatibility +#include "variant.h" diff --git a/variants/bluey/variant.cpp b/variants/bluey/variant.cpp new file mode 100644 index 00000000..4dcd9dd1 --- /dev/null +++ b/variants/bluey/variant.cpp @@ -0,0 +1,85 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" + +/* + + A0 P0.02/AIN0 | 1 2 | P0.26 D0 + A1 P0.03/AIN1 | 3 4 | P0.27 D1 + A2 P0.04/AIN2 | 5 6 | P0.24/AIN4 A3 + D2 P0.22 | 7 8 | P0.29/AIN5 A4 + D3 P0.23 | 9 10 | P0.30/AIN6 A5 + D4 P0.24 | 11 12 | P0.31/AIN7 A6 + D5 P0.25 | 13 14 | Ex_vin + GND | 15 16 | 3v3 + GND | 17 18 | GND + + + button D6 - P0.16 + R D7 - P0.19 + G D8 - P0.18 + B D9 - P0.17 + + D10 SCL - P0.11 DRDYn - P0.12 D11 + D12 SDA - P0.13 INT - P0.14 D13 + D14 INT1 - P0.15 INT2 - P0.20 D15 + + RXD - P0.08 TXD - P0.06 + RTS - P0.05 CTS - P0.07 + + SS - P0.22 SCK - P0.25 + MISO - P0.24 MOSI - P0.23 +*/ + + +const uint32_t g_ADigitalPinMap[] = { + // D0 - D15 + 26, + 27, + 22, // SS + 23, // MOSI + 24, // MISO + 25, // SCK + 16, // Button + 19, // R + 18, // G + 17, // B + 11, // SCL + 12, // DRDYn + 13, // SDA + 14, // INT + 15, // INT1 + 20, // INT2 + + // A0 - A6 + 2, + 3, + 4, + 24, + 29, + 30, + 31, + + // RX, TX, RTS, CTS + 8, + 6, + 5, + 7, +}; diff --git a/variants/bluey/variant.h b/variants/bluey/variant.h new file mode 100644 index 00000000..d877e854 --- /dev/null +++ b/variants/bluey/variant.h @@ -0,0 +1,110 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ELECTRONUT_BLUEY_ +#define _VARIANT_ELECTRONUT_BLUEY_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (27u) +#define NUM_DIGITAL_PINS (27u) +#define NUM_ANALOG_INPUTS (7u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LEDR (7) +#define PIN_LEDG (8) +#define PIN_LEDB (9) +#define LED_BUILTIN PIN_LEDR + +// Buttons +#define PIN_BUTTON (6) + +/* + * Analog pins + */ +#define PIN_A0 (16) +#define PIN_A1 (17) +#define PIN_A2 (18) +#define PIN_A3 (19) +#define PIN_A4 (20) +#define PIN_A5 (21) +#define PIN_A6 (22) + +static const uint8_t A0 = PIN_A0 ; // AIN0 / AREF / P0.02 +static const uint8_t A1 = PIN_A1 ; // AIN1 +static const uint8_t A2 = PIN_A2 ; // AIN2 +static const uint8_t A3 = PIN_A3 ; // AIN4 +static const uint8_t A4 = PIN_A4 ; // AIN5 +static const uint8_t A5 = PIN_A5 ; // AIN6 +static const uint8_t A6 = PIN_A6 ; // AIN7 +#define ADC_RESOLUTION 10 + +// Other pins +#define PIN_AREF (16) +static const uint8_t AREF = PIN_AREF; + +/* + * Serial interfaces + */ +// Serial +#define PIN_SERIAL_RX (23) +#define PIN_SERIAL_TX (24) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (4) +#define PIN_SPI_MOSI (3) +#define PIN_SPI_SCK (5) + +static const uint8_t SS = 2 ; +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (12u) +#define PIN_WIRE_SCL (10u) + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif