Skip to content

Commit a317abe

Browse files
authored
Merge pull request #257 from adafruit/develop
update usb, add Adafruit_TinyUSB_core support
2 parents 358333f + b147760 commit a317abe

File tree

244 files changed

+38700
-14193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+38700
-14193
lines changed

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: c
2+
sudo: false
3+
cache:
4+
directories:
5+
- ~/arduino_ide
6+
7+
git:
8+
depth: false
9+
quiet: true
10+
11+
before_install:
12+
# - source <(curl -SLs https://raw.githubusercontent.com/hathach/travis-ci-arduino/test-nrf52/install.sh)
13+
script:
14+
# - build_platform adafruit:nrf52:feather52840
15+
16+
notifications:
17+
email:
18+
on_success: change
19+
on_failure: change

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ This repository contains the Arduino BSP for Adafruit nRF52 series:
44

55
- [Bluefruit Feather nRF52832](https://www.adafruit.com/product/3406)
66
- [Bluefruit Feather nRF52840](https://www.adafruit.com/product/4062)
7+
8+
Following boards are also included but are not officially supported:
9+
710
- [Noric nRF52840DK PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK)
811

912
## BSP Installation

boards.txt

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os
6868
#**********************************************
6969
feather52840.name=Adafruit Bluefruit nRF52840 Feather Express
7070

71-
# DFU Mode with CDC only
71+
# DFU Mode with CDC + MSC (UF2)
7272
feather52840.vid.0=0x239A
73-
feather52840.pid.0=0x002A
73+
feather52840.pid.0=0x0029
7474

75-
# DFU Mode with CDC + MSC (UF2)
75+
# DFU Mode with CDC only
7676
feather52840.vid.1=0x239A
77-
feather52840.pid.1=0x0029
77+
feather52840.pid.1=0x002A
7878

79-
# Arduino Application with CDC + MSC
79+
# Arduino Application
8080
feather52840.vid.2=0x239A
8181
feather52840.pid.2=0x8029
8282

8383
# CircuitPython
84-
feather52840.vid.2=0x239A
85-
feather52840.pid.2=0x802A
84+
feather52840.vid.3=0x239A
85+
feather52840.pid.3=0x802A
8686

8787
feather52840.bootloader.tool=bootburn
8888

@@ -125,44 +125,60 @@ feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os
125125
#**********************************************
126126
# Bluefruit Metro nRF52840 Express Board
127127
#**********************************************
128-
#metro52840.name=Adafruit Bluefruit nRF52840 Metro Express
129-
#metro52840.bootloader.tool=bootburn
128+
metro52840.name=Adafruit Bluefruit nRF52840 Metro Express
129+
metro52840.bootloader.tool=bootburn
130+
131+
# DFU Mode with CDC + MSC (UF2)
132+
metro52840.vid.0=0x239A
133+
metro52840.pid.0=0x003F
134+
135+
# DFU Mode with CDC only
136+
metro52840.vid.1=0x239A
137+
metro52840.pid.1=0x0040
138+
139+
# Arduino Application
140+
metro52840.vid.2=0x239A
141+
metro52840.pid.2=0x803F
142+
143+
# CircuitPython
144+
metro52840.vid.3=0x239A
145+
metro52840.pid.3=0x8040
130146

131147
# Upload
132-
#metro52840.upload.tool=nrfutil
133-
#metro52840.upload.protocol=nrfutil
134-
#metro52840.upload.use_1200bps_touch=true
135-
#metro52840.upload.wait_for_upload_port=true
148+
metro52840.upload.tool=nrfutil
149+
metro52840.upload.protocol=nrfutil
150+
metro52840.upload.use_1200bps_touch=true
151+
metro52840.upload.wait_for_upload_port=true
136152

137153
# Build
138-
#metro52840.build.mcu=cortex-m4
139-
#metro52840.build.f_cpu=64000000
140-
#metro52840.build.board=NRF52840_METRO
141-
#metro52840.build.core=nRF5
142-
#metro52840.build.variant=metro_nrf52840_express
143-
#metro52840.build.extra_flags=-DNRF52840_XXAA
154+
metro52840.build.mcu=cortex-m4
155+
metro52840.build.f_cpu=64000000
156+
metro52840.build.board=NRF52840_METRO
157+
metro52840.build.core=nRF5
158+
metro52840.build.variant=metro_nrf52840_express
159+
metro52840.build.extra_flags=-DNRF52840_XXAA -DARDUINO_NRF52_FEATHER
144160

145161
# SofDevice Menu
146162
# Ram & ROM size varies depending on SoftDevice (check linker script)
147163

148-
#metro52840.menu.softdevice.s140v6=0.2.9 (s140 6.1.1)
149-
#metro52840.menu.softdevice.s140v6.build.sd_flags=-DS140
150-
#metro52840.menu.softdevice.s140v6.build.sd_name=s140
151-
#metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1
152-
#metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
153-
#metro52840.menu.softdevice.s140v6.build.ldscript=nrf52840_s140_v6.ld
154-
#metro52840.menu.softdevice.s140v6.upload.maximum_size=815104
155-
#metro52840.menu.softdevice.s140v6.upload.maximum_data_size=248832
164+
metro52840.menu.softdevice.s140v6=0.2.9 (s140 6.1.1)
165+
metro52840.menu.softdevice.s140v6.build.sd_flags=-DS140
166+
metro52840.menu.softdevice.s140v6.build.sd_name=s140
167+
metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1
168+
metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
169+
metro52840.menu.softdevice.s140v6.build.ldscript=nrf52840_s140_v6.ld
170+
metro52840.menu.softdevice.s140v6.upload.maximum_size=815104
171+
metro52840.menu.softdevice.s140v6.upload.maximum_data_size=248832
156172

157173
# Debug Menu
158-
#metro52840.menu.debug.l0=Level 0 (Release)
159-
#metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os
160-
#metro52840.menu.debug.l1=Level 1 (Error Message)
161-
#metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os
162-
#metro52840.menu.debug.l2=Level 2 (Full Debug)
163-
#metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os
164-
#metro52840.menu.debug.l3=Level 3 (Segger SystemView)
165-
#metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os
174+
metro52840.menu.debug.l0=Level 0 (Release)
175+
metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os
176+
metro52840.menu.debug.l1=Level 1 (Error Message)
177+
metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os
178+
metro52840.menu.debug.l2=Level 2 (Full Debug)
179+
metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os
180+
metro52840.menu.debug.l3=Level 3 (Segger SystemView)
181+
metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -Os
166182

167183
#**********************************************
168184
# Nordic nRF52840DK (PCA10056)

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adafruit nRF52 Arduino Core Changelog
22

3-
# 0.10.1
3+
# 0.10.5
44

55
This release added multiple concurrent peripheral connections support, allow Bluefruit device to multiple central (phones/PC) simultaneously. It introduces new BLE class: BLEPeriph, BLEConnection, remove BLEGap, refactor/rename/move functions and callbacks.
66

cores/nRF5/Arduino.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void setup( void ) ;
3636
void loop( void ) ;
3737

3838
void suspendLoop(void);
39-
uint32_t setLoopStacksize(void);
4039

4140
#include "WVariant.h"
4241

@@ -69,12 +68,7 @@ uint32_t setLoopStacksize(void);
6968
#include "utility/AdaCallback.h"
7069

7170
#ifdef NRF52840_XXAA
72-
#include "tusb.h"
73-
74-
#ifdef __cplusplus
75-
#include "USBSerial.h"
76-
#endif
77-
71+
#include "Adafruit_TinyUSB_core.h"
7872
#endif
7973

8074
// Include board variant

cores/nRF5/common_func.h

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
// DEBUG HELPER
116116
//--------------------------------------------------------------------+
117117
#if CFG_DEBUG == 2
118-
#define malloc_named( name, size ) ({ ::printf("[malloc] %s : %d\r\n", name, size); malloc(size); })
118+
#define malloc_named( name, size ) ({ PRINTF("[malloc] %s : %d\r\n", name, size); malloc(size); })
119119
#else
120120
#define malloc_named( name, size ) malloc ( size )
121121
#endif
@@ -140,38 +140,44 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place
140140

141141
#if CFG_DEBUG
142142

143-
#define PRINT_LOCATION() ::printf("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__)
144-
#define PRINT_MESS(x) ::printf("%s: %d: %s \n" , __FUNCTION__, __LINE__, (char*)(x))
145-
#define PRTNT_HEAP() if (CFG_DEBUG == 3) ::printf("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size())
146-
#define PRINT_STR(x) ::printf("%s: %d: " #x " = %s\n" , __FUNCTION__, __LINE__, (char*)(x) )
147-
#define PRINT_INT(x) ::printf("%s: %d: " #x " = %ld\n" , __FUNCTION__, __LINE__, (uint32_t) (x) )
143+
#if __cplusplus
144+
#define PRINTF ::printf
145+
#else
146+
#define PRINTF printf
147+
#endif
148+
149+
#define PRINT_LOCATION() PRINTF("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__)
150+
#define PRINT_MESS(x) PRINTF("%s: %d: %s \n" , __FUNCTION__, __LINE__, (char*)(x))
151+
#define PRTNT_HEAP() if (CFG_DEBUG == 3) PRINTF("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size())
152+
#define PRINT_STR(x) PRINTF("%s: %d: " #x " = %s\n" , __FUNCTION__, __LINE__, (char*)(x) )
153+
#define PRINT_INT(x) PRINTF("%s: %d: " #x " = %ld\n" , __FUNCTION__, __LINE__, (uint32_t) (x) )
148154

149155
#define PRINT_HEX(x) \
150156
do {\
151-
::printf("%s: %d: " #x " = 0x", __PRETTY_FUNCTION__, __LINE__);\
157+
PRINTF("%s: %d: " #x " = 0x", __PRETTY_FUNCTION__, __LINE__);\
152158
char fmt[] = "%00X\n";\
153159
fmt[2] += 2*sizeof(x); /* Hex with correct size */\
154-
::printf(fmt, (x) );\
160+
PRINTF(fmt, (x) );\
155161
}while(0)
156162

157163
#define PRINT_BUFFER(buf, n) \
158164
do {\
159165
uint8_t const* p8 = (uint8_t const*) (buf);\
160-
::printf(#buf ": ");\
161-
for(uint32_t i=0; i<(n); i++) ::printf("%02x ", p8[i]);\
162-
::printf("\n");\
166+
PRINTF(#buf ": ");\
167+
for(uint32_t i=0; i<(n); i++) PRINTF("%02x ", p8[i]);\
168+
PRINTF("\n");\
163169
}while(0)
164170

165171
#define ADALOG(tag, ...) \
166172
do { \
167-
if ( tag ) ::printf("[%-6s] ", tag);\
168-
::printf(__VA_ARGS__);\
169-
::printf("\n");\
173+
if ( tag ) PRINTF("[%-6s] ", tag);\
174+
PRINTF(__VA_ARGS__);\
175+
PRINTF("\n");\
170176
}while(0)
171177

172178
#define ADALOG_BUFFER(_tag, _buf, _n) \
173179
do {\
174-
if ( _tag ) ::printf("%-6s: len = %d\n", _tag, _n);\
180+
if ( _tag ) PRINTF("%-6s: len = %d\n", _tag, _n);\
175181
dbgDumpMemory(_buf, 1, _n, true);\
176182
}while(0)
177183

cores/nRF5/flash/flash_cache.c

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,26 @@
1-
/**************************************************************************/
2-
/*!
3-
@file flash_cache.c
4-
@author hathach (tinyusb.org)
5-
6-
@section LICENSE
7-
8-
Software License Agreement (BSD License)
9-
10-
Copyright (c) 2018, Adafruit Industries (adafruit.com)
11-
All rights reserved.
12-
13-
Redistribution and use in source and binary forms, with or without
14-
modification, are permitted provided that the following conditions are met:
15-
1. Redistributions of source code must retain the above copyright
16-
notice, this list of conditions and the following disclaimer.
17-
2. Redistributions in binary form must reproduce the above copyright
18-
notice, this list of conditions and the following disclaimer in the
19-
documentation and/or other materials provided with the distribution.
20-
3. Neither the name of the copyright holders nor the
21-
names of its contributors may be used to endorse or promote products
22-
derived from this software without specific prior written permission.
23-
24-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25-
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34-
*/
35-
/**************************************************************************/
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2019 Ha Thach for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
3624

3725
#include "flash_cache.h"
3826
#include "common_func.h"

cores/nRF5/flash/flash_cache.h

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,26 @@
1-
/**************************************************************************/
2-
/*!
3-
@file flash_cache.h
4-
@author hathach (tinyusb.org)
5-
6-
@section LICENSE
7-
8-
Software License Agreement (BSD License)
9-
10-
Copyright (c) 2018, Adafruit Industries (adafruit.com)
11-
All rights reserved.
12-
13-
Redistribution and use in source and binary forms, with or without
14-
modification, are permitted provided that the following conditions are met:
15-
1. Redistributions of source code must retain the above copyright
16-
notice, this list of conditions and the following disclaimer.
17-
2. Redistributions in binary form must reproduce the above copyright
18-
notice, this list of conditions and the following disclaimer in the
19-
documentation and/or other materials provided with the distribution.
20-
3. Neither the name of the copyright holders nor the
21-
names of its contributors may be used to endorse or promote products
22-
derived from this software without specific prior written permission.
23-
24-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25-
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34-
*/
35-
/**************************************************************************/
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2019 Ha Thach for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
3624

3725
#ifndef FLASH_CACHE_H_
3826
#define FLASH_CACHE_H_

0 commit comments

Comments
 (0)