![](/media/cache/profiles/profileJosh.jpg.50x50_q85.jpg)
A speedtest
Dependencies: aconno_SEGGER_RTT CustomService
Diff: main.cpp
- Branch:
- TestBranch
- Revision:
- 4:de5cf6b1e96b
- Parent:
- 2:84d964276266
- Child:
- 5:9ca5e2a69411
diff -r 84d964276266 -r de5cf6b1e96b main.cpp --- a/main.cpp Fri Aug 25 06:53:07 2017 +0000 +++ b/main.cpp Sun May 13 20:03:40 2018 +0000 @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Aconno. All Rights Reserved. +/* Copyright (c) 2018 Aconno. All Rights Reserved. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from @@ -7,84 +7,10 @@ */ #include "mbed.h" -#include "acd52832_bsp.h" -#include "ble/BLE.h" -#include "GapAdvertisingData.h" -#define USE_PWM (0) -#define USE_BLE (1) - -#if USE_BLE - BLE &ble = BLE::Instance(); -#endif - -Ticker WakeSleepT; -Ticker turnBuzzOffT; -Ticker sleepChanger; -#if USE_PWM - PwmOut buzzer(p31); -#endif - -#if USE_BLE -void bleInitComplete(BLE::InitializationCompleteCallbackContext *params){ - BLE& ble = params->ble; - /* Ensure that it is the default instance of BLE */ - if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) { - return; - } - uint8_t MSD = 0x23; - /* setup advertising */ - ble.gap().setAdvertisingInterval(100); // --> Has to be at least 100ms! - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, &MSD, 1); - ble.gap().stopAdvertising(); -} -#endif - +DigitalOut led(p23); int main(){ - #if USE_BLE - ble.init(bleInitComplete); - /* SpinWait for initialization to complete. This is necessary because the BLE object is used in the main loop below. */ - while (ble.hasInitialized() == false){} - #endif - - #if USE_PWM - buzzer.period(0.0F); - buzzer.write(0.0F); - #endif - - /* - // Disconnect and stop PWM0 - NRF_PWM0->PSEL.OUT[0] = 0x80000000; - NRF_PWM0->PSEL.OUT[1] = 0x80000000; - NRF_PWM0->PSEL.OUT[2] = 0x80000000; - NRF_PWM0->PSEL.OUT[3] = 0x80000000; - NRF_PWM0->TASKS_STOP = 1; - */ - - // Disconnect and stop PWM1 - NRF_PWM1->PSEL.OUT[0] = 0x80000000; - NRF_PWM1->PSEL.OUT[1] = 0x80000000; - NRF_PWM1->PSEL.OUT[2] = 0x80000000; - NRF_PWM1->PSEL.OUT[3] = 0x80000000; - NRF_PWM1->TASKS_STOP = 1; - - // Disconnect and stop PWM2 - NRF_PWM2->PSEL.OUT[0] = 0x80000000; - NRF_PWM2->PSEL.OUT[1] = 0x80000000; - NRF_PWM2->PSEL.OUT[2] = 0x80000000; - NRF_PWM2->PSEL.OUT[3] = 0x80000000; - NRF_PWM2->TASKS_STOP = 1; - - NRF_CLOCK->TASKS_LFCLKSTART = 1; - while(!NRF_CLOCK->EVENTS_LFCLKSTARTED); - NRF_CLOCK->TASKS_HFCLKSTOP; - NRF_POWER->TASKS_LOWPWR = 0x00000001; - - while(1){ - #if USE_BLE - ble.waitForEvent(); - #endif - __WFI(); - } + led = !led; + wait_ms(250); } \ No newline at end of file