sd

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_UARTConsole by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
jinu
Date:
Mon Oct 03 13:31:13 2016 +0000
Parent:
9:5f0732aa3008
Commit message:
tested with BLE uart send and receive;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
spi_cmd_handler.c Show annotated file Show diff for this revision Revisions of this file
spi_slave.c Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 29 12:12:10 2015 +0000
+++ b/main.cpp	Mon Oct 03 13:31:13 2016 +0000
@@ -42,8 +42,30 @@
 
 void periodicCallback(void)
 {
-    led1 = !led1;
-    DEBUG("ping\r\n");
+    //led1 = !led1;
+    // DEBUG("ping\r\n");
+ #if 0
+    /*This is tested and working fine */
+    uint8_t tx_arr[5]; 
+    tx_arr[0] = 'a';
+    tx_arr[1] = 'b';
+    tx_arr[2] = 'c';
+    tx_arr[3] = '\n';
+    tx_arr[4] = '\r';
+    uart->write(tx_arr, sizeof(tx_arr));    
+#endif    
+    int temp = 0;
+    temp = uart->_getc();
+    if (temp != EOF)
+    {
+        uint8_t tx_arr[5]; 
+        tx_arr[0] = 'a';
+        tx_arr[1] = 'b';
+        tx_arr[2] = 'c';
+        tx_arr[3] = '\n';
+        tx_arr[4] = '\r';
+        uart->write(tx_arr, sizeof(tx_arr));    
+    }
 }
 
 int main(void)
@@ -58,7 +80,7 @@
     
     uart = new UARTService(ble);
 
-    /* setup advertising */
+    /* setup advertising */    
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
     ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
     ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
@@ -67,7 +89,10 @@
                                      (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed));
 
     ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
-    ble.startAdvertising();
+    ble.startAdvertising();    
+    
+    
+  
 
     while (true) {
         ble.waitForEvent();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spi_cmd_handler.c	Mon Oct 03 13:31:13 2016 +0000
@@ -0,0 +1,2 @@
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spi_slave.c	Mon Oct 03 13:31:13 2016 +0000
@@ -0,0 +1,46 @@
+#if 0
+/******************************************************************************/
+/* Include Files*/
+/******************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include "mbed.h"
+
+/******************************************************************************/
+/* Local Defines                                                              */
+/******************************************************************************/
+#define SPI_DUMMY_BYTE 0xFF
+
+/******************************************************************************/
+/* Global Functions                                                              */
+/******************************************************************************/
+/**
+ * @brief  Initializes the SPI in slave mode
+ * @param  None        
+ * @retval None
+ */
+void spi_slave_init(void)
+{
+
+}
+
+/**
+ * @brief  Receive data from Master
+ * @param  
+ * @retval 
+ */
+uint8_t spi_slave_rx_data(uint8_t * rx_buf)
+{
+
+}
+
+/**
+ * @brief  Send data to Master
+ * @param  
+ * @retval 
+ */
+void spi_slave_tx_data(uint8_t *tx_buf, uint8_t len)
+{
+
+}
+#endif
\ No newline at end of file