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.
Fork of X_NUCLEO_IDB0XA1 by
Revision 277:8da7a954664d, committed 2016-09-15
- Comitter:
- Vincent Coubard
- Date:
- Thu Sep 15 10:51:41 2016 +0100
- Branch:
- sync_with_github
- Parent:
- 276:a20f4cad1d61
- Parent:
- 274:4826afdae563
- Child:
- 278:a5209d8cfd61
- Child:
- 279:30a6a8ad2623
- Commit message:
- Sync with 09eed58c8df8d351803324b150e324027ecb9ad6
Merge 7b242e25ed2bc04230f0e62d1ae2c076bfc1c354 into e6d00ca1d1860d23ec86287a3d7ff17abad1cb06
2016-07-25 16:35:33+02:00: Andrea Palmieri
Merge pull request #9 from ARMmbed/rtos
Scheduling policy
Changed in this revision
--- a/source/BlueNRGDevice.cpp Thu Sep 15 10:51:40 2016 +0100
+++ b/source/BlueNRGDevice.cpp Thu Sep 15 10:51:41 2016 +0100
@@ -227,9 +227,7 @@
bool must_return = false;
do {
- BlueNRGGap::getInstance().Process();
-
- HCI_Process();
+ bluenrgDeviceInstance.processEvents();
if(must_return) return;
@@ -466,4 +464,8 @@
void BlueNRGDevice::enable_irq()
{
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:40 2016 +0100
+++ b/source/bluenrg-hci/hci/hci.c Thu Sep 15 10:51:41 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:40 2016 +0100
+++ b/source/platform/btle.cpp Thu Sep 15 10:51:41 2016 +0100
@@ -183,14 +183,11 @@
/*ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0,
strlen(name), (tHalUint8 *)name);*/
+ signalEventsToProcess();
// update the peripheral preferred conenction parameters handle
// This value is hardcoded at the moment.
g_preferred_connection_parameters_char_handle = 10;
-
-#ifdef AST_FOR_MBED_OS
- minar::Scheduler::postCallback(btle_handler);
-#endif
return;
}
@@ -203,15 +200,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)
--- a/source/platform/clock.c Thu Sep 15 10:51:40 2016 +0100
+++ b/source/platform/clock.c Thu Sep 15 10:51:41 2016 +0100
@@ -1,7 +1,12 @@
#include "clock.h"
-#include "mbed-drivers/wait_api.h"
-#include "mbed-drivers/rtc_time.h"
+#ifdef YOTTA_CFG_MBED_OS
+ #include "mbed-drivers/wait_api.h"
+ #include "mbed-drivers/rtc_time.h"
+#else
+ #include "wait_api.h"
+ #include "rtc_time.h"
+#endif
const uint32_t CLOCK_SECOND = 1000;
@@ -28,7 +33,4 @@
{
wait_ms(i);
}
-/*---------------------------------------------------------------------------*/
-
-
-
+/*---------------------------------------------------------------------------*/
\ No newline at end of file
--- a/source/platform/stm32_bluenrg_ble.cpp Thu Sep 15 10:51:40 2016 +0100
+++ b/source/platform/stm32_bluenrg_ble.cpp Thu Sep 15 10:51:41 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:40 2016 +0100
+++ b/x-nucleo-idb0xa1/BlueNRGDevice.h Thu Sep 15 10:51:41 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:40 2016 +0100 +++ b/x-nucleo-idb0xa1/bluenrg-hci/hal.h Thu Sep 15 10:51:41 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:40 2016 +0100
+++ b/x-nucleo-idb0xa1/platform/btle.h Thu Sep 15 10:51:41 2016 +0100
@@ -50,10 +50,9 @@
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
}
