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

Revision:
34:d5553509f31a
Parent:
32:5a5d9525c6c4
Child:
35:6152c9709697
diff -r 5a5d9525c6c4 -r d5553509f31a mmSPI.cpp
--- a/mmSPI.cpp	Mon Aug 26 22:39:44 2013 +0000
+++ b/mmSPI.cpp	Sat Aug 31 02:19:42 2013 +0000
@@ -167,8 +167,6 @@
 
     void mmSPI::write_register(char cRegister, char cValue)
     {     
-      int dLoop;                                // loop index.
-      
       clear_transmit_vector();                  // clear transmit vector.
       
       pcSend[7] = 0x02;                         // mbed sends a command.
@@ -181,6 +179,21 @@
  
       clear_transmit_vector();                  // clear transmit vector.
     }                                           // write_register.
+//----------------------------------------------//------------------------------   
+                                                // write instruction register.
+    void mmSPI::write_IR(char cValueH, char cValueL)
+    {
+      clear_transmit_vector();                  // clear transmit vector.
+      
+      pcSend[7] = 0x06;                         // mbed sends a command.
+      
+      pcSend[1] = (cValueH & 0xFF);             // load IR shadow with new IR content.
+      pcSend[0] = (cValueL & 0xFF);
+ 
+      transceive_vector(1,1,1,0);               // transmit command.
+ 
+      clear_transmit_vector();                  // clear transmit vector.    
+    }                                           // write instruction register.
 //----------------------------------------------//------------------------------
 //  cRegister  ->  CPU_register
 //      0      ->    R0