This is an involuntary fork, created because the repository would not update mmSPI. SPI library used to communicate with an altera development board attached to four zigbee-header pins.
Dependents: Embedded_RTOS_Project
Fork of mmSPI by
Diff: mmSPI.cpp
- Revision:
- 13:3e6886a96aea
- Parent:
- 12:a1b7ce9c1d64
- Child:
- 14:35717622a4fb
diff -r a1b7ce9c1d64 -r 3e6886a96aea mmSPI.cpp --- a/mmSPI.cpp Sat Aug 17 23:13:12 2013 +0000 +++ b/mmSPI.cpp Sun Aug 18 04:09:47 2013 +0000 @@ -69,9 +69,32 @@ // limit is 256 characters. // MSB out/in first. void mmSPI::transceive_vector(char *cReceive, char *cSend, char cNumBytes) - { + { + // the first SPI pulse after the + // CPU clock goes low is used for + // parallel-load of the SPI shadow + // registers, not for shifting. + if (0) + { + *pSCLK = 1; + wait(fSPIquarterP); + wait(fSPIquarterP); + *pSCLK = 0; + wait(fSPIquarterP); + wait(fSPIquarterP); + } + for (dLoop02 = (cNumBytes - 1); dLoop02 >= 0; dLoop02--) transceive_byte(&(cReceive[dLoop02]), &(cSend[dLoop02])); + + *pSCLK = 0; // SPI clock rests low. + + *pCPUclk = 1; // pulse the CPU clock. + wait(fSPIquarterP); + wait(fSPIquarterP); + *pCPUclk = 0; + wait(fSPIquarterP); + wait(fSPIquarterP); } //----------------------------------------------//------------------------------ // transceive a character array.