Test program to fill up the heap
Fork of BLE_BatteryLevel by
Revision 16:abab51f6db64, committed 2015-01-13
- Comitter:
- Enob
- Date:
- Tue Jan 13 07:32:48 2015 +0000
- Parent:
- 15:60e095fe4b45
- Commit message:
- initial commit
Changed in this revision
--- a/BLE_API.lib Tue Dec 16 09:12:25 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#fb2a891a0d98
--- a/main.cpp Tue Dec 16 09:12:25 2014 +0000
+++ b/main.cpp Tue Jan 13 07:32:48 2015 +0000
@@ -15,53 +15,13 @@
*/
#include "mbed.h"
-#include "BLEDevice.h"
-#include "BatteryService.h"
-BLEDevice ble;
-
-DigitalOut led1(LED1, 1);
-Ticker t;
-
-void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
-{
- printf("Disconnected handle %u!\n\r", handle);
- printf("Restarting the advertising process\n\r");
- ble.startAdvertising();
-}
-
-void blink(void)
-{
- led1 = !led1;
-}
+volatile uint8_t* heap_tester;
int main(void)
{
- uint8_t batteryLevel = 50;
- t.attach(blink, 1.0f);
-
- printf("Initialising the nRF51822\n\r");
-
- ble.init();
- ble.onDisconnection(disconnectionCallback);
-
- BatteryService batteryService(ble, batteryLevel);
-
- /* setup advertising */
- ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
- ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
- ble.setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(1000)); /* 1000ms; in multiples of 0.625ms. */
- ble.startAdvertising();
-
- while (true) {
- ble.waitForEvent(); // this will return upon any system event (such as an interrupt or a ticker wakeup)
-
- // the magic battery processing
- batteryLevel++;
- if (batteryLevel > 100) {
- batteryLevel = 20;
- }
-
- batteryService.updateBatteryLevel(batteryLevel);
- }
-}
+ while(true)
+ {
+ heap_tester = new uint8_t;
+ }
+}
\ No newline at end of file
--- a/mbed.bld Tue Dec 16 09:12:25 2014 +0000 +++ b/mbed.bld Tue Jan 13 07:32:48 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
--- a/nRF51822.lib Tue Dec 16 09:12:25 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#17fe69405098
