Run on TY51822r3 board with ACC sensor (LIS3DH or BMC050)

Dependencies:   BLE_API LIS3DH mbed nRF51822 BMC050 nRF51_LowPwr nRF51_Vdd

Fork of BLE_EddystoneBeacon_Service by Bluetooth Low Energy

Revision:
15:af8c24f34a9f
Parent:
14:5a2a104a21a8
Child:
16:a7d07ea94b31
--- a/main.cpp	Mon Jul 20 04:29:07 2015 +0000
+++ b/main.cpp	Mon Jul 20 19:31:40 2015 +0000
@@ -23,7 +23,7 @@
 
 BLE ble;
 ZipBeaconConfigService *zipBeaconConfig;
-InterruptIn button(p17);
+//InterruptIn button(p17);
 
 /**
  * URIBeaconConfig service can operate in two modes: a configuration mode which
@@ -34,14 +34,14 @@
  *
  * The following help with this switch.
  */
-static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 60;  // Duration after power-on that config service is available.
+static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 5;  // Duration after power-on that config service is available.
 Ticker configAdvertisementTimeoutTicker;
 
 //
 // Have to use this to add a interrupt, because C++ is stupid. 
 //
 void stupidWrapperFn(){
-    zipBeaconConfig->pduCountCallback();
+    zipBeaconConfig->radioNotificationCallback();
     }
 
 /**
@@ -56,6 +56,7 @@
         ble.gap().startAdvertising();
 
         configAdvertisementTimeoutTicker.detach(); /* disable the callback from the timeout Ticker. */
+        printf("removing config service\r\n");
     }
 }
 
@@ -65,10 +66,12 @@
 void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
 {
     ble.gap().startAdvertising();
+    printf("disconnect CB\r\n");
 }
 
 int main(void)
 {
+    printf("Starting Example\r\n");
     ble.init();
     ble.gap().onDisconnection(disconnectionCallback);
 
@@ -84,7 +87,7 @@
 
     /* Initialize a zipBeaconConfig service providing config params, default URI, and power levels. */
     static ZipBeaconConfigService::PowerLevels_t defaultAdvPowerLevels = {-20, -4, 0, 10}; // Values for ADV packets related to firmware levels
-    zipBeaconConfig = new ZipBeaconConfigService(ble, params, !fetchedFromPersistentStorage, "http://uribeacon.org", defaultAdvPowerLevels);
+    zipBeaconConfig = new ZipBeaconConfigService(ble, params, !fetchedFromPersistentStorage, "http://mbed.org", defaultAdvPowerLevels);
     if (!zipBeaconConfig->configuredSuccessfully()) {
         error("failed to accommodate URI");
     }
@@ -96,8 +99,8 @@
 
     ble.gap().startAdvertising(); /* Set the whole thing in motion. After this call a GAP central can scan the zipBeaconConfig
                                    * service. This can then be switched to the normal URIBeacon functionality after a timeout. */
-
-    button.rise(&stupidWrapperFn);
+    printf("Running...\r\n");
+    //button.rise(&stupidWrapperFn);
     while (true) {
         ble.waitForEvent();
     }