BLE Nano Code.Tested with Integrated mDot code

Dependencies:   BLE_API mbed nRF51822

Fork of eco_Labs_ble_Client by Happiest

Revision:
16:79b149aae10a
Parent:
15:67fbed00edf2
Child:
25:96044c55f844
--- a/spi_slave.cpp	Tue Oct 11 09:49:14 2016 +0000
+++ b/spi_slave.cpp	Tue Oct 11 12:01:10 2016 +0000
@@ -49,7 +49,9 @@
 uint8_t spi_tx_buf[SPI_TX_BUF_SIZE];
 uint8_t spi_tx_ptr;
 uint8_t spi_bytes_to_send;
- 
+
+#define SPI_RQST 28
+#define SPI_RDY 29 
 /******************************************************************************/
 /* Global Functions                                                              */
 /******************************************************************************/
@@ -58,17 +60,31 @@
  * @param  None        
  * @retval None
  */
-void enable_interrupt_line(bool status )
+void enable_interrupt_line(bool state ,uint8_t pin_num )
 {
-    if(status)
+    
+    if(pin_num == SPI_RQST)
     {
-        spi_rqst =1;
-        spi_rdy =1;
+        if(state)
+        {
+            spi_rqst =1;
+        }
+        else
+        {
+            spi_rqst =0;
+        }
     }
     else
     {
-        spi_rqst =0;
-        spi_rdy =0;
+        if(state)
+        {
+
+            spi_rdy =1;
+        }
+        else
+        {
+            spi_rdy =0;
+        }
     }
         
 }
@@ -108,12 +124,12 @@
              //   if (spi_tx_ptr++ > SPI_TX_BUF_SIZE) {
              //       spi_tx_ptr= 0;
              //   }
-             //   send_ptr++;
                 spi_bytes_to_send--;
                 if(spi_bytes_to_send ==0)
                 {
                     send_ptr = 0;
-                    enable_interrupt_line(false);
+                    /*read compleated*/
+                    enable_interrupt_line(false,SPI_RDY);
                 }
             } else {
                 device.reply(SPI_TX_EMPTY_DATA);
@@ -140,7 +156,7 @@
     spi_bytes_to_send = 0;
    
     /* TODO: make the GPIO line high */
-    enable_interrupt_line(true);    
+    enable_interrupt_line(true,SPI_RDY);    
     
     /* Copy the buffer into local buffer */
     memcpy(&spi_tx_buf[spi_tx_ptr], tx_buf, len);