Geo beacon for VF.
Dependencies: MMA8452 aconno_bsp adc52832_common
Diff: main.cpp
- Revision:
- 32:61d2328ec1a7
- Parent:
- 31:caef580f5943
- Child:
- 33:449fcc43b287
--- a/main.cpp Thu Nov 23 15:49:10 2017 +0000
+++ b/main.cpp Fri Nov 24 15:02:50 2017 +0000
@@ -52,6 +52,7 @@
#define I2C_CLK (p2)
#define INT2_PIN (p4)
#define BUZZER (p31)
+#define USE_IBEACON_ONLY (1)
typedef struct __attribute__((packed, aligned(1))){
uint16_t appleID;
@@ -270,13 +271,13 @@
ble.gap().onConnection(onConnectionCallback); // -->> Uncomment these two lines for shush-shush
ble.gattServer().onDataWritten(onDataWrittenCallback);
- ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t *)msd, MSD_SIZE);
+ //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t *)msd, MSD_SIZE);
/*
* iBeacon
*/
- //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
- //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, sizeof(ibeaconMSD));
+ ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
+ ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, sizeof(ibeaconMSD));
ble.gap().setAdvertisingInterval(ADV_INTERVAL); // --> Has to be at least 100ms!
}
@@ -393,15 +394,15 @@
WakeMeUp();
}
else{
- if(!cnt){
+ if(USE_IBEACON_ONLY || !cnt){
nextState = iBEACON;
changeAdvPaylod(nextState);
}
- if(cnt==1){
+ else if(cnt==1){
nextState = BEACON;
changeAdvPaylod(nextState);
}
- cnt = (cnt+1)%5; // Everyfifth advertising change to iBeacon
+ cnt = (cnt+1)%5; // Every fifth advertising change to iBeacon
ble.gap().startAdvertising();
#if DEBUG

