Like what was added for T3.x with that 3 yeard PR, I added the same support to T4.x
Added the PORT TOGGLE defines. I copied the _PORTSET blocks and then simply used block editing in Sublime text to then change the SET to Toggle.
Also added in the code...
Test sketch:
```
void setup() {
pinMode(13, OUTPUT);
}
int led = 13;
void loop() {
digitalToggleFast(led);
delay(500);
digitalToggleFast(13);
delay(250);
digitalToggle(13);
delay(1000);
digitalToggle(led);
delay(250);
}
```
Also added values to keywords.txt
A couple of minimalist changes.
systick_isr - By default it does nothing with the event responder.
Only if the user calls the attachInterrupt member of EventResponder will it install the version of the ISR that checks the list for any active ISR event Responders.
T4 Yield - try to keep bitfields for things yield should test
Make it such that yield hopefully can test to see there is nothing to do and returns quickly.
There are some interesting limitations, that is that the serialEvent
handling code. Both for USB and hardware Serial can only remove it self
if the default eventHandler is called once, as I don't know anyway to
detect if the default code (weak linkage) is included or if it is a user
version. So waits until called to remove it self from active list.
Sketches can force this by simply calling the event method right after
calling begin on the serial port.
Fixed the Serial2 object to use the new correct pins, plus made Serial8 only valid for T4 B1 (not B2).
Also I defined IO pins for the six signals associated with the SD Card slot.
I have tested these both as IO pins and now as SPI2
shifting both sides by 16 bit gives pretty good accuracy with fast code:
movw r3, #9155
ldr r2, .L2
mul r0, r3, r0
lsrs r0, r0, #1
umull r3, r0, r2, r0
lsrs r0, r0, #8
.L2:
.word 144122641
with 984 MHz it allows nsec to be max ~143000 max which is plenty