Test program to fill up the heap

Dependencies:   mbed

Fork of BLE_BatteryLevel by Bluetooth Low Energy

main.cpp

Committer:
ktownsend
Date:
2014-01-09
Revision:
0:395932faedf1
Child:
1:54fe327e5d0a

File content as of revision 0:395932faedf1:

#include "mbed.h"
#include "uuid.h"
#include "hw/nrf51822.h"

/* Radio HW */
nRF51822 radio;

int main(void)
{
    GattService        battService ( 0x180F );
    GattCharacteristic battLevel   ( 0x2A19, 1, 1, BLE_GATT_CHAR_PROPERTIES_NOTIFY | BLE_GATT_CHAR_PROPERTIES_READ);

    /* Make sure we get a clean start */    
    radio.reset();
    
    /* Add the characteristic to our service */
    battService.addCharacteristic(battLevel);
    
    /* Pass the service into the radio */
    radio.addService(battService);
    
    /* Configure the radio and start advertising with default values */
    /* Make sure you've added all of your services before calling this function! */
    radio.start();

    /* Now that we're live, update the battery level characteristic */
    uint8_t batt = 72;
    radio.writeCharacteristic(battLevel.handle, (uint8_t*)&batt, sizeof(batt));
    
    while(1);
}