Skip to content

Commit d28219b

Browse files
authored
Merge pull request #486 from adafruit/update-tinyusb
Update tinyusb
2 parents eefeba8 + 3e326e9 commit d28219b

File tree

160 files changed

+60025
-7059
lines changed

Some content is hidden

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

160 files changed

+60025
-7059
lines changed

.github/workflows/githubci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ jobs:
5252
rm -r $HOME/$BSP_PATH/*
5353
ln -s $GITHUB_WORKSPACE $HOME/$BSP_PATH/$BSP_VERSION
5454
# Install library dependency
55-
arduino-cli lib install "Adafruit AHRS" "Adafruit APDS9960 Library" "Adafruit BMP280 Library" "Adafruit Circuit Playground" "Adafruit EPD" "Adafruit GFX Library" "Adafruit HX8357 Library" "Adafruit ILI9341" "Adafruit LIS3MDL" "Adafruit LSM6DS" "Adafruit NeoPixel" "Adafruit NeoMatrix" "Adafruit Sensor Calibration" "Adafruit SHT31 Library" "Adafruit SSD1306" "Adafruit ST7735 and ST7789 Library" "Firmata" "MIDI Library" "SdFat - Adafruit Fork"
55+
arduino-cli lib install "Adafruit AHRS" "Adafruit APDS9960 Library" "Adafruit BMP280 Library" "Adafruit Circuit Playground" "Adafruit EPD" "Adafruit GFX Library" "Adafruit HX8357 Library" "Adafruit ILI9341" "Adafruit LIS3MDL" "Adafruit LSM6DS" "Adafruit NeoPixel" "Adafruit NeoMatrix" "Adafruit Sensor Calibration" "Adafruit SHT31 Library" "Adafruit SSD1306" "Adafruit ST7735 and ST7789 Library" "Firmata" "SdFat - Adafruit Fork"
56+
57+
# TODO update to support MIDI version 5 later on
58+
arduino-cli lib install "MIDI Library"@4.3.1
5659
5760
- name: Build examples
5861
run: python3 tools/build_all.py ${{ matrix.arduino-platform }}

cores/nRF5/TinyUSB/Adafruit_TinyUSB_nRF.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
#include "Arduino.h"
3131
#include "Adafruit_TinyUSB_Core.h"
3232

33+
//--------------------------------------------------------------------+
34+
// Forward USB interrupt events to TinyUSB IRQ Handler
35+
//--------------------------------------------------------------------+
36+
extern "C" void USBD_IRQHandler(void)
37+
{
38+
tud_int_handler(0);
39+
}
40+
3341
//--------------------------------------------------------------------+
3442
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
3543
//--------------------------------------------------------------------+
@@ -106,15 +114,6 @@ void Adafruit_TinyUSB_Core_touch1200(void)
106114
//--------------------------------------------------------------------+
107115
// Adafruit_USBD_Device platform dependent
108116
//--------------------------------------------------------------------+
109-
void Adafruit_USBD_Device::detach(void)
110-
{
111-
NRF_USBD->USBPULLUP = 0;
112-
}
113-
114-
void Adafruit_USBD_Device::attach(void)
115-
{
116-
NRF_USBD->USBPULLUP = 1;
117-
}
118117

119118
uint8_t Adafruit_USBD_Device::getSerialDescriptor(uint16_t* serial_str)
120119
{

cores/nRF5/nordic/nrfx/CHANGELOG.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,93 @@
11
# Changelog
22
All notable changes to this project are documented in this file.
33

4+
## [2.1.0] - 2020-01-24
5+
### Added
6+
- Added HALs for DCNF, OSCILLATORS, USBREG, and VREQCTRL.
7+
- Added support for 1-MHz clock frequency in TWIM.
8+
- Introduced the NRFX_I2S_STATUS_TRANSFER_STOPPED flag in the I2S driver.
9+
- Introduced the nrfx_power_compat layer that allows use of the nrfx_power API with new SoC.
10+
- Added encryption support in the QSPI driver.
11+
- Added support for USBD in nRF5340.
12+
- Expanded HALs to cover new functions in nRF5340: GPIO, I2S, PDM, POWER, QSPI, and REGULATORS.
13+
- Introduced new clock management system in the CLOCK driver.
14+
- Introduced new audio clock configuration settings in the I2S and PDM drivers for nRF5340.
15+
- Implemented workaround for nRF5340 anomaly 4 in the CLOCK driver.
16+
- Implemented workaround for nRF5340 anomaly 10 in the CCM HAL.
17+
- Implemented workaround for nRF9160 anomaly 21 and nRF5340 anomaly 6 in the NVMC HAL.
18+
- Implemented workaround for nRF9160 anomaly 23 and nRF5340 anomaly 44 in the UARTE driver.
19+
- Introduced the NRFX_TWIM_NO_SPURIOUS_STOP_CHECK flag in the TWIM driver.
20+
- Added functions for getting shortcut configuration in the TWIM HAL.
21+
22+
### Changed
23+
- Updated MDK to 8.30.2.
24+
- Reorganized templates of nrfx_config header files for different SoCs. Now they are included through one common file according to the selected SoC.
25+
- Improved the UARTE driver to consume less current after the driver uninitialization. Now all clocks are disabled properly after uninitialization.
26+
- Improved the GPIOTE driver robustness by setting the LATCH functionality to be used by default.
27+
- Changed names of the frequency divider symbols in the QSPI HAL to reflect the new frequencies in nRF5340. Old API names were preserved and are still supported.
28+
- Improved spurious STOP condition handling in the TWIM driver.
29+
- Improved sampling procedure in the advanced blocking mode in the SAADC driver.
30+
- Improved calibration procedure in the SAADC driver for nRF5340 and nRF9160.
31+
32+
### Fixed
33+
- Fixed address assertions in NVMC driver for the nRF5340 network core.
34+
- Fixed an issue in the TWI driver that would make the driver stuck when a premature STOP condition was generated by a slave device. The driver now handles this situation properly and signals that a bus error occurred.
35+
- Fixed the stopping procedure in the PWM driver. Previously in very specific circumstances the PWM output might be not stopped at all or might be immediately restarted.
36+
37+
## [2.0.0] - 2019-11-06
38+
### Added
39+
- Added support for nRF5340.
40+
- Added HALs for: CACHE, FPU, MUTEX, and RESET.
41+
- Added driver and HAL for IPC.
42+
- Added possibility to configure in UART and UARTE the number of stop bits and the type of parity, when a given SoC allows it.
43+
- Added function in the GPIO HAL for selecting the MCU to control the specified pin.
44+
- Added support for ONESHOT register in the TIMER HAL.
45+
- Added support for LIST feature in HALs for SPIS and TWIS.
46+
- Added possibility to choose TIMER instance used for workarounds in the NFCT driver.
47+
48+
### Changed
49+
- Updated MDK to 8.29.0.
50+
- Enhanced PWM driver API: added the "p_context" parameter to the event handler.
51+
- Updated address and task getters in all HALs to return values as uint32_t type.
52+
- Updated all HAL functions to take the pointer to the structure of registers of the peripheral as their first argument.
53+
- Changed __STATIC_INLINE symbol to NRF_STATIC_INLINE for HALs and NRFX_STATIC_INLINE for drivers.
54+
- Refactored the SAADC driver and HAL.
55+
- Refactored the WDT driver and HAL to support multiple instances.
56+
- Changed nrfx_gpiote_init() function to take the interrupt priority as its parameter. Previously this priority was an nrfx_config option.
57+
- Changed nrf_usbd_ep_all_disable() function to disable really all endpoints. Use nrf_usbd_ep_default_config() to restore the default endpoint configuration.
58+
- Updated nrfx_gpiote_out_init() and nrfx_gpiote_in_init() return codes. Now NRFX_ERROR_INVALID_STATE is changed to NRFX_ERROR_BUSY.
59+
- Replaced the SWI/EGU driver with one for EGU only.
60+
- Aligned symbol names for default IRQ priority in nrfx_config. These symbols are now adhering to the following standard: NRFX_xxx_DEFAULT_CONFIG_IRQ_PRIORITY.
61+
- Changed the way of configuring the MISO pin pull setting in SPI and SPIM drivers. Now it can be set separately for each instance.
62+
63+
### Removed
64+
- Removed deprecated functions from drivers: TWI and TWIM. See migration guide for details.
65+
- Removed deprecated functions from HALs: ECB, NVMC, and TEMP. See migration guide for details.
66+
- Removed redundant bariers in the nrfx_usbd driver.
67+
- Removed the default configuration values for drivers from the nrfx_config header files.
68+
69+
## [1.8.1] - 2019-10-21
70+
### Added
71+
- Added functions in the GPIOTE driver for getting task or event for the specified GPIO pin.
72+
73+
### Changed
74+
- Updated MDK to version 8.27.1.
75+
- Moved the nrfx_gppi helper from helpers/nrfx_gppi/ to helpers/.
76+
- Changed the interrupt initialization in the GPIOTE driver, so that mapping of the GPIOTEx_IRQn enumeration values is no longer needed for nRF9160.
77+
78+
## [1.8.0] - 2019-08-27
79+
### Added
80+
- Added support for nRF52833.
81+
- Added bus recovery feature in the TWI and TWIM drivers.
82+
- Added the nrfx_gppi helper layer to facilitate developing generic code that can utilize PPI or DPPI, depending on which interface is available in a given SoC.
83+
84+
### Changed
85+
- Updated MDK to version 8.27.0.
86+
87+
### Fixed
88+
- Fixed an issue in the TWIM driver that would make the driver stuck when a premature STOP condition was generated by a slave device. The driver now handles this situation properly and signals that a bus error occurred.
89+
- Fixed a frame timing bug in the NFCT driver. Previously, the timing of the SENS_RES response could be violated after the NFCT peripheral was put to the Sleep state with the SLP_REQ command.
90+
491
## [1.7.2] - 2019-07-25
592
### Added
693
- Added functions in the DPPI, GPIOTE, PPI, RTC, and TIMER HALs for getting tasks and events specified by index.

cores/nRF5/nordic/nrfx/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
1+
Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

cores/nRF5/nordic/nrfx/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,23 @@ SoCs, as well as startup and initialization files for them.
1616
* nRF52810
1717
* nRF52811
1818
* nRF52832
19+
* nRF52833
1920
* nRF52840
21+
* nRF5340
2022
* nRF9160
2123

2224
## Directories
2325

2426
```
2527
.
2628
├── doc # Project documentation files
27-
├── drivers # nrfx drivers files
28-
│ └── include # nrfx drivers headers
29-
│ └── src # nrfx drivers sources
29+
├── drivers # nrfx driver files
30+
│ └── include # nrfx driver headers
31+
│ └── src # nrfx driver sources
3032
├── hal # Hardware Access Layer files
31-
├── mdk # Nordic MDK files
32-
├── soc # Nordic SoC related files
33+
├── helpers # nrfx driver helper files
34+
├── mdk # nRF MDK files
35+
├── soc # SoC specific files
3336
└── templates # Templates of nrfx integration files
3437
```
3538

cores/nRF5/nordic/nrfx/drivers/include/nrf_bitmask.h

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016 - 2019, Nordic Semiconductor ASA
2+
* Copyright (c) 2016 - 2020, Nordic Semiconductor ASA
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -57,21 +57,22 @@ extern "C" {
5757
* @param[in] bit Bit index.
5858
* @param[in] p_mask Pointer to mask with bit fields.
5959
*
60-
* @return 0 if bit is not set, positive value otherwise.
60+
* @retval true If the specified bit is set.
61+
* @retval false If the specified bit is cleared.
6162
*/
62-
__STATIC_INLINE uint32_t nrf_bitmask_bit_is_set(uint32_t bit, void const * p_mask)
63+
__STATIC_INLINE bool nrf_bitmask_bit_is_set(uint32_t bit, void const * p_mask)
6364
{
6465
uint8_t const * p_mask8 = (uint8_t const *)p_mask;
6566
uint32_t byte_idx = BITMASK_BYTE_GET(bit);
6667
bit = BITMASK_RELBIT_GET(bit);
67-
return (1 << bit) & p_mask8[byte_idx];
68+
return ((1U << bit) & p_mask8[byte_idx]) != 0U;
6869
}
6970

7071
/**
7172
* @brief Function for setting a bit in the multi-byte bit mask.
7273
*
73-
* @param[in] bit Bit index.
74-
* @param[in] p_mask Pointer to mask with bit fields.
74+
* @param[in] bit Bit index.
75+
* @param[in,out] p_mask Pointer to mask with bit fields.
7576
*/
7677
__STATIC_INLINE void nrf_bitmask_bit_set(uint32_t bit, void * p_mask)
7778
{
@@ -84,8 +85,8 @@ __STATIC_INLINE void nrf_bitmask_bit_set(uint32_t bit, void * p_mask)
8485
/**
8586
* @brief Function for clearing a bit in the multi-byte bit mask.
8687
*
87-
* @param[in] bit Bit index.
88-
* @param[in] p_mask Pointer to mask with bit fields.
88+
* @param[in] bit Bit index.
89+
* @param[in,out] p_mask Pointer to mask with bit fields.
8990
*/
9091
__STATIC_INLINE void nrf_bitmask_bit_clear(uint32_t bit, void * p_mask)
9192
{
@@ -98,21 +99,20 @@ __STATIC_INLINE void nrf_bitmask_bit_clear(uint32_t bit, void * p_mask)
9899
/**
99100
* @brief Function for performing bitwise OR operation on two multi-byte bit masks.
100101
*
101-
* @param[in] p_mask1 Pointer to the first bit mask.
102-
* @param[in] p_mask2 Pointer to the second bit mask.
103-
* @param[in] p_out_mask Pointer to the output bit mask.
104-
* @param[in] length Length of output mask in bytes.
102+
* @param[in] p_mask1 Pointer to the first bit mask.
103+
* @param[in] p_mask2 Pointer to the second bit mask.
104+
* @param[out] p_out_mask Pointer to the output bit mask.
105+
* @param[in] length Length of output mask in bytes.
105106
*/
106-
__STATIC_INLINE void nrf_bitmask_masks_or(void const * p_mask1,
107-
void const * p_mask2,
108-
void * p_out_mask,
109-
uint32_t length)
107+
__STATIC_INLINE void nrf_bitmask_masks_or(void const * p_mask1,
108+
void const * p_mask2,
109+
void * p_out_mask,
110+
size_t length)
110111
{
111112
uint8_t const * p_mask8_1 = (uint8_t const *)p_mask1;
112113
uint8_t const * p_mask8_2 = (uint8_t const *)p_mask2;
113114
uint8_t * p_mask8_out = (uint8_t *)p_out_mask;
114-
uint32_t i;
115-
for (i = 0; i < length; i++)
115+
for (size_t i = 0; i < length; i++)
116116
{
117117
p_mask8_out[i] = p_mask8_1[i] | p_mask8_2[i];
118118
}
@@ -121,21 +121,20 @@ __STATIC_INLINE void nrf_bitmask_masks_or(void const * p_mask1,
121121
/**
122122
* @brief Function for performing bitwise AND operation on two multi-byte bit masks.
123123
*
124-
* @param[in] p_mask1 Pointer to the first bit mask.
125-
* @param[in] p_mask2 Pointer to the second bit mask.
126-
* @param[in] p_out_mask Pointer to the output bit mask.
127-
* @param[in] length Length of output mask in bytes.
124+
* @param[in] p_mask1 Pointer to the first bit mask.
125+
* @param[in] p_mask2 Pointer to the second bit mask.
126+
* @param[out] p_out_mask Pointer to the output bit mask.
127+
* @param[in] length Length of output mask in bytes.
128128
*/
129-
__STATIC_INLINE void nrf_bitmask_masks_and(void const * p_mask1,
130-
void const * p_mask2,
131-
void * p_out_mask,
132-
uint32_t length)
129+
__STATIC_INLINE void nrf_bitmask_masks_and(void const * p_mask1,
130+
void const * p_mask2,
131+
void * p_out_mask,
132+
size_t length)
133133
{
134134
uint8_t const * p_mask8_1 = (uint8_t const *)p_mask1;
135135
uint8_t const * p_mask8_2 = (uint8_t const *)p_mask2;
136136
uint8_t * p_mask8_out = (uint8_t *)p_out_mask;
137-
uint32_t i;
138-
for (i = 0; i < length; i++)
137+
for (size_t i = 0; i < length; i++)
139138
{
140139
p_mask8_out[i] = p_mask8_1[i] & p_mask8_2[i];
141140
}

cores/nRF5/nordic/nrfx/drivers/include/nrfx_adc.h

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015 - 2019, Nordic Semiconductor ASA
2+
* Copyright (c) 2015 - 2020, Nordic Semiconductor ASA
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -77,18 +77,28 @@ typedef struct
7777
} data; ///< Union to store event data.
7878
} nrfx_adc_evt_t;
7979

80-
/** @brief Macro for initializing the ADC channel with the default configuration. */
80+
/**
81+
* @brief ADC channel default configuration.
82+
*
83+
* This configuration sets up ADC channel with the following options:
84+
* - 10 bits resolution
85+
* - full scale input
86+
* - reference voltage: 1.2 V
87+
* - external reference input disabled
88+
*
89+
* @param[in] analog_input Analog input.
90+
*/
8191
#define NRFX_ADC_DEFAULT_CHANNEL(analog_input) \
82-
{ \
83-
NULL, \
84-
{ \
92+
{ \
93+
NULL, \
94+
{ \
8595
.resolution = NRF_ADC_CONFIG_RES_10BIT, \
8696
.scaling = NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE, \
8797
.reference = NRF_ADC_CONFIG_REF_VBG, \
88-
.input = (analog_input), \
98+
.input = (nrf_adc_config_input_t)analog_input, \
8999
.extref = NRF_ADC_CONFIG_EXTREFSEL_NONE \
90-
} \
91-
}
100+
} \
101+
}
92102

93103
/** @brief Forward declaration of the nrfx_adc_channel_t type. */
94104
typedef struct nrfx_adc_channel_s nrfx_adc_channel_t;
@@ -112,9 +122,9 @@ typedef struct
112122
} nrfx_adc_config_t;
113123

114124
/** @brief ADC default configuration. */
115-
#define NRFX_ADC_DEFAULT_CONFIG \
116-
{ \
117-
.interrupt_priority = NRFX_ADC_CONFIG_IRQ_PRIORITY \
125+
#define NRFX_ADC_DEFAULT_CONFIG \
126+
{ \
127+
.interrupt_priority = NRFX_ADC_DEFAULT_CONFIG_IRQ_PRIORITY \
118128
}
119129

120130
/**
@@ -206,8 +216,8 @@ void nrfx_adc_sample(void);
206216
* @retval NRFX_SUCCESS Conversion was successful.
207217
* @retval NRFX_ERROR_BUSY The ADC driver is busy.
208218
*/
209-
nrfx_err_t nrfx_adc_sample_convert(nrfx_adc_channel_t const * const p_channel,
210-
nrf_adc_value_t * p_value);
219+
nrfx_err_t nrfx_adc_sample_convert(nrfx_adc_channel_t const * p_channel,
220+
nrf_adc_value_t * p_value);
211221

212222
/**
213223
* @brief Function for converting data to the buffer.
@@ -256,16 +266,14 @@ bool nrfx_adc_is_busy(void);
256266
*
257267
* @return Start task address.
258268
*/
259-
__STATIC_INLINE uint32_t nrfx_adc_start_task_get(void);
260-
261-
#ifndef SUPPRESS_INLINE_IMPLEMENTATION
269+
NRFX_STATIC_INLINE uint32_t nrfx_adc_start_task_get(void);
262270

263-
__STATIC_INLINE uint32_t nrfx_adc_start_task_get(void)
271+
#ifndef NRFX_DECLARE_ONLY
272+
NRFX_STATIC_INLINE uint32_t nrfx_adc_start_task_get(void)
264273
{
265-
return nrf_adc_task_address_get(NRF_ADC_TASK_START);
274+
return nrf_adc_task_address_get(NRF_ADC, NRF_ADC_TASK_START);
266275
}
267-
268-
#endif
276+
#endif // NRFX_DECLARE_ONLY
269277

270278
/** @} */
271279

0 commit comments

Comments
 (0)