BLE Nano Code.Tested with Integrated mDot code

Dependencies:   BLE_API mbed nRF51822

Fork of eco_Labs_ble_Client by Happiest

Revision:
11:b8e687d97537
Parent:
10:09d1a403eb14
Child:
17:3fb1aafa4436
--- a/main.cpp	Tue Oct 04 11:05:45 2016 +0000
+++ b/main.cpp	Thu Oct 06 09:42:38 2016 +0000
@@ -20,6 +20,7 @@
 #include "mbed.h"
 #include "BLE.h"
 #include "UARTService.h"
+#include "ble_types.h"
 
 /******************************************************************************/
 /* Local Defines                                                              */
@@ -33,13 +34,19 @@
 #define DEBUG(...) /* nothing */
 #endif /* #if NEED_CONSOLE_OUTPUT */
 
+
+
+
 /******************************************************************************/
 /* Extern Function declarations */
 /******************************************************************************/
+extern void spi_buf_init(void);
 extern void ble_event_wait(void);
 extern void ble_init(void);
 extern void ble_data_handler_init(void);
-
+extern void spi_slave_rx_data(void);
+extern void spi_dummy_test(void);
+void init_interrupt_line(void );
 /******************************************************************************/
 /* External Variable Declarations */
 /******************************************************************************/
@@ -48,33 +55,20 @@
 /******************************************************************************/
 /* Static Variable Declarations */
 /******************************************************************************/
-static DigitalOut led1(LED1);
-
+DigitalOut led1(LED1);
+uint8_t spi_ble_array[20];
+uint8_t spi_slave_test_rx_data(uint8_t * rx_buf);
 /******************************************************************************/
 /* Static Functions */
 /******************************************************************************/
 /**
- * @brief  periodicCallback - Periodic timer call back
+ * @brief  Function Toggles the LED State
  * @param  
  * @retval 
  */
-static void periodicCallback(void)
-{
-    // Toggle the LED only if device is Advertizing
-    if(!isDeviceConnected)
-        led1 = !led1; 
-}
-
-/**
- * @brief  Initializes the LED
- * @param  none
- * @retval none
- */
-static void led_init(void)
+void toggle_led(void)
 {    
-    led1 = 1;
-    Ticker ticker;
-    ticker.attach(periodicCallback, 1);
+    led1 = !led1;    
 }
 
 /******************************************************************************/
@@ -84,18 +78,22 @@
  * @brief  Main - entry point to the application
  * @param  
  * @retval 
- */
+ */ 
 int main(void)
 {
-    led_init();
-    //spi_init();    
-    ble_init();  
+    /* LED init */
+    led1 = 1;           
+    toggle_led();
+    init_interrupt_line();
+    spi_buf_init();
+    
     ble_data_handler_init();
     
     // Infinite loop, never exits
     while (true) 
     {
-        ble_event_wait();
+        //ble_event_wait();
+        spi_slave_rx_data();        
     }
 }
 /******************************************************************************/