diff --git a/boards.txt b/boards.txt index a050d27e..43c8639d 100644 --- a/boards.txt +++ b/boards.txt @@ -1090,3 +1090,45 @@ SeeedArchLink.menu.softdevice.s130.upload.maximum_size=151552 SeeedArchLink.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130 SeeedArchLink.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxaa.ld +DTBlow_BLE.name=DTBlow BLE + +DTBlow_BLE.upload.tool=sandeepmistry:openocd +DTBlow_BLE.upload.target=nrf51 +DTBlow_BLE.upload.maximum_size=262144 + +DTBlow_BLE.bootloader.tool=sandeepmistry:openocd + +DTBlow_BLE.build.mcu=cortex-m0 +DTBlow_BLE.build.f_cpu=16000000 +DTBlow_BLE.build.board=DTBLOW_BLE +DTBlow_BLE.build.core=nRF5 +DTBlow_BLE.build.variant=DTBlow_BLE +DTBlow_BLE.build.variant_system_lib= +DTBlow_BLE.build.extra_flags=-DNRF51 +DTBlow_BLE.build.float_flags= +DTBlow_BLE.build.ldscript=nrf51_{build.chip}.ld + +DTBlow_BLE.build.lfclk_flags=-DUSE_LFXO + +DTBlow_BLE.menu.chip.xxaa=16 kB RAM, 256 kB flash (xxaa) +DTBlow_BLE.menu.chip.xxaa.build.chip=xxaa +DTBlow_BLE.menu.chip.xxac=32 kB RAM, 256 kB flash (xxac) +DTBlow_BLE.menu.chip.xxac.build.chip=xxac + +DTBlow_BLE.menu.softdevice.none=None +DTBlow_BLE.menu.softdevice.none.softdevice=none +DTBlow_BLE.menu.softdevice.none.softdeviceversion= + +DTBlow_BLE.menu.softdevice.s110=S110 +DTBlow_BLE.menu.softdevice.s110.softdevice=s110 +DTBlow_BLE.menu.softdevice.s110.softdeviceversion=8.0.0 +DTBlow_BLE.menu.softdevice.s110.upload.maximum_size=151552 +DTBlow_BLE.menu.softdevice.s110.build.extra_flags=-DNRF51 -DS110 -DNRF51_S110 +DTBlow_BLE.menu.softdevice.s110.build.ldscript=armgcc_s110_nrf51822_{build.chip}.ld + +DTBlow_BLE.menu.softdevice.s130=S130 +DTBlow_BLE.menu.softdevice.s130.softdevice=s130 +DTBlow_BLE.menu.softdevice.s130.softdeviceversion=2.0.1 +DTBlow_BLE.menu.softdevice.s130.upload.maximum_size=151552 +DTBlow_BLE.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130 +DTBlow_BLE.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_{build.chip}.ld \ No newline at end of file diff --git a/variants/DTBlow_BLE/pins_arduino.h b/variants/DTBlow_BLE/pins_arduino.h new file mode 100644 index 00000000..3ef4d4a9 --- /dev/null +++ b/variants/DTBlow_BLE/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/DTBlow_BLE/variant.cpp b/variants/DTBlow_BLE/variant.cpp new file mode 100644 index 00000000..02d405b6 --- /dev/null +++ b/variants/DTBlow_BLE/variant.cpp @@ -0,0 +1,55 @@ +/* + 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" + +const uint32_t g_ADigitalPinMap[] = { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31 +}; diff --git a/variants/DTBlow_BLE/variant.h b/variants/DTBlow_BLE/variant.h new file mode 100644 index 00000000..c640daab --- /dev/null +++ b/variants/DTBlow_BLE/variant.h @@ -0,0 +1,116 @@ +/* + 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_GENERIC_ +#define _VARIANT_GENERIC_ + +#include "nrf.h" + +/** Master clock frequency */ +#if defined(NRF52_SERIES) +#define VARIANT_MCK (64000000ul) +#else +#define VARIANT_MCK (16000000ul) +#endif + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (31u) +#define NUM_DIGITAL_PINS (31u) +#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LED1 (18) +#define PIN_LED2 (19) +#define PIN_LED3 (20) +#define PIN_LED4 (21) +#define PIN_LED5 (22) +#define LED_BUILTIN PIN_LED1 + +// Buttons +#define PIN_BUTTON1 (16) +#define PIN_BUTTON2 (17) + +/* + * Analog pins + */ +#define PIN_A0 (2) +#define PIN_A1 (3) +#define PIN_A2 (4) +#define PIN_A3 (5) +#define PIN_A4 (6) +#define PIN_A5 (7) + +static const uint8_t A0 = PIN_A0 ; +static const uint8_t A1 = PIN_A1 ; +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +#ifdef NRF52 +#define ADC_RESOLUTION 14 +#else +#define ADC_RESOLUTION 10 +#endif + +/* + * Serial interfaces + */ +// Serial +#define PIN_SERIAL_RX (11) +#define PIN_SERIAL_TX (9) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (23) +#define PIN_SPI_MOSI (24) +#define PIN_SPI_SCK (25) + +static const uint8_t SS = 30 ; +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 (0u) +#define PIN_WIRE_SCL (1u) + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +#ifdef __cplusplus +} +#endif + +#endif