SPI library used to communicate with an altera development board attached to four zigbee-header pins.

Revision:
12:a1b7ce9c1d64
Parent:
11:17207edac925
Child:
13:3e6886a96aea
--- a/mmSPI.cpp	Sat Aug 17 22:05:33 2013 +0000
+++ b/mmSPI.cpp	Sat Aug 17 23:13:12 2013 +0000
@@ -52,15 +52,15 @@
     void mmSPI::transceive_byte(char *cReceive, char *cSend)
     {
       *cReceive = 0;                            // clear receive byte.                                    
-      for (cLoop01 = 7; cLoop01 >= 0; cLoop01--)// loop for 8 bits in the byte.
+      for (dLoop01 = 7; dLoop01 >= 0; dLoop01--)// loop for 8 bits in the byte.
       {
         *pSCLK = 0;                             // SPI clock negedge.
         wait(fSPIquarterP);                     // until middle of clock low.
-        *pMOSI = (*cSend >> cLoop01) & 1;       // assert MOSI.
+        *pMOSI = (*cSend >> dLoop01) & 1;       // assert MOSI.
         wait(fSPIquarterP);                     // MOSI setup time
         *pSCLK = 1;                             // SPI clock posedge.
         wait(fSPIquarterP);                     // MISO setup time.
-        *cReceive = *cReceive | (*pMISO << cLoop01);
+        *cReceive = *cReceive | (*pMISO << dLoop01);
         wait(fSPIquarterP);                     // finish-out cycle.
       }
     }
@@ -70,8 +70,8 @@
                                                 // MSB out/in first.
     void mmSPI::transceive_vector(char *cReceive, char *cSend, char cNumBytes)
     {    
-      for (cLoop02 = (cNumBytes - 1); cLoop02 >= 0; cLoop02--)
-      transceive_byte(&(cReceive[cLoop02]), &(cSend[cLoop02]));
+      for (dLoop02 = (cNumBytes - 1); dLoop02 >= 0; dLoop02--)
+      transceive_byte(&(cReceive[dLoop02]), &(cSend[dLoop02]));
     }
 //----------------------------------------------//------------------------------
                                                 // transceive a character array.