Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: BLE_LED_IDB0XA1_demo MOTOR_BLE_V2 Motor_Ble_v1 Motor_Ble_v10223 ... more
Fork of X_NUCLEO_IDB0XA1 by
Revision 133:1bb8df697f7f, committed 2015-10-07
- Comitter:
- Wolfgang Betz
- Date:
- Wed Oct 07 09:08:22 2015 +0200
- Parent:
- 132:51056160fa4a
- Child:
- 134:d2f8d5898d04
- Commit message:
- Add callback after IRQ
Changed in this revision
--- a/source/bluenrg-hci/hci/hci.c Wed Oct 07 08:39:04 2015 +0200
+++ b/source/bluenrg-hci/hci/hci.c Wed Oct 07 09:08:22 2015 +0200
@@ -22,6 +22,7 @@
#include "hal.h"
#include "hci_const.h"
#include "gp_timer.h"
+#include "debug.h"
#include "stm32_bluenrg_ble.h"
@@ -156,11 +157,17 @@
// HCI Read Packet Pool is empty, wait for a free packet.
readPacketListFull = TRUE;
Clear_SPI_EXTI_Flag();
- return;
+ goto get_out;
}
Clear_SPI_EXTI_Flag();
}
+
+ get_out:
+#ifdef YOTTA_CFG
+ Call_BTLE_Handler();
+#endif
+ return;
}
void hci_write(const void* data1, const void* data2, uint8_t n_bytes1, uint8_t n_bytes2){
--- a/source/platform/btle.cpp Wed Oct 07 08:39:04 2015 +0200
+++ b/source/platform/btle.cpp Wed Oct 07 09:08:22 2015 +0200
@@ -72,10 +72,6 @@
#define IDB04A1 0
#define IDB05A1 1
-#ifdef YOTTA_CFG
-static void btle_handler(void);
-#endif
-
void HCI_Input(tHciDataPacket * hciReadPacket);
//#define BDADDR_SIZE 6
@@ -213,12 +209,9 @@
*/
/**************************************************************************/
#ifdef YOTTA_CFG
-static void btle_handler(void)
+void btle_handler(void)
{
HCI_Process();
-
- // reschedule myself
- minar::Scheduler::postCallback(btle_handler);
}
#endif
@@ -365,12 +358,15 @@
}
//PRINTF("EVT_LE_CONN_COMPLETE LL role=%d\n", cc->role);
switch (cc->role) {
- case 0: //master
+ case 0: //master
role = Gap::CENTRAL;
break;
- case 1:
+ case 1:
role = Gap::PERIPHERAL;
break;
+ default:
+ role = Gap::CENTRAL;
+ break;
}
//PRINTF("EVT_LE_CONN_COMPLETE GAP role=%d\n", role);
BlueNRGGap::getInstance().processConnectionEvent(cc->handle, role/*Gap::PERIPHERAL*/, peerAddrType, cc->peer_bdaddr, addr_type, bleAddr, (const BlueNRGGap::ConnectionParams_t *)&connectionParams);
--- a/source/platform/stm32_bluenrg_ble.cpp Wed Oct 07 08:39:04 2015 +0200
+++ b/source/platform/stm32_bluenrg_ble.cpp Wed Oct 07 09:08:22 2015 +0200
@@ -39,6 +39,7 @@
#include "BlueNRGGap.h"
#include "BlueNRGDevice.h"
#include "Utils.h"
+#include "btle.h"
// FIXME: find a better way to get the instance of the BlueNRG device
extern BlueNRGDevice bluenrgDeviceInstance;
@@ -175,6 +176,18 @@
bluenrgDeviceInstance.disable_irq();
}
+#ifdef YOTTA_CFG
+/**
+ * Call BTLE callback handler.
+ * @param None
+ * @retval None
+ */
+void Call_BTLE_Handler(void)
+{
+ minar::Scheduler::postCallback(btle_handler);
+}
+#endif
+
/**
* @brief Clear Pending SPI IRQ.
* @param None
--- a/x-nucleo-idb0xa1/bluenrg-hci/hal.h Wed Oct 07 08:39:04 2015 +0200 +++ b/x-nucleo-idb0xa1/bluenrg-hci/hal.h Wed Oct 07 09:08:22 2015 +0200 @@ -98,6 +98,11 @@ */ void Disable_SPI_IRQ(void); +/** + * Call BTLE callback handler. + */ +void Call_BTLE_Handler(void); + void Hal_Init_Timer(void); uint32_t Hal_Get_Timer_Value(void); void Hal_Start_Timer(uint32_t timeout);
--- a/x-nucleo-idb0xa1/platform/btle.h Wed Oct 07 08:39:04 2015 +0200 +++ b/x-nucleo-idb0xa1/platform/btle.h Wed Oct 07 09:08:22 2015 +0200 @@ -43,6 +43,10 @@ void User_Process(void); void setConnectable(void); +#ifdef YOTTA_CFG +extern void btle_handler(void); +#endif + #ifdef __cplusplus } #endif
