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 Mike Moore

Revision:
6:b480fc4e87e5
Parent:
5:b14dcaae260e
Child:
7:b3e8b537d5c2
--- a/mmSPI.cpp	Wed Aug 14 15:13:05 2013 +0000
+++ b/mmSPI.cpp	Wed Aug 14 15:19:24 2013 +0000
@@ -39,21 +39,22 @@
       error("\n\r mmSPI::setSPIfrequency : FATAL SPI frequency set too low. \n\r"); 
       fSPIquarterP = (1 / fSPIfreq) / 4;        // figure quarter-cycle period.
     }
-    
 //----------------------------------------------//------------------------------
 //  we're not going for speed, so lets go for good setup / hold.
-    void mmSPI::transceive_byte(void)           // send/receive a byte.
+
+                                                // send/receive a byte over SPI.
+    void mmSPI::transceive_byte(char *cReceive, char *cSend)
     {
-      cReceive = 0;                             // clear receive byte.                                    
+      *cReceive = 0;                            // clear receive byte.                                    
       for (cLoop01 = 7; cLoop01 >= 0; cLoop01++)// 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 >> cLoop01) & 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 << cLoop01);
         wait(fSPIquarterP);                     // finish-out cycle.
       }
     }
@@ -67,5 +68,3 @@
 
 
 
-
-