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:
4:aa1fe8707bef
Parent:
3:de99451ab3c0
Child:
5:b14dcaae260e
diff -r de99451ab3c0 -r aa1fe8707bef mmSPI.cpp
--- a/mmSPI.cpp	Wed Aug 14 10:45:33 2013 +0000
+++ b/mmSPI.cpp	Wed Aug 14 14:47:12 2013 +0000
@@ -31,6 +31,15 @@
       pSCLK = new DigitalOut(mmSPI_SCLK);       // SPI SCLK pin object.
       if (!pSCLK) error("\n\r mmSPI::allocations : FATAL malloc error for pSCLK. \n\r"); 
     } 
+//----------------------------------------------//------------------------------    
+    void mmSPI::setSPIfrequency(float fFreq)    // set SPI clock frequency.
+    {
+      fSPIfreq = fFreq;                         // promote to object scope.
+      if (fSPIfreq < .05)                       // don't get near divide-by-zero.
+      error("\n\r mmSPI::setSPIfrequency : FATAL SPI frequency set too low. \n\r"); 
+      fSPIquarterP = (1 / fSPIfreq) / 4;        // figure quarter-cycle period.
+    }
+    
 //----------------------------------------------//------------------------------
     char mmSPI::transceive_byte(char cSend)     // send/receive a byte.
     {