My fork of X_NUCLEO_IDB0XA1

Fork of X_NUCLEO_IDB0XA1 by ST

Files at this revision

API Documentation at this revision

Comitter:
Vincent Coubard
Date:
Thu Sep 15 10:51:26 2016 +0100
Branch:
e9fb3e390284c3f7ef8e1d21cc55deef7558ca3d
Parent:
254:f4d217cadbde
Child:
273:00205952d841
Commit message:
Sync with e9fb3e390284c3f7ef8e1d21cc55deef7558ca3d

2016-07-11 11:07:03+01:00: Vincent Coubard
Changes needed for the scheduling policy.
Friendly with RTOS.

Changed in this revision

source/BlueNRGDevice.cpp Show annotated file Show diff for this revision Revisions of this file
source/bluenrg-hci/hci/hci.c Show annotated file Show diff for this revision Revisions of this file
source/platform/btle.cpp Show annotated file Show diff for this revision Revisions of this file
source/platform/stm32_bluenrg_ble.cpp Show annotated file Show diff for this revision Revisions of this file
x-nucleo-idb0xa1/BlueNRGDevice.h Show annotated file Show diff for this revision Revisions of this file
x-nucleo-idb0xa1/bluenrg-hci/hal.h Show annotated file Show diff for this revision Revisions of this file
x-nucleo-idb0xa1/platform/btle.h Show annotated file Show diff for this revision Revisions of this file
--- a/source/BlueNRGDevice.cpp	Thu Sep 15 10:51:17 2016 +0100
+++ b/source/BlueNRGDevice.cpp	Thu Sep 15 10:51:26 2016 +0100
@@ -229,9 +229,7 @@
 	bool must_return = false;
 
 	do {
-		BlueNRGGap::getInstance().Process();
-		
-		HCI_Process();
+        bluenrgDeviceInstance.processEvents();
 		
 		if(must_return) return;
 
@@ -469,3 +467,7 @@
 {
     irq_.enable_irq();
 }
+
+void BlueNRGDevice::processEvents() {
+    btle_handler();
+}
\ No newline at end of file
--- a/source/bluenrg-hci/hci/hci.c	Thu Sep 15 10:51:17 2016 +0100
+++ b/source/bluenrg-hci/hci/hci.c	Thu Sep 15 10:51:26 2016 +0100
@@ -179,9 +179,7 @@
         hciReadPacket->data_len = data_len;
         if(HCI_verify(hciReadPacket) == 0) {
           list_insert_tail(&hciReadPktRxQueue, (tListNode *)hciReadPacket);
-#ifdef AST_FOR_MBED_OS
-	  Call_BTLE_Handler();
-#endif
+	      signalEventsToProcess();
         } else {
           list_insert_head(&hciReadPktPool, (tListNode *)hciReadPacket);
 #ifdef POOL_CNT
@@ -199,9 +197,7 @@
     }
     else{
       // HCI Read Packet Pool is empty, wait for a free packet.
-#ifdef AST_FOR_MBED_OS
-      Call_BTLE_Handler();
-#endif
+      signalEventsToProcess();
       readPacketListFull = TRUE;
       Clear_SPI_EXTI_Flag();
       return;
@@ -1229,4 +1225,3 @@
   
   return 0;
 }
-
--- a/source/platform/btle.cpp	Thu Sep 15 10:51:17 2016 +0100
+++ b/source/platform/btle.cpp	Thu Sep 15 10:51:26 2016 +0100
@@ -203,9 +203,7 @@
     /*ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0,
                             strlen(name), (tHalUint8 *)name);*/
 
-#ifdef AST_FOR_MBED_OS
-    minar::Scheduler::postCallback(btle_handler);
-#endif
+    signalEventsToProcess();
     return;
 }
 
@@ -218,15 +216,14 @@
     @returns
 */
 /**************************************************************************/
-#ifdef AST_FOR_MBED_OS
 int btle_handler_pending = 0;
 
 void btle_handler(void)
 {
     btle_handler_pending = 0;
+	BlueNRGGap::getInstance().Process();    
     HCI_Process();
 }
-#endif
 
 /* set BLE Version string */
 void setVersionString(uint8_t hwVersion, uint16_t fwVersion)
@@ -643,4 +640,4 @@
 
 #ifdef __cplusplus
 }
-#endif
+#endif
\ No newline at end of file
--- a/source/platform/stm32_bluenrg_ble.cpp	Thu Sep 15 10:51:17 2016 +0100
+++ b/source/platform/stm32_bluenrg_ble.cpp	Thu Sep 15 10:51:26 2016 +0100
@@ -172,20 +172,12 @@
     bluenrgDeviceInstance.enable_irq();
 }
 
-#ifdef AST_FOR_MBED_OS
-/**
- * Call BTLE callback handler.
- * @param  None
- * @retval None
- */
-void Call_BTLE_Handler(void)
-{
-	if(!btle_handler_pending) {
-		btle_handler_pending = 1;
-		minar::Scheduler::postCallback(btle_handler);
-	}
+void signalEventsToProcess(void)  {
+    if(btle_handler_pending == 0) {
+        btle_handler_pending = 1;
+        bluenrgDeviceInstance.signalEventsToProcess(BLE::DEFAULT_INSTANCE);
+    }
 }
-#endif
 
 /**
  * @brief  Disable SPI IRQ.
@@ -224,4 +216,4 @@
 // End of C function wrappers
 ////////////////////////////////////////
  
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\ No newline at end of file
--- a/x-nucleo-idb0xa1/BlueNRGDevice.h	Thu Sep 15 10:51:17 2016 +0100
+++ b/x-nucleo-idb0xa1/BlueNRGDevice.h	Thu Sep 15 10:51:26 2016 +0100
@@ -88,6 +88,8 @@
     int32_t spiWrite(uint8_t* data1, uint8_t* data2, uint8_t Nb_bytes1, uint8_t Nb_bytes2);
     void disable_irq();
     void enable_irq();
+
+    virtual void processEvents();
     
 private:
     bool isInitialized;
@@ -102,4 +104,4 @@
     SecurityManager *sm;
 };
 
-#endif
+#endif
\ No newline at end of file
--- a/x-nucleo-idb0xa1/bluenrg-hci/hal.h	Thu Sep 15 10:51:17 2016 +0100
+++ b/x-nucleo-idb0xa1/bluenrg-hci/hal.h	Thu Sep 15 10:51:26 2016 +0100
@@ -98,14 +98,11 @@
  */
 void Disable_SPI_IRQ(void);
 
-/**
- * Call BTLE callback handler.
- */
-void Call_BTLE_Handler(void);
+void signalEventsToProcess(void);
 
 void Hal_Init_Timer(void);
 uint32_t Hal_Get_Timer_Value(void);
 void Hal_Start_Timer(uint32_t timeout);
 void Hal_Stop_Timer(void);
 
-#endif /* __HAL_H__ */
+#endif /* __HAL_H__ */
\ No newline at end of file
--- a/x-nucleo-idb0xa1/platform/btle.h	Thu Sep 15 10:51:17 2016 +0100
+++ b/x-nucleo-idb0xa1/platform/btle.h	Thu Sep 15 10:51:26 2016 +0100
@@ -49,13 +49,12 @@
                               uint16_t scan_window,
                               uint8_t own_address_type);
 
-#ifdef AST_FOR_MBED_OS
+
 extern int btle_handler_pending;
 extern void btle_handler(void);
-#endif
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif
+#endif
\ No newline at end of file