Note: due to osal_freertos changes https://github.com/hathach/tinyusb/pull/468 the Adafruit_TinyUSB_Core_init() should be near the task scheduler (or better inside loop task) to prevent calling portYIELD_FROM_ISR() when scheduler not started
when programming the GPIOTE peripheral.
the memory barrier is still used once in the ISR,
to prevent spurious interrupts caused by delay
writing over the (16MHz) AHB bus.
* Changed to use compiler intrinsics
* Significantly reduced comments near memory barrier usage, as per request
* Updating `attachInterrupt()` loops to more closely match requested style
* First loop should not be checking pinmap for -1.
* Second loop should ensure no pending event when
first allocating the GPIOTE channel.
* Second loop needs to update pinmap with pin when
allocated the GPIOTE channel.
Reduce the number of cycles spent in the GPIOTE ISR,
by reading common volatile registers across AHB only
once, and using a safer hack to prevent spurious ISR
firing when the last channel's event was cleared.
First, when looking for a channel, first loop through
all mapped channels to see if the GPIO was already mapped.
This prevents a single GPIO being configured for more than
one channel at a time.
Second, do not use a GPIOTE channel if the channel is
already in use (e.g., by a library, sketch, or other code
outside the Board Support Package).
This is a step in preparation for the ability to
change the default handler for printf(), such as
when advanced debug output capabilities make it
more performant to output via an alternative route.
size_t is unsigned; the #defined constant was treated as an integer,
which caused the following warning:
In file included from cores\nRF5\Uart.cpp:21:0:
cores\nRF5\Arduino.h: In instantiation of
```C++
decltype ( ((b < a) ? b : a) )
min(const T&, const L&)
[with
T = unsigned int;
L = int;
decltype (((b < a) ? b : a)) = unsigned int
]:
```
cores\nRF5\Uart.cpp:228:54: required from here
cores\nRF5\Arduino.h:92:15: warning:
comparison between signed and unsigned integer expressions [-Wsign-compare]
return (b < a) ? b : a;
Of course, had to apply them manually, as the patch file
did not apply directly. This is because some files were
renamed / moved relative to the original distribution,
while others were deleted because they did not apply.