diff --git a/.gitignore b/.gitignore index 7c70bf33..82589cc8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ cores/nRF5/SDK/components/softdevice/*/hex/*.txt # IDE tools extras/ide-tools/bin extras/ide-tools/nRF5FlashSoftDevice.jar +.vscode/* diff --git a/.travis.yml b/.travis.yml index e90af747..b5838239 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,3 +35,4 @@ script: - buildExampleSketch sandeepmistry:nRF5:TinyBLE 01.Basics Blink - buildExampleSketch sandeepmistry:nRF5:bluey 01.Basics Blink - buildExampleSketch sandeepmistry:nRF5:hackaBLE 01.Basics Blink + - buildExampleSketch sandeepmistry:nRF5:Sinobit 01.Basics BareMinimum diff --git a/README.md b/README.md index 5f93e356..d19df402 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Does not require a custom bootloader on the device. * [Waveshare BLE400](http://www.waveshare.com/wiki/BLE400) * [ng-beacon](https://github.com/urish/ng-beacon) * [TinyBLE](https://www.seeedstudio.com/Seeed-Tiny-BLE-BLE-%2B-6DOF-Mbed-Platform-p-2268.html) + * [Sino:bit](http://sinobit.org) ## Installing @@ -58,7 +59,7 @@ No additional setup required. For 64-bit Linux users, ```libc6:i386```, ```libstdc++6:i386```, ```libncurses5:i386``` and ```libudev1:i386``` need to be installed : * ```sudo dpkg --add-architecture i386``` * ```sudo apt-get update``` - * ```sudo apt-get install libc6:i386 libstdc++6:i386 libncurses5:i386 libudev1:i386``` + * ```sudo apt-get install libc6:i386 libstdc++6:i386 libncurses5:i386 libudev1:i386``` ##### Windows diff --git a/boards.txt b/boards.txt index a185129d..4c58437f 100644 --- a/boards.txt +++ b/boards.txt @@ -818,3 +818,50 @@ ng_beacon.menu.softdevice.s130.softdeviceversion=2.0.1 ng_beacon.menu.softdevice.s130.upload.maximum_size=151552 ng_beacon.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130 ng_beacon.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxaa.ld + + +Sinobit.name=Sino:bit + +Sinobit.vid.0=0x0d28 +Sinobit.pid.0=0x0204 + +Sinobit.upload.tool=sandeepmistry:openocd +Sinobit.upload.protocol=cmsis-dap +Sinobit.upload.target=nrf51 +Sinobit.upload.maximum_size=262144 +Sinobit.upload.setup_command=transport select swd; +Sinobit.upload.use_1200bps_touch=false +Sinobit.upload.wait_for_upload_port=false +Sinobit.upload.native_usb=false + +Sinobit.bootloader.tool=sandeepmistry:openocd + +Sinobit.build.mcu=cortex-m0 +Sinobit.build.f_cpu=16000000 +Sinobit.build.board=SINOBIT +Sinobit.build.core=nRF5 +Sinobit.build.variant=Sinobit +Sinobit.build.variant_system_lib= +Sinobit.build.extra_flags=-DNRF51 +Sinobit.build.float_flags= +Sinobit.build.ldscript=nrf51_xxaa.ld + +Sinobit.build.lfclk_flags=-DUSE_LFRC + +Sinobit.menu.softdevice.none=None +Sinobit.menu.softdevice.none.softdevice=none +Sinobit.menu.softdevice.none.softdeviceversion= + +Sinobit.menu.softdevice.s110=S110 +Sinobit.menu.softdevice.s110.softdevice=s110 +Sinobit.menu.softdevice.s110.softdeviceversion=8.0.0 +Sinobit.menu.softdevice.s110.upload.maximum_size=151552 +Sinobit.menu.softdevice.s110.build.extra_flags=-DNRF51 -DS110 -DNRF51_S110 +Sinobit.menu.softdevice.s110.build.ldscript=armgcc_s110_nrf51822_xxaa.ld + +Sinobit.menu.softdevice.s130=S130 +Sinobit.menu.softdevice.s130.softdevice=s130 +Sinobit.menu.softdevice.s130.softdeviceversion=2.0.1 +Sinobit.menu.softdevice.s130.upload.maximum_size=151552 +Sinobit.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130 +Sinobit.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxaa.ld diff --git a/variants/Sinobit/README.md b/variants/Sinobit/README.md new file mode 100644 index 00000000..b666efc2 --- /dev/null +++ b/variants/Sinobit/README.md @@ -0,0 +1,6 @@ +# Sino:Bit support files for Arduino +Contributed by Tomas Lubkowitz @sceptic_int for Sino:Bit + +For LED Matrix functionality please look at https://learn.adafruit.com/sino-bit-with-arduino/dastels-overview + + diff --git a/variants/Sinobit/pins_arduino.h b/variants/Sinobit/pins_arduino.h new file mode 100644 index 00000000..3ef4d4a9 --- /dev/null +++ b/variants/Sinobit/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/Sinobit/variant.cpp b/variants/Sinobit/variant.cpp new file mode 100644 index 00000000..93111220 --- /dev/null +++ b/variants/Sinobit/variant.cpp @@ -0,0 +1,57 @@ +/* + 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[] = { + + 3, // A0 - left pad + 2, // A1 - middle pad + 1, // A2 - right pad + 4, // A3 - COL1 + 5, // A4 - COL2 + 17, // BTN A + 12, // COL9 + 11, // COL8 + 18, + 10, // COL7 + 6, // A5 - COL3 + 26, // BTN B + 20, + 23, // SCK + 22, // MISO + 21, // MOSI + 16, + (uint32_t)-1, // 3.3V + (uint32_t)-1, // 3.3V + 0, // SCL + 30, // SDA + 25, // RX + 24, // TX + 7, // COL4 + 8, // COL5 + 9, // COL6 + 13, // ROW1 + 14, // ROW2 + 15, // ROW3 + 28, // ACCEL INT 1 + 27, // ACCEL INT 2 + 29, // MAG INT 2 + 19 // RST +}; diff --git a/variants/Sinobit/variant.h b/variants/Sinobit/variant.h new file mode 100644 index 00000000..2e048b72 --- /dev/null +++ b/variants/Sinobit/variant.h @@ -0,0 +1,103 @@ +/* + 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_SINOBIT_ +#define _VARIANT_SINOBIT_ + +/** Master clock frequency */ +#define VARIANT_MCK (16000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (33u) +#define NUM_DIGITAL_PINS (20u) +#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LED (13) +#define LED_BUILTIN PIN_LED + +// Buttons +#define PIN_BUTTON_A (5) +#define PIN_BUTTON_B (11) + +/* + * Analog pins + */ +#define PIN_A0 (0) +#define PIN_A1 (1) +#define PIN_A2 (2) +#define PIN_A3 (3) +#define PIN_A4 (4) +#define PIN_A5 (10) + + +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 ; +#define ADC_RESOLUTION 10 + +/* + * Serial interfaces + */ +// Serial +#define PIN_SERIAL_RX (21) +#define PIN_SERIAL_TX (22) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (14) +#define PIN_SPI_MOSI (15) +#define PIN_SPI_SCK (13) + +static const uint8_t SS = 16 ; +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 (20u) +#define PIN_WIRE_SCL (19u) + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +#ifdef __cplusplus +} +#endif + +#endif