POTATO

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351

Files at this revision

API Documentation at this revision

Comitter:
natasha41575
Date:
Mon May 06 05:29:48 2019 +0000
Parent:
8:de0336411ac1
Commit message:
POTATO; ;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r de0336411ac1 -r fe52fbcc6187 main.cpp
--- a/main.cpp	Mon May 06 05:09:55 2019 +0000
+++ b/main.cpp	Mon May 06 05:29:48 2019 +0000
@@ -52,25 +52,19 @@
     pc.printf("Right\r\n");
     StartHaptic();
     
-    kw40z_device.ToggleAdvertisementMode();
     uint8_t buf[6] = "Right";
     kw40z_device.SendMessage(buf, 5);
     
-    kw40z_device.ToggleAdvertisementMode();
-    kw40z_device.SendMessage(buf, 5);
 }
 
 void ButtonLeft(void)
 {
     pc.printf("Left\r\n");
     StartHaptic();
-    
-    kw40z_device.ToggleAdvertisementMode();
+
     uint8_t buf[6] = "Left";
     kw40z_device.SendMessage(buf, 5);
     
-    kw40z_device.ToggleAdvertisementMode();
-    kw40z_device.SendMessage(buf, 5);
 }
 
 void PassKey(void)
@@ -131,6 +125,11 @@
     kw40z_device.attach_passkey(&PassKey);
     kw40z_device.attach_alert(&alertReceived);
     
+    while (kw40z_device.GetAdvertisementMode() != 0) {
+        kw40z_device.ToggleAdvertisementMode();
+    }
+    
+    
     memset(text, 0, sizeof(char)*20);