Hexiwear library for communicating with the on-board KW40Z BLE device. KW40Z handles also the touch buttons.
Fork of Hexi_KW40Z by
Diff: Hexi_KW40Z.h
- Revision:
- 1:f6f9b24aea57
- Parent:
- 0:c2d52562f36b
- Child:
- 2:bb66c19c3c04
--- a/Hexi_KW40Z.h Mon Sep 19 02:46:28 2016 +0000 +++ b/Hexi_KW40Z.h Mon Sep 19 03:39:36 2016 +0000 @@ -152,13 +152,10 @@ slide = 4, /**< touch slide */ } hexi_buttons_t; -typedef struct -{ - void (*buttons)(hexi_buttons_t button); - void (*alert)(uint8_t *data, uint8_t length); - void (*passkey)(uint8_t *data); - void (*notifications)(uint8_t eventId, uint8_t categoryId); -} kw40z_callbacks_t; +typedef void (*button_t)(void); +typedef void (*alert_t)(uint8_t *data, uint8_t length); +typedef void (*passkey_t)(uint8_t *data); +typedef void (*notifications_t)(uint8_t eventId, uint8_t categoryId); typedef struct name { @@ -185,7 +182,16 @@ */ ~KW40Z(); - void attach(kw40z_callbacks_t * callbacks); + void attach_buttonUp(button_t btnFct); + void attach_buttonDown(button_t btnFct); + void attach_buttonLeft(button_t btnFct); + void attach_buttonRight(button_t btnFct); + void attach_buttonSlide(button_t btnFct); + + void attach_alert(alert_t alertFct); + void attach_passkey(passkey_t passkeyFct); + void attach_notifications(notifications_t notFct); + void GetVersion(); private: @@ -196,7 +202,16 @@ hostInterface_packet_t hostInterface_rxPacket; hostInterface_packet_t hostInterface_txPacket; - kw40z_callbacks_t * kw40z_Cbs; + button_t buttonUpCb; + button_t buttonDownCb; + button_t buttonLeftCb; + button_t buttonRightCb; + button_t buttonSlideCb; + + alert_t alertCb; + passkey_t passkeyCb; + notifications_t notificationsCb; + uint8_t * rxBuff; bool confirmReceived;