Alright, here it is! ...
Wait a minute, I must be crazy! It's the same library, so if it compiles as is on LC, master should be working! hahahaah
For LC, play with the buffers! I lowered them while testing to make it "fit"![]()
while ( !(GPIOD_PDIR & 0x01) ) {
10 dwords at 4MHz with overhead == ~ 120uS lol
At 6MHz it's having a seizure but trying nonetheless lol
I think for LC users 4MHz is enough, right?![]()
I can make that adaptable too! (slave CS,MISO,MOSI,SCK pin!)
That what you want??I need a break first lol but Yeah I can add that too
How you want it defined? overloaded or by slave.setMISO(pin) (like teensy )
I swept through the ISR in a matter of hours just t get LC built in hehehe
The functions already exist (setMISO, setMOSI, setSCK, setCS) for the master to select the slave hardware port, we can just add a _slave option use in them
Ex1: ( !sSPI_port ) ? SPI0_C1 &= ~SPI_C1_SPTIE : SPI1_C1 &= ~SPI_C1_SPTIE;
Ex2: if ( ( !sSPI_port ) ? SPI0_S & SPI_S_SPRF : SPI1_S & SPI_S_SPRF ) {
Ex3: if ( (( !sSPI_port ) ? ((uint16_t)(SPI0_DH << 8) | SPI0_DL) : ((uint16_t)(SPI1_DH << 8) | SPI1_DL)) == 0xD0D0 ) break;
Ex4:
( !sSPI_port ) ? SPI0_DH = 0xBA : SPI1_DH = 0xBA;
( !sSPI_port ) ? SPI0_DL = 0xBE : SPI1_DL = 0xBE;
Teensy NOT Online @ millis=570
Teensy Online @ millis=600
C:\examples\slave\slave.ino May 8 2018 19:11:43
Cycle Counter Not Enabled :0
Hello world!
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
1 2 3 4 5 6 7 8 9 10
Hello world!
while ( !(GPIOD_PDIR & sSPI_port_gpioloop) ) {
void spi1_isr(void) {
spi0_isr();
}
void spi0_isr(void) {
//sSPI_port = 0; // SPI0
sSPI_port = 1; // SPI1
Sketch uses 8636 bytes (13%) of program storage space. Maximum is 63488 bytes.
Global variables use 2112 bytes (25%) of dynamic memory, leaving 6080 bytes for local variables. Maximum is 8192 bytes.
[ATTACH]13763._xfImport[/ATTACH]