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: Hexi_Buttons_Example Hexi_Click_Relay-v2_Example Hexi_Click_Relay-v3_Example Hexi_Catch-the-dot_Game ... more
Revision 6:23323e8aeda4, committed 2016-09-25
- Comitter:
- cotigac
- Date:
- Sun Sep 25 04:28:52 2016 +0000
- Parent:
- 5:8c7c1cc024ed
- Child:
- 8:2b9b24f3154d
- Commit message:
- Updated thread initialization in the class constructor as ARM team suggested
Changed in this revision
| Hexi_KW40Z.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Hexi_KW40Z.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Hexi_KW40Z.cpp Tue Sep 20 22:38:58 2016 +0000
+++ b/Hexi_KW40Z.cpp Sun Sep 25 04:28:52 2016 +0000
@@ -39,7 +39,7 @@
RawSerial pc(USBTX, USBRX); // tx, rx
#endif
-KW40Z::KW40Z(PinName txPin,PinName rxPin) : device(txPin, rxPin), mainThread(&KW40Z::mainStarter, this, osPriorityNormal,1024), rxThread(&KW40Z::rxStarter, this, osPriorityNormal,1024)
+KW40Z::KW40Z(PinName txPin,PinName rxPin) : device(txPin, rxPin), mainThread(osPriorityNormal,1024), rxThread(osPriorityNormal,1024)
{
#if defined (LIB_DEBUG)
pc.baud(115200);
@@ -71,8 +71,8 @@
bondPassKey = 0;
/* intialization finalized, signal to start the threads */
- mainThread.signal_set(START_THREAD);
- rxThread.signal_set(START_THREAD);
+ mainThread.start(this,&KW40Z::mainTask);
+ rxThread.start(this, &KW40Z::rxTask);
}
KW40Z::~KW40Z(void)
@@ -88,31 +88,17 @@
void KW40Z::attach_passkey(passkey_t passkeyFct){ passkeyCb = passkeyFct; }
void KW40Z::attach_notifications(notifications_t notFct) { notificationsCb = notFct; }
-void KW40Z::rxStarter(void const *p) {
- KW40Z *instance = (KW40Z*)p;
- instance->rxTask();
-}
-
-void KW40Z::mainStarter(void const *p) {
- KW40Z *instance = (KW40Z*)p;
- instance->mainTask();
-}
-
void KW40Z::mainTask(void)
{
- mainThread.signal_wait(START_THREAD);
-
#if defined (LIB_DEBUG)
pc.printf("MainTask Stared\r\n");
#endif
-
SendGetActiveTsiGroup();
SendGetAdvertisementMode();
SendGetLinkState();
SendGetVersion();
-
while(1)
{
osEvent evt = queue.get();
@@ -127,8 +113,6 @@
void KW40Z::rxTask(void)
{
- rxThread.signal_wait(START_THREAD);
-
#if defined (LIB_DEBUG)
pc.printf("RxTask Stared\r\n");
#endif
@@ -706,5 +690,3 @@
{
return activeTsiGroup;
}
-
-
--- a/Hexi_KW40Z.h Tue Sep 20 22:38:58 2016 +0000
+++ b/Hexi_KW40Z.h Sun Sep 25 04:28:52 2016 +0000
@@ -41,8 +41,6 @@
//#define LIB_DEBUG 1
-#define START_THREAD 1
-
#define gHostInterface_startByte1 0x55
#define gHostInterface_startByte2 0xAA
#define gHostInterface_trailerByte 0x45
@@ -217,10 +215,6 @@
uint32_t GetPassKey(void);
-
-
-
-
private:
RawSerial device;
Thread mainThread;
@@ -269,9 +263,6 @@
void DebugPrintRxPacket();
void DebugPrintTxPacket(hostInterface_packet_t * txPacket);
#endif
-
- static void rxStarter(void const *p);
- static void mainStarter(void const *p);
};
#endif
\ No newline at end of file