Sketches that includes String objects did not compile, so simply copy the wstring.cpp from Teensy3 directory.
Likewise sketches that used stream functions like:
Serial1.readBytes would not compile as the Stream sources were not included.
So likewise copied over from Teensy3 directory
"noinline, noclone" has the opposite effect of beeing faster now on T4
Maye it would be best to use an empty define ? Then we can remove the section in the linker-file, too.
#define FASTRUN
QA quick and dirty import of the AVR emulation stuff for SPI registers.
So far none of SPCR is implemented
in SPSR only getting status of SPIF is setup
SPDR reads and writes to LPSPI4...
So, it allows for some simple SPI write functions and wait for the write to complete and read the result.
WIth this Adafruit_ILI9341 graphic test runs
I created a structure IMXRT_LPSPI_t
like what was done for UARTS.
I hopefully got all of the unused fields in properly to get the registers on the correct addresses.
Note: I did not update the other #define LPSPIn_ values but left them, likewise, I create a new define for each of the addresses.
That way we can double check I have everything properly aligned
Add some support for serialEventX calls when yield is called.
Currently keep table of which SerialX objects are Used (.begin called) and each has their own function which does the
if (Serial1.available()) serialEvent1();
Calling SerialX.end(), removes the call from the list. Also the default weak pointer serialEventX functions call the disable function, as to only be called once as no one is actually processing them...
At some point will integrate this with EventResponder
Put in first pass at SerialX.end(),
Which should disable the Serial object, and I believe set the IO pins to be GPIO pins.
Also defined the extern void SerialEvent1() like functions in header in preperation for callbacks...
Fleshing out some of the missing pieces. - Need to test
copy NVIC execution priority from T3
Set priority per Serial object
RTS pin
CTS pin - only Serial3 supports
setRX, setTX - do nothing none of these have two pins defined.
Maybe temporary - but added from previous code ability to add second buffer for RX and TX
Used macros from OneWIre to fast set/clear the optional Transmitter Enable support.
Also fixed bug in ISR where was not properly looking for TC. This will help make SerialX->flush() to work
This pass has some more support for using the Hardware Serial objects.
Including setting an ISR for doing both reads and writes, sets up the FIFO,
Sitll lots more work to go.
Things like: fifo - need to better understand/set watermarks, also RX need to read in more than one byte if more available.
Also support fo r other features, like formats, 9 bit, ...
BUt at least you can do simple reads/writes
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