Hexiwear library for communicating with the on-board KW40Z BLE device. KW40Z handles also the touch buttons.
Dependents: Hexi_BLE_Example_Modified Hexi_BLE_Example_ModifiedPOTATO
Fork of Hexi_KW40Z by
Diff: Hexi_KW40Z.h
- Revision:
- 9:8058541a8e2d
- Parent:
- 8:2b9b24f3154d
- Child:
- 11:a9a838035b87
diff -r 2b9b24f3154d -r 8058541a8e2d Hexi_KW40Z.h --- a/Hexi_KW40Z.h Sun Sep 25 05:50:22 2016 +0000 +++ b/Hexi_KW40Z.h Mon Sep 26 01:37:59 2016 +0000 @@ -39,11 +39,13 @@ #include "mbed.h" #include "rtos.h" -//#define LIB_DEBUG 1 +#define LIB_DEBUG 1 #define gHostInterface_startByte1 0x55 #define gHostInterface_startByte2 0xAA #define gHostInterface_trailerByte 0x45 +#define gHostInterface_rxConfirmMask 0x01 +#define gHostInterface_txPacketMask 0x10 #define gHostInterface_dataSize 23 #define gHostInterface_headerSize 4 @@ -204,6 +206,7 @@ void SendCalories(uint16_t calories); void SendAlert(uint8_t *pData, uint8_t length); void SendSetApplicationMode(gui_current_app_t mode); + void SendGetVersion(void); void ToggleTsiGroup(void); void ToggleAdvertisementMode(void); @@ -216,9 +219,13 @@ uint32_t GetPassKey(void); private: - RawSerial device; +#if defined (LIB_DEBUG) + RawSerial pc; +#endif + + RawSerial device; + Thread rxThread; Thread mainThread; - Thread rxThread; hostInterface_packet_t hostInterface_rxPacket; hostInterface_packet_t hostInterface_txPacket; @@ -249,19 +256,18 @@ void rxTask(void); void ProcessBuffer(); - void ProcessReceivedPacket(hostInterface_packet_t * rxPacket); + void ProcessPacket(hostInterface_packet_t * packet); void SendPacket(hostInterface_packet_t * txPacket, bool confirmRequested); + void SendInternal(hostInterface_packet_t * txPacket); void SearchStartByte(); void SendPacketOK(void); void SendGetActiveTsiGroup(void); void SendGetAdvertisementMode(void); void SendGetLinkState(void); - void SendGetVersion(void); -#if defined (LIB_DEBUG) - void DebugPrintRxPacket(); - void DebugPrintTxPacket(hostInterface_packet_t * txPacket); +#if defined (LIB_DEBUG) + void DebugPrintPacket(hostInterface_packet_t * packet); #endif };