Merge pull request #640 from adafruit/rework-tinyusb-lib
Rework tinyusb lib
This commit is contained in:
55 files changed
+97
-226
No files matched your search
@@ -62,6 +62,9 @@ jobs:
|
||||
# https://github.com/firmata/arduino/pull/438
|
||||
git clone --depth 1 https://github.com/firmata/arduino.git $HOME/Arduino/libraries/firmata
|
||||
|
||||
# TODO temporarily remove TinyUSB pre-1.0.0 version install by arduino-cli
|
||||
rm -r $HOME/Arduino/libraries/Adafruit_TinyUSB_Library
|
||||
|
||||
# Library summary
|
||||
arduino-cli lib list
|
||||
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
# Ignore local overrides of platform.txt and boards.txt,
|
||||
/boards.local.txt
|
||||
/platform.local.txt
|
||||
/libraries/**/build/
|
||||
@@ -4,3 +4,6 @@
|
||||
[submodule "libraries/Adafruit_nRFCrypto"]
|
||||
path = libraries/Adafruit_nRFCrypto
|
||||
url = https://github.com/adafruit/Adafruit_nRFCrypto.git
|
||||
[submodule "libraries/Adafruit_TinyUSB_Arduino"]
|
||||
path = libraries/Adafruit_TinyUSB_Arduino
|
||||
url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
|
||||
@@ -57,10 +57,14 @@ void resumeLoop(void);
|
||||
#include "pulse.h"
|
||||
#include "HardwarePWM.h"
|
||||
#include "utility/SoftwareTimer.h"
|
||||
|
||||
#include "Uart.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_TINYUSB
|
||||
// Needed for declaring Serial
|
||||
#include "Adafruit_USBD_CDC.h"
|
||||
#endif
|
||||
|
||||
#include "delay.h"
|
||||
#include "binary.h"
|
||||
#include "common_inc.h"
|
||||
@@ -68,9 +72,6 @@ void resumeLoop(void);
|
||||
#include "utility/utilities.h"
|
||||
#include "utility/AdaCallback.h"
|
||||
|
||||
#ifdef USE_TINYUSB
|
||||
#include "Adafruit_TinyUSB_Core.h"
|
||||
#endif
|
||||
|
||||
// Include board variant
|
||||
#include "variant.h"
|
||||
|
||||
Submodule cores/nRF5/TinyUSB/Adafruit_TinyUSB_ArduinoCore deleted from e7b892095f.
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019, hathach for Adafruit
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef USE_TINYUSB
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "nrfx_power.h"
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Adafruit_TinyUSB_Core.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#define USBD_STACK_SZ (200)
|
||||
|
||||
// tinyusb function that handles power event (detected, ready, removed)
|
||||
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
|
||||
extern "C" void tusb_hal_nrf_power_event(uint32_t event);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
extern "C" void USBD_IRQHandler(void)
|
||||
{
|
||||
#if CFG_SYSVIEW
|
||||
SEGGER_SYSVIEW_RecordEnterISR();
|
||||
#endif
|
||||
|
||||
tud_int_handler(0);
|
||||
|
||||
#if CFG_SYSVIEW
|
||||
SEGGER_SYSVIEW_RecordExitISR();
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Core Init & Touch1200
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Init usb hardware when starting up. Softdevice is not enabled yet
|
||||
static void usb_hardware_init(void)
|
||||
{
|
||||
// Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice
|
||||
// 2 is highest for application
|
||||
NVIC_SetPriority(USBD_IRQn, 2);
|
||||
|
||||
// USB power may already be ready at this time -> no event generated
|
||||
// We need to invoke the handler based on the status initially
|
||||
uint32_t usb_reg = NRF_POWER->USBREGSTATUS;
|
||||
|
||||
// Power module init
|
||||
const nrfx_power_config_t pwr_cfg = { 0 };
|
||||
nrfx_power_init(&pwr_cfg);
|
||||
|
||||
// Register tusb function as USB power handler
|
||||
const nrfx_power_usbevt_config_t config = { .handler = (nrfx_power_usb_event_handler_t) tusb_hal_nrf_power_event };
|
||||
nrfx_power_usbevt_init(&config);
|
||||
|
||||
nrfx_power_usbevt_enable();
|
||||
|
||||
if ( usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_DETECTED);
|
||||
}
|
||||
|
||||
// USB Device Driver task
|
||||
// This top level thread process all usb events and invoke callbacks
|
||||
static void usb_device_task(void* param)
|
||||
{
|
||||
(void) param;
|
||||
|
||||
Serial.setStringDescriptor("TinyUSB Serial");
|
||||
USBDevice.addInterface(Serial);
|
||||
USBDevice.setID(USB_VID, USB_PID);
|
||||
USBDevice.begin();
|
||||
|
||||
usb_hardware_init();
|
||||
|
||||
// Init tinyusb stack
|
||||
tusb_init();
|
||||
|
||||
// RTOS forever loop
|
||||
while (1)
|
||||
{
|
||||
// tinyusb device task
|
||||
tud_task();
|
||||
}
|
||||
}
|
||||
|
||||
void Adafruit_TinyUSB_Core_init(void)
|
||||
{
|
||||
// Create a task for tinyusb device stack
|
||||
xTaskCreate(usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
|
||||
}
|
||||
|
||||
void Adafruit_TinyUSB_Core_touch1200(void)
|
||||
{
|
||||
delay(5); // a few millisecond for USB control status completion
|
||||
enterSerialDfu();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Adafruit_USBD_Device platform dependent
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
uint8_t Adafruit_USBD_Device::getSerialDescriptor(uint16_t* serial_str)
|
||||
{
|
||||
// Serial is 64-bit DeviceID -> 16 chars len
|
||||
char tmp_serial[17];
|
||||
sprintf(tmp_serial, "%08lX%08lX", NRF_FICR->DEVICEID[1], NRF_FICR->DEVICEID[0]);
|
||||
|
||||
for(uint8_t i=0; i<16; i++) serial_str[i] = tmp_serial[i];
|
||||
return 16;
|
||||
}
|
||||
|
||||
#endif // USE_TINYUSB
|
||||
@@ -36,11 +36,13 @@
|
||||
#ifndef COMMON_INC_H_
|
||||
#define COMMON_INC_H_
|
||||
|
||||
#define ATTR_PACKED __attribute__ ((packed))
|
||||
#define ATTR_WEAK __attribute__((weak))
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "compiler_macro.h"
|
||||
#include "common_func.h"
|
||||
#include "verify.h"
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/******************************************************************************/
|
||||
/*!
|
||||
@file compiler_macro.h
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2013, K. Townsend (microBuilder.eu)
|
||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef _COMPILER_MACRO_H_
|
||||
#define _COMPILER_MACRO_H_
|
||||
|
||||
#include "common/tusb_compiler.h"
|
||||
|
||||
#define ATTR_PACKED TU_ATTR_PACKED
|
||||
#define ATTR_WEAK TU_ATTR_WEAK
|
||||
|
||||
#endif /* _COMPILER_MACRO_H_ */
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ void delay( uint32_t ms )
|
||||
#ifdef USE_TINYUSB
|
||||
// Take chance to flush usb cdc
|
||||
uint32_t flush_tick = xTaskGetTickCount();
|
||||
tud_cdc_write_flush();
|
||||
TinyUSB_Device_FlushCDC();
|
||||
|
||||
flush_tick = xTaskGetTickCount()-flush_tick;
|
||||
if (flush_tick >= ticks) return;
|
||||
|
||||
+14
-14
@@ -15,10 +15,17 @@
|
||||
|
||||
#define ARDUINO_MAIN
|
||||
#include "Arduino.h"
|
||||
|
||||
#if (CFG_LOGGER == 2)
|
||||
#include <SEGGER_RTT.h>
|
||||
#endif
|
||||
|
||||
// From the UI, setting debug level to 3 will enable SysView
|
||||
#if CFG_SYSVIEW
|
||||
#include "SEGGER_RTT.h"
|
||||
#include "SEGGER_SYSVIEW.h"
|
||||
#endif
|
||||
|
||||
// DEBUG Level 1
|
||||
#if CFG_DEBUG
|
||||
// weak function to avoid compilation error with
|
||||
@@ -27,15 +34,6 @@ void Bluefruit_printInfo() __attribute__((weak));
|
||||
void Bluefruit_printInfo() {}
|
||||
#endif
|
||||
|
||||
// From the UI, setting debug level to 3 will enable SysView
|
||||
#if CFG_SYSVIEW
|
||||
#include "SEGGER_RTT.h"
|
||||
#include "SEGGER_SYSVIEW.h"
|
||||
#endif
|
||||
|
||||
static TaskHandle_t _loopHandle;
|
||||
|
||||
|
||||
// Weak empty variant initialization function.
|
||||
// May be redefined by variant files.
|
||||
void initVariant() __attribute__((weak));
|
||||
@@ -44,10 +42,16 @@ void initVariant() { }
|
||||
#define LOOP_STACK_SZ (256*4)
|
||||
#define CALLBACK_STACK_SZ (256*3)
|
||||
|
||||
static TaskHandle_t _loopHandle;
|
||||
|
||||
static void loop_task(void* arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
#ifdef USE_TINYUSB
|
||||
TinyUSB_Device_Init(0);
|
||||
#endif
|
||||
|
||||
#if CFG_DEBUG
|
||||
// If Serial is not begin(), call it to avoid hard fault
|
||||
if(!Serial) Serial.begin(115200);
|
||||
@@ -80,12 +84,8 @@ int main( void )
|
||||
SEGGER_SYSVIEW_Conf();
|
||||
#endif
|
||||
|
||||
#ifdef USE_TINYUSB
|
||||
Adafruit_TinyUSB_Core_init();
|
||||
#endif
|
||||
|
||||
// Create a task for loop()
|
||||
xTaskCreate( loop_task, "loop", LOOP_STACK_SZ, NULL, TASK_PRIO_LOW, &_loopHandle);
|
||||
xTaskCreate(loop_task, "loop", LOOP_STACK_SZ, NULL, TASK_PRIO_LOW, &_loopHandle);
|
||||
|
||||
// Initialize callback task
|
||||
ada_callback_init(CALLBACK_STACK_SZ);
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ extern "C"
|
||||
void yield(void)
|
||||
{
|
||||
#ifdef USE_TINYUSB
|
||||
tud_cdc_write_flush();
|
||||
TinyUSB_Device_FlushCDC();
|
||||
#endif
|
||||
|
||||
taskYIELD();
|
||||
|
||||
File renamed without changes.
+4
-8
@@ -40,18 +40,16 @@
|
||||
#ifndef _VERIFY_H_
|
||||
#define _VERIFY_H_
|
||||
|
||||
#include "compiler_macro.h"
|
||||
//--------------------------------------------------------------------+
|
||||
// Compile-time Assert
|
||||
//--------------------------------------------------------------------+
|
||||
#define VERIFY_STATIC(const_expr) _Static_assert(const_expr, "Assert failed")
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Compile-time Assert
|
||||
//--------------------------------------------------------------------+
|
||||
#define VERIFY_STATIC(const_expr) TU_VERIFY_STATIC(const_expr, "Assert failed")
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// VERIFY Helper
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -132,8 +130,6 @@ extern "C"
|
||||
*/
|
||||
#define VERIFY(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_2ARGS, VERIFY_1ARGS)(__VA_ARGS__)
|
||||
|
||||
// TODO VERIFY with final statement
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Submodule
+1
Submodule libraries/Adafruit_TinyUSB_Arduino added at 1b8b9c9b07.
Submodule libraries/Adafruit_nRFCrypto updated: 50131a5834...01de30c89b.
@@ -17,6 +17,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
int ledPin = LED_RED; // LED connected to digital pin 9
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
* Note: Bluefruit nRF52832 does not support Serial1
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
const int baudrate = 115200;
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
int adcin = A5;
|
||||
int adcvalue = 0;
|
||||
float mv_per_lsb = 3600.0F/1024.0F; // 10-bit ADC with 3.6V input range
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
#if defined ARDUINO_NRF52840_CIRCUITPLAY
|
||||
#define PIN_VBAT A8 // this is just a mock read, we'll use the light sensor, so we can run the test
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
by Pierre Constantineau
|
||||
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include <bluefruit.h>
|
||||
|
||||
#define WAKE_LOW_PIN PIN_A0
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
by Arturo Guadalupi
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
|
||||
// the setup function runs once when you press reset or power the board
|
||||
void setup() {
|
||||
// initialize digital pin LED_BUILTIN as an output.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/* This sketch invoke API to enter OTA dfu mode */
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
/*
|
||||
* This sketch will reset the board into Serial DFU mode
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
* to defer callback from ISR context with attachInterrupt
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
int interruptPin = A0;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* -
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
#define SW_RXD A0
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
// Interval between systick event
|
||||
#define TICK_INTERVAL_MS 50
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
typedef volatile uint32_t REG32;
|
||||
#define pREG32 (REG32 *)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
|
||||
void setup()
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
// NFC pins to GPIO mode is a ONE WAY OPERATION and you will need a debugger
|
||||
// like a Segger J-Link to set them back to NFC mode!
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
while ( !Serial ) delay(10); // for nrf52840 with native usb
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
/*
|
||||
* Sketch demonstate mutli-task using Scheduler. Demo create loop2() that
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
/* SoftwareTimer is a helper class that uses FreeRTOS software timer
|
||||
* to invoke callback. Its periodic timing is flexible as opposed to
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// License: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
// PIN_BUZZER should be defined by the supported variant e.g CPlay Bluefruit or CLUE.
|
||||
// Otherwise please define the pin you would like to use for tone output
|
||||
|
||||
@@ -8,4 +8,4 @@ category=Communication
|
||||
url=https://github.com/adafruit/Adafruit_nRF52_Arduino
|
||||
architectures=*
|
||||
includes=bluefruit.h
|
||||
depends=Adafruit nRFCrypto
|
||||
depends=Adafruit nRFCrypto, Adafruit TinyUSB Library
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "bluefruit_common.h"
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
#define CFG_ADV_BLINKY_INTERVAL 500
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include "BLEService.h"
|
||||
|
||||
// include usb hid definitions
|
||||
#include "tinyusb/src/class/hid/hid.h"
|
||||
#include "class/hid/hid.h"
|
||||
|
||||
extern const uint8_t hid_ascii_to_keycode[128][2];
|
||||
extern const uint8_t hid_keycode_to_ascii[128][2];
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <Adafruit_LittleFS.h>
|
||||
#include <InternalFileSystem.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <Adafruit_LittleFS.h>
|
||||
#include <InternalFileSystem.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <Adafruit_LittleFS.h>
|
||||
#include <InternalFileSystem.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <Adafruit_LittleFS.h>
|
||||
#include <InternalFileSystem.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
// hardware random generator
|
||||
#include "nrf_rng.h"
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#ifndef _PDM_H_INCLUDED
|
||||
#define _PDM_H_INCLUDED
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#if !defined(ARDUINO_NRF52_ADAFRUIT)
|
||||
#error "This library targets only Adafruit NRF52840 boards"
|
||||
#endif
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include "utility/PDMDoubleBuffer.h"
|
||||
|
||||
class PDMClass
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include "RotaryEncoder.h"
|
||||
|
||||
#define PIN_A A0
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include "RotaryEncoder.h"
|
||||
|
||||
#define PIN_A A0
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include "RotaryEncoder.h"
|
||||
|
||||
#define PIN_A A0
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include "RotaryEncoder.h"
|
||||
|
||||
#define PIN_A A0
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#define _SPI_H_INCLUDED
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include "nrfx_spim.h"
|
||||
|
||||
// SPI_HAS_TRANSACTION means SPI has
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
http://www.arduino.cc/en/Tutorial/Knob
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include <Servo.h>
|
||||
|
||||
Servo myservo; // create servo object to control a servo
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
http://www.arduino.cc/en/Tutorial/Sweep
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include <Servo.h>
|
||||
|
||||
Servo myservo; // create servo object to control a servo
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
SoftwareSerial mySerial(A0, A1); // RX, TX
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
#include <SoftwareSerial.h>
|
||||
// software serial #1: TX = digital pin A1, RX = digital pin A0
|
||||
SoftwareSerial portOne(A0, A1);
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
|
||||
#include "Stream.h"
|
||||
#include "variant.h"
|
||||
|
||||
#include "RingBuffer.h"
|
||||
|
||||
#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
// WIRE_HAS_END means Wire has end()
|
||||
#define WIRE_HAS_END 1
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ 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} "-I{build.core.path}/cmsis/Core/Include" "-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{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
|
||||
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} "-I{build.core.path}/cmsis/Core/Include" "-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"
|
||||
|
||||
# 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}'
|
||||
|
||||
@@ -53,6 +53,10 @@ def build_examples(variant):
|
||||
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, 's140v6' if variant != 'feather52832' else 's132v6')
|
||||
|
||||
for sketch in all_examples:
|
||||
# skip TinyUSB library examples for nRF52832
|
||||
if variant == 'feather52832' and "libraries/Adafruit_TinyUSB_Arduino" in sketch:
|
||||
continue
|
||||
|
||||
start_time = time.monotonic()
|
||||
|
||||
# Skip if contains: ".board.test.skip" or ".all.test.skip"
|
||||
|
||||
Reference in new issue
Block a user