From ab13cfd3959951094ea313cc507456077e52a8cc Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 4 Jun 2021 12:21:48 +0700 Subject: [PATCH] add back raytac dongle with correct PID --- boards.txt | 52 +++++++++++++++ variants/raytac_mdbt50q_rx/variant.cpp | 44 +++++++++++++ variants/raytac_mdbt50q_rx/variant.h | 89 ++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 variants/raytac_mdbt50q_rx/variant.cpp create mode 100644 variants/raytac_mdbt50q_rx/variant.h diff --git a/boards.txt b/boards.txt index bf715c9d..a5bcb844 100644 --- a/boards.txt +++ b/boards.txt @@ -496,3 +496,55 @@ 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 Corporation" +mdbt50qrx.build.usb_product="Raytac MDBT50Q - RX" +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=0.5.0 SoftDevice 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 diff --git a/variants/raytac_mdbt50q_rx/variant.cpp b/variants/raytac_mdbt50q_rx/variant.cpp new file mode 100644 index 00000000..115282a0 --- /dev/null +++ b/variants/raytac_mdbt50q_rx/variant.cpp @@ -0,0 +1,44 @@ +/* + 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[] = +{ + // D0 .. D13 + 45, // D0 is P1.13 (LED1) + 43, // D1 is P1.11 (LED2) + 15, // D2 is P0.15 (Button) +}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} + diff --git a/variants/raytac_mdbt50q_rx/variant.h b/variants/raytac_mdbt50q_rx/variant.h new file mode 100644 index 00000000..0ee7fd1b --- /dev/null +++ b/variants/raytac_mdbt50q_rx/variant.h @@ -0,0 +1,89 @@ + /* + 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_MDBT50Q_RX_ +#define _VARIANT_MDBT50Q_RX_ + +/** 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 (3) +#define NUM_DIGITAL_PINS (3) +#define NUM_ANALOG_INPUTS (0) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (0) +#define PIN_LED2 (1) + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_RED PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 0 // State when LED is litted + +/* + * Buttons + */ +#define PIN_BUTTON1 2 + +#define PIN_DFU 2 + +// Buttons +/* +#define PIN_BUTTON1 (2) +#define PIN_BUTTON2 (3) +#define PIN_BUTTON3 (4) +#define PIN_BUTTON4 (5) +*/ + +#define ADC_RESOLUTION 14 + +// Bad things happen if the serial pins aren't defined. Instead +// define them with an invalid pin number +// Serial +#define PIN_SERIAL1_RX (3) +#define PIN_SERIAL1_TX (3) + + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif