Hexiwear library for communicating with the on-board KW40Z BLE device. KW40Z handles also the touch buttons.
Dependents: Hexi_Buttons_Example Hexi_Click_Relay-v2_Example Hexi_Click_Relay-v3_Example Hexi_Catch-the-dot_Game ... more
Diff: Hexi_KW40Z.h
- Revision:
- 2:bb66c19c3c04
- Parent:
- 1:f6f9b24aea57
- Child:
- 3:9e92f113c671
--- a/Hexi_KW40Z.h Mon Sep 19 03:39:36 2016 +0000 +++ b/Hexi_KW40Z.h Mon Sep 19 05:45:31 2016 +0000 @@ -143,14 +143,14 @@ alertIn_type_timeUpdate = 3, } hostInterface_alertIn_type_t; +/** current app enum */ typedef enum { - pressUp = 0, /**< touch press up */ - pressDown = 1, /**< touch press down */ - pressLeft = 2, /**< touch press left */ - pressRight = 3, /**< touch press right */ - slide = 4, /**< touch slide */ -} hexi_buttons_t; + GUI_CURRENT_APP_IDLE = 0, /**< no app active */ + GUI_CURRENT_APP_SENSOR_TAG = 2, /**< sensor tag */ + GUI_CURRENT_APP_HEART_RATE = 5, /**< heart rate */ + GUI_CURRENT_APP_PEDOMETER = 6 /**< Pedometer */ +} gui_current_app_t; typedef void (*button_t)(void); typedef void (*alert_t)(uint8_t *data, uint8_t length); @@ -192,7 +192,27 @@ void attach_passkey(passkey_t passkeyFct); void attach_notifications(notifications_t notFct); - void GetVersion(); + void SendBatteryLevel(uint8_t percentage); + void SendAccel(uint8_t x, uint8_t y, uint8_t z); + void SendGyro(uint8_t x, uint8_t y, uint8_t z); + void SendMag(uint8_t x, uint8_t y, uint8_t z); + void SendAmbientLight(uint8_t percentage); + void SendTemperature(uint16_t celsius); + void SendHumidity(uint16_t percentage); + void SendPressure(uint16_t pascal); + void SendHearRate(uint8_t rate); + void SendSteps(uint16_t steps); + void SendCalories(uint16_t calories); + void SendAlert(uint8_t *pData, uint8_t length); + void SendSetApplicationMode(gui_current_app_t mode); + + void ToggleTsiGroup(void); + void ToggleAdvertisementMode(void); + + uint8_t GetTsiGroup(void); + uint8_t GetAdvertisementMode(void); + uint8_t GetLinkState(void); + hexiwear_version_t GetVersion(void); private: RawSerial device; @@ -215,6 +235,11 @@ uint8_t * rxBuff; bool confirmReceived; + hexiwear_version_t kw40_version; + uint8_t activeTsiGroup; + uint8_t advertisementMode; + uint8_t linkState; + MemoryPool<hostInterface_packet_t, 16> mpool; Queue<hostInterface_packet_t, 16> queue; @@ -225,8 +250,12 @@ void ProcessReceivedPacket(hostInterface_packet_t * rxPacket); void SendPacket(hostInterface_packet_t * txPacket, bool confirmRequested); void SearchStartByte(); - void SendPacketOK(); - void ConfirmPacketOK(); + + void SendPacketOK(void); + void SendGetActiveTsiGroup(void); + void SendGetAdvertisementMode(void); + void SendGetLinkState(void); + void SendGetVersion(void); #if defined (LIB_DEBUG) void DebugPrintRxPacket();