diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp new file mode 100644 index 0000000..d2db957 --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. 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 + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h new file mode 100644 index 0000000..d03d1cc --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h @@ -0,0 +1,123 @@ +/* + Copyright (c) 2016 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 +*/ + +#pragma once + +#include +#include // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h new file mode 100644 index 0000000..c2d5824 --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h @@ -0,0 +1,100 @@ +/* + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ + +#ifndef udp_h +#define udp_h + +#include +#include + +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = + 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + + // KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + + virtual void stop() = 0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; +}; + +#endif diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/boards.txt b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/boards.txt new file mode 100644 index 0000000..c21a831 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/boards.txt @@ -0,0 +1,716 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. 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 + +menu.softdevice=SoftDevice +menu.debug=Debug + +# ---------------------------------- +# Bluefruit Feather nRF52832 +# ---------------------------------- +feather52832.name=Adafruit Feather nRF52832 +feather52832.bootloader.tool=bootburn + +# Upload +feather52832.upload.tool=nrfutil +feather52832.upload.protocol=nrfutil +feather52832.upload.use_1200bps_touch=false +feather52832.upload.wait_for_upload_port=false +feather52832.upload.native_usb=false +feather52832.upload.maximum_size=290816 +feather52832.upload.maximum_data_size=52224 + +# Build +feather52832.build.mcu=cortex-m4 +feather52832.build.f_cpu=64000000 +feather52832.build.board=NRF52832_FEATHER +feather52832.build.core=nRF5 +feather52832.build.variant=feather_nrf52832 +feather52832.build.usb_manufacturer="Adafruit LLC" +feather52832.build.usb_product="Feather nRF52832" +feather52832.build.extra_flags=-DNRF52832_XXAA -DNRF52 +feather52832.build.ldscript=nrf52832_s132_v6.ld + +# SofDevice Menu +feather52832.menu.softdevice.s132v6=S132 6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_name=s132 +feather52832.menu.softdevice.s132v6.build.sd_version=6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +feather52832.menu.debug.l0=Level 0 (Release) +feather52832.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52832.menu.debug.l1=Level 1 (Error Message) +feather52832.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52832.menu.debug.l2=Level 2 (Full Debug) +feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52832.menu.debug.l3=Level 3 (Segger SystemView) +feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Bluefruit Feather nRF52840 Express +# ---------------------------------- +feather52840.name=Adafruit Feather nRF52840 Express + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +feather52840.vid.0=0x239A +feather52840.pid.0=0x8029 +feather52840.vid.1=0x239A +feather52840.pid.1=0x0029 +feather52840.vid.2=0x239A +feather52840.pid.2=0x002A +feather52840.vid.3=0x239A +feather52840.pid.3=0x802A + +# Upload +feather52840.bootloader.tool=bootburn +feather52840.upload.tool=nrfutil +feather52840.upload.protocol=nrfutil +feather52840.upload.use_1200bps_touch=true +feather52840.upload.wait_for_upload_port=true +feather52840.upload.maximum_size=815104 +feather52840.upload.maximum_data_size=237568 + +# Build +feather52840.build.mcu=cortex-m4 +feather52840.build.f_cpu=64000000 +feather52840.build.board=NRF52840_FEATHER +feather52840.build.core=nRF5 +feather52840.build.variant=feather_nrf52840_express +feather52840.build.usb_manufacturer="Adafruit LLC" +feather52840.build.usb_product="Feather nRF52840 Express" +feather52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840.build.ldscript=nrf52840_s140_v6.ld +feather52840.build.vid=0x239A +feather52840.build.pid=0x8029 + +# SofDevice Menu +feather52840.menu.softdevice.s140v6=S140 6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_name=s140 +feather52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840.menu.debug.l0=Level 0 (Release) +feather52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840.menu.debug.l1=Level 1 (Error Message) +feather52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840.menu.debug.l2=Level 2 (Full Debug) +feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840.menu.debug.l3=Level 3 (Segger SystemView) +feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + +# ---------------------------------- +# Feather nRF52840 sense +# ---------------------------------- +feather52840sense.name=Adafruit Feather nRF52840 Sense + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +feather52840sense.vid.0=0x239A +feather52840sense.pid.0=0x8087 +feather52840sense.vid.1=0x239A +feather52840sense.pid.1=0x0087 +feather52840sense.vid.2=0x239A +feather52840sense.pid.2=0x0088 +feather52840sense.vid.3=0x239A +feather52840sense.pid.3=0x8088 + +# Upload +feather52840sense.bootloader.tool=bootburn +feather52840sense.upload.tool=nrfutil +feather52840sense.upload.protocol=nrfutil +feather52840sense.upload.use_1200bps_touch=true +feather52840sense.upload.wait_for_upload_port=true +feather52840sense.upload.maximum_size=815104 +feather52840sense.upload.maximum_data_size=237568 + +# Build +feather52840sense.build.mcu=cortex-m4 +feather52840sense.build.f_cpu=64000000 +feather52840sense.build.board=NRF52840_FEATHER_SENSE +feather52840sense.build.core=nRF5 +feather52840sense.build.variant=feather_nrf52840_sense +feather52840sense.build.usb_manufacturer="Adafruit LLC" +feather52840sense.build.usb_product="Feather nRF52840 Sense" +feather52840sense.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840sense.build.ldscript=nrf52840_s140_v6.ld +feather52840sense.build.vid=0x239A +feather52840sense.build.pid=0x8087 + +# SofDevice Menu +feather52840sense.menu.softdevice.s140v6=S140 6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_name=s140 +feather52840sense.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840sense.menu.debug.l0=Level 0 (Release) +feather52840sense.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840sense.menu.debug.l1=Level 1 (Error Message) +feather52840sense.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840sense.menu.debug.l2=Level 2 (Full Debug) +feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840sense.menu.debug.l3=Level 3 (Segger SystemView) +feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + +# --------------------------------------------- +# Bluefruit ItsyBitsy nRF52840 Express +# --------------------------------------------- +itsybitsy52840.name=Adafruit ItsyBitsy nRF52840 Express + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +itsybitsy52840.vid.0=0x239A +itsybitsy52840.pid.0=0x8051 +itsybitsy52840.vid.1=0x239A +itsybitsy52840.pid.1=0x0051 +itsybitsy52840.vid.2=0x239A +itsybitsy52840.pid.2=0x0052 +itsybitsy52840.vid.3=0x239A +itsybitsy52840.pid.3=0x8052 + +# Upload +itsybitsy52840.bootloader.tool=bootburn +itsybitsy52840.upload.tool=nrfutil +itsybitsy52840.upload.protocol=nrfutil +itsybitsy52840.upload.use_1200bps_touch=true +itsybitsy52840.upload.wait_for_upload_port=true +itsybitsy52840.upload.maximum_size=815104 +itsybitsy52840.upload.maximum_data_size=237568 + +# Build +itsybitsy52840.build.mcu=cortex-m4 +itsybitsy52840.build.f_cpu=64000000 +itsybitsy52840.build.board=NRF52840_ITSYBITSY +itsybitsy52840.build.core=nRF5 +itsybitsy52840.build.variant=itsybitsy_nrf52840_express +itsybitsy52840.build.usb_manufacturer="Adafruit LLC" +itsybitsy52840.build.usb_product="ItsyBitsy nRF52840 Express" +itsybitsy52840.build.extra_flags=-DNRF52840_XXAA -DARDUINO_NRF52_ITSYBITSY {build.flags.usb} +itsybitsy52840.build.ldscript=nrf52840_s140_v6.ld +itsybitsy52840.build.vid=0x239A +itsybitsy52840.build.pid=0x8051 + +# SofDevice Menu +itsybitsy52840.menu.softdevice.s140v6=0.2.11 SoftDevice s140 6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_name=s140 +itsybitsy52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +itsybitsy52840.menu.debug.l0=Level 0 (Release) +itsybitsy52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +itsybitsy52840.menu.debug.l1=Level 1 (Error Message) +itsybitsy52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +itsybitsy52840.menu.debug.l2=Level 2 (Full Debug) +itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView) +itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# --------------------------------------------- +# Bluefruit Circuit Playground nRF52840 Express +# --------------------------------------------- +cplaynrf52840.name=Adafruit Circuit Playground Bluefruit + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +cplaynrf52840.vid.0=0x239A +cplaynrf52840.pid.0=0x8045 +cplaynrf52840.vid.1=0x239A +cplaynrf52840.pid.1=0x0045 +cplaynrf52840.vid.2=0x239A +cplaynrf52840.pid.2=0x0046 +cplaynrf52840.vid.3=0x239A +cplaynrf52840.pid.3=0x8046 + +# Upload +cplaynrf52840.bootloader.tool=bootburn +cplaynrf52840.upload.tool=nrfutil +cplaynrf52840.upload.protocol=nrfutil +cplaynrf52840.upload.use_1200bps_touch=true +cplaynrf52840.upload.wait_for_upload_port=true +cplaynrf52840.upload.maximum_size=815104 +cplaynrf52840.upload.maximum_data_size=237568 + +# Build +cplaynrf52840.build.mcu=cortex-m4 +cplaynrf52840.build.f_cpu=64000000 +cplaynrf52840.build.board=NRF52840_CIRCUITPLAY +cplaynrf52840.build.core=nRF5 +cplaynrf52840.build.variant=circuitplayground_nrf52840 +cplaynrf52840.build.usb_manufacturer="Adafruit LLC" +cplaynrf52840.build.usb_product="Circuit Playground Bluefruit" +cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld +cplaynrf52840.build.vid=0x239A +cplaynrf52840.build.pid=0x8045 + +# SofDevice Menu +cplaynrf52840.menu.softdevice.s140v6=S140 6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cplaynrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cplaynrf52840.menu.debug.l0=Level 0 (Release) +cplaynrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cplaynrf52840.menu.debug.l1=Level 1 (Error Message) +cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cplaynrf52840.menu.debug.l2=Level 2 (Full Debug) +cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + +# --------------------------------------------- +# Clue nRF52840 +# --------------------------------------------- +cluenrf52840.name=Adafruit CLUE + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +cluenrf52840.vid.0=0x239A +cluenrf52840.pid.0=0x8072 +cluenrf52840.vid.1=0x239A +cluenrf52840.pid.1=0x0072 +cluenrf52840.vid.2=0x239A +cluenrf52840.pid.2=0x0071 +cluenrf52840.vid.3=0x239A +cluenrf52840.pid.3=0x8071 + +# Upload +cluenrf52840.bootloader.tool=bootburn +cluenrf52840.upload.tool=nrfutil +cluenrf52840.upload.protocol=nrfutil +cluenrf52840.upload.use_1200bps_touch=true +cluenrf52840.upload.wait_for_upload_port=true +cluenrf52840.upload.maximum_size=815104 +cluenrf52840.upload.maximum_data_size=237568 + +# Build +cluenrf52840.build.mcu=cortex-m4 +cluenrf52840.build.f_cpu=64000000 +cluenrf52840.build.board=NRF52840_CLUE +cluenrf52840.build.core=nRF5 +cluenrf52840.build.variant=clue_nrf52840 +cluenrf52840.build.usb_manufacturer="Adafruit LLC" +cluenrf52840.build.usb_product="CLUE" +cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cluenrf52840.build.ldscript=nrf52840_s140_v6.ld +cluenrf52840.build.vid=0x239A +cluenrf52840.build.pid=0x8071 + +# SofDevice Menu +cluenrf52840.menu.softdevice.s140v6=S140 6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cluenrf52840.menu.debug.l0=Level 0 (Release) +cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cluenrf52840.menu.debug.l1=Level 1 (Error Message) +cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cluenrf52840.menu.debug.l2=Level 2 (Full Debug) +cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Metro nRF52840 Express +# ---------------------------------- +metro52840.name=Adafruit Metro nRF52840 Express + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +metro52840.vid.0=0x239A +metro52840.pid.0=0x803F +metro52840.vid.1=0x239A +metro52840.pid.1=0x003F +metro52840.vid.2=0x239A +metro52840.pid.2=0x0040 +metro52840.vid.3=0x239A +metro52840.pid.3=0x8040 + +# Upload +metro52840.bootloader.tool=bootburn +metro52840.upload.tool=nrfutil +metro52840.upload.protocol=nrfutil +metro52840.upload.use_1200bps_touch=true +metro52840.upload.wait_for_upload_port=true +metro52840.upload.maximum_size=815104 +metro52840.upload.maximum_data_size=237568 + +# Build +metro52840.build.mcu=cortex-m4 +metro52840.build.f_cpu=64000000 +metro52840.build.board=NRF52840_METRO +metro52840.build.core=nRF5 +metro52840.build.variant=metro_nrf52840_express +metro52840.build.usb_manufacturer="Adafruit LLC" +metro52840.build.usb_product="Metro nRF52840 Express" +metro52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +metro52840.build.ldscript=nrf52840_s140_v6.ld +metro52840.build.vid=0x239A +metro52840.build.pid=0x803F + +# SofDevice Menu +metro52840.menu.softdevice.s140v6=S140 6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_name=s140 +metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +metro52840.menu.debug.l0=Level 0 (Release) +metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +metro52840.menu.debug.l1=Level 1 (Error Message) +metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +metro52840.menu.debug.l2=Level 2 (Full Debug) +metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +metro52840.menu.debug.l3=Level 3 (Segger SystemView) +metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + + + +# ------------------------------------------------------- +# +# Boards that aren't made by Adafruit +# +# ------------------------------------------------------- + + +# ---------------------------------- +# Nordic nRF52840DK (PCA10056) +# ---------------------------------- +pca10056.name=Nordic nRF52840DK (PCA10056) +pca10056.bootloader.tool=bootburn + +# Upload +pca10056.upload.tool=nrfutil +pca10056.upload.protocol=nrfutil +pca10056.upload.use_1200bps_touch=true +pca10056.upload.wait_for_upload_port=true +pca10056.upload.maximum_size=815104 +pca10056.upload.maximum_data_size=237568 + +# Build +pca10056.build.mcu=cortex-m4 +pca10056.build.f_cpu=64000000 +pca10056.build.board=NRF52840_PCA10056 +pca10056.build.core=nRF5 +pca10056.build.variant=pca10056 +pca10056.build.usb_manufacturer="Nordic" +pca10056.build.usb_product="nRF52840 DK" +pca10056.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +pca10056.build.ldscript=nrf52840_s140_v6.ld +pca10056.build.vid=0x239A +pca10056.build.pid=0x8029 + +# SofDevice Menu +pca10056.menu.softdevice.s140v6=S140 6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_name=s140 +pca10056.menu.softdevice.s140v6.build.sd_version=6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +pca10056.menu.debug.l0=Level 0 (Release) +pca10056.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +pca10056.menu.debug.l1=Level 1 (Error Message) +pca10056.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +pca10056.menu.debug.l2=Level 2 (Full Debug) +pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +pca10056.menu.debug.l3=Level 3 (Segger SystemView) +pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Particle Xenon +# ---------------------------------- +particle_xenon.name=Particle Xenon + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +particle_xenon.vid.0=0x239A +particle_xenon.pid.0=0x8029 +particle_xenon.vid.1=0x239A +particle_xenon.pid.1=0x0029 +particle_xenon.vid.2=0x239A +particle_xenon.pid.2=0x002A +particle_xenon.vid.3=0x239A +particle_xenon.pid.3=0x802A + +# Upload +particle_xenon.bootloader.tool=bootburn +particle_xenon.upload.tool=nrfutil +particle_xenon.upload.protocol=nrfutil +particle_xenon.upload.use_1200bps_touch=true +particle_xenon.upload.wait_for_upload_port=true +particle_xenon.upload.maximum_size=815104 +particle_xenon.upload.maximum_data_size=237568 + +# Build +particle_xenon.build.mcu=cortex-m4 +particle_xenon.build.f_cpu=64000000 +particle_xenon.build.board=PARTICLE_XENON +particle_xenon.build.core=nRF5 +particle_xenon.build.variant=particle_xenon +particle_xenon.build.usb_manufacturer="Particle Industries" +particle_xenon.build.usb_product="Particle Xenon" +particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +particle_xenon.build.ldscript=nrf52840_s140_v6.ld +particle_xenon.build.vid=0x239A +particle_xenon.build.pid=0x8029 + +# SofDevice Menu +particle_xenon.menu.softdevice.s140v6=S140 6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_name=s140 +particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +particle_xenon.menu.debug.l0=Level 0 (Release) +particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +particle_xenon.menu.debug.l1=Level 1 (Error Message) +particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +particle_xenon.menu.debug.l2=Level 2 (Full Debug) +particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +particle_xenon.menu.debug.l3=Level 3 (Segger SystemView) +particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Raytac MDBT50Q - RX +# ---------------------------------- +mdbt50qrx.name=Raytac MDBT50Q-RX Dongle + +# VID/PID for bootloader, Arduino + Circuitpython App +mdbt50qrx.vid.0=0x239A +mdbt50qrx.pid.0=0x810B +mdbt50qrx.vid.1=0x239A +mdbt50qrx.pid.1=0x010B +mdbt50qrx.vid.2=0x239A +mdbt50qrx.pid.2=0x810C + +# Upload +mdbt50qrx.bootloader.tool=bootburn +mdbt50qrx.upload.tool=nrfutil +mdbt50qrx.upload.protocol=nrfutil +mdbt50qrx.upload.use_1200bps_touch=true +mdbt50qrx.upload.wait_for_upload_port=true +mdbt50qrx.upload.maximum_size=815104 +mdbt50qrx.upload.maximum_data_size=237568 + +# Build +mdbt50qrx.build.mcu=cortex-m4 +mdbt50qrx.build.f_cpu=64000000 +mdbt50qrx.build.board=MDBT50Q_RX +mdbt50qrx.build.core=nRF5 +mdbt50qrx.build.variant=raytac_mdbt50q_rx +mdbt50qrx.build.usb_manufacturer="Raytac" +mdbt50qrx.build.usb_product="nRF52840 Dongle" +mdbt50qrx.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +mdbt50qrx.build.ldscript=nrf52840_s140_v6.ld +mdbt50qrx.build.vid=0x239A +mdbt50qrx.build.pid=0x810B + +# SofDevice Menu +mdbt50qrx.menu.softdevice.s140v6=S140 6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_name=s140 +mdbt50qrx.menu.softdevice.s140v6.build.sd_version=6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +mdbt50qrx.menu.debug.l0=Level 0 (Release) +mdbt50qrx.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +mdbt50qrx.menu.debug.l1=Level 1 (Error Message) +mdbt50qrx.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +mdbt50qrx.menu.debug.l2=Level 2 (Full Debug) +mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView) +mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# NINA B302 +# ---------------------------------- +ninab302.name=NINA B302 ublox + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +ninab302.vid.0=0x239A +ninab302.pid.0=0x8029 +ninab302.vid.1=0x239A +ninab302.pid.1=0x0029 +ninab302.vid.2=0x7239A +ninab302.pid.2=0x002A +ninab302.vid.3=0x239A +ninab302.pid.3=0x802A + +# Upload +ninab302.bootloader.tool=bootburn +ninab302.upload.tool=nrfutil +ninab302.upload.protocol=nrfutil +ninab302.upload.use_1200bps_touch=true +ninab302.upload.wait_for_upload_port=true +ninab302.upload.maximum_size=815104 +ninab302.upload.maximum_data_size=237568 + +# Build +ninab302.build.mcu=cortex-m4 +ninab302.build.f_cpu=64000000 +ninab302.build.board=NINA_B302_ublox +ninab302.build.core=nRF5 +ninab302.build.variant=NINA_B302_ublox +ninab302.build.usb_manufacturer="Nordic" +ninab302.build.usb_product="NINA B302 ublox" +ninab302.build.extra_flags=-DNRF52840_XXAA -DNINA_B302_ublox {build.flags.usb} +ninab302.build.ldscript=nrf52840_s140_v6.ld +ninab302.build.vid=0x239A +ninab302.build.pid=0x8029 + +# SofDevice Menu +ninab302.menu.softdevice.s140v6=0.3.2 SoftDevice s140 6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_name=s140 +ninab302.menu.softdevice.s140v6.build.sd_version=6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +ninab302.menu.debug.l0=Level 0 (Release) +ninab302.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab302.menu.debug.l1=Level 1 (Error Message) +ninab302.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab302.menu.debug.l2=Level 2 (Full Debug) +ninab302.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab302.menu.debug.l3=Level 3 (Segger SystemView) +ninab302.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab302.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# NINA B112 +# ---------------------------------- +ninab112.name=NINA B112 ublox +ninab112.bootloader.tool=bootburn + +# Upload +ninab112.upload.tool=nrfutil +ninab112.upload.protocol=nrfutil +ninab112.upload.use_1200bps_touch=false +ninab112.upload.wait_for_upload_port=false +ninab112.upload.native_usb=false +ninab112.upload.maximum_size=290816 +ninab112.upload.maximum_data_size=52224 + +# Build +ninab112.build.mcu=cortex-m4 +ninab112.build.f_cpu=64000000 +ninab112.build.board=NINA_B112_ublox +ninab112.build.core=nRF5 +ninab112.build.variant=NINA_B112_ublox +feather52840.build.usb_manufacturer="Adafruit LLC" +feather52840.build.usb_product="Feather nRF52832" +ninab112.build.extra_flags=-DNRF52832_XXAA -DNINA_B112_ublox -DNRF52 +ninab112.build.ldscript=nrf52832_s132_v6.ld + +# SofDevice Menu +ninab112.menu.softdevice.s132v6=0.3.2 SoftDevice s132 6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_name=s132 +ninab112.menu.softdevice.s132v6.build.sd_version=6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +ninab112.menu.debug.l0=Level 0 (Release) +ninab112.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab112.menu.debug.l1=Level 1 (Error Message) +ninab112.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab112.menu.debug.l2=Level 2 (Full Debug) +ninab112.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab112.menu.debug.l3=Level 3 (Segger SystemView) +ninab112.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab112.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +################################################################## +## KH Add SparkFun Pro nRF52840 Mini +################################################################## +#********************************************** +# SparkFun Pro nRF52840 Mini +#********************************************** +sparkfunnrf52840mini.name=SparkFun Pro nRF52840 Mini + +# DFU Mode with CDC only +sparkfunnrf52840mini.vid.0=0x1B4F +sparkfunnrf52840mini.pid.0=0x002A + +# DFU Mode with CDC + MSC (UF2) +sparkfunnrf52840mini.vid.1=0x1B4F +sparkfunnrf52840mini.pid.1=0x0029 + +# Application with CDC + MSC +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x8029 + +# CircuitPython +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x802A + +sparkfunnrf52840mini.bootloader.tool=bootburn + +# Upload +sparkfunnrf52840mini.upload.tool=nrfutil +sparkfunnrf52840mini.upload.protocol=nrfutil +sparkfunnrf52840mini.upload.use_1200bps_touch=true +sparkfunnrf52840mini.upload.wait_for_upload_port=true +#sparkfunnrf52840mini.upload.native_usb=true + +# Build +sparkfunnrf52840mini.build.mcu=cortex-m4 +sparkfunnrf52840mini.build.f_cpu=64000000 +sparkfunnrf52840mini.build.board=NRF52840_FEATHER +sparkfunnrf52840mini.build.core=nRF5 +sparkfunnrf52840mini.build.variant=sparkfun_nrf52840_mini +sparkfunnrf52840mini.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +sparkfunnrf52840mini.build.vid=0x1B4F +sparkfunnrf52840mini.build.pid=0x5284 +sparkfunnrf52840mini.build.usb_manufacturer="SparkFun" +sparkfunnrf52840mini.build.usb_product="nRF52840 Mini Breakout" + +# SofDevice Menu +# Ram & ROM size varies depending on SoftDevice (check linker script) + +sparkfunnrf52840mini.menu.softdevice.s140v6=s140 6.1.1 r0 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_flags=-DS140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_name=s140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_version=6.1.1 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_fwid=0x00B6 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.ldscript=nrf52840_s140_v6.ld +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_size=815104 +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_data_size=248832 + +# Debug Menu +sparkfunnrf52840mini.menu.debug.l0=Level 0 (Release) +sparkfunnrf52840mini.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os +sparkfunnrf52840mini.menu.debug.l1=Level 1 (Error Message) +sparkfunnrf52840mini.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os +sparkfunnrf52840mini.menu.debug.l2=Level 2 (Full Debug) +sparkfunnrf52840mini.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os +sparkfunnrf52840mini.menu.debug.l3=Level 3 (Segger SystemView) +sparkfunnrf52840mini.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os + +################################################################## diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp new file mode 100644 index 0000000..d2db957 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. 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 + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Print.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Print.h new file mode 100644 index 0000000..d03d1cc --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Print.h @@ -0,0 +1,123 @@ +/* + Copyright (c) 2016 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 +*/ + +#pragma once + +#include +#include // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Udp.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Udp.h new file mode 100644 index 0000000..c2d5824 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Udp.h @@ -0,0 +1,100 @@ +/* + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ + +#ifndef udp_h +#define udp_h + +#include +#include + +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = + 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + + // KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + + virtual void stop() = 0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; +}; + +#endif diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/platform.txt b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/platform.txt new file mode 100644 index 0000000..8e858fa --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/platform.txt @@ -0,0 +1,167 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. All rights 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 + +name=Adafruit nRF52 Boards +version=1.0.0 + +# Compile variables +# ----------------- + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall +compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith + +# Allow changing optimization settings via platform.local.txt / boards.local.txt +compiler.optimization_flag=-Ofast + +compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD + +# KH, Error here to use gcc, must use g++ +#compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.cmd=arm-none-eabi-g++ + +compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp + +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2bin.flags=-O binary +compiler.elf2bin.cmd=arm-none-eabi-objcopy +compiler.elf2hex.flags=-O ihex +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align --specs=nano.specs --specs=nosys.specs +compiler.size.cmd=arm-none-eabi-size + +# this can be overriden in boards.txt +build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float +build.debug_flags=-DCFG_DEBUG=0 +build.logger_flags=-DCFG_LOGGER=1 +build.sysview_flags=-DCFG_SYSVIEW=0 + +# USB flags +build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.libraries.ldflags= +compiler.elf2bin.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math + +# common compiler for nrf +rtos.path={build.core.path}/freertos +nordic.path={build.core.path}/nordic + +# build.logger_flags and build.sysview_flags are intentionally empty, +# to allow modification via a user's own boards.local.txt or platform.local.txt files. +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino" + +# Compile patterns +# ---------------- + +## Compile c files +## KH Add -DBOARD_NAME="{build.board}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +## KH Add -DBOARD_NAME="{build.board}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +## KH Add -DBOARD_NAME="{build.board}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Create archives +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group + +## Create output (bin file) +#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Create dfu package zip file +recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" + +## Create uf2 file +#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" + +## Save bin +recipe.output.tmp_file_bin={build.project_name}.bin +recipe.output.save_file_bin={build.project_name}.save.bin + +## Save hex +recipe.output.tmp_file_hex={build.project_name}.hex +recipe.output.save_file_hexu={build.project_name}.save.hex + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* + +## Export Compiled Binary +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + +#*************************************************** +# adafruit-nrfutil for uploading +# https://github.com/adafruit/Adafruit_nRF52_nrfutil +# pre-built binaries are provided for macos and windows +#*************************************************** +tools.nrfutil.cmd=adafruit-nrfutil +tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe +tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil + +tools.nrfutil.upload.params.verbose=--verbose +tools.nrfutil.upload.params.quiet= +tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank + +#*************************************************** +# Burning bootloader with either jlink or nrfutil +#*************************************************** + +# Bootloader version +tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.1_{build.sd_name}_{build.sd_version} + +tools.bootburn.bootloader.params.verbose= +tools.bootburn.bootloader.params.quiet= +tools.bootburn.bootloader.pattern={program.burn_pattern} + +# erase flash page while programming +tools.bootburn.erase.params.verbose= +tools.bootburn.erase.params.quiet= +tools.bootburn.erase.pattern= + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.cpp new file mode 100644 index 0000000..63d3f4d --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.cpp @@ -0,0 +1,60 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" + +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 5, // D0 is P0.05 (UART RX) + 6, // D1 is P0.06 (UART TX) + 7, // D2 is P0.07 + 31, // D3 is P0.31 + 18, // D4 is P0.18 (LED Blue) + 99, // D5 (NC) + 9, // D6 is P0.09 NFC1 + 10, // D7 is P0.10 (Button) NFC2 + 99, // D8 (NC) + 8, // D9 is P0.08 + 11, // D10 is P0.11 CS + 13, // D11 is P0.13 MOSI + 12, // D12 is P0.12 MISO + 14, // D13 is P0.14 SCK + //I2C + 2, // D14 is P0.2 (SDA) + 3, // D15 is P0.3 (SCL) + // D16 .. D21 (aka A0 .. A5) + 3, // D16 is P0.03 (A0) + 2, // D17 is P0.02 (A1) + 4, // D18 is P0.04 (A2) + 30, // D19 is P0.30 (A3) SW2 + 29, // D20 is P0.29 (A4) + 28, // D21 is P0.28 (A5) + 9, // P0.09 NFC + 10, // P0.10 NFC + 16, // SW1 (LED Green) +}; \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.h new file mode 100644 index 0000000..caa0b61 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.h @@ -0,0 +1,172 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +#ifndef _VARIANT_NINA_B112_UBLOX_ +#define _VARIANT_NINA_B112_UBLOX_ + +#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ + .rc_ctiv = 0, \ +.rc_temp_ctiv = 0, \ +.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LED LED1 +#define LED_BUILTIN PIN_LED + +//LEDs onboard +#define LED1 (0) // Red +#define LED2 (24) // Green/SW1 +#define LED3 (4) // Blue + +#define LED_STATE_ON 1 // State when LED is litted + +//Switch +#define SW1 (24) +#define SW2 (19) + +// NFC +#define PIN_NFC_1 (6) // P0.9 +#define PIN_NFC_2 (7) // P0.10 + +/* + Analog pins +*/ +#define PIN_A0 (16) // P0.03 +#define PIN_A1 (17) // P0.02 +#define PIN_A2 (18) // P0.04 +#define PIN_A3 (19) // P0.30 +#define PIN_A4 (20) // P0.29 +#define PIN_A5 (21) // P0.28 + +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 14 + +#define PIN_D0 (0) // P0.05 +#define PIN_D1 (1) // P0.06 +#define PIN_D2 (2) // P0.07 +#define PIN_D3 (4) // P0.31 +#define PIN_D4 (5) // P0.18 +#define PIN_D6 (6) // P0.09 +#define PIN_D7 (7) // P0.10 +#define PIN_D9 (9) // P0.08 +#define PIN_D10 (11) // P0.11 +#define PIN_D11 (13) // P0.13 +#define PIN_D12 (12) // P0.12 +#define PIN_D13 (14) // P0.14 +#define PIN_D14 (2) // P0.02 +#define PIN_D15 (3) // P0.03 + +static const uint8_t D0 = PIN_D0 ; +static const uint8_t D1 = PIN_D1 ; +static const uint8_t D2 = PIN_D2 ; +static const uint8_t D3 = PIN_D3 ; +static const uint8_t D4 = PIN_D4 ; +static const uint8_t D6 = PIN_D6 ; +static const uint8_t D7 = PIN_D7 ; +static const uint8_t D9 = PIN_D9 ; +static const uint8_t D10 = PIN_D10 ; +static const uint8_t D11 = PIN_D11 ; +static const uint8_t D12 = PIN_D12 ; +static const uint8_t D13 = PIN_D13 ; +static const uint8_t D14 = PIN_D14 ; +static const uint8_t D15 = PIN_D15 ; + +// Other pins +//static const uint8_t AREF = PIN_AREF; + +//#define PIN_AREF (24) +//#define PIN_VBAT PIN_A7 + +/* + Serial interfaces +*/ +#define PIN_SERIAL_RX (0) // P0.05 +#define PIN_SERIAL_TX (1) // P0.06 +#define PIN_SERIAL_CTS (2) // P0.07 +#define PIN_SERIAL_RTS (3) // P0.31 +#define PIN_SERIAL_DTR (28) // P0.28 +#define PIN_SERIAL_DSR (29) // P0.29 + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (12) // P0.12 +#define PIN_SPI_MOSI (11) // P0.13 +#define PIN_SPI_SCK (13) // P0.14 + +static const uint8_t SS = 10 ; // P0.11 +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 (14) // P0.02 +#define PIN_WIRE_SCL (15) // P0.03 + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + + +#endif //_VARIANT_NINA_B112_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/variant.cpp new file mode 100644 index 0000000..7f317d6 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/variant.cpp @@ -0,0 +1,87 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#include "variant.h" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 29, // D0 is P0.29 (UART RX) + 45, // D1 is P1.13 (UART TX) + 44, // D2 is P1.12 (NFC2) + 31, // D3 is P0.31 (LED1) + 13, // D4 is P0.13 (LED2) + 11, // D5 is P0.11 + 9, // D6 is P0.09 + 10, // D7 is P0.10 (Button) + 41, // D8 is P1.09 + 12, // D9 is P0.12 + 14, // D10 is P0.14 + 15, // D11 is P0.15 + 32, // D12 is P1.00 + 7, // D13 is P0.07 + + // D14 .. D21 (aka A0 .. A5) + 4, // D14 is P0.04 (A0) + 30, // D15 is P0.30 (A1) + 5, // D16 is P0.05 (A2) + 2, // D17 is P0.02 (A3) + 28, // D18 is P0.28 (A4) + 3, // D19 is P0.03 (A5) + + // D20 .. D21 (aka I2C pins) + 16, // D20 is P0.16 (SDA) + 24, // D21 is P0.24 (SCL) + + // QSPI pins (not exposed via any header / test point) + 19, // D22 is P0.19 (QSPI CLK) + 17, // D23 is P0.17 (QSPI CS) + 20, // D24 is P0.20 (QSPI Data 0) + 21, // D25 is P0.21 (QSPI Data 1) + 22, // D26 is P0.22 (QSPI Data 2) + 26, // D27 is P0.23 (QSPI Data 3) + + 40, // D28 is P1.08 - IO34 + 41, // D29 is P1.01 - IO35 + 44, // D30 is P1.02 - IO36 + 45, // D31 is P1.03 - IO37 + 42, // D32 is P1.10 - IO38 + 43, // D33 is P1.11 - IO39 + 47, // D34 is P1.15 - IO40 + 46, // D35 is P1.14 - IO41 + 26, // D36 is P0.26 - IO42 + 6, // D37 is P0.6 - IO43 + 27, // D38 is P0.27 - IO44 +}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/variant.h new file mode 100644 index 0000000..d588790 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/variant.h @@ -0,0 +1,149 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#ifndef _VARIANT_NINA_B302_UBLOX_ +#define _VARIANT_NINA_B302_UBLOX_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus +// Number of pins defined in PinDescription array +#define PINS_COUNT (40) +#define NUM_DIGITAL_PINS (34) +#define NUM_ANALOG_INPUTS (6) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (3) +#define PIN_LED2 (4) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +/* + Buttons +*/ +#define PIN_BUTTON1 (7) + +/* + Analog pins +*/ +#define PIN_A0 (14) +#define PIN_A1 (15) +#define PIN_A2 (16) +#define PIN_A3 (17) +#define PIN_A4 (18) +#define PIN_A5 (19) + +#define D0 (0) +#define D1 (1) +#define D2 (2) +#define D3 (3) +#define D4 (4) +#define D5 (5) +#define D6 (6) +#define D7 (7) +#define D8 (8) +#define D9 (9) +#define D10 (10) +#define D11 (11) +#define D12 (12) +#define D13 (13) + +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 14 + +#define PIN_NFC1 (31) +#define PIN_NFC2 (2) + +/* + Serial interfaces +*/ +#define PIN_SERIAL1_RX (0) +#define PIN_SERIAL1_TX (1) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (22) //24 original +#define PIN_SPI_MOSI (23) //25 original +#define PIN_SPI_SCK (24) //26 original + +static const uint8_t SS = (13); +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 (20) +#define PIN_WIRE_SCL (21) + +// QSPI Pins +#define PIN_QSPI_SCK 22 +#define PIN_QSPI_CS 23 +#define PIN_QSPI_IO0 24 +#define PIN_QSPI_IO1 25 +#define PIN_QSPI_IO2 26 +#define PIN_QSPI_IO3 27 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES GD25Q16C +#define EXTERNAL_FLASH_USE_QSPI + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif //_VARIANT_NINA_B302_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.cpp new file mode 100644 index 0000000..534abf3 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.cpp @@ -0,0 +1,49 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // P0 + 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, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 +}; +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.h new file mode 100644 index 0000000..f98c8e0 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.h @@ -0,0 +1,152 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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_SPARKFUN52840MINI_ +#define _VARIANT_SPARKFUN52840MINI_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (64) +#define NUM_DIGITAL_PINS (64) +#define NUM_ANALOG_INPUTS (8) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (7) +#define PIN_LED2 (14) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_BLUE PIN_LED1 +#define LED_RED PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +// Buttons +/* + #define PIN_BUTTON1 (2) + #define PIN_BUTTON2 (3) + #define PIN_BUTTON3 (4) + #define PIN_BUTTON4 (5) +*/ + +/* + Analog pins +*/ +#define PIN_A0 (2) +#define PIN_A1 (3) +#define PIN_A2 (4) +#define PIN_A3 (5) +#define PIN_A4 (28) +#define PIN_A5 (29) +#define PIN_A6 (30) +#define PIN_A7 (31) + +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 ; +static const uint8_t A6 = PIN_A6 ; +static const uint8_t A7 = PIN_A7 ; +#define ADC_RESOLUTION 14 + +// Other pins +#define PIN_AREF (2) +#define PIN_DFU (13) +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +static const uint8_t AREF = PIN_AREF; + +/* + Serial interfaces +*/ +// Serial +//Previous Hardware UART definition for nRF52 Arduino Core, below 0.16.0 +//Feel free to comment out these two lines below if there are conflicts with latest release +#define PIN_SERIAL_RX (15) +#define PIN_SERIAL_TX (17) + +//Hardware UART definition for nRF52 Arduino Core, 0.17.0 and above +#define PIN_SERIAL1_RX (15) +#define PIN_SERIAL1_TX (17) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (31) +#define PIN_SPI_MOSI (3) +#define PIN_SPI_SCK (30) + +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 (8) +#define PIN_WIRE_SCL (11) + +/* + QSPI interface for external flash +*/ +#define PIN_QSPI_SCK 32 +#define PIN_QSPI_CS 33 +#define PIN_QSPI_DATA0 34 +#define PIN_QSPI_DATA1 35 +#define PIN_QSPI_DATA2 36 +#define PIN_QSPI_DATA3 37 + +// On-board QSPI Flash +// If EXTERNAL_FLASH_DEVICES is not defined, all supported devices will be used +#define EXTERNAL_FLASH_DEVICES GD25Q16C + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/boards.txt b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/boards.txt new file mode 100644 index 0000000..c21a831 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/boards.txt @@ -0,0 +1,716 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. 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 + +menu.softdevice=SoftDevice +menu.debug=Debug + +# ---------------------------------- +# Bluefruit Feather nRF52832 +# ---------------------------------- +feather52832.name=Adafruit Feather nRF52832 +feather52832.bootloader.tool=bootburn + +# Upload +feather52832.upload.tool=nrfutil +feather52832.upload.protocol=nrfutil +feather52832.upload.use_1200bps_touch=false +feather52832.upload.wait_for_upload_port=false +feather52832.upload.native_usb=false +feather52832.upload.maximum_size=290816 +feather52832.upload.maximum_data_size=52224 + +# Build +feather52832.build.mcu=cortex-m4 +feather52832.build.f_cpu=64000000 +feather52832.build.board=NRF52832_FEATHER +feather52832.build.core=nRF5 +feather52832.build.variant=feather_nrf52832 +feather52832.build.usb_manufacturer="Adafruit LLC" +feather52832.build.usb_product="Feather nRF52832" +feather52832.build.extra_flags=-DNRF52832_XXAA -DNRF52 +feather52832.build.ldscript=nrf52832_s132_v6.ld + +# SofDevice Menu +feather52832.menu.softdevice.s132v6=S132 6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_name=s132 +feather52832.menu.softdevice.s132v6.build.sd_version=6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +feather52832.menu.debug.l0=Level 0 (Release) +feather52832.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52832.menu.debug.l1=Level 1 (Error Message) +feather52832.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52832.menu.debug.l2=Level 2 (Full Debug) +feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52832.menu.debug.l3=Level 3 (Segger SystemView) +feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Bluefruit Feather nRF52840 Express +# ---------------------------------- +feather52840.name=Adafruit Feather nRF52840 Express + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +feather52840.vid.0=0x239A +feather52840.pid.0=0x8029 +feather52840.vid.1=0x239A +feather52840.pid.1=0x0029 +feather52840.vid.2=0x239A +feather52840.pid.2=0x002A +feather52840.vid.3=0x239A +feather52840.pid.3=0x802A + +# Upload +feather52840.bootloader.tool=bootburn +feather52840.upload.tool=nrfutil +feather52840.upload.protocol=nrfutil +feather52840.upload.use_1200bps_touch=true +feather52840.upload.wait_for_upload_port=true +feather52840.upload.maximum_size=815104 +feather52840.upload.maximum_data_size=237568 + +# Build +feather52840.build.mcu=cortex-m4 +feather52840.build.f_cpu=64000000 +feather52840.build.board=NRF52840_FEATHER +feather52840.build.core=nRF5 +feather52840.build.variant=feather_nrf52840_express +feather52840.build.usb_manufacturer="Adafruit LLC" +feather52840.build.usb_product="Feather nRF52840 Express" +feather52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840.build.ldscript=nrf52840_s140_v6.ld +feather52840.build.vid=0x239A +feather52840.build.pid=0x8029 + +# SofDevice Menu +feather52840.menu.softdevice.s140v6=S140 6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_name=s140 +feather52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840.menu.debug.l0=Level 0 (Release) +feather52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840.menu.debug.l1=Level 1 (Error Message) +feather52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840.menu.debug.l2=Level 2 (Full Debug) +feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840.menu.debug.l3=Level 3 (Segger SystemView) +feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + +# ---------------------------------- +# Feather nRF52840 sense +# ---------------------------------- +feather52840sense.name=Adafruit Feather nRF52840 Sense + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +feather52840sense.vid.0=0x239A +feather52840sense.pid.0=0x8087 +feather52840sense.vid.1=0x239A +feather52840sense.pid.1=0x0087 +feather52840sense.vid.2=0x239A +feather52840sense.pid.2=0x0088 +feather52840sense.vid.3=0x239A +feather52840sense.pid.3=0x8088 + +# Upload +feather52840sense.bootloader.tool=bootburn +feather52840sense.upload.tool=nrfutil +feather52840sense.upload.protocol=nrfutil +feather52840sense.upload.use_1200bps_touch=true +feather52840sense.upload.wait_for_upload_port=true +feather52840sense.upload.maximum_size=815104 +feather52840sense.upload.maximum_data_size=237568 + +# Build +feather52840sense.build.mcu=cortex-m4 +feather52840sense.build.f_cpu=64000000 +feather52840sense.build.board=NRF52840_FEATHER_SENSE +feather52840sense.build.core=nRF5 +feather52840sense.build.variant=feather_nrf52840_sense +feather52840sense.build.usb_manufacturer="Adafruit LLC" +feather52840sense.build.usb_product="Feather nRF52840 Sense" +feather52840sense.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840sense.build.ldscript=nrf52840_s140_v6.ld +feather52840sense.build.vid=0x239A +feather52840sense.build.pid=0x8087 + +# SofDevice Menu +feather52840sense.menu.softdevice.s140v6=S140 6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_name=s140 +feather52840sense.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840sense.menu.debug.l0=Level 0 (Release) +feather52840sense.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840sense.menu.debug.l1=Level 1 (Error Message) +feather52840sense.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840sense.menu.debug.l2=Level 2 (Full Debug) +feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840sense.menu.debug.l3=Level 3 (Segger SystemView) +feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + +# --------------------------------------------- +# Bluefruit ItsyBitsy nRF52840 Express +# --------------------------------------------- +itsybitsy52840.name=Adafruit ItsyBitsy nRF52840 Express + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +itsybitsy52840.vid.0=0x239A +itsybitsy52840.pid.0=0x8051 +itsybitsy52840.vid.1=0x239A +itsybitsy52840.pid.1=0x0051 +itsybitsy52840.vid.2=0x239A +itsybitsy52840.pid.2=0x0052 +itsybitsy52840.vid.3=0x239A +itsybitsy52840.pid.3=0x8052 + +# Upload +itsybitsy52840.bootloader.tool=bootburn +itsybitsy52840.upload.tool=nrfutil +itsybitsy52840.upload.protocol=nrfutil +itsybitsy52840.upload.use_1200bps_touch=true +itsybitsy52840.upload.wait_for_upload_port=true +itsybitsy52840.upload.maximum_size=815104 +itsybitsy52840.upload.maximum_data_size=237568 + +# Build +itsybitsy52840.build.mcu=cortex-m4 +itsybitsy52840.build.f_cpu=64000000 +itsybitsy52840.build.board=NRF52840_ITSYBITSY +itsybitsy52840.build.core=nRF5 +itsybitsy52840.build.variant=itsybitsy_nrf52840_express +itsybitsy52840.build.usb_manufacturer="Adafruit LLC" +itsybitsy52840.build.usb_product="ItsyBitsy nRF52840 Express" +itsybitsy52840.build.extra_flags=-DNRF52840_XXAA -DARDUINO_NRF52_ITSYBITSY {build.flags.usb} +itsybitsy52840.build.ldscript=nrf52840_s140_v6.ld +itsybitsy52840.build.vid=0x239A +itsybitsy52840.build.pid=0x8051 + +# SofDevice Menu +itsybitsy52840.menu.softdevice.s140v6=0.2.11 SoftDevice s140 6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_name=s140 +itsybitsy52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +itsybitsy52840.menu.debug.l0=Level 0 (Release) +itsybitsy52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +itsybitsy52840.menu.debug.l1=Level 1 (Error Message) +itsybitsy52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +itsybitsy52840.menu.debug.l2=Level 2 (Full Debug) +itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView) +itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# --------------------------------------------- +# Bluefruit Circuit Playground nRF52840 Express +# --------------------------------------------- +cplaynrf52840.name=Adafruit Circuit Playground Bluefruit + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +cplaynrf52840.vid.0=0x239A +cplaynrf52840.pid.0=0x8045 +cplaynrf52840.vid.1=0x239A +cplaynrf52840.pid.1=0x0045 +cplaynrf52840.vid.2=0x239A +cplaynrf52840.pid.2=0x0046 +cplaynrf52840.vid.3=0x239A +cplaynrf52840.pid.3=0x8046 + +# Upload +cplaynrf52840.bootloader.tool=bootburn +cplaynrf52840.upload.tool=nrfutil +cplaynrf52840.upload.protocol=nrfutil +cplaynrf52840.upload.use_1200bps_touch=true +cplaynrf52840.upload.wait_for_upload_port=true +cplaynrf52840.upload.maximum_size=815104 +cplaynrf52840.upload.maximum_data_size=237568 + +# Build +cplaynrf52840.build.mcu=cortex-m4 +cplaynrf52840.build.f_cpu=64000000 +cplaynrf52840.build.board=NRF52840_CIRCUITPLAY +cplaynrf52840.build.core=nRF5 +cplaynrf52840.build.variant=circuitplayground_nrf52840 +cplaynrf52840.build.usb_manufacturer="Adafruit LLC" +cplaynrf52840.build.usb_product="Circuit Playground Bluefruit" +cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld +cplaynrf52840.build.vid=0x239A +cplaynrf52840.build.pid=0x8045 + +# SofDevice Menu +cplaynrf52840.menu.softdevice.s140v6=S140 6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cplaynrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cplaynrf52840.menu.debug.l0=Level 0 (Release) +cplaynrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cplaynrf52840.menu.debug.l1=Level 1 (Error Message) +cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cplaynrf52840.menu.debug.l2=Level 2 (Full Debug) +cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + +# --------------------------------------------- +# Clue nRF52840 +# --------------------------------------------- +cluenrf52840.name=Adafruit CLUE + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +cluenrf52840.vid.0=0x239A +cluenrf52840.pid.0=0x8072 +cluenrf52840.vid.1=0x239A +cluenrf52840.pid.1=0x0072 +cluenrf52840.vid.2=0x239A +cluenrf52840.pid.2=0x0071 +cluenrf52840.vid.3=0x239A +cluenrf52840.pid.3=0x8071 + +# Upload +cluenrf52840.bootloader.tool=bootburn +cluenrf52840.upload.tool=nrfutil +cluenrf52840.upload.protocol=nrfutil +cluenrf52840.upload.use_1200bps_touch=true +cluenrf52840.upload.wait_for_upload_port=true +cluenrf52840.upload.maximum_size=815104 +cluenrf52840.upload.maximum_data_size=237568 + +# Build +cluenrf52840.build.mcu=cortex-m4 +cluenrf52840.build.f_cpu=64000000 +cluenrf52840.build.board=NRF52840_CLUE +cluenrf52840.build.core=nRF5 +cluenrf52840.build.variant=clue_nrf52840 +cluenrf52840.build.usb_manufacturer="Adafruit LLC" +cluenrf52840.build.usb_product="CLUE" +cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cluenrf52840.build.ldscript=nrf52840_s140_v6.ld +cluenrf52840.build.vid=0x239A +cluenrf52840.build.pid=0x8071 + +# SofDevice Menu +cluenrf52840.menu.softdevice.s140v6=S140 6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cluenrf52840.menu.debug.l0=Level 0 (Release) +cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cluenrf52840.menu.debug.l1=Level 1 (Error Message) +cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cluenrf52840.menu.debug.l2=Level 2 (Full Debug) +cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Metro nRF52840 Express +# ---------------------------------- +metro52840.name=Adafruit Metro nRF52840 Express + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +metro52840.vid.0=0x239A +metro52840.pid.0=0x803F +metro52840.vid.1=0x239A +metro52840.pid.1=0x003F +metro52840.vid.2=0x239A +metro52840.pid.2=0x0040 +metro52840.vid.3=0x239A +metro52840.pid.3=0x8040 + +# Upload +metro52840.bootloader.tool=bootburn +metro52840.upload.tool=nrfutil +metro52840.upload.protocol=nrfutil +metro52840.upload.use_1200bps_touch=true +metro52840.upload.wait_for_upload_port=true +metro52840.upload.maximum_size=815104 +metro52840.upload.maximum_data_size=237568 + +# Build +metro52840.build.mcu=cortex-m4 +metro52840.build.f_cpu=64000000 +metro52840.build.board=NRF52840_METRO +metro52840.build.core=nRF5 +metro52840.build.variant=metro_nrf52840_express +metro52840.build.usb_manufacturer="Adafruit LLC" +metro52840.build.usb_product="Metro nRF52840 Express" +metro52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +metro52840.build.ldscript=nrf52840_s140_v6.ld +metro52840.build.vid=0x239A +metro52840.build.pid=0x803F + +# SofDevice Menu +metro52840.menu.softdevice.s140v6=S140 6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_name=s140 +metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +metro52840.menu.debug.l0=Level 0 (Release) +metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +metro52840.menu.debug.l1=Level 1 (Error Message) +metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +metro52840.menu.debug.l2=Level 2 (Full Debug) +metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +metro52840.menu.debug.l3=Level 3 (Segger SystemView) +metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + + + + +# ------------------------------------------------------- +# +# Boards that aren't made by Adafruit +# +# ------------------------------------------------------- + + +# ---------------------------------- +# Nordic nRF52840DK (PCA10056) +# ---------------------------------- +pca10056.name=Nordic nRF52840DK (PCA10056) +pca10056.bootloader.tool=bootburn + +# Upload +pca10056.upload.tool=nrfutil +pca10056.upload.protocol=nrfutil +pca10056.upload.use_1200bps_touch=true +pca10056.upload.wait_for_upload_port=true +pca10056.upload.maximum_size=815104 +pca10056.upload.maximum_data_size=237568 + +# Build +pca10056.build.mcu=cortex-m4 +pca10056.build.f_cpu=64000000 +pca10056.build.board=NRF52840_PCA10056 +pca10056.build.core=nRF5 +pca10056.build.variant=pca10056 +pca10056.build.usb_manufacturer="Nordic" +pca10056.build.usb_product="nRF52840 DK" +pca10056.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +pca10056.build.ldscript=nrf52840_s140_v6.ld +pca10056.build.vid=0x239A +pca10056.build.pid=0x8029 + +# SofDevice Menu +pca10056.menu.softdevice.s140v6=S140 6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_name=s140 +pca10056.menu.softdevice.s140v6.build.sd_version=6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +pca10056.menu.debug.l0=Level 0 (Release) +pca10056.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +pca10056.menu.debug.l1=Level 1 (Error Message) +pca10056.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +pca10056.menu.debug.l2=Level 2 (Full Debug) +pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +pca10056.menu.debug.l3=Level 3 (Segger SystemView) +pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Particle Xenon +# ---------------------------------- +particle_xenon.name=Particle Xenon + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +particle_xenon.vid.0=0x239A +particle_xenon.pid.0=0x8029 +particle_xenon.vid.1=0x239A +particle_xenon.pid.1=0x0029 +particle_xenon.vid.2=0x239A +particle_xenon.pid.2=0x002A +particle_xenon.vid.3=0x239A +particle_xenon.pid.3=0x802A + +# Upload +particle_xenon.bootloader.tool=bootburn +particle_xenon.upload.tool=nrfutil +particle_xenon.upload.protocol=nrfutil +particle_xenon.upload.use_1200bps_touch=true +particle_xenon.upload.wait_for_upload_port=true +particle_xenon.upload.maximum_size=815104 +particle_xenon.upload.maximum_data_size=237568 + +# Build +particle_xenon.build.mcu=cortex-m4 +particle_xenon.build.f_cpu=64000000 +particle_xenon.build.board=PARTICLE_XENON +particle_xenon.build.core=nRF5 +particle_xenon.build.variant=particle_xenon +particle_xenon.build.usb_manufacturer="Particle Industries" +particle_xenon.build.usb_product="Particle Xenon" +particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +particle_xenon.build.ldscript=nrf52840_s140_v6.ld +particle_xenon.build.vid=0x239A +particle_xenon.build.pid=0x8029 + +# SofDevice Menu +particle_xenon.menu.softdevice.s140v6=S140 6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_name=s140 +particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +particle_xenon.menu.debug.l0=Level 0 (Release) +particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +particle_xenon.menu.debug.l1=Level 1 (Error Message) +particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +particle_xenon.menu.debug.l2=Level 2 (Full Debug) +particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +particle_xenon.menu.debug.l3=Level 3 (Segger SystemView) +particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# Raytac MDBT50Q - RX +# ---------------------------------- +mdbt50qrx.name=Raytac MDBT50Q-RX Dongle + +# VID/PID for bootloader, Arduino + Circuitpython App +mdbt50qrx.vid.0=0x239A +mdbt50qrx.pid.0=0x810B +mdbt50qrx.vid.1=0x239A +mdbt50qrx.pid.1=0x010B +mdbt50qrx.vid.2=0x239A +mdbt50qrx.pid.2=0x810C + +# Upload +mdbt50qrx.bootloader.tool=bootburn +mdbt50qrx.upload.tool=nrfutil +mdbt50qrx.upload.protocol=nrfutil +mdbt50qrx.upload.use_1200bps_touch=true +mdbt50qrx.upload.wait_for_upload_port=true +mdbt50qrx.upload.maximum_size=815104 +mdbt50qrx.upload.maximum_data_size=237568 + +# Build +mdbt50qrx.build.mcu=cortex-m4 +mdbt50qrx.build.f_cpu=64000000 +mdbt50qrx.build.board=MDBT50Q_RX +mdbt50qrx.build.core=nRF5 +mdbt50qrx.build.variant=raytac_mdbt50q_rx +mdbt50qrx.build.usb_manufacturer="Raytac" +mdbt50qrx.build.usb_product="nRF52840 Dongle" +mdbt50qrx.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +mdbt50qrx.build.ldscript=nrf52840_s140_v6.ld +mdbt50qrx.build.vid=0x239A +mdbt50qrx.build.pid=0x810B + +# SofDevice Menu +mdbt50qrx.menu.softdevice.s140v6=S140 6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_name=s140 +mdbt50qrx.menu.softdevice.s140v6.build.sd_version=6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +mdbt50qrx.menu.debug.l0=Level 0 (Release) +mdbt50qrx.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +mdbt50qrx.menu.debug.l1=Level 1 (Error Message) +mdbt50qrx.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +mdbt50qrx.menu.debug.l2=Level 2 (Full Debug) +mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView) +mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# NINA B302 +# ---------------------------------- +ninab302.name=NINA B302 ublox + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +ninab302.vid.0=0x239A +ninab302.pid.0=0x8029 +ninab302.vid.1=0x239A +ninab302.pid.1=0x0029 +ninab302.vid.2=0x7239A +ninab302.pid.2=0x002A +ninab302.vid.3=0x239A +ninab302.pid.3=0x802A + +# Upload +ninab302.bootloader.tool=bootburn +ninab302.upload.tool=nrfutil +ninab302.upload.protocol=nrfutil +ninab302.upload.use_1200bps_touch=true +ninab302.upload.wait_for_upload_port=true +ninab302.upload.maximum_size=815104 +ninab302.upload.maximum_data_size=237568 + +# Build +ninab302.build.mcu=cortex-m4 +ninab302.build.f_cpu=64000000 +ninab302.build.board=NINA_B302_ublox +ninab302.build.core=nRF5 +ninab302.build.variant=NINA_B302_ublox +ninab302.build.usb_manufacturer="Nordic" +ninab302.build.usb_product="NINA B302 ublox" +ninab302.build.extra_flags=-DNRF52840_XXAA -DNINA_B302_ublox {build.flags.usb} +ninab302.build.ldscript=nrf52840_s140_v6.ld +ninab302.build.vid=0x239A +ninab302.build.pid=0x8029 + +# SofDevice Menu +ninab302.menu.softdevice.s140v6=0.3.2 SoftDevice s140 6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_name=s140 +ninab302.menu.softdevice.s140v6.build.sd_version=6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +ninab302.menu.debug.l0=Level 0 (Release) +ninab302.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab302.menu.debug.l1=Level 1 (Error Message) +ninab302.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab302.menu.debug.l2=Level 2 (Full Debug) +ninab302.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab302.menu.debug.l3=Level 3 (Segger SystemView) +ninab302.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab302.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# NINA B112 +# ---------------------------------- +ninab112.name=NINA B112 ublox +ninab112.bootloader.tool=bootburn + +# Upload +ninab112.upload.tool=nrfutil +ninab112.upload.protocol=nrfutil +ninab112.upload.use_1200bps_touch=false +ninab112.upload.wait_for_upload_port=false +ninab112.upload.native_usb=false +ninab112.upload.maximum_size=290816 +ninab112.upload.maximum_data_size=52224 + +# Build +ninab112.build.mcu=cortex-m4 +ninab112.build.f_cpu=64000000 +ninab112.build.board=NINA_B112_ublox +ninab112.build.core=nRF5 +ninab112.build.variant=NINA_B112_ublox +feather52840.build.usb_manufacturer="Adafruit LLC" +feather52840.build.usb_product="Feather nRF52832" +ninab112.build.extra_flags=-DNRF52832_XXAA -DNINA_B112_ublox -DNRF52 +ninab112.build.ldscript=nrf52832_s132_v6.ld + +# SofDevice Menu +ninab112.menu.softdevice.s132v6=0.3.2 SoftDevice s132 6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_name=s132 +ninab112.menu.softdevice.s132v6.build.sd_version=6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +ninab112.menu.debug.l0=Level 0 (Release) +ninab112.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab112.menu.debug.l1=Level 1 (Error Message) +ninab112.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab112.menu.debug.l2=Level 2 (Full Debug) +ninab112.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab112.menu.debug.l3=Level 3 (Segger SystemView) +ninab112.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab112.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +################################################################## +## KH Add SparkFun Pro nRF52840 Mini +################################################################## +#********************************************** +# SparkFun Pro nRF52840 Mini +#********************************************** +sparkfunnrf52840mini.name=SparkFun Pro nRF52840 Mini + +# DFU Mode with CDC only +sparkfunnrf52840mini.vid.0=0x1B4F +sparkfunnrf52840mini.pid.0=0x002A + +# DFU Mode with CDC + MSC (UF2) +sparkfunnrf52840mini.vid.1=0x1B4F +sparkfunnrf52840mini.pid.1=0x0029 + +# Application with CDC + MSC +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x8029 + +# CircuitPython +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x802A + +sparkfunnrf52840mini.bootloader.tool=bootburn + +# Upload +sparkfunnrf52840mini.upload.tool=nrfutil +sparkfunnrf52840mini.upload.protocol=nrfutil +sparkfunnrf52840mini.upload.use_1200bps_touch=true +sparkfunnrf52840mini.upload.wait_for_upload_port=true +#sparkfunnrf52840mini.upload.native_usb=true + +# Build +sparkfunnrf52840mini.build.mcu=cortex-m4 +sparkfunnrf52840mini.build.f_cpu=64000000 +sparkfunnrf52840mini.build.board=NRF52840_FEATHER +sparkfunnrf52840mini.build.core=nRF5 +sparkfunnrf52840mini.build.variant=sparkfun_nrf52840_mini +sparkfunnrf52840mini.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +sparkfunnrf52840mini.build.vid=0x1B4F +sparkfunnrf52840mini.build.pid=0x5284 +sparkfunnrf52840mini.build.usb_manufacturer="SparkFun" +sparkfunnrf52840mini.build.usb_product="nRF52840 Mini Breakout" + +# SofDevice Menu +# Ram & ROM size varies depending on SoftDevice (check linker script) + +sparkfunnrf52840mini.menu.softdevice.s140v6=s140 6.1.1 r0 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_flags=-DS140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_name=s140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_version=6.1.1 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_fwid=0x00B6 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.ldscript=nrf52840_s140_v6.ld +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_size=815104 +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_data_size=248832 + +# Debug Menu +sparkfunnrf52840mini.menu.debug.l0=Level 0 (Release) +sparkfunnrf52840mini.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os +sparkfunnrf52840mini.menu.debug.l1=Level 1 (Error Message) +sparkfunnrf52840mini.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os +sparkfunnrf52840mini.menu.debug.l2=Level 2 (Full Debug) +sparkfunnrf52840mini.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os +sparkfunnrf52840mini.menu.debug.l3=Level 3 (Segger SystemView) +sparkfunnrf52840mini.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os + +################################################################## diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.cpp new file mode 100644 index 0000000..d2db957 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. 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 + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.h new file mode 100644 index 0000000..d03d1cc --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.h @@ -0,0 +1,123 @@ +/* + Copyright (c) 2016 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 +*/ + +#pragma once + +#include +#include // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Udp.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Udp.h new file mode 100644 index 0000000..c2d5824 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Udp.h @@ -0,0 +1,100 @@ +/* + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ + +#ifndef udp_h +#define udp_h + +#include +#include + +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = + 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + + // KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + + virtual void stop() = 0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; +}; + +#endif diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/platform.txt b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/platform.txt new file mode 100644 index 0000000..34a515e --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/platform.txt @@ -0,0 +1,167 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. All rights 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 + +name=Adafruit nRF52 Boards +version=1.1.0 + +# Compile variables +# ----------------- + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall +compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith + +# Allow changing optimization settings via platform.local.txt / boards.local.txt +compiler.optimization_flag=-Ofast + +compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD + +# KH, Error here to use gcc, must use g++ +#compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.cmd=arm-none-eabi-g++ + +compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp + +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2bin.flags=-O binary +compiler.elf2bin.cmd=arm-none-eabi-objcopy +compiler.elf2hex.flags=-O ihex +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs +compiler.size.cmd=arm-none-eabi-size + +# this can be overriden in boards.txt +build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float +build.debug_flags=-DCFG_DEBUG=0 +build.logger_flags=-DCFG_LOGGER=1 +build.sysview_flags=-DCFG_SYSVIEW=0 + +# USB flags +build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.libraries.ldflags= +compiler.elf2bin.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math + +# common compiler for nrf +rtos.path={build.core.path}/freertos +nordic.path={build.core.path}/nordic + +# build.logger_flags and build.sysview_flags are intentionally empty, +# to allow modification via a user's own boards.local.txt or platform.local.txt files. +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino" + +# Compile patterns +# ---------------- + +## Compile c files +## KH Add -DBOARD_NAME="{build.board}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +## KH Add -DBOARD_NAME="{build.board}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +## KH Add -DBOARD_NAME="{build.board}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Create archives +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group + +## Create output (bin file) +#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Create dfu package zip file +recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" + +## Create uf2 file +#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" + +## Save bin +recipe.output.tmp_file_bin={build.project_name}.bin +recipe.output.save_file_bin={build.project_name}.save.bin + +## Save hex +recipe.output.tmp_file_hex={build.project_name}.hex +recipe.output.save_file_hexu={build.project_name}.save.hex + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* + +## Export Compiled Binary +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + +#*************************************************** +# adafruit-nrfutil for uploading +# https://github.com/adafruit/Adafruit_nRF52_nrfutil +# pre-built binaries are provided for macos and windows +#*************************************************** +tools.nrfutil.cmd=adafruit-nrfutil +tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe +tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil + +tools.nrfutil.upload.params.verbose=--verbose +tools.nrfutil.upload.params.quiet= +tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank + +#*************************************************** +# Burning bootloader with either jlink or nrfutil +#*************************************************** + +# Bootloader version +tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.2_{build.sd_name}_{build.sd_version} + +tools.bootburn.bootloader.params.verbose= +tools.bootburn.bootloader.params.quiet= +tools.bootburn.bootloader.pattern={program.burn_pattern} + +# erase flash page while programming +tools.bootburn.erase.params.verbose= +tools.bootburn.erase.params.quiet= +tools.bootburn.erase.pattern= + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.cpp new file mode 100644 index 0000000..63d3f4d --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.cpp @@ -0,0 +1,60 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" + +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 5, // D0 is P0.05 (UART RX) + 6, // D1 is P0.06 (UART TX) + 7, // D2 is P0.07 + 31, // D3 is P0.31 + 18, // D4 is P0.18 (LED Blue) + 99, // D5 (NC) + 9, // D6 is P0.09 NFC1 + 10, // D7 is P0.10 (Button) NFC2 + 99, // D8 (NC) + 8, // D9 is P0.08 + 11, // D10 is P0.11 CS + 13, // D11 is P0.13 MOSI + 12, // D12 is P0.12 MISO + 14, // D13 is P0.14 SCK + //I2C + 2, // D14 is P0.2 (SDA) + 3, // D15 is P0.3 (SCL) + // D16 .. D21 (aka A0 .. A5) + 3, // D16 is P0.03 (A0) + 2, // D17 is P0.02 (A1) + 4, // D18 is P0.04 (A2) + 30, // D19 is P0.30 (A3) SW2 + 29, // D20 is P0.29 (A4) + 28, // D21 is P0.28 (A5) + 9, // P0.09 NFC + 10, // P0.10 NFC + 16, // SW1 (LED Green) +}; \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.h new file mode 100644 index 0000000..caa0b61 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.h @@ -0,0 +1,172 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +#ifndef _VARIANT_NINA_B112_UBLOX_ +#define _VARIANT_NINA_B112_UBLOX_ + +#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ + .rc_ctiv = 0, \ +.rc_temp_ctiv = 0, \ +.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LED LED1 +#define LED_BUILTIN PIN_LED + +//LEDs onboard +#define LED1 (0) // Red +#define LED2 (24) // Green/SW1 +#define LED3 (4) // Blue + +#define LED_STATE_ON 1 // State when LED is litted + +//Switch +#define SW1 (24) +#define SW2 (19) + +// NFC +#define PIN_NFC_1 (6) // P0.9 +#define PIN_NFC_2 (7) // P0.10 + +/* + Analog pins +*/ +#define PIN_A0 (16) // P0.03 +#define PIN_A1 (17) // P0.02 +#define PIN_A2 (18) // P0.04 +#define PIN_A3 (19) // P0.30 +#define PIN_A4 (20) // P0.29 +#define PIN_A5 (21) // P0.28 + +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 14 + +#define PIN_D0 (0) // P0.05 +#define PIN_D1 (1) // P0.06 +#define PIN_D2 (2) // P0.07 +#define PIN_D3 (4) // P0.31 +#define PIN_D4 (5) // P0.18 +#define PIN_D6 (6) // P0.09 +#define PIN_D7 (7) // P0.10 +#define PIN_D9 (9) // P0.08 +#define PIN_D10 (11) // P0.11 +#define PIN_D11 (13) // P0.13 +#define PIN_D12 (12) // P0.12 +#define PIN_D13 (14) // P0.14 +#define PIN_D14 (2) // P0.02 +#define PIN_D15 (3) // P0.03 + +static const uint8_t D0 = PIN_D0 ; +static const uint8_t D1 = PIN_D1 ; +static const uint8_t D2 = PIN_D2 ; +static const uint8_t D3 = PIN_D3 ; +static const uint8_t D4 = PIN_D4 ; +static const uint8_t D6 = PIN_D6 ; +static const uint8_t D7 = PIN_D7 ; +static const uint8_t D9 = PIN_D9 ; +static const uint8_t D10 = PIN_D10 ; +static const uint8_t D11 = PIN_D11 ; +static const uint8_t D12 = PIN_D12 ; +static const uint8_t D13 = PIN_D13 ; +static const uint8_t D14 = PIN_D14 ; +static const uint8_t D15 = PIN_D15 ; + +// Other pins +//static const uint8_t AREF = PIN_AREF; + +//#define PIN_AREF (24) +//#define PIN_VBAT PIN_A7 + +/* + Serial interfaces +*/ +#define PIN_SERIAL_RX (0) // P0.05 +#define PIN_SERIAL_TX (1) // P0.06 +#define PIN_SERIAL_CTS (2) // P0.07 +#define PIN_SERIAL_RTS (3) // P0.31 +#define PIN_SERIAL_DTR (28) // P0.28 +#define PIN_SERIAL_DSR (29) // P0.29 + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (12) // P0.12 +#define PIN_SPI_MOSI (11) // P0.13 +#define PIN_SPI_SCK (13) // P0.14 + +static const uint8_t SS = 10 ; // P0.11 +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 (14) // P0.02 +#define PIN_WIRE_SCL (15) // P0.03 + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + + +#endif //_VARIANT_NINA_B112_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.cpp new file mode 100644 index 0000000..7f317d6 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.cpp @@ -0,0 +1,87 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#include "variant.h" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 29, // D0 is P0.29 (UART RX) + 45, // D1 is P1.13 (UART TX) + 44, // D2 is P1.12 (NFC2) + 31, // D3 is P0.31 (LED1) + 13, // D4 is P0.13 (LED2) + 11, // D5 is P0.11 + 9, // D6 is P0.09 + 10, // D7 is P0.10 (Button) + 41, // D8 is P1.09 + 12, // D9 is P0.12 + 14, // D10 is P0.14 + 15, // D11 is P0.15 + 32, // D12 is P1.00 + 7, // D13 is P0.07 + + // D14 .. D21 (aka A0 .. A5) + 4, // D14 is P0.04 (A0) + 30, // D15 is P0.30 (A1) + 5, // D16 is P0.05 (A2) + 2, // D17 is P0.02 (A3) + 28, // D18 is P0.28 (A4) + 3, // D19 is P0.03 (A5) + + // D20 .. D21 (aka I2C pins) + 16, // D20 is P0.16 (SDA) + 24, // D21 is P0.24 (SCL) + + // QSPI pins (not exposed via any header / test point) + 19, // D22 is P0.19 (QSPI CLK) + 17, // D23 is P0.17 (QSPI CS) + 20, // D24 is P0.20 (QSPI Data 0) + 21, // D25 is P0.21 (QSPI Data 1) + 22, // D26 is P0.22 (QSPI Data 2) + 26, // D27 is P0.23 (QSPI Data 3) + + 40, // D28 is P1.08 - IO34 + 41, // D29 is P1.01 - IO35 + 44, // D30 is P1.02 - IO36 + 45, // D31 is P1.03 - IO37 + 42, // D32 is P1.10 - IO38 + 43, // D33 is P1.11 - IO39 + 47, // D34 is P1.15 - IO40 + 46, // D35 is P1.14 - IO41 + 26, // D36 is P0.26 - IO42 + 6, // D37 is P0.6 - IO43 + 27, // D38 is P0.27 - IO44 +}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.h new file mode 100644 index 0000000..d588790 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.h @@ -0,0 +1,149 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#ifndef _VARIANT_NINA_B302_UBLOX_ +#define _VARIANT_NINA_B302_UBLOX_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus +// Number of pins defined in PinDescription array +#define PINS_COUNT (40) +#define NUM_DIGITAL_PINS (34) +#define NUM_ANALOG_INPUTS (6) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (3) +#define PIN_LED2 (4) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +/* + Buttons +*/ +#define PIN_BUTTON1 (7) + +/* + Analog pins +*/ +#define PIN_A0 (14) +#define PIN_A1 (15) +#define PIN_A2 (16) +#define PIN_A3 (17) +#define PIN_A4 (18) +#define PIN_A5 (19) + +#define D0 (0) +#define D1 (1) +#define D2 (2) +#define D3 (3) +#define D4 (4) +#define D5 (5) +#define D6 (6) +#define D7 (7) +#define D8 (8) +#define D9 (9) +#define D10 (10) +#define D11 (11) +#define D12 (12) +#define D13 (13) + +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 14 + +#define PIN_NFC1 (31) +#define PIN_NFC2 (2) + +/* + Serial interfaces +*/ +#define PIN_SERIAL1_RX (0) +#define PIN_SERIAL1_TX (1) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (22) //24 original +#define PIN_SPI_MOSI (23) //25 original +#define PIN_SPI_SCK (24) //26 original + +static const uint8_t SS = (13); +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 (20) +#define PIN_WIRE_SCL (21) + +// QSPI Pins +#define PIN_QSPI_SCK 22 +#define PIN_QSPI_CS 23 +#define PIN_QSPI_IO0 24 +#define PIN_QSPI_IO1 25 +#define PIN_QSPI_IO2 26 +#define PIN_QSPI_IO3 27 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES GD25Q16C +#define EXTERNAL_FLASH_USE_QSPI + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif //_VARIANT_NINA_B302_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.cpp new file mode 100644 index 0000000..534abf3 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.cpp @@ -0,0 +1,49 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // P0 + 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, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 +}; +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.h new file mode 100644 index 0000000..f98c8e0 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.h @@ -0,0 +1,152 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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_SPARKFUN52840MINI_ +#define _VARIANT_SPARKFUN52840MINI_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (64) +#define NUM_DIGITAL_PINS (64) +#define NUM_ANALOG_INPUTS (8) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (7) +#define PIN_LED2 (14) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_BLUE PIN_LED1 +#define LED_RED PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +// Buttons +/* + #define PIN_BUTTON1 (2) + #define PIN_BUTTON2 (3) + #define PIN_BUTTON3 (4) + #define PIN_BUTTON4 (5) +*/ + +/* + Analog pins +*/ +#define PIN_A0 (2) +#define PIN_A1 (3) +#define PIN_A2 (4) +#define PIN_A3 (5) +#define PIN_A4 (28) +#define PIN_A5 (29) +#define PIN_A6 (30) +#define PIN_A7 (31) + +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 ; +static const uint8_t A6 = PIN_A6 ; +static const uint8_t A7 = PIN_A7 ; +#define ADC_RESOLUTION 14 + +// Other pins +#define PIN_AREF (2) +#define PIN_DFU (13) +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +static const uint8_t AREF = PIN_AREF; + +/* + Serial interfaces +*/ +// Serial +//Previous Hardware UART definition for nRF52 Arduino Core, below 0.16.0 +//Feel free to comment out these two lines below if there are conflicts with latest release +#define PIN_SERIAL_RX (15) +#define PIN_SERIAL_TX (17) + +//Hardware UART definition for nRF52 Arduino Core, 0.17.0 and above +#define PIN_SERIAL1_RX (15) +#define PIN_SERIAL1_TX (17) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (31) +#define PIN_SPI_MOSI (3) +#define PIN_SPI_SCK (30) + +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 (8) +#define PIN_WIRE_SCL (11) + +/* + QSPI interface for external flash +*/ +#define PIN_QSPI_SCK 32 +#define PIN_QSPI_CS 33 +#define PIN_QSPI_DATA0 34 +#define PIN_QSPI_DATA1 35 +#define PIN_QSPI_DATA2 36 +#define PIN_QSPI_DATA3 37 + +// On-board QSPI Flash +// If EXTERNAL_FLASH_DEVICES is not defined, all supported devices will be used +#define EXTERNAL_FLASH_DEVICES GD25Q16C + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/boards.txt b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/boards.txt new file mode 100644 index 0000000..541eb10 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/boards.txt @@ -0,0 +1,834 @@ +menu.softdevice=SoftDevice +menu.debug=Debug +menu.debug_output=Debug Output + +# ----------------------------------- +# Adafruit Feather nRF52832 +# ----------------------------------- +feather52832.name=Adafruit Feather nRF52832 + +# VID/PID for Bootloader, Arduino & CircuitPython + +# Upload +feather52832.bootloader.tool=bootburn +feather52832.upload.tool=nrfutil +feather52832.upload.protocol=nrfutil +feather52832.upload.use_1200bps_touch=false +feather52832.upload.wait_for_upload_port=false +feather52832.upload.native_usb=false +feather52832.upload.maximum_size=290816 +feather52832.upload.maximum_data_size=52224 + +# Build +feather52832.build.mcu=cortex-m4 +feather52832.build.f_cpu=64000000 +feather52832.build.board=NRF52832_FEATHER +feather52832.build.core=nRF5 +feather52832.build.variant=feather_nrf52832 +feather52832.build.usb_manufacturer="Adafruit" +feather52832.build.usb_product="Feather nRF52832" +feather52832.build.extra_flags=-DNRF52832_XXAA -DNRF52 +feather52832.build.ldscript=nrf52832_s132_v6.ld + +# SoftDevice Menu +feather52832.menu.softdevice.s132v6=S132 6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_name=s132 +feather52832.menu.softdevice.s132v6.build.sd_version=6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +feather52832.menu.debug.l0=Level 0 (Release) +feather52832.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52832.menu.debug.l1=Level 1 (Error Message) +feather52832.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52832.menu.debug.l2=Level 2 (Full Debug) +feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52832.menu.debug.l3=Level 3 (Segger SystemView) +feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +feather52832.menu.debug_output.serial=Serial +feather52832.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +feather52832.menu.debug_output.serial1=Serial1 +feather52832.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +feather52832.menu.debug_output.rtt=Segger RTT +feather52832.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Feather nRF52840 Express +# ----------------------------------- +feather52840.name=Adafruit Feather nRF52840 Express + +# VID/PID for Bootloader, Arduino & CircuitPython +feather52840.vid.0=0x239A +feather52840.pid.0=0x8029 +feather52840.vid.1=0x239A +feather52840.pid.1=0x0029 +feather52840.vid.2=0x239A +feather52840.pid.2=0x002A +feather52840.vid.3=0x239A +feather52840.pid.3=0x802A + +# Upload +feather52840.bootloader.tool=bootburn +feather52840.upload.tool=nrfutil +feather52840.upload.protocol=nrfutil +feather52840.upload.use_1200bps_touch=true +feather52840.upload.wait_for_upload_port=true +feather52840.upload.maximum_size=815104 +feather52840.upload.maximum_data_size=237568 + +# Build +feather52840.build.mcu=cortex-m4 +feather52840.build.f_cpu=64000000 +feather52840.build.board=NRF52840_FEATHER +feather52840.build.core=nRF5 +feather52840.build.variant=feather_nrf52840_express +feather52840.build.usb_manufacturer="Adafruit" +feather52840.build.usb_product="Feather nRF52840 Express" +feather52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840.build.ldscript=nrf52840_s140_v6.ld +feather52840.build.vid=0x239A +feather52840.build.pid=0x8029 + +# SoftDevice Menu +feather52840.menu.softdevice.s140v6=S140 6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_name=s140 +feather52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840.menu.debug.l0=Level 0 (Release) +feather52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840.menu.debug.l1=Level 1 (Error Message) +feather52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840.menu.debug.l2=Level 2 (Full Debug) +feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840.menu.debug.l3=Level 3 (Segger SystemView) +feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +feather52840.menu.debug_output.serial=Serial +feather52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +feather52840.menu.debug_output.serial1=Serial1 +feather52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +feather52840.menu.debug_output.rtt=Segger RTT +feather52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Feather nRF52840 Sense +# ----------------------------------- +feather52840sense.name=Adafruit Feather nRF52840 Sense + +# VID/PID for Bootloader, Arduino & CircuitPython +feather52840sense.vid.0=0x239A +feather52840sense.pid.0=0x8087 +feather52840sense.vid.1=0x239A +feather52840sense.pid.1=0x0087 +feather52840sense.vid.2=0x239A +feather52840sense.pid.2=0x0088 +feather52840sense.vid.3=0x239A +feather52840sense.pid.3=0x8088 + +# Upload +feather52840sense.bootloader.tool=bootburn +feather52840sense.upload.tool=nrfutil +feather52840sense.upload.protocol=nrfutil +feather52840sense.upload.use_1200bps_touch=true +feather52840sense.upload.wait_for_upload_port=true +feather52840sense.upload.maximum_size=815104 +feather52840sense.upload.maximum_data_size=237568 + +# Build +feather52840sense.build.mcu=cortex-m4 +feather52840sense.build.f_cpu=64000000 +feather52840sense.build.board=NRF52840_FEATHER_SENSE +feather52840sense.build.core=nRF5 +feather52840sense.build.variant=feather_nrf52840_sense +feather52840sense.build.usb_manufacturer="Adafruit" +feather52840sense.build.usb_product="Feather nRF52840 Sense" +feather52840sense.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840sense.build.ldscript=nrf52840_s140_v6.ld +feather52840sense.build.vid=0x239A +feather52840sense.build.pid=0x8087 + +# SoftDevice Menu +feather52840sense.menu.softdevice.s140v6=S140 6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_name=s140 +feather52840sense.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840sense.menu.debug.l0=Level 0 (Release) +feather52840sense.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840sense.menu.debug.l1=Level 1 (Error Message) +feather52840sense.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840sense.menu.debug.l2=Level 2 (Full Debug) +feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840sense.menu.debug.l3=Level 3 (Segger SystemView) +feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +feather52840sense.menu.debug_output.serial=Serial +feather52840sense.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +feather52840sense.menu.debug_output.serial1=Serial1 +feather52840sense.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +feather52840sense.menu.debug_output.rtt=Segger RTT +feather52840sense.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit ItsyBitsy nRF52840 Express +# ----------------------------------- +itsybitsy52840.name=Adafruit ItsyBitsy nRF52840 Express + +# VID/PID for Bootloader, Arduino & CircuitPython +itsybitsy52840.vid.0=0x239A +itsybitsy52840.pid.0=0x8051 +itsybitsy52840.vid.1=0x239A +itsybitsy52840.pid.1=0x0051 +itsybitsy52840.vid.2=0x239A +itsybitsy52840.pid.2=0x0052 +itsybitsy52840.vid.3=0x239A +itsybitsy52840.pid.3=0x8052 + +# Upload +itsybitsy52840.bootloader.tool=bootburn +itsybitsy52840.upload.tool=nrfutil +itsybitsy52840.upload.protocol=nrfutil +itsybitsy52840.upload.use_1200bps_touch=true +itsybitsy52840.upload.wait_for_upload_port=true +itsybitsy52840.upload.maximum_size=815104 +itsybitsy52840.upload.maximum_data_size=237568 + +# Build +itsybitsy52840.build.mcu=cortex-m4 +itsybitsy52840.build.f_cpu=64000000 +itsybitsy52840.build.board=NRF52840_ITSYBITSY +itsybitsy52840.build.core=nRF5 +itsybitsy52840.build.variant=itsybitsy_nrf52840_express +itsybitsy52840.build.usb_manufacturer="Adafruit" +itsybitsy52840.build.usb_product="ItsyBitsy nRF52840 Express" +itsybitsy52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +itsybitsy52840.build.ldscript=nrf52840_s140_v6.ld +itsybitsy52840.build.vid=0x239A +itsybitsy52840.build.pid=0x8051 + +# SoftDevice Menu +itsybitsy52840.menu.softdevice.s140v6=S140 6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_name=s140 +itsybitsy52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +itsybitsy52840.menu.debug.l0=Level 0 (Release) +itsybitsy52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +itsybitsy52840.menu.debug.l1=Level 1 (Error Message) +itsybitsy52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +itsybitsy52840.menu.debug.l2=Level 2 (Full Debug) +itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView) +itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +itsybitsy52840.menu.debug_output.serial=Serial +itsybitsy52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +itsybitsy52840.menu.debug_output.serial1=Serial1 +itsybitsy52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +itsybitsy52840.menu.debug_output.rtt=Segger RTT +itsybitsy52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Circuit Playground Bluefruit +# ----------------------------------- +cplaynrf52840.name=Adafruit Circuit Playground Bluefruit + +# VID/PID for Bootloader, Arduino & CircuitPython +cplaynrf52840.vid.0=0x239A +cplaynrf52840.pid.0=0x8045 +cplaynrf52840.vid.1=0x239A +cplaynrf52840.pid.1=0x0045 +cplaynrf52840.vid.2=0x239A +cplaynrf52840.pid.2=0x8046 + +# Upload +cplaynrf52840.bootloader.tool=bootburn +cplaynrf52840.upload.tool=nrfutil +cplaynrf52840.upload.protocol=nrfutil +cplaynrf52840.upload.use_1200bps_touch=true +cplaynrf52840.upload.wait_for_upload_port=true +cplaynrf52840.upload.maximum_size=815104 +cplaynrf52840.upload.maximum_data_size=237568 + +# Build +cplaynrf52840.build.mcu=cortex-m4 +cplaynrf52840.build.f_cpu=64000000 +cplaynrf52840.build.board=NRF52840_CIRCUITPLAY +cplaynrf52840.build.core=nRF5 +cplaynrf52840.build.variant=circuitplayground_nrf52840 +cplaynrf52840.build.usb_manufacturer="Adafruit" +cplaynrf52840.build.usb_product="Circuit Playground Bluefruit" +cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld +cplaynrf52840.build.vid=0x239A +cplaynrf52840.build.pid=0x8045 + +# SoftDevice Menu +cplaynrf52840.menu.softdevice.s140v6=S140 6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cplaynrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cplaynrf52840.menu.debug.l0=Level 0 (Release) +cplaynrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cplaynrf52840.menu.debug.l1=Level 1 (Error Message) +cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cplaynrf52840.menu.debug.l2=Level 2 (Full Debug) +cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +cplaynrf52840.menu.debug_output.serial=Serial +cplaynrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +cplaynrf52840.menu.debug_output.serial1=Serial1 +cplaynrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +cplaynrf52840.menu.debug_output.rtt=Segger RTT +cplaynrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit CLUE +# ----------------------------------- +cluenrf52840.name=Adafruit CLUE + +# VID/PID for Bootloader, Arduino & CircuitPython +cluenrf52840.vid.0=0x239A +cluenrf52840.pid.0=0x8071 +cluenrf52840.vid.1=0x239A +cluenrf52840.pid.1=0x0071 +cluenrf52840.vid.2=0x239A +cluenrf52840.pid.2=0x8072 + +# Upload +cluenrf52840.bootloader.tool=bootburn +cluenrf52840.upload.tool=nrfutil +cluenrf52840.upload.protocol=nrfutil +cluenrf52840.upload.use_1200bps_touch=true +cluenrf52840.upload.wait_for_upload_port=true +cluenrf52840.upload.maximum_size=815104 +cluenrf52840.upload.maximum_data_size=237568 + +# Build +cluenrf52840.build.mcu=cortex-m4 +cluenrf52840.build.f_cpu=64000000 +cluenrf52840.build.board=NRF52840_CLUE +cluenrf52840.build.core=nRF5 +cluenrf52840.build.variant=clue_nrf52840 +cluenrf52840.build.usb_manufacturer="Adafruit" +cluenrf52840.build.usb_product="CLUE" +cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cluenrf52840.build.ldscript=nrf52840_s140_v6.ld +cluenrf52840.build.vid=0x239A +cluenrf52840.build.pid=0x8071 + +# SoftDevice Menu +cluenrf52840.menu.softdevice.s140v6=S140 6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cluenrf52840.menu.debug.l0=Level 0 (Release) +cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cluenrf52840.menu.debug.l1=Level 1 (Error Message) +cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cluenrf52840.menu.debug.l2=Level 2 (Full Debug) +cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +cluenrf52840.menu.debug_output.serial=Serial +cluenrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +cluenrf52840.menu.debug_output.serial1=Serial1 +cluenrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +cluenrf52840.menu.debug_output.rtt=Segger RTT +cluenrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit LED Glasses Driver nRF52840 +# ----------------------------------- +ledglasses_nrf52840.name=Adafruit LED Glasses Driver nRF52840 + +# VID/PID for Bootloader, Arduino & CircuitPython +ledglasses_nrf52840.vid.0=0x239A +ledglasses_nrf52840.pid.0=0x810D +ledglasses_nrf52840.vid.1=0x239A +ledglasses_nrf52840.pid.1=0x010D +ledglasses_nrf52840.vid.2=0x239A +ledglasses_nrf52840.pid.2=0x810E + +# Upload +ledglasses_nrf52840.bootloader.tool=bootburn +ledglasses_nrf52840.upload.tool=nrfutil +ledglasses_nrf52840.upload.protocol=nrfutil +ledglasses_nrf52840.upload.use_1200bps_touch=true +ledglasses_nrf52840.upload.wait_for_upload_port=true +ledglasses_nrf52840.upload.maximum_size=815104 +ledglasses_nrf52840.upload.maximum_data_size=237568 + +# Build +ledglasses_nrf52840.build.mcu=cortex-m4 +ledglasses_nrf52840.build.f_cpu=64000000 +ledglasses_nrf52840.build.board=NRF52840_LED_GLASSES +ledglasses_nrf52840.build.core=nRF5 +ledglasses_nrf52840.build.variant=ledglasses_nrf52840 +ledglasses_nrf52840.build.usb_manufacturer="Adafruit" +ledglasses_nrf52840.build.usb_product="LED Glasses Driver nRF52840" +ledglasses_nrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +ledglasses_nrf52840.build.ldscript=nrf52840_s140_v6.ld +ledglasses_nrf52840.build.vid=0x239A +ledglasses_nrf52840.build.pid=0x810D + +# SoftDevice Menu +ledglasses_nrf52840.menu.softdevice.s140v6=S140 6.1.1 +ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_name=s140 +ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +ledglasses_nrf52840.menu.debug.l0=Level 0 (Release) +ledglasses_nrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ledglasses_nrf52840.menu.debug.l1=Level 1 (Error Message) +ledglasses_nrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ledglasses_nrf52840.menu.debug.l2=Level 2 (Full Debug) +ledglasses_nrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ledglasses_nrf52840.menu.debug.l3=Level 3 (Segger SystemView) +ledglasses_nrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ledglasses_nrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +ledglasses_nrf52840.menu.debug_output.serial=Serial +ledglasses_nrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +ledglasses_nrf52840.menu.debug_output.serial1=Serial1 +ledglasses_nrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +ledglasses_nrf52840.menu.debug_output.rtt=Segger RTT +ledglasses_nrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Raytac nRF52840 Dongle +# ----------------------------------- +mdbt50qrx.name=Raytac nRF52840 Dongle + +# VID/PID for Bootloader, Arduino & CircuitPython +mdbt50qrx.vid.0=0x239A +mdbt50qrx.pid.0=0x810B +mdbt50qrx.vid.1=0x239A +mdbt50qrx.pid.1=0x010B +mdbt50qrx.vid.2=0x239A +mdbt50qrx.pid.2=0x810C + +# Upload +mdbt50qrx.bootloader.tool=bootburn +mdbt50qrx.upload.tool=nrfutil +mdbt50qrx.upload.protocol=nrfutil +mdbt50qrx.upload.use_1200bps_touch=true +mdbt50qrx.upload.wait_for_upload_port=true +mdbt50qrx.upload.maximum_size=815104 +mdbt50qrx.upload.maximum_data_size=237568 + +# Build +mdbt50qrx.build.mcu=cortex-m4 +mdbt50qrx.build.f_cpu=64000000 +mdbt50qrx.build.board=MDBT50Q_RX +mdbt50qrx.build.core=nRF5 +mdbt50qrx.build.variant=raytac_mdbt50q_rx +mdbt50qrx.build.usb_manufacturer="Raytac" +mdbt50qrx.build.usb_product="nRF52840 Dongle" +mdbt50qrx.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +mdbt50qrx.build.ldscript=nrf52840_s140_v6.ld +mdbt50qrx.build.vid=0x239A +mdbt50qrx.build.pid=0x810B + +# SoftDevice Menu +mdbt50qrx.menu.softdevice.s140v6=S140 6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_name=s140 +mdbt50qrx.menu.softdevice.s140v6.build.sd_version=6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +mdbt50qrx.menu.debug.l0=Level 0 (Release) +mdbt50qrx.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +mdbt50qrx.menu.debug.l1=Level 1 (Error Message) +mdbt50qrx.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +mdbt50qrx.menu.debug.l2=Level 2 (Full Debug) +mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView) +mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +mdbt50qrx.menu.debug_output.serial=Serial +mdbt50qrx.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +mdbt50qrx.menu.debug_output.serial1=Serial1 +mdbt50qrx.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +mdbt50qrx.menu.debug_output.rtt=Segger RTT +mdbt50qrx.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Metro nRF52840 Express +# ----------------------------------- +metro52840.name=Adafruit Metro nRF52840 Express + +# VID/PID for Bootloader, Arduino & CircuitPython +metro52840.vid.0=0x239A +metro52840.pid.0=0x803F +metro52840.vid.1=0x239A +metro52840.pid.1=0x003F +metro52840.vid.2=0x239A +metro52840.pid.2=0x0040 +metro52840.vid.3=0x239A +metro52840.pid.3=0x8040 + +# Upload +metro52840.bootloader.tool=bootburn +metro52840.upload.tool=nrfutil +metro52840.upload.protocol=nrfutil +metro52840.upload.use_1200bps_touch=true +metro52840.upload.wait_for_upload_port=true +metro52840.upload.maximum_size=815104 +metro52840.upload.maximum_data_size=237568 + +# Build +metro52840.build.mcu=cortex-m4 +metro52840.build.f_cpu=64000000 +metro52840.build.board=NRF52840_METRO +metro52840.build.core=nRF5 +metro52840.build.variant=metro_nrf52840_express +metro52840.build.usb_manufacturer="Adafruit" +metro52840.build.usb_product="Metro nRF52840 Express" +metro52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +metro52840.build.ldscript=nrf52840_s140_v6.ld +metro52840.build.vid=0x239A +metro52840.build.pid=0x803F + +# SoftDevice Menu +metro52840.menu.softdevice.s140v6=S140 6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_name=s140 +metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +metro52840.menu.debug.l0=Level 0 (Release) +metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +metro52840.menu.debug.l1=Level 1 (Error Message) +metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +metro52840.menu.debug.l2=Level 2 (Full Debug) +metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +metro52840.menu.debug.l3=Level 3 (Segger SystemView) +metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +metro52840.menu.debug_output.serial=Serial +metro52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +metro52840.menu.debug_output.serial1=Serial1 +metro52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +metro52840.menu.debug_output.rtt=Segger RTT +metro52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + + +# ------------------------------------------------------- +# +# Boards that aren't made by Adafruit +# +# ------------------------------------------------------- + +# ----------------------------------- +# Nordic nRF52840 DK +# ----------------------------------- +pca10056.name=Nordic nRF52840 DK + +# VID/PID for Bootloader, Arduino & CircuitPython +pca10056.vid.0=0x239A +pca10056.pid.0=0x8029 +pca10056.vid.1=0x239A +pca10056.pid.1=0x0029 + +# Upload +pca10056.bootloader.tool=bootburn +pca10056.upload.tool=nrfutil +pca10056.upload.protocol=nrfutil +pca10056.upload.use_1200bps_touch=true +pca10056.upload.wait_for_upload_port=true +pca10056.upload.maximum_size=815104 +pca10056.upload.maximum_data_size=237568 + +# Build +pca10056.build.mcu=cortex-m4 +pca10056.build.f_cpu=64000000 +pca10056.build.board=NRF52840_PCA10056 +pca10056.build.core=nRF5 +pca10056.build.variant=pca10056 +pca10056.build.usb_manufacturer="Nordic" +pca10056.build.usb_product="nRF52840 DK" +pca10056.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +pca10056.build.ldscript=nrf52840_s140_v6.ld +pca10056.build.vid=0x239A +pca10056.build.pid=0x8029 + +# SoftDevice Menu +pca10056.menu.softdevice.s140v6=S140 6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_name=s140 +pca10056.menu.softdevice.s140v6.build.sd_version=6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +pca10056.menu.debug.l0=Level 0 (Release) +pca10056.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +pca10056.menu.debug.l1=Level 1 (Error Message) +pca10056.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +pca10056.menu.debug.l2=Level 2 (Full Debug) +pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +pca10056.menu.debug.l3=Level 3 (Segger SystemView) +pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +pca10056.menu.debug_output.serial=Serial +pca10056.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +pca10056.menu.debug_output.serial1=Serial1 +pca10056.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +pca10056.menu.debug_output.rtt=Segger RTT +pca10056.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Particle Xenon +# ----------------------------------- +particle_xenon.name=Particle Xenon + +# VID/PID for Bootloader, Arduino & CircuitPython +particle_xenon.vid.0=0x239A +particle_xenon.pid.0=0x8029 +particle_xenon.vid.1=0x239A +particle_xenon.pid.1=0x0029 + +# Upload +particle_xenon.bootloader.tool=bootburn +particle_xenon.upload.tool=nrfutil +particle_xenon.upload.protocol=nrfutil +particle_xenon.upload.use_1200bps_touch=true +particle_xenon.upload.wait_for_upload_port=true +particle_xenon.upload.maximum_size=815104 +particle_xenon.upload.maximum_data_size=237568 + +# Build +particle_xenon.build.mcu=cortex-m4 +particle_xenon.build.f_cpu=64000000 +particle_xenon.build.board=PARTICLE_XENON +particle_xenon.build.core=nRF5 +particle_xenon.build.variant=particle_xenon +particle_xenon.build.usb_manufacturer="Particle" +particle_xenon.build.usb_product="Xenon" +particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +particle_xenon.build.ldscript=nrf52840_s140_v6.ld +particle_xenon.build.vid=0x239A +particle_xenon.build.pid=0x8029 + +# SoftDevice Menu +particle_xenon.menu.softdevice.s140v6=S140 6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_name=s140 +particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +particle_xenon.menu.debug.l0=Level 0 (Release) +particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +particle_xenon.menu.debug.l1=Level 1 (Error Message) +particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +particle_xenon.menu.debug.l2=Level 2 (Full Debug) +particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +particle_xenon.menu.debug.l3=Level 3 (Segger SystemView) +particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +particle_xenon.menu.debug_output.serial=Serial +particle_xenon.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +particle_xenon.menu.debug_output.serial1=Serial1 +particle_xenon.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +particle_xenon.menu.debug_output.rtt=Segger RTT +particle_xenon.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + + +# ---------------------------------- +# NINA B302 +# ---------------------------------- +ninab302.name=NINA B302 ublox + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +ninab302.vid.0=0x239A +ninab302.pid.0=0x8029 +ninab302.vid.1=0x239A +ninab302.pid.1=0x0029 +ninab302.vid.2=0x7239A +ninab302.pid.2=0x002A +ninab302.vid.3=0x239A +ninab302.pid.3=0x802A + +# Upload +ninab302.bootloader.tool=bootburn +ninab302.upload.tool=nrfutil +ninab302.upload.protocol=nrfutil +ninab302.upload.use_1200bps_touch=true +ninab302.upload.wait_for_upload_port=true +ninab302.upload.maximum_size=815104 +ninab302.upload.maximum_data_size=237568 + +# Build +ninab302.build.mcu=cortex-m4 +ninab302.build.f_cpu=64000000 +ninab302.build.board=NINA_B302_ublox +ninab302.build.core=nRF5 +ninab302.build.variant=NINA_B302_ublox +ninab302.build.usb_manufacturer="Nordic" +ninab302.build.usb_product="NINA B302 ublox" +ninab302.build.extra_flags=-DNRF52840_XXAA -DNINA_B302_ublox {build.flags.usb} +ninab302.build.ldscript=nrf52840_s140_v6.ld +ninab302.build.vid=0x239A +ninab302.build.pid=0x8029 + +# SofDevice Menu +ninab302.menu.softdevice.s140v6=0.3.2 SoftDevice s140 6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_name=s140 +ninab302.menu.softdevice.s140v6.build.sd_version=6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +ninab302.menu.debug.l0=Level 0 (Release) +ninab302.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab302.menu.debug.l1=Level 1 (Error Message) +ninab302.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab302.menu.debug.l2=Level 2 (Full Debug) +ninab302.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab302.menu.debug.l3=Level 3 (Segger SystemView) +ninab302.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab302.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# NINA B112 +# ---------------------------------- +ninab112.name=NINA B112 ublox +ninab112.bootloader.tool=bootburn + +# Upload +ninab112.upload.tool=nrfutil +ninab112.upload.protocol=nrfutil +ninab112.upload.use_1200bps_touch=false +ninab112.upload.wait_for_upload_port=false +ninab112.upload.native_usb=false +ninab112.upload.maximum_size=290816 +ninab112.upload.maximum_data_size=52224 + +# Build +ninab112.build.mcu=cortex-m4 +ninab112.build.f_cpu=64000000 +ninab112.build.board=NINA_B112_ublox +ninab112.build.core=nRF5 +ninab112.build.variant=NINA_B112_ublox +feather52840.build.usb_manufacturer="Adafruit LLC" +feather52840.build.usb_product="Feather nRF52832" +ninab112.build.extra_flags=-DNRF52832_XXAA -DNINA_B112_ublox -DNRF52 +ninab112.build.ldscript=nrf52832_s132_v6.ld + +# SofDevice Menu +ninab112.menu.softdevice.s132v6=0.3.2 SoftDevice s132 6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_name=s132 +ninab112.menu.softdevice.s132v6.build.sd_version=6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +ninab112.menu.debug.l0=Level 0 (Release) +ninab112.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab112.menu.debug.l1=Level 1 (Error Message) +ninab112.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab112.menu.debug.l2=Level 2 (Full Debug) +ninab112.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab112.menu.debug.l3=Level 3 (Segger SystemView) +ninab112.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab112.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +################################################################## +## KH Add SparkFun Pro nRF52840 Mini +################################################################## +#********************************************** +# SparkFun Pro nRF52840 Mini +#********************************************** +sparkfunnrf52840mini.name=SparkFun Pro nRF52840 Mini + +# DFU Mode with CDC only +sparkfunnrf52840mini.vid.0=0x1B4F +sparkfunnrf52840mini.pid.0=0x002A + +# DFU Mode with CDC + MSC (UF2) +sparkfunnrf52840mini.vid.1=0x1B4F +sparkfunnrf52840mini.pid.1=0x0029 + +# Application with CDC + MSC +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x8029 + +# CircuitPython +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x802A + +sparkfunnrf52840mini.bootloader.tool=bootburn + +# Upload +sparkfunnrf52840mini.upload.tool=nrfutil +sparkfunnrf52840mini.upload.protocol=nrfutil +sparkfunnrf52840mini.upload.use_1200bps_touch=true +sparkfunnrf52840mini.upload.wait_for_upload_port=true +#sparkfunnrf52840mini.upload.native_usb=true + +# Build +sparkfunnrf52840mini.build.mcu=cortex-m4 +sparkfunnrf52840mini.build.f_cpu=64000000 +sparkfunnrf52840mini.build.board=NRF52840_FEATHER +sparkfunnrf52840mini.build.core=nRF5 +sparkfunnrf52840mini.build.variant=sparkfun_nrf52840_mini +sparkfunnrf52840mini.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +sparkfunnrf52840mini.build.vid=0x1B4F +sparkfunnrf52840mini.build.pid=0x5284 +sparkfunnrf52840mini.build.usb_manufacturer="SparkFun" +sparkfunnrf52840mini.build.usb_product="nRF52840 Mini Breakout" + +# SofDevice Menu +# Ram & ROM size varies depending on SoftDevice (check linker script) + +sparkfunnrf52840mini.menu.softdevice.s140v6=s140 6.1.1 r0 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_flags=-DS140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_name=s140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_version=6.1.1 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_fwid=0x00B6 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.ldscript=nrf52840_s140_v6.ld +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_size=815104 +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_data_size=248832 + +# Debug Menu +sparkfunnrf52840mini.menu.debug.l0=Level 0 (Release) +sparkfunnrf52840mini.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os +sparkfunnrf52840mini.menu.debug.l1=Level 1 (Error Message) +sparkfunnrf52840mini.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os +sparkfunnrf52840mini.menu.debug.l2=Level 2 (Full Debug) +sparkfunnrf52840mini.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os +sparkfunnrf52840mini.menu.debug.l3=Level 3 (Segger SystemView) +sparkfunnrf52840mini.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os + +################################################################## diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.cpp new file mode 100644 index 0000000..d2db957 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. 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 + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.h new file mode 100644 index 0000000..d03d1cc --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.h @@ -0,0 +1,123 @@ +/* + Copyright (c) 2016 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 +*/ + +#pragma once + +#include +#include // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h new file mode 100644 index 0000000..c2d5824 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h @@ -0,0 +1,100 @@ +/* + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ + +#ifndef udp_h +#define udp_h + +#include +#include + +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = + 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + + // KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + + virtual void stop() = 0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; +}; + +#endif diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/platform.txt b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/platform.txt new file mode 100644 index 0000000..8bc132d --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/platform.txt @@ -0,0 +1,166 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. All rights 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 + +name=Adafruit nRF52 Boards +version=1.2.0 + +# Compile variables +# ----------------- + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall +compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith + +# Allow changing optimization settings via platform.local.txt / boards.local.txt +compiler.optimization_flag=-Ofast + +compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD + +# KH, Error here to use gcc, must use g++ +#compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.cmd=arm-none-eabi-g++ + +compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp + +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2bin.flags=-O binary +compiler.elf2bin.cmd=arm-none-eabi-objcopy +compiler.elf2hex.flags=-O ihex +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs +compiler.size.cmd=arm-none-eabi-size + +# this can be overriden in boards.txt +# Logger 0: Serial (CDC), 1 Serial1 (UART), 2 Segger RTT +build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float +build.debug_flags=-DCFG_DEBUG=0 +build.logger_flags=-DCFG_LOGGER=0 +build.sysview_flags=-DCFG_SYSVIEW=0 + +# USB flags +build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.libraries.ldflags= +compiler.elf2bin.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math + +# common compiler for nrf +rtos.path={build.core.path}/freertos +nordic.path={build.core.path}/nordic + +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino" + +# Compile patterns +# ---------------- + +## Compile c files +## KH Add '-DBOARD_NAME="{build.board}"' +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} '-DBOARD_NAME="{build.board}"' -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +## KH Add '-DBOARD_NAME="{build.board}"' +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} '-DBOARD_NAME="{build.board}"' -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +## KH Add '-DBOARD_NAME="{build.board}"' +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} '-DBOARD_NAME="{build.board}"' -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Create archives +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group + +## Create output (bin file) +#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Create dfu package zip file +recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" + +## Create uf2 file +#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" + +## Save bin +recipe.output.tmp_file_bin={build.project_name}.bin +recipe.output.save_file_bin={build.project_name}.save.bin + +## Save hex +recipe.output.tmp_file_hex={build.project_name}.hex +recipe.output.save_file_hexu={build.project_name}.save.hex + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* + +## Export Compiled Binary +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + +#*************************************************** +# adafruit-nrfutil for uploading +# https://github.com/adafruit/Adafruit_nRF52_nrfutil +# pre-built binaries are provided for macos and windows +#*************************************************** +tools.nrfutil.cmd=adafruit-nrfutil +tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe +tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil + +tools.nrfutil.upload.params.verbose=--verbose +tools.nrfutil.upload.params.quiet= +tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank + +#*************************************************** +# Burning bootloader with either jlink or nrfutil +#*************************************************** + +# Bootloader version +tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.2_{build.sd_name}_{build.sd_version} + +tools.bootburn.bootloader.params.verbose= +tools.bootburn.bootloader.params.quiet= +tools.bootburn.bootloader.pattern={program.burn_pattern} + +# erase flash page while programming +tools.bootburn.erase.params.verbose= +tools.bootburn.erase.params.quiet= +tools.bootburn.erase.pattern= + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.cpp new file mode 100644 index 0000000..63d3f4d --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.cpp @@ -0,0 +1,60 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" + +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 5, // D0 is P0.05 (UART RX) + 6, // D1 is P0.06 (UART TX) + 7, // D2 is P0.07 + 31, // D3 is P0.31 + 18, // D4 is P0.18 (LED Blue) + 99, // D5 (NC) + 9, // D6 is P0.09 NFC1 + 10, // D7 is P0.10 (Button) NFC2 + 99, // D8 (NC) + 8, // D9 is P0.08 + 11, // D10 is P0.11 CS + 13, // D11 is P0.13 MOSI + 12, // D12 is P0.12 MISO + 14, // D13 is P0.14 SCK + //I2C + 2, // D14 is P0.2 (SDA) + 3, // D15 is P0.3 (SCL) + // D16 .. D21 (aka A0 .. A5) + 3, // D16 is P0.03 (A0) + 2, // D17 is P0.02 (A1) + 4, // D18 is P0.04 (A2) + 30, // D19 is P0.30 (A3) SW2 + 29, // D20 is P0.29 (A4) + 28, // D21 is P0.28 (A5) + 9, // P0.09 NFC + 10, // P0.10 NFC + 16, // SW1 (LED Green) +}; \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.h new file mode 100644 index 0000000..caa0b61 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.h @@ -0,0 +1,172 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +#ifndef _VARIANT_NINA_B112_UBLOX_ +#define _VARIANT_NINA_B112_UBLOX_ + +#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ + .rc_ctiv = 0, \ +.rc_temp_ctiv = 0, \ +.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LED LED1 +#define LED_BUILTIN PIN_LED + +//LEDs onboard +#define LED1 (0) // Red +#define LED2 (24) // Green/SW1 +#define LED3 (4) // Blue + +#define LED_STATE_ON 1 // State when LED is litted + +//Switch +#define SW1 (24) +#define SW2 (19) + +// NFC +#define PIN_NFC_1 (6) // P0.9 +#define PIN_NFC_2 (7) // P0.10 + +/* + Analog pins +*/ +#define PIN_A0 (16) // P0.03 +#define PIN_A1 (17) // P0.02 +#define PIN_A2 (18) // P0.04 +#define PIN_A3 (19) // P0.30 +#define PIN_A4 (20) // P0.29 +#define PIN_A5 (21) // P0.28 + +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 14 + +#define PIN_D0 (0) // P0.05 +#define PIN_D1 (1) // P0.06 +#define PIN_D2 (2) // P0.07 +#define PIN_D3 (4) // P0.31 +#define PIN_D4 (5) // P0.18 +#define PIN_D6 (6) // P0.09 +#define PIN_D7 (7) // P0.10 +#define PIN_D9 (9) // P0.08 +#define PIN_D10 (11) // P0.11 +#define PIN_D11 (13) // P0.13 +#define PIN_D12 (12) // P0.12 +#define PIN_D13 (14) // P0.14 +#define PIN_D14 (2) // P0.02 +#define PIN_D15 (3) // P0.03 + +static const uint8_t D0 = PIN_D0 ; +static const uint8_t D1 = PIN_D1 ; +static const uint8_t D2 = PIN_D2 ; +static const uint8_t D3 = PIN_D3 ; +static const uint8_t D4 = PIN_D4 ; +static const uint8_t D6 = PIN_D6 ; +static const uint8_t D7 = PIN_D7 ; +static const uint8_t D9 = PIN_D9 ; +static const uint8_t D10 = PIN_D10 ; +static const uint8_t D11 = PIN_D11 ; +static const uint8_t D12 = PIN_D12 ; +static const uint8_t D13 = PIN_D13 ; +static const uint8_t D14 = PIN_D14 ; +static const uint8_t D15 = PIN_D15 ; + +// Other pins +//static const uint8_t AREF = PIN_AREF; + +//#define PIN_AREF (24) +//#define PIN_VBAT PIN_A7 + +/* + Serial interfaces +*/ +#define PIN_SERIAL_RX (0) // P0.05 +#define PIN_SERIAL_TX (1) // P0.06 +#define PIN_SERIAL_CTS (2) // P0.07 +#define PIN_SERIAL_RTS (3) // P0.31 +#define PIN_SERIAL_DTR (28) // P0.28 +#define PIN_SERIAL_DSR (29) // P0.29 + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (12) // P0.12 +#define PIN_SPI_MOSI (11) // P0.13 +#define PIN_SPI_SCK (13) // P0.14 + +static const uint8_t SS = 10 ; // P0.11 +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 (14) // P0.02 +#define PIN_WIRE_SCL (15) // P0.03 + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + + +#endif //_VARIANT_NINA_B112_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.cpp new file mode 100644 index 0000000..7f317d6 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.cpp @@ -0,0 +1,87 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#include "variant.h" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 29, // D0 is P0.29 (UART RX) + 45, // D1 is P1.13 (UART TX) + 44, // D2 is P1.12 (NFC2) + 31, // D3 is P0.31 (LED1) + 13, // D4 is P0.13 (LED2) + 11, // D5 is P0.11 + 9, // D6 is P0.09 + 10, // D7 is P0.10 (Button) + 41, // D8 is P1.09 + 12, // D9 is P0.12 + 14, // D10 is P0.14 + 15, // D11 is P0.15 + 32, // D12 is P1.00 + 7, // D13 is P0.07 + + // D14 .. D21 (aka A0 .. A5) + 4, // D14 is P0.04 (A0) + 30, // D15 is P0.30 (A1) + 5, // D16 is P0.05 (A2) + 2, // D17 is P0.02 (A3) + 28, // D18 is P0.28 (A4) + 3, // D19 is P0.03 (A5) + + // D20 .. D21 (aka I2C pins) + 16, // D20 is P0.16 (SDA) + 24, // D21 is P0.24 (SCL) + + // QSPI pins (not exposed via any header / test point) + 19, // D22 is P0.19 (QSPI CLK) + 17, // D23 is P0.17 (QSPI CS) + 20, // D24 is P0.20 (QSPI Data 0) + 21, // D25 is P0.21 (QSPI Data 1) + 22, // D26 is P0.22 (QSPI Data 2) + 26, // D27 is P0.23 (QSPI Data 3) + + 40, // D28 is P1.08 - IO34 + 41, // D29 is P1.01 - IO35 + 44, // D30 is P1.02 - IO36 + 45, // D31 is P1.03 - IO37 + 42, // D32 is P1.10 - IO38 + 43, // D33 is P1.11 - IO39 + 47, // D34 is P1.15 - IO40 + 46, // D35 is P1.14 - IO41 + 26, // D36 is P0.26 - IO42 + 6, // D37 is P0.6 - IO43 + 27, // D38 is P0.27 - IO44 +}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.h new file mode 100644 index 0000000..d588790 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.h @@ -0,0 +1,149 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#ifndef _VARIANT_NINA_B302_UBLOX_ +#define _VARIANT_NINA_B302_UBLOX_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus +// Number of pins defined in PinDescription array +#define PINS_COUNT (40) +#define NUM_DIGITAL_PINS (34) +#define NUM_ANALOG_INPUTS (6) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (3) +#define PIN_LED2 (4) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +/* + Buttons +*/ +#define PIN_BUTTON1 (7) + +/* + Analog pins +*/ +#define PIN_A0 (14) +#define PIN_A1 (15) +#define PIN_A2 (16) +#define PIN_A3 (17) +#define PIN_A4 (18) +#define PIN_A5 (19) + +#define D0 (0) +#define D1 (1) +#define D2 (2) +#define D3 (3) +#define D4 (4) +#define D5 (5) +#define D6 (6) +#define D7 (7) +#define D8 (8) +#define D9 (9) +#define D10 (10) +#define D11 (11) +#define D12 (12) +#define D13 (13) + +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 14 + +#define PIN_NFC1 (31) +#define PIN_NFC2 (2) + +/* + Serial interfaces +*/ +#define PIN_SERIAL1_RX (0) +#define PIN_SERIAL1_TX (1) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (22) //24 original +#define PIN_SPI_MOSI (23) //25 original +#define PIN_SPI_SCK (24) //26 original + +static const uint8_t SS = (13); +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 (20) +#define PIN_WIRE_SCL (21) + +// QSPI Pins +#define PIN_QSPI_SCK 22 +#define PIN_QSPI_CS 23 +#define PIN_QSPI_IO0 24 +#define PIN_QSPI_IO1 25 +#define PIN_QSPI_IO2 26 +#define PIN_QSPI_IO3 27 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES GD25Q16C +#define EXTERNAL_FLASH_USE_QSPI + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif //_VARIANT_NINA_B302_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.cpp new file mode 100644 index 0000000..534abf3 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.cpp @@ -0,0 +1,49 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // P0 + 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, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 +}; +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.h new file mode 100644 index 0000000..f98c8e0 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.h @@ -0,0 +1,152 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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_SPARKFUN52840MINI_ +#define _VARIANT_SPARKFUN52840MINI_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (64) +#define NUM_DIGITAL_PINS (64) +#define NUM_ANALOG_INPUTS (8) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (7) +#define PIN_LED2 (14) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_BLUE PIN_LED1 +#define LED_RED PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +// Buttons +/* + #define PIN_BUTTON1 (2) + #define PIN_BUTTON2 (3) + #define PIN_BUTTON3 (4) + #define PIN_BUTTON4 (5) +*/ + +/* + Analog pins +*/ +#define PIN_A0 (2) +#define PIN_A1 (3) +#define PIN_A2 (4) +#define PIN_A3 (5) +#define PIN_A4 (28) +#define PIN_A5 (29) +#define PIN_A6 (30) +#define PIN_A7 (31) + +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 ; +static const uint8_t A6 = PIN_A6 ; +static const uint8_t A7 = PIN_A7 ; +#define ADC_RESOLUTION 14 + +// Other pins +#define PIN_AREF (2) +#define PIN_DFU (13) +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +static const uint8_t AREF = PIN_AREF; + +/* + Serial interfaces +*/ +// Serial +//Previous Hardware UART definition for nRF52 Arduino Core, below 0.16.0 +//Feel free to comment out these two lines below if there are conflicts with latest release +#define PIN_SERIAL_RX (15) +#define PIN_SERIAL_TX (17) + +//Hardware UART definition for nRF52 Arduino Core, 0.17.0 and above +#define PIN_SERIAL1_RX (15) +#define PIN_SERIAL1_TX (17) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (31) +#define PIN_SPI_MOSI (3) +#define PIN_SPI_SCK (30) + +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 (8) +#define PIN_WIRE_SCL (11) + +/* + QSPI interface for external flash +*/ +#define PIN_QSPI_SCK 32 +#define PIN_QSPI_CS 33 +#define PIN_QSPI_DATA0 34 +#define PIN_QSPI_DATA1 35 +#define PIN_QSPI_DATA2 36 +#define PIN_QSPI_DATA3 37 + +// On-board QSPI Flash +// If EXTERNAL_FLASH_DEVICES is not defined, all supported devices will be used +#define EXTERNAL_FLASH_DEVICES GD25Q16C + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/boards.txt b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/boards.txt new file mode 100644 index 0000000..541eb10 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/boards.txt @@ -0,0 +1,834 @@ +menu.softdevice=SoftDevice +menu.debug=Debug +menu.debug_output=Debug Output + +# ----------------------------------- +# Adafruit Feather nRF52832 +# ----------------------------------- +feather52832.name=Adafruit Feather nRF52832 + +# VID/PID for Bootloader, Arduino & CircuitPython + +# Upload +feather52832.bootloader.tool=bootburn +feather52832.upload.tool=nrfutil +feather52832.upload.protocol=nrfutil +feather52832.upload.use_1200bps_touch=false +feather52832.upload.wait_for_upload_port=false +feather52832.upload.native_usb=false +feather52832.upload.maximum_size=290816 +feather52832.upload.maximum_data_size=52224 + +# Build +feather52832.build.mcu=cortex-m4 +feather52832.build.f_cpu=64000000 +feather52832.build.board=NRF52832_FEATHER +feather52832.build.core=nRF5 +feather52832.build.variant=feather_nrf52832 +feather52832.build.usb_manufacturer="Adafruit" +feather52832.build.usb_product="Feather nRF52832" +feather52832.build.extra_flags=-DNRF52832_XXAA -DNRF52 +feather52832.build.ldscript=nrf52832_s132_v6.ld + +# SoftDevice Menu +feather52832.menu.softdevice.s132v6=S132 6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_name=s132 +feather52832.menu.softdevice.s132v6.build.sd_version=6.1.1 +feather52832.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +feather52832.menu.debug.l0=Level 0 (Release) +feather52832.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52832.menu.debug.l1=Level 1 (Error Message) +feather52832.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52832.menu.debug.l2=Level 2 (Full Debug) +feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52832.menu.debug.l3=Level 3 (Segger SystemView) +feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +feather52832.menu.debug_output.serial=Serial +feather52832.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +feather52832.menu.debug_output.serial1=Serial1 +feather52832.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +feather52832.menu.debug_output.rtt=Segger RTT +feather52832.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Feather nRF52840 Express +# ----------------------------------- +feather52840.name=Adafruit Feather nRF52840 Express + +# VID/PID for Bootloader, Arduino & CircuitPython +feather52840.vid.0=0x239A +feather52840.pid.0=0x8029 +feather52840.vid.1=0x239A +feather52840.pid.1=0x0029 +feather52840.vid.2=0x239A +feather52840.pid.2=0x002A +feather52840.vid.3=0x239A +feather52840.pid.3=0x802A + +# Upload +feather52840.bootloader.tool=bootburn +feather52840.upload.tool=nrfutil +feather52840.upload.protocol=nrfutil +feather52840.upload.use_1200bps_touch=true +feather52840.upload.wait_for_upload_port=true +feather52840.upload.maximum_size=815104 +feather52840.upload.maximum_data_size=237568 + +# Build +feather52840.build.mcu=cortex-m4 +feather52840.build.f_cpu=64000000 +feather52840.build.board=NRF52840_FEATHER +feather52840.build.core=nRF5 +feather52840.build.variant=feather_nrf52840_express +feather52840.build.usb_manufacturer="Adafruit" +feather52840.build.usb_product="Feather nRF52840 Express" +feather52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840.build.ldscript=nrf52840_s140_v6.ld +feather52840.build.vid=0x239A +feather52840.build.pid=0x8029 + +# SoftDevice Menu +feather52840.menu.softdevice.s140v6=S140 6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_name=s140 +feather52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840.menu.debug.l0=Level 0 (Release) +feather52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840.menu.debug.l1=Level 1 (Error Message) +feather52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840.menu.debug.l2=Level 2 (Full Debug) +feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840.menu.debug.l3=Level 3 (Segger SystemView) +feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +feather52840.menu.debug_output.serial=Serial +feather52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +feather52840.menu.debug_output.serial1=Serial1 +feather52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +feather52840.menu.debug_output.rtt=Segger RTT +feather52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Feather nRF52840 Sense +# ----------------------------------- +feather52840sense.name=Adafruit Feather nRF52840 Sense + +# VID/PID for Bootloader, Arduino & CircuitPython +feather52840sense.vid.0=0x239A +feather52840sense.pid.0=0x8087 +feather52840sense.vid.1=0x239A +feather52840sense.pid.1=0x0087 +feather52840sense.vid.2=0x239A +feather52840sense.pid.2=0x0088 +feather52840sense.vid.3=0x239A +feather52840sense.pid.3=0x8088 + +# Upload +feather52840sense.bootloader.tool=bootburn +feather52840sense.upload.tool=nrfutil +feather52840sense.upload.protocol=nrfutil +feather52840sense.upload.use_1200bps_touch=true +feather52840sense.upload.wait_for_upload_port=true +feather52840sense.upload.maximum_size=815104 +feather52840sense.upload.maximum_data_size=237568 + +# Build +feather52840sense.build.mcu=cortex-m4 +feather52840sense.build.f_cpu=64000000 +feather52840sense.build.board=NRF52840_FEATHER_SENSE +feather52840sense.build.core=nRF5 +feather52840sense.build.variant=feather_nrf52840_sense +feather52840sense.build.usb_manufacturer="Adafruit" +feather52840sense.build.usb_product="Feather nRF52840 Sense" +feather52840sense.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +feather52840sense.build.ldscript=nrf52840_s140_v6.ld +feather52840sense.build.vid=0x239A +feather52840sense.build.pid=0x8087 + +# SoftDevice Menu +feather52840sense.menu.softdevice.s140v6=S140 6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_name=s140 +feather52840sense.menu.softdevice.s140v6.build.sd_version=6.1.1 +feather52840sense.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +feather52840sense.menu.debug.l0=Level 0 (Release) +feather52840sense.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52840sense.menu.debug.l1=Level 1 (Error Message) +feather52840sense.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52840sense.menu.debug.l2=Level 2 (Full Debug) +feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52840sense.menu.debug.l3=Level 3 (Segger SystemView) +feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +feather52840sense.menu.debug_output.serial=Serial +feather52840sense.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +feather52840sense.menu.debug_output.serial1=Serial1 +feather52840sense.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +feather52840sense.menu.debug_output.rtt=Segger RTT +feather52840sense.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit ItsyBitsy nRF52840 Express +# ----------------------------------- +itsybitsy52840.name=Adafruit ItsyBitsy nRF52840 Express + +# VID/PID for Bootloader, Arduino & CircuitPython +itsybitsy52840.vid.0=0x239A +itsybitsy52840.pid.0=0x8051 +itsybitsy52840.vid.1=0x239A +itsybitsy52840.pid.1=0x0051 +itsybitsy52840.vid.2=0x239A +itsybitsy52840.pid.2=0x0052 +itsybitsy52840.vid.3=0x239A +itsybitsy52840.pid.3=0x8052 + +# Upload +itsybitsy52840.bootloader.tool=bootburn +itsybitsy52840.upload.tool=nrfutil +itsybitsy52840.upload.protocol=nrfutil +itsybitsy52840.upload.use_1200bps_touch=true +itsybitsy52840.upload.wait_for_upload_port=true +itsybitsy52840.upload.maximum_size=815104 +itsybitsy52840.upload.maximum_data_size=237568 + +# Build +itsybitsy52840.build.mcu=cortex-m4 +itsybitsy52840.build.f_cpu=64000000 +itsybitsy52840.build.board=NRF52840_ITSYBITSY +itsybitsy52840.build.core=nRF5 +itsybitsy52840.build.variant=itsybitsy_nrf52840_express +itsybitsy52840.build.usb_manufacturer="Adafruit" +itsybitsy52840.build.usb_product="ItsyBitsy nRF52840 Express" +itsybitsy52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +itsybitsy52840.build.ldscript=nrf52840_s140_v6.ld +itsybitsy52840.build.vid=0x239A +itsybitsy52840.build.pid=0x8051 + +# SoftDevice Menu +itsybitsy52840.menu.softdevice.s140v6=S140 6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_name=s140 +itsybitsy52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +itsybitsy52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +itsybitsy52840.menu.debug.l0=Level 0 (Release) +itsybitsy52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +itsybitsy52840.menu.debug.l1=Level 1 (Error Message) +itsybitsy52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +itsybitsy52840.menu.debug.l2=Level 2 (Full Debug) +itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView) +itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +itsybitsy52840.menu.debug_output.serial=Serial +itsybitsy52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +itsybitsy52840.menu.debug_output.serial1=Serial1 +itsybitsy52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +itsybitsy52840.menu.debug_output.rtt=Segger RTT +itsybitsy52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Circuit Playground Bluefruit +# ----------------------------------- +cplaynrf52840.name=Adafruit Circuit Playground Bluefruit + +# VID/PID for Bootloader, Arduino & CircuitPython +cplaynrf52840.vid.0=0x239A +cplaynrf52840.pid.0=0x8045 +cplaynrf52840.vid.1=0x239A +cplaynrf52840.pid.1=0x0045 +cplaynrf52840.vid.2=0x239A +cplaynrf52840.pid.2=0x8046 + +# Upload +cplaynrf52840.bootloader.tool=bootburn +cplaynrf52840.upload.tool=nrfutil +cplaynrf52840.upload.protocol=nrfutil +cplaynrf52840.upload.use_1200bps_touch=true +cplaynrf52840.upload.wait_for_upload_port=true +cplaynrf52840.upload.maximum_size=815104 +cplaynrf52840.upload.maximum_data_size=237568 + +# Build +cplaynrf52840.build.mcu=cortex-m4 +cplaynrf52840.build.f_cpu=64000000 +cplaynrf52840.build.board=NRF52840_CIRCUITPLAY +cplaynrf52840.build.core=nRF5 +cplaynrf52840.build.variant=circuitplayground_nrf52840 +cplaynrf52840.build.usb_manufacturer="Adafruit" +cplaynrf52840.build.usb_product="Circuit Playground Bluefruit" +cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld +cplaynrf52840.build.vid=0x239A +cplaynrf52840.build.pid=0x8045 + +# SoftDevice Menu +cplaynrf52840.menu.softdevice.s140v6=S140 6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cplaynrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cplaynrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cplaynrf52840.menu.debug.l0=Level 0 (Release) +cplaynrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cplaynrf52840.menu.debug.l1=Level 1 (Error Message) +cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cplaynrf52840.menu.debug.l2=Level 2 (Full Debug) +cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +cplaynrf52840.menu.debug_output.serial=Serial +cplaynrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +cplaynrf52840.menu.debug_output.serial1=Serial1 +cplaynrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +cplaynrf52840.menu.debug_output.rtt=Segger RTT +cplaynrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit CLUE +# ----------------------------------- +cluenrf52840.name=Adafruit CLUE + +# VID/PID for Bootloader, Arduino & CircuitPython +cluenrf52840.vid.0=0x239A +cluenrf52840.pid.0=0x8071 +cluenrf52840.vid.1=0x239A +cluenrf52840.pid.1=0x0071 +cluenrf52840.vid.2=0x239A +cluenrf52840.pid.2=0x8072 + +# Upload +cluenrf52840.bootloader.tool=bootburn +cluenrf52840.upload.tool=nrfutil +cluenrf52840.upload.protocol=nrfutil +cluenrf52840.upload.use_1200bps_touch=true +cluenrf52840.upload.wait_for_upload_port=true +cluenrf52840.upload.maximum_size=815104 +cluenrf52840.upload.maximum_data_size=237568 + +# Build +cluenrf52840.build.mcu=cortex-m4 +cluenrf52840.build.f_cpu=64000000 +cluenrf52840.build.board=NRF52840_CLUE +cluenrf52840.build.core=nRF5 +cluenrf52840.build.variant=clue_nrf52840 +cluenrf52840.build.usb_manufacturer="Adafruit" +cluenrf52840.build.usb_product="CLUE" +cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +cluenrf52840.build.ldscript=nrf52840_s140_v6.ld +cluenrf52840.build.vid=0x239A +cluenrf52840.build.pid=0x8071 + +# SoftDevice Menu +cluenrf52840.menu.softdevice.s140v6=S140 6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140 +cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +cluenrf52840.menu.debug.l0=Level 0 (Release) +cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +cluenrf52840.menu.debug.l1=Level 1 (Error Message) +cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +cluenrf52840.menu.debug.l2=Level 2 (Full Debug) +cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView) +cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +cluenrf52840.menu.debug_output.serial=Serial +cluenrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +cluenrf52840.menu.debug_output.serial1=Serial1 +cluenrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +cluenrf52840.menu.debug_output.rtt=Segger RTT +cluenrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit LED Glasses Driver nRF52840 +# ----------------------------------- +ledglasses_nrf52840.name=Adafruit LED Glasses Driver nRF52840 + +# VID/PID for Bootloader, Arduino & CircuitPython +ledglasses_nrf52840.vid.0=0x239A +ledglasses_nrf52840.pid.0=0x810D +ledglasses_nrf52840.vid.1=0x239A +ledglasses_nrf52840.pid.1=0x010D +ledglasses_nrf52840.vid.2=0x239A +ledglasses_nrf52840.pid.2=0x810E + +# Upload +ledglasses_nrf52840.bootloader.tool=bootburn +ledglasses_nrf52840.upload.tool=nrfutil +ledglasses_nrf52840.upload.protocol=nrfutil +ledglasses_nrf52840.upload.use_1200bps_touch=true +ledglasses_nrf52840.upload.wait_for_upload_port=true +ledglasses_nrf52840.upload.maximum_size=815104 +ledglasses_nrf52840.upload.maximum_data_size=237568 + +# Build +ledglasses_nrf52840.build.mcu=cortex-m4 +ledglasses_nrf52840.build.f_cpu=64000000 +ledglasses_nrf52840.build.board=NRF52840_LED_GLASSES +ledglasses_nrf52840.build.core=nRF5 +ledglasses_nrf52840.build.variant=ledglasses_nrf52840 +ledglasses_nrf52840.build.usb_manufacturer="Adafruit" +ledglasses_nrf52840.build.usb_product="LED Glasses Driver nRF52840" +ledglasses_nrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +ledglasses_nrf52840.build.ldscript=nrf52840_s140_v6.ld +ledglasses_nrf52840.build.vid=0x239A +ledglasses_nrf52840.build.pid=0x810D + +# SoftDevice Menu +ledglasses_nrf52840.menu.softdevice.s140v6=S140 6.1.1 +ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_name=s140 +ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +ledglasses_nrf52840.menu.debug.l0=Level 0 (Release) +ledglasses_nrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ledglasses_nrf52840.menu.debug.l1=Level 1 (Error Message) +ledglasses_nrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ledglasses_nrf52840.menu.debug.l2=Level 2 (Full Debug) +ledglasses_nrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ledglasses_nrf52840.menu.debug.l3=Level 3 (Segger SystemView) +ledglasses_nrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ledglasses_nrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +ledglasses_nrf52840.menu.debug_output.serial=Serial +ledglasses_nrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +ledglasses_nrf52840.menu.debug_output.serial1=Serial1 +ledglasses_nrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +ledglasses_nrf52840.menu.debug_output.rtt=Segger RTT +ledglasses_nrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Raytac nRF52840 Dongle +# ----------------------------------- +mdbt50qrx.name=Raytac nRF52840 Dongle + +# VID/PID for Bootloader, Arduino & CircuitPython +mdbt50qrx.vid.0=0x239A +mdbt50qrx.pid.0=0x810B +mdbt50qrx.vid.1=0x239A +mdbt50qrx.pid.1=0x010B +mdbt50qrx.vid.2=0x239A +mdbt50qrx.pid.2=0x810C + +# Upload +mdbt50qrx.bootloader.tool=bootburn +mdbt50qrx.upload.tool=nrfutil +mdbt50qrx.upload.protocol=nrfutil +mdbt50qrx.upload.use_1200bps_touch=true +mdbt50qrx.upload.wait_for_upload_port=true +mdbt50qrx.upload.maximum_size=815104 +mdbt50qrx.upload.maximum_data_size=237568 + +# Build +mdbt50qrx.build.mcu=cortex-m4 +mdbt50qrx.build.f_cpu=64000000 +mdbt50qrx.build.board=MDBT50Q_RX +mdbt50qrx.build.core=nRF5 +mdbt50qrx.build.variant=raytac_mdbt50q_rx +mdbt50qrx.build.usb_manufacturer="Raytac" +mdbt50qrx.build.usb_product="nRF52840 Dongle" +mdbt50qrx.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +mdbt50qrx.build.ldscript=nrf52840_s140_v6.ld +mdbt50qrx.build.vid=0x239A +mdbt50qrx.build.pid=0x810B + +# SoftDevice Menu +mdbt50qrx.menu.softdevice.s140v6=S140 6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_name=s140 +mdbt50qrx.menu.softdevice.s140v6.build.sd_version=6.1.1 +mdbt50qrx.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +mdbt50qrx.menu.debug.l0=Level 0 (Release) +mdbt50qrx.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +mdbt50qrx.menu.debug.l1=Level 1 (Error Message) +mdbt50qrx.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +mdbt50qrx.menu.debug.l2=Level 2 (Full Debug) +mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView) +mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +mdbt50qrx.menu.debug_output.serial=Serial +mdbt50qrx.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +mdbt50qrx.menu.debug_output.serial1=Serial1 +mdbt50qrx.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +mdbt50qrx.menu.debug_output.rtt=Segger RTT +mdbt50qrx.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Adafruit Metro nRF52840 Express +# ----------------------------------- +metro52840.name=Adafruit Metro nRF52840 Express + +# VID/PID for Bootloader, Arduino & CircuitPython +metro52840.vid.0=0x239A +metro52840.pid.0=0x803F +metro52840.vid.1=0x239A +metro52840.pid.1=0x003F +metro52840.vid.2=0x239A +metro52840.pid.2=0x0040 +metro52840.vid.3=0x239A +metro52840.pid.3=0x8040 + +# Upload +metro52840.bootloader.tool=bootburn +metro52840.upload.tool=nrfutil +metro52840.upload.protocol=nrfutil +metro52840.upload.use_1200bps_touch=true +metro52840.upload.wait_for_upload_port=true +metro52840.upload.maximum_size=815104 +metro52840.upload.maximum_data_size=237568 + +# Build +metro52840.build.mcu=cortex-m4 +metro52840.build.f_cpu=64000000 +metro52840.build.board=NRF52840_METRO +metro52840.build.core=nRF5 +metro52840.build.variant=metro_nrf52840_express +metro52840.build.usb_manufacturer="Adafruit" +metro52840.build.usb_product="Metro nRF52840 Express" +metro52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +metro52840.build.ldscript=nrf52840_s140_v6.ld +metro52840.build.vid=0x239A +metro52840.build.pid=0x803F + +# SoftDevice Menu +metro52840.menu.softdevice.s140v6=S140 6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_name=s140 +metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1 +metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +metro52840.menu.debug.l0=Level 0 (Release) +metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +metro52840.menu.debug.l1=Level 1 (Error Message) +metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +metro52840.menu.debug.l2=Level 2 (Full Debug) +metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +metro52840.menu.debug.l3=Level 3 (Segger SystemView) +metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +metro52840.menu.debug_output.serial=Serial +metro52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +metro52840.menu.debug_output.serial1=Serial1 +metro52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +metro52840.menu.debug_output.rtt=Segger RTT +metro52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + + +# ------------------------------------------------------- +# +# Boards that aren't made by Adafruit +# +# ------------------------------------------------------- + +# ----------------------------------- +# Nordic nRF52840 DK +# ----------------------------------- +pca10056.name=Nordic nRF52840 DK + +# VID/PID for Bootloader, Arduino & CircuitPython +pca10056.vid.0=0x239A +pca10056.pid.0=0x8029 +pca10056.vid.1=0x239A +pca10056.pid.1=0x0029 + +# Upload +pca10056.bootloader.tool=bootburn +pca10056.upload.tool=nrfutil +pca10056.upload.protocol=nrfutil +pca10056.upload.use_1200bps_touch=true +pca10056.upload.wait_for_upload_port=true +pca10056.upload.maximum_size=815104 +pca10056.upload.maximum_data_size=237568 + +# Build +pca10056.build.mcu=cortex-m4 +pca10056.build.f_cpu=64000000 +pca10056.build.board=NRF52840_PCA10056 +pca10056.build.core=nRF5 +pca10056.build.variant=pca10056 +pca10056.build.usb_manufacturer="Nordic" +pca10056.build.usb_product="nRF52840 DK" +pca10056.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +pca10056.build.ldscript=nrf52840_s140_v6.ld +pca10056.build.vid=0x239A +pca10056.build.pid=0x8029 + +# SoftDevice Menu +pca10056.menu.softdevice.s140v6=S140 6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_name=s140 +pca10056.menu.softdevice.s140v6.build.sd_version=6.1.1 +pca10056.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +pca10056.menu.debug.l0=Level 0 (Release) +pca10056.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +pca10056.menu.debug.l1=Level 1 (Error Message) +pca10056.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +pca10056.menu.debug.l2=Level 2 (Full Debug) +pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +pca10056.menu.debug.l3=Level 3 (Segger SystemView) +pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +pca10056.menu.debug_output.serial=Serial +pca10056.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +pca10056.menu.debug_output.serial1=Serial1 +pca10056.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +pca10056.menu.debug_output.rtt=Segger RTT +pca10056.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + +# ----------------------------------- +# Particle Xenon +# ----------------------------------- +particle_xenon.name=Particle Xenon + +# VID/PID for Bootloader, Arduino & CircuitPython +particle_xenon.vid.0=0x239A +particle_xenon.pid.0=0x8029 +particle_xenon.vid.1=0x239A +particle_xenon.pid.1=0x0029 + +# Upload +particle_xenon.bootloader.tool=bootburn +particle_xenon.upload.tool=nrfutil +particle_xenon.upload.protocol=nrfutil +particle_xenon.upload.use_1200bps_touch=true +particle_xenon.upload.wait_for_upload_port=true +particle_xenon.upload.maximum_size=815104 +particle_xenon.upload.maximum_data_size=237568 + +# Build +particle_xenon.build.mcu=cortex-m4 +particle_xenon.build.f_cpu=64000000 +particle_xenon.build.board=PARTICLE_XENON +particle_xenon.build.core=nRF5 +particle_xenon.build.variant=particle_xenon +particle_xenon.build.usb_manufacturer="Particle" +particle_xenon.build.usb_product="Xenon" +particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +particle_xenon.build.ldscript=nrf52840_s140_v6.ld +particle_xenon.build.vid=0x239A +particle_xenon.build.pid=0x8029 + +# SoftDevice Menu +particle_xenon.menu.softdevice.s140v6=S140 6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_name=s140 +particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1 +particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +particle_xenon.menu.debug.l0=Level 0 (Release) +particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +particle_xenon.menu.debug.l1=Level 1 (Error Message) +particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +particle_xenon.menu.debug.l2=Level 2 (Full Debug) +particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +particle_xenon.menu.debug.l3=Level 3 (Segger SystemView) +particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# Debug Output Menu +particle_xenon.menu.debug_output.serial=Serial +particle_xenon.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0 +particle_xenon.menu.debug_output.serial1=Serial1 +particle_xenon.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG +particle_xenon.menu.debug_output.rtt=Segger RTT +particle_xenon.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL + + +# ---------------------------------- +# NINA B302 +# ---------------------------------- +ninab302.name=NINA B302 ublox + +# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App +ninab302.vid.0=0x239A +ninab302.pid.0=0x8029 +ninab302.vid.1=0x239A +ninab302.pid.1=0x0029 +ninab302.vid.2=0x7239A +ninab302.pid.2=0x002A +ninab302.vid.3=0x239A +ninab302.pid.3=0x802A + +# Upload +ninab302.bootloader.tool=bootburn +ninab302.upload.tool=nrfutil +ninab302.upload.protocol=nrfutil +ninab302.upload.use_1200bps_touch=true +ninab302.upload.wait_for_upload_port=true +ninab302.upload.maximum_size=815104 +ninab302.upload.maximum_data_size=237568 + +# Build +ninab302.build.mcu=cortex-m4 +ninab302.build.f_cpu=64000000 +ninab302.build.board=NINA_B302_ublox +ninab302.build.core=nRF5 +ninab302.build.variant=NINA_B302_ublox +ninab302.build.usb_manufacturer="Nordic" +ninab302.build.usb_product="NINA B302 ublox" +ninab302.build.extra_flags=-DNRF52840_XXAA -DNINA_B302_ublox {build.flags.usb} +ninab302.build.ldscript=nrf52840_s140_v6.ld +ninab302.build.vid=0x239A +ninab302.build.pid=0x8029 + +# SofDevice Menu +ninab302.menu.softdevice.s140v6=0.3.2 SoftDevice s140 6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_name=s140 +ninab302.menu.softdevice.s140v6.build.sd_version=6.1.1 +ninab302.menu.softdevice.s140v6.build.sd_fwid=0x00B6 + +# Debug Menu +ninab302.menu.debug.l0=Level 0 (Release) +ninab302.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab302.menu.debug.l1=Level 1 (Error Message) +ninab302.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab302.menu.debug.l2=Level 2 (Full Debug) +ninab302.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab302.menu.debug.l3=Level 3 (Segger SystemView) +ninab302.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab302.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +# ---------------------------------- +# NINA B112 +# ---------------------------------- +ninab112.name=NINA B112 ublox +ninab112.bootloader.tool=bootburn + +# Upload +ninab112.upload.tool=nrfutil +ninab112.upload.protocol=nrfutil +ninab112.upload.use_1200bps_touch=false +ninab112.upload.wait_for_upload_port=false +ninab112.upload.native_usb=false +ninab112.upload.maximum_size=290816 +ninab112.upload.maximum_data_size=52224 + +# Build +ninab112.build.mcu=cortex-m4 +ninab112.build.f_cpu=64000000 +ninab112.build.board=NINA_B112_ublox +ninab112.build.core=nRF5 +ninab112.build.variant=NINA_B112_ublox +feather52840.build.usb_manufacturer="Adafruit LLC" +feather52840.build.usb_product="Feather nRF52832" +ninab112.build.extra_flags=-DNRF52832_XXAA -DNINA_B112_ublox -DNRF52 +ninab112.build.ldscript=nrf52832_s132_v6.ld + +# SofDevice Menu +ninab112.menu.softdevice.s132v6=0.3.2 SoftDevice s132 6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_name=s132 +ninab112.menu.softdevice.s132v6.build.sd_version=6.1.1 +ninab112.menu.softdevice.s132v6.build.sd_fwid=0x00B7 + +# Debug Menu +ninab112.menu.debug.l0=Level 0 (Release) +ninab112.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +ninab112.menu.debug.l1=Level 1 (Error Message) +ninab112.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +ninab112.menu.debug.l2=Level 2 (Full Debug) +ninab112.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +ninab112.menu.debug.l3=Level 3 (Segger SystemView) +ninab112.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +ninab112.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 + +################################################################## +## KH Add SparkFun Pro nRF52840 Mini +################################################################## +#********************************************** +# SparkFun Pro nRF52840 Mini +#********************************************** +sparkfunnrf52840mini.name=SparkFun Pro nRF52840 Mini + +# DFU Mode with CDC only +sparkfunnrf52840mini.vid.0=0x1B4F +sparkfunnrf52840mini.pid.0=0x002A + +# DFU Mode with CDC + MSC (UF2) +sparkfunnrf52840mini.vid.1=0x1B4F +sparkfunnrf52840mini.pid.1=0x0029 + +# Application with CDC + MSC +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x8029 + +# CircuitPython +sparkfunnrf52840mini.vid.2=0x1B4F +sparkfunnrf52840mini.pid.2=0x802A + +sparkfunnrf52840mini.bootloader.tool=bootburn + +# Upload +sparkfunnrf52840mini.upload.tool=nrfutil +sparkfunnrf52840mini.upload.protocol=nrfutil +sparkfunnrf52840mini.upload.use_1200bps_touch=true +sparkfunnrf52840mini.upload.wait_for_upload_port=true +#sparkfunnrf52840mini.upload.native_usb=true + +# Build +sparkfunnrf52840mini.build.mcu=cortex-m4 +sparkfunnrf52840mini.build.f_cpu=64000000 +sparkfunnrf52840mini.build.board=NRF52840_FEATHER +sparkfunnrf52840mini.build.core=nRF5 +sparkfunnrf52840mini.build.variant=sparkfun_nrf52840_mini +sparkfunnrf52840mini.build.extra_flags=-DNRF52840_XXAA {build.flags.usb} +sparkfunnrf52840mini.build.vid=0x1B4F +sparkfunnrf52840mini.build.pid=0x5284 +sparkfunnrf52840mini.build.usb_manufacturer="SparkFun" +sparkfunnrf52840mini.build.usb_product="nRF52840 Mini Breakout" + +# SofDevice Menu +# Ram & ROM size varies depending on SoftDevice (check linker script) + +sparkfunnrf52840mini.menu.softdevice.s140v6=s140 6.1.1 r0 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_flags=-DS140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_name=s140 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_version=6.1.1 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.sd_fwid=0x00B6 +sparkfunnrf52840mini.menu.softdevice.s140v6.build.ldscript=nrf52840_s140_v6.ld +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_size=815104 +sparkfunnrf52840mini.menu.softdevice.s140v6.upload.maximum_data_size=248832 + +# Debug Menu +sparkfunnrf52840mini.menu.debug.l0=Level 0 (Release) +sparkfunnrf52840mini.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os +sparkfunnrf52840mini.menu.debug.l1=Level 1 (Error Message) +sparkfunnrf52840mini.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os +sparkfunnrf52840mini.menu.debug.l2=Level 2 (Full Debug) +sparkfunnrf52840mini.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os +sparkfunnrf52840mini.menu.debug.l3=Level 3 (Segger SystemView) +sparkfunnrf52840mini.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os + +################################################################## diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp new file mode 100644 index 0000000..d2db957 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. 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 + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.h new file mode 100644 index 0000000..d03d1cc --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.h @@ -0,0 +1,123 @@ +/* + Copyright (c) 2016 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 +*/ + +#pragma once + +#include +#include // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h new file mode 100644 index 0000000..c2d5824 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h @@ -0,0 +1,100 @@ +/* + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ + +#ifndef udp_h +#define udp_h + +#include +#include + +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = + 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + + // KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + + virtual void stop() = 0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; +}; + +#endif diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/platform.txt b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/platform.txt new file mode 100644 index 0000000..14296ad --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/platform.txt @@ -0,0 +1,166 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. All rights 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 + +name=Adafruit nRF52 Boards +version=1.3.0 + +# Compile variables +# ----------------- + +compiler.warning_flags=-Werror=return-type +compiler.warning_flags.none=-Werror=return-type +compiler.warning_flags.default=-Werror=return-type +compiler.warning_flags.more=-Wall -Werror=return-type +compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith + +# Allow changing optimization settings via platform.local.txt / boards.local.txt +compiler.optimization_flag=-Ofast + +compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD + +# KH, Error here to use gcc, must use g++ +#compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.cmd=arm-none-eabi-g++ + +compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp + +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2bin.flags=-O binary +compiler.elf2bin.cmd=arm-none-eabi-objcopy +compiler.elf2hex.flags=-O ihex +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs +compiler.size.cmd=arm-none-eabi-size + +# this can be overriden in boards.txt +# Logger 0: Serial (CDC), 1 Serial1 (UART), 2 Segger RTT +build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float +build.debug_flags=-DCFG_DEBUG=0 +build.logger_flags=-DCFG_LOGGER=0 +build.sysview_flags=-DCFG_SYSVIEW=0 + +# USB flags +build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.libraries.ldflags= +compiler.elf2bin.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math + +# common compiler for nrf +rtos.path={build.core.path}/freertos +nordic.path={build.core.path}/nordic + +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino" + +# Compile patterns +# ---------------- + +## Compile c files +## KH Add '-DBOARD_NAME="{build.board}"' +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} '-DBOARD_NAME="{build.board}"' -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +## KH Add '-DBOARD_NAME="{build.board}"' +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} '-DBOARD_NAME="{build.board}"' -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +## KH Add '-DBOARD_NAME="{build.board}"' +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} '-DBOARD_NAME="{build.board}"' -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Create archives +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group + +## Create output (bin file) +#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Create dfu package zip file +recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" + +## Create uf2 file +#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" + +## Save bin +recipe.output.tmp_file_bin={build.project_name}.bin +recipe.output.save_file_bin={build.project_name}.save.bin + +## Save hex +recipe.output.tmp_file_hex={build.project_name}.hex +recipe.output.save_file_hexu={build.project_name}.save.hex + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* + +## Export Compiled Binary +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + +#*************************************************** +# adafruit-nrfutil for uploading +# https://github.com/adafruit/Adafruit_nRF52_nrfutil +# pre-built binaries are provided for macos and windows +#*************************************************** +tools.nrfutil.cmd=adafruit-nrfutil +tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe +tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil + +tools.nrfutil.upload.params.verbose=--verbose +tools.nrfutil.upload.params.quiet= +tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank + +#*************************************************** +# Burning bootloader with either jlink or nrfutil +#*************************************************** + +# Bootloader version +tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.2_{build.sd_name}_{build.sd_version} + +tools.bootburn.bootloader.params.verbose= +tools.bootburn.bootloader.params.quiet= +tools.bootburn.bootloader.pattern={program.burn_pattern} + +# erase flash page while programming +tools.bootburn.erase.params.verbose= +tools.bootburn.erase.params.quiet= +tools.bootburn.erase.pattern= + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.cpp new file mode 100644 index 0000000..63d3f4d --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.cpp @@ -0,0 +1,60 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" + +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 5, // D0 is P0.05 (UART RX) + 6, // D1 is P0.06 (UART TX) + 7, // D2 is P0.07 + 31, // D3 is P0.31 + 18, // D4 is P0.18 (LED Blue) + 99, // D5 (NC) + 9, // D6 is P0.09 NFC1 + 10, // D7 is P0.10 (Button) NFC2 + 99, // D8 (NC) + 8, // D9 is P0.08 + 11, // D10 is P0.11 CS + 13, // D11 is P0.13 MOSI + 12, // D12 is P0.12 MISO + 14, // D13 is P0.14 SCK + //I2C + 2, // D14 is P0.2 (SDA) + 3, // D15 is P0.3 (SCL) + // D16 .. D21 (aka A0 .. A5) + 3, // D16 is P0.03 (A0) + 2, // D17 is P0.02 (A1) + 4, // D18 is P0.04 (A2) + 30, // D19 is P0.30 (A3) SW2 + 29, // D20 is P0.29 (A4) + 28, // D21 is P0.28 (A5) + 9, // P0.09 NFC + 10, // P0.10 NFC + 16, // SW1 (LED Green) +}; \ No newline at end of file diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.h new file mode 100644 index 0000000..caa0b61 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.h @@ -0,0 +1,172 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +//https://www.u-blox.com/sites/default/files/NINA-B1_DataSheet_UBX-15019243.pdf +//https://www.u-blox.com/sites/default/files/EVK-NINA-B1_UserGuide_%28UBX-15028120%29_C1-Public.pdf + +#ifndef _VARIANT_NINA_B112_UBLOX_ +#define _VARIANT_NINA_B112_UBLOX_ + +#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ + .rc_ctiv = 0, \ +.rc_temp_ctiv = 0, \ +.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_OUTPUTS (0u) + +// LEDs +#define PIN_LED LED1 +#define LED_BUILTIN PIN_LED + +//LEDs onboard +#define LED1 (0) // Red +#define LED2 (24) // Green/SW1 +#define LED3 (4) // Blue + +#define LED_STATE_ON 1 // State when LED is litted + +//Switch +#define SW1 (24) +#define SW2 (19) + +// NFC +#define PIN_NFC_1 (6) // P0.9 +#define PIN_NFC_2 (7) // P0.10 + +/* + Analog pins +*/ +#define PIN_A0 (16) // P0.03 +#define PIN_A1 (17) // P0.02 +#define PIN_A2 (18) // P0.04 +#define PIN_A3 (19) // P0.30 +#define PIN_A4 (20) // P0.29 +#define PIN_A5 (21) // P0.28 + +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 14 + +#define PIN_D0 (0) // P0.05 +#define PIN_D1 (1) // P0.06 +#define PIN_D2 (2) // P0.07 +#define PIN_D3 (4) // P0.31 +#define PIN_D4 (5) // P0.18 +#define PIN_D6 (6) // P0.09 +#define PIN_D7 (7) // P0.10 +#define PIN_D9 (9) // P0.08 +#define PIN_D10 (11) // P0.11 +#define PIN_D11 (13) // P0.13 +#define PIN_D12 (12) // P0.12 +#define PIN_D13 (14) // P0.14 +#define PIN_D14 (2) // P0.02 +#define PIN_D15 (3) // P0.03 + +static const uint8_t D0 = PIN_D0 ; +static const uint8_t D1 = PIN_D1 ; +static const uint8_t D2 = PIN_D2 ; +static const uint8_t D3 = PIN_D3 ; +static const uint8_t D4 = PIN_D4 ; +static const uint8_t D6 = PIN_D6 ; +static const uint8_t D7 = PIN_D7 ; +static const uint8_t D9 = PIN_D9 ; +static const uint8_t D10 = PIN_D10 ; +static const uint8_t D11 = PIN_D11 ; +static const uint8_t D12 = PIN_D12 ; +static const uint8_t D13 = PIN_D13 ; +static const uint8_t D14 = PIN_D14 ; +static const uint8_t D15 = PIN_D15 ; + +// Other pins +//static const uint8_t AREF = PIN_AREF; + +//#define PIN_AREF (24) +//#define PIN_VBAT PIN_A7 + +/* + Serial interfaces +*/ +#define PIN_SERIAL_RX (0) // P0.05 +#define PIN_SERIAL_TX (1) // P0.06 +#define PIN_SERIAL_CTS (2) // P0.07 +#define PIN_SERIAL_RTS (3) // P0.31 +#define PIN_SERIAL_DTR (28) // P0.28 +#define PIN_SERIAL_DSR (29) // P0.29 + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (12) // P0.12 +#define PIN_SPI_MOSI (11) // P0.13 +#define PIN_SPI_SCK (13) // P0.14 + +static const uint8_t SS = 10 ; // P0.11 +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 (14) // P0.02 +#define PIN_WIRE_SCL (15) // P0.03 + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + + +#endif //_VARIANT_NINA_B112_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/pins_arduino.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/pins_arduino.h new file mode 100644 index 0000000..3ef4d4a --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/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/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.cpp new file mode 100644 index 0000000..7f317d6 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.cpp @@ -0,0 +1,87 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#include "variant.h" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // D0 .. D13 + 29, // D0 is P0.29 (UART RX) + 45, // D1 is P1.13 (UART TX) + 44, // D2 is P1.12 (NFC2) + 31, // D3 is P0.31 (LED1) + 13, // D4 is P0.13 (LED2) + 11, // D5 is P0.11 + 9, // D6 is P0.09 + 10, // D7 is P0.10 (Button) + 41, // D8 is P1.09 + 12, // D9 is P0.12 + 14, // D10 is P0.14 + 15, // D11 is P0.15 + 32, // D12 is P1.00 + 7, // D13 is P0.07 + + // D14 .. D21 (aka A0 .. A5) + 4, // D14 is P0.04 (A0) + 30, // D15 is P0.30 (A1) + 5, // D16 is P0.05 (A2) + 2, // D17 is P0.02 (A3) + 28, // D18 is P0.28 (A4) + 3, // D19 is P0.03 (A5) + + // D20 .. D21 (aka I2C pins) + 16, // D20 is P0.16 (SDA) + 24, // D21 is P0.24 (SCL) + + // QSPI pins (not exposed via any header / test point) + 19, // D22 is P0.19 (QSPI CLK) + 17, // D23 is P0.17 (QSPI CS) + 20, // D24 is P0.20 (QSPI Data 0) + 21, // D25 is P0.21 (QSPI Data 1) + 22, // D26 is P0.22 (QSPI Data 2) + 26, // D27 is P0.23 (QSPI Data 3) + + 40, // D28 is P1.08 - IO34 + 41, // D29 is P1.01 - IO35 + 44, // D30 is P1.02 - IO36 + 45, // D31 is P1.03 - IO37 + 42, // D32 is P1.10 - IO38 + 43, // D33 is P1.11 - IO39 + 47, // D34 is P1.15 - IO40 + 46, // D35 is P1.14 - IO41 + 26, // D36 is P0.26 - IO42 + 6, // D37 is P0.6 - IO43 + 27, // D38 is P0.27 - IO44 +}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.h new file mode 100644 index 0000000..d588790 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.h @@ -0,0 +1,149 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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 +*/ + +// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). +// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) + +#ifndef _VARIANT_NINA_B302_UBLOX_ +#define _VARIANT_NINA_B302_UBLOX_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus +// Number of pins defined in PinDescription array +#define PINS_COUNT (40) +#define NUM_DIGITAL_PINS (34) +#define NUM_ANALOG_INPUTS (6) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (3) +#define PIN_LED2 (4) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +/* + Buttons +*/ +#define PIN_BUTTON1 (7) + +/* + Analog pins +*/ +#define PIN_A0 (14) +#define PIN_A1 (15) +#define PIN_A2 (16) +#define PIN_A3 (17) +#define PIN_A4 (18) +#define PIN_A5 (19) + +#define D0 (0) +#define D1 (1) +#define D2 (2) +#define D3 (3) +#define D4 (4) +#define D5 (5) +#define D6 (6) +#define D7 (7) +#define D8 (8) +#define D9 (9) +#define D10 (10) +#define D11 (11) +#define D12 (12) +#define D13 (13) + +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 14 + +#define PIN_NFC1 (31) +#define PIN_NFC2 (2) + +/* + Serial interfaces +*/ +#define PIN_SERIAL1_RX (0) +#define PIN_SERIAL1_TX (1) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (22) //24 original +#define PIN_SPI_MOSI (23) //25 original +#define PIN_SPI_SCK (24) //26 original + +static const uint8_t SS = (13); +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 (20) +#define PIN_WIRE_SCL (21) + +// QSPI Pins +#define PIN_QSPI_SCK 22 +#define PIN_QSPI_CS 23 +#define PIN_QSPI_IO0 24 +#define PIN_QSPI_IO1 25 +#define PIN_QSPI_IO2 26 +#define PIN_QSPI_IO3 27 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES GD25Q16C +#define EXTERNAL_FLASH_USE_QSPI + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif //_VARIANT_NINA_B302_UBLOX_ diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.cpp b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.cpp new file mode 100644 index 0000000..534abf3 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.cpp @@ -0,0 +1,49 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "nrf.h" + +const uint32_t g_ADigitalPinMap[] = +{ + // P0 + 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, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 +}; +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} + diff --git a/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.h b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.h new file mode 100644 index 0000000..f98c8e0 --- /dev/null +++ b/Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.h @@ -0,0 +1,152 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + 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_SPARKFUN52840MINI_ +#define _VARIANT_SPARKFUN52840MINI_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + Headers + ----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (64) +#define NUM_DIGITAL_PINS (64) +#define NUM_ANALOG_INPUTS (8) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (7) +#define PIN_LED2 (14) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_BLUE PIN_LED1 +#define LED_RED PIN_LED2 + +#define LED_STATE_ON 1 // State when LED is litted + +// Buttons +/* + #define PIN_BUTTON1 (2) + #define PIN_BUTTON2 (3) + #define PIN_BUTTON3 (4) + #define PIN_BUTTON4 (5) +*/ + +/* + Analog pins +*/ +#define PIN_A0 (2) +#define PIN_A1 (3) +#define PIN_A2 (4) +#define PIN_A3 (5) +#define PIN_A4 (28) +#define PIN_A5 (29) +#define PIN_A6 (30) +#define PIN_A7 (31) + +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 ; +static const uint8_t A6 = PIN_A6 ; +static const uint8_t A7 = PIN_A7 ; +#define ADC_RESOLUTION 14 + +// Other pins +#define PIN_AREF (2) +#define PIN_DFU (13) +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +static const uint8_t AREF = PIN_AREF; + +/* + Serial interfaces +*/ +// Serial +//Previous Hardware UART definition for nRF52 Arduino Core, below 0.16.0 +//Feel free to comment out these two lines below if there are conflicts with latest release +#define PIN_SERIAL_RX (15) +#define PIN_SERIAL_TX (17) + +//Hardware UART definition for nRF52 Arduino Core, 0.17.0 and above +#define PIN_SERIAL1_RX (15) +#define PIN_SERIAL1_TX (17) + +/* + SPI Interfaces +*/ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (31) +#define PIN_SPI_MOSI (3) +#define PIN_SPI_SCK (30) + +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 (8) +#define PIN_WIRE_SCL (11) + +/* + QSPI interface for external flash +*/ +#define PIN_QSPI_SCK 32 +#define PIN_QSPI_CS 33 +#define PIN_QSPI_DATA0 34 +#define PIN_QSPI_DATA1 35 +#define PIN_QSPI_DATA2 36 +#define PIN_QSPI_DATA3 37 + +// On-board QSPI Flash +// If EXTERNAL_FLASH_DEVICES is not defined, all supported devices will be used +#define EXTERNAL_FLASH_DEVICES GD25Q16C + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + Arduino objects - C++ only + ----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file