for camera
Dependencies: BLE_API mbed nRF51822
Fork of BLE_GATT_Example by
Diff: main.cpp
- Revision:
- 29:48287117fa46
- Parent:
- 28:382c630bae02
- Child:
- 30:27466f74458c
--- a/main.cpp Sat Jun 10 01:10:45 2017 +0000 +++ b/main.cpp Sat Jun 10 03:05:02 2017 +0000 @@ -57,7 +57,7 @@ ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); // advertising type ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); // add name ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); // UUID's broadcast in advertising packet - ble.gap().setAdvertisingInterval(100); // 100ms. + ble.gap().setAdvertisingInterval(500); // 500ms. /* Add our custom service */ ble.addService(customService); @@ -70,9 +70,15 @@ * Main loop */ int main(void) -{ +{ + NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos; + NRF_POWER->TASKS_LOWPWR = 1; + NRF_ADC->ENABLE = (ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos); + NRF_POWER->DCDCEN = 0x00000001; + BLE& ble = BLE::Instance(BLE::DEFAULT_INSTANCE); ble.init(bleInitComplete); + ble.setTxPower(-20); /* SpinWait for initialization to complete. This is necessary because the * BLE object is used in the main loop below. */