Example #1
0
	bool Target::open(mcp2200::Device &device)
	{
		if (isPathSet()){
			if (device.open(getPath())){
				return true;
			}else{
				cerr << "could not open device (" << getPath() << ")\n";
				return false;
			}
		}
		if (isSerialSet()){
			if (device.open(getVendorId(), getProductId(), getSerial().c_str())){
				return true;
			}else{
				cerr << "could not open device (" << *this << ", serial:" << getSerial() << ")\n";
				return false;
			}
		}
		if (device.open(getVendorId(), getProductId())){
			return true;
		}else{
			cerr << "could not open device (" << *this << ")\n";
			return false;
		}
	}
Example #2
0
void System::printFreqs() const
{
    getSerial().print(freq,4);
    getSerial().print(" (");
    getSerial().print(freqMeas.get(),4);
    getSerial().print(") ");
    for (int i=0;i<subSystems.getSize();i++) subSystems(i)->printFreqs();
    if (subSystems.getSize() > 0) getSerial().println();
}
bool CDVRPTRControllerV2::openModem()
{
	bool ret = false;

	switch (m_connection) {
		case CT_USB:
			ret = m_usb->open();
			break;
		case CT_NETWORK:
			ret = m_network->open();
			break;
		default:
			wxLogError(wxT("Invalid connection type: %d"), int(m_connection));
			break;
	}

	if (!ret)
		return false;

	ret = getSerial();
	if (!ret) {
		closeModem();
		return false;
	}

	ret = setConfig();
	if (!ret) {
		closeModem();
		return false;
	}

	return true;
}
Example #4
0
void EncoderVorbis::initStream() {
    // set up analysis state and auxiliary encoding storage
    vorbis_analysis_init(&m_vdsp, &m_vinfo);
    vorbis_block_init(&m_vdsp, &m_vblock);

    // set up packet-to-stream encoder; attach a random serial number
    srand(time(0));
    ogg_stream_init(&m_oggs, getSerial());

    // add comment
    vorbis_comment_init(&m_vcomment);
    vorbis_comment_add_tag(&m_vcomment, "ENCODER", "mixxx/libvorbis");
    if (m_metaDataArtist != NULL)
        vorbis_comment_add_tag(&m_vcomment, "ARTIST", m_metaDataArtist);
    if (m_metaDataTitle != NULL)
        vorbis_comment_add_tag(&m_vcomment, "TITLE", m_metaDataTitle);
        if (m_metaDataAlbum != NULL)
        vorbis_comment_add_tag(&m_vcomment, "ALBUM", m_metaDataAlbum);

    // set up the vorbis headers
    ogg_packet headerInit;
    ogg_packet headerComment;
    ogg_packet headerCode;
    vorbis_analysis_headerout(&m_vdsp, &m_vcomment, &headerInit, &headerComment, &headerCode);
    ogg_stream_packetin(&m_oggs, &headerInit);
    ogg_stream_packetin(&m_oggs, &headerComment);
    ogg_stream_packetin(&m_oggs, &headerCode);

        //The encoder is now inialized
        // Encode method will start streaming by sending the header first
        m_header_write = true;
    m_bStreamInitialized = true;
}
Example #5
0
std::string SDRDeviceInfo::getDeviceId() {
    std::string deviceId;
    
    deviceId.append(getName());
    deviceId.append(" :: ");
    deviceId.append(getSerial());
    
    return deviceId;
}
Example #6
0
const char * ULaserDevice::print(const char * preString, char * buff, int buffCnt)
{
  snprintf(buff, buffCnt, "%s %s on %s open=%s w=%ddeg, "
           "res=%4.2fdeg, rate=%.1f/s scan=%lu\n", preString,
           getName(), devName, bool2str(isPortOpen()),
           modeAngleScan, angleResolution,
           getMsgRate(), getSerial());
  return buff;
}
Example #7
0
NovenaTestEngine::NovenaTestEngine(NovenaTestWindow *ui)
{
    currentTest = NULL;
    currentTestNumber = -1;
    currentThread = NULL;
    this->ui = ui;
    debugMode = false;

    getSerial();
}
Example #8
0
/*!
\author Luxor
\brief Adds a temp effect to the object
*/
bool cObject::addTempfx( cObject& src, int32_t num, int32_t more1, int32_t more2, int32_t more3, int32_t dur, int32_t amxcback )
{
	if ( num < 0 || num >= tempfx::MAX_TEMPFX_INDEX )
		return false;

	//
	//	Repeatable check
	//
	if ( !tempfx::isDestRepeatable(num) && getTempfx( num ) )
			return false;

	if ( !tempfx::isSrcRepeatable(num) && src.getTempfx( num ) )
			return false;

	//
	//	Create the tempfx
	//
	tempfx::cTempfx tmpeff( src.getSerial(), getSerial(), num, dur, more1, more2, more3, amxcback );

	if ( !tmpeff.isValid() )
		return false;

        //
        //	Put the object in the global check vector if necessary
        //
        tempfx::addTempfxCheck( getSerial() );

	//
	//	Start the tempfx
	//
	tmpeff.start();

	//
	//	Put it in the class vector
	//
	if ( tempfx == NULL )
		tempfx = new TempfxVector;

	tempfx->push_front( tmpeff );

	return true;
}
Example #9
0
void doSendSerial() {
  char serialNumber[SERIAL_LEN] = {0};
  getSerial(serialNumber, SERIAL_LEN);
  jsvUnLock(messageVar);
  messageVar = jsvVarPrintf("%s", serialNumber + SERIAL_OFFSET);
  WDEBUG("Serial: "); WDEBUGSTRVAR(messageVar); WDEBUGLN("");
  JsVar *serial = jspGetNamedField(execInfo.root, SERIAL4_WIFI, false);
  jswrap_serial_print(serial, messageVar);
  jsvUnLock(serial);
  blink(PIN_RED, 20);blink(PIN_RED, 20);blink(PIN_RED, 20);
}
Example #10
0
void Publisher::state::collectGarbage() {
  if (items.empty()) {
    return;
  }

  uint64_t minSerial = std::numeric_limits<uint64_t>::max();
  for (auto& it : subscribers) {
    auto sub = it.lock();
    if (sub) {
      minSerial = std::min(minSerial, sub->getSerial());
    }
  }

  while (!items.empty() && items.front()->serial < minSerial) {
    items.pop_front();
  }
}
Example #11
0
void doMeasurement() {
  enableDASH(); 

  JsVar *i2c1 = jspGetNamedField(execInfo.root, "I2C1", false);
  IOEventFlags device = jsiGetDeviceFromClass(i2c1);
  if (!DEVICE_IS_I2C(device)) {
    blink(PIN_RED, 100); 
    return;
  }
  jsvUnLock(i2c1);

  unsigned char dataPtr[2];
  dataPtr[0] = CMD_MEASURE_TEMPERATURE_HOLD;

  jshI2CWrite(device, (unsigned char)(CMD_TEMP_ADDR), 1, (unsigned char*)dataPtr, true);
  int i = 0;
  for (i=0; i<2; i++) { dataPtr[i] = 0; }
  jshI2CRead(device, (unsigned char)CMD_TEMP_ADDR, 2, (unsigned char*)dataPtr, true);

  int temp = ((dataPtr[0] * 256) + dataPtr[1]);
  /// http://www.silabs.com/Support%20Documents/TechnicalDocs/Si7050-1-3-4-5-A20.pdf#page=14
  JsVarFloat realTemp = ((175.72f * temp) / 65536.0f) - 46.85f;

  char temperatureBuffer[6] = {0};
  ftoa_bounded(realTemp, temperatureBuffer, 5);
  temperatureBuffer[5] = '\0';

  char serialNumber[SERIAL_LEN] = {0};
  getSerial(serialNumber, SERIAL_LEN);

  /// Generate the JSON that we send to gateway skyand then to API{\"nodeSerial\":\"%s\",\"channel\":\"temp\",\"value\":\"%s\",\"metric\":\"c\"}');", serialNumber + SERIAL_OFFSE
  jsvUnLock(messageVar);
  if (doTimeout) { //regular message
    messageVar = jsvVarPrintf("{\"ns\":\"%s\",\"ch\":\"t\",\"v\":\"%s\",\"m\":\"c\"}", serialNumber + SERIAL_OFFSET, temperatureBuffer);
  } else { //this only happens if we forced the read
    messageVar = jsvVarPrintf("{\"ns\":\"%s\",\"ch\":\"t\",\"v\":\"%s\",\"m\":\"c\",\"f\":\"y\"}", serialNumber + SERIAL_OFFSET, temperatureBuffer);
  }
  WDEBUG("sending on DASH: "); WDEBUGSTRVAR(messageVar); WDEBUGLN("");
  JsVar *serial = jspGetNamedField(execInfo.root, SERIAL1_DASH7, false);
  jswrap_serial_print(serial, messageVar);
  jsvUnLock(serial);
  transmittingData = true; // see jswrap_wice_idle
}
bool CDVRPTRControllerV2::openModem()
{
	bool ret = m_serial.open();
	if (!ret)
		return false;

	ret = getSerial();
	if (!ret) {
		m_serial.close();
		return false;
	}

	ret = setConfig();
	if (!ret) {
		m_serial.close();
		return false;
	}

	return true;
}
Example #13
0
//---------------------------------------------------------------------------
// exit
//---------------------------------------------------------------------------
bool Config::exit()
{
    if( _state != STATE_RUNNING )
        LBWARN << "Exiting non-initialized config" << std::endl;

    LBASSERT( _state == STATE_RUNNING || _state == STATE_INITIALIZING );
    _state = STATE_EXITING;

    const Canvases& canvases = getCanvases();
    for( Canvases::const_iterator i = canvases.begin();
         i != canvases.end(); ++i )
    {
        Canvas* canvas = *i;
        canvas->exit();
    }

    for( Compounds::const_iterator i = _compounds.begin();
         i != _compounds.end(); ++i )
    {
        Compound* compound = *i;
        compound->exit();
    }

    const bool success = _updateRunning( true );

    // send exit event to app, needed if this is called from init()
    EventOCommand cmd( send( findApplicationNetNode(),
                             fabric::CMD_CONFIG_EVENT ));
    Event event;
    event.serial = getSerial();
    event.time = getServer()->getTime();
    event.originator = getID();

    cmd << EVENT_EXIT << event;

    _needsFinish = false;
    _state = STATE_STOPPED;
    return success;
}
Example #14
0
void Window::_updateEvent( Event& event )
{
    // TODO 2.0 event interface will stream these and remove them from Event
    event.time = getConfig()->getTime();
    event.originator = getID();
    event.serial = getSerial();

    switch( event.type )
    {
        case Event::WINDOW_POINTER_MOTION:
        case Event::WINDOW_POINTER_BUTTON_PRESS:
        case Event::WINDOW_POINTER_BUTTON_RELEASE:
        case Event::WINDOW_POINTER_WHEEL:
        {
            const int32_t xPos = event.pointer.x;
            const int32_t yPos = event.pointer.y;

            if( !getRenderContext( xPos, yPos, event.context ))
                LBVERB << "No rendering context for pointer event at "
                       << xPos << ", " << yPos << std::endl;
        }
    }
}
Example #15
0
bool CDVRPTRControllerV2::open()
{
	bool ret = m_serial.open();
	if (!ret)
		return false;

	ret = getSerial();
	if (!ret) {
		m_serial.close();
		return false;
	}

	ret = setConfig();
	if (!ret) {
		m_serial.close();
		return false;
	}

	Create();
	SetPriority(100U);
	Run();

	return true;
}
Example #16
0
json_ref Publisher::getDebugInfo() const {
  auto ret = json_object();

  auto rlock = state_.rlock();
  ret.set("next_serial", json_integer(rlock->nextSerial));

  auto subscribers = json_array();
  auto& subscribers_arr = subscribers.array();

  for (auto& sub_ref : rlock->subscribers) {
    auto sub = sub_ref.lock();
    if (sub) {
      auto sub_json = json_object({{"serial", json_integer(sub->getSerial())},
                                   {"info", w_string_to_json(sub->getInfo())}});
      subscribers_arr.emplace_back(sub_json);
    } else {
      // This is a subscriber that is now dead. It will be cleaned up the next
      // time enqueue is called.
    }
  }

  ret.set("subscribers", std::move(subscribers));

  auto items = json_array();
  auto& items_arr = items.array();

  for (auto& item : rlock->items) {
    auto item_json = json_object(
        {{"serial", json_integer(item->serial)}, {"payload", item->payload}});
    items_arr.emplace_back(item_json);
  }

  ret.set("items", std::move(items));

  return ret;
}
Example #17
0
int start_mongoose(int ether)
{
	struct mg_context* ctx;

	// Initialize random number generator. It will be used later on for
	// the session identifier creation.
	srand((unsigned)time(0));

	// Setup and start Mongoose
	const char* options[] =
	{
		"document_root", ODI_HOME,
		"listening_ports", WEB_SERVER_PORT,
		//"access_log_file", "/odi/log/mongoose_access",
		"error_log_file", "/odi/log/mongoose_error",
		"enable_directory_listing", "no",
		"ssl_certificate", SSL_KEY_FILE,
		"request_timeout_ms", REQUESTED_TIME_OUT,
		NULL
	};

	if ((ctx = mg_start(options, event_handler, NULL)) == NULL)
	{
		logger_error("%s\n", "Cannot start REMOTEM, fatal exit");
		exit(EXIT_FAILURE);
	}
	logger_remotem("Web server root directory is %s, started on ports %s",
		mg_get_option(ctx, "document_root"), mg_get_option(ctx, "listening_ports"));

	strcpy(downloading_status, "Idle");
	get_config_info();
	if (ether) configure_network();
	DVR_ID = getSerial();

	return EXIT_SUCCESS;
}
Example #18
0
void loop()                     // run over and over again
{
  getSerial();
}
bool CDVAPController::open()
{
	bool res = m_serial.open();
	if (!res)
		return false;

	res = getName();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = getFirmware();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = getSerial();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = setModulation();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = setMode();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = setSquelch();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = setPower();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = setFrequency();
	if (!res) {
		m_serial.close();
		return false;
	}

	res = start();
	if (!res) {
		m_serial.close();
		return false;
	}

	Create();
	SetPriority(100U);
	Run();

	return true;
}
Example #20
0
int main()
{
	getSerial(getI2CPath());
	return 0;
}
Example #21
0
	airspyHandler::airspyHandler (QSettings *s, bool full, bool *success) {
int	result, i;
QString	h;
int	k;
int	distance	= 10000000;
uint32_t myBuffer [20];
uint32_t samplerate_count;

	this	-> airspySettings	= s;
	*success		= false;

	this	-> myFrame		= new QFrame (NULL);
	setupUi (this -> myFrame);
	this	-> myFrame	-> show ();

	inputRate	= 2500000;

	airspySettings	-> beginGroup ("airspyHandler");
	int16_t temp 		= airspySettings -> value ("linearity", 10).
	                                                          toInt ();
	linearitySlider		-> setValue (temp);
	linearityDisplay	-> display  (temp);
	temp			= airspySettings -> value ("sensitivity", 10).
	                                                          toInt ();
	sensitivitySlider	-> setValue (temp);
	sensitivityDisplay	-> display (temp);
	vgaGain			= airspySettings -> value ("vga", 5).toInt ();
	vgaSlider		-> setValue (vgaGain);
	vgaDisplay		-> display (vgaGain);
	mixerGain		= airspySettings -> value ("mixer", 10). toInt ();
	mixerSlider		-> setValue (mixerGain);
	mixerDisplay		-> display (mixerGain);
	mixer_agc		= false;
	lnaGain			= airspySettings -> value ("lna", 5). toInt ();
	lnaSlider		-> setValue (lnaGain);
	lnaDisplay		-> display  (lnaGain);
	mixer_agc		= false;
	lna_agc			= false;
	rf_bias			= false;
	airspySettings		-> endGroup ();
//
	device			= 0;
	serialNumber		= 0;
	theBuffer		= NULL;
#ifdef	__MINGW32__
	const char *libraryString = "airspy.dll";
	Handle		= LoadLibrary ((wchar_t *)L"airspy.dll");
#else
	const char *libraryString = "libairspy.so";
	Handle		= dlopen ("libusb-1.0.so", RTLD_NOW | RTLD_GLOBAL);
	if (Handle == NULL) {
	   fprintf (stderr, "libusb cannot be loaded\n");
	   goto err;
	}
	   
	Handle		= dlopen ("libairspy.so", RTLD_LAZY);
#endif

	if (Handle == NULL) {
	   fprintf (stderr, "failed to open %s\n", libraryString);
#ifndef	__MINGW32__
	   fprintf (stderr, "Error = %s\n", dlerror ());
#endif
	   goto err;
	}
	libraryLoaded	= true;

	if (!load_airspyFunctions ()) {
	   fprintf (stderr, "problem in loading functions\n");
	   return;
	}
//
	strcpy (serial,"");
	result = this -> my_airspy_init ();
	if (result != AIRSPY_SUCCESS) {
	   printf("my_airspy_init () failed: %s (%d)\n",
	             my_airspy_error_name((airspy_error)result), result);
        return;
	}

	result = my_airspy_open (&device);
	if (result != AIRSPY_SUCCESS) {
	   printf ("my_airpsy_open () failed: %s (%d)\n",
	             my_airspy_error_name ((airspy_error)result), result);
	   return;
	}
//
//	extract the rates

	(void) my_airspy_get_samplerates (device, &samplerate_count, 0);
        fprintf (stderr, "%d samplerates are supported\n", samplerate_count);
        my_airspy_get_samplerates (device, myBuffer, samplerate_count);

        inputRate    = 0;
        for (i = 0; i < samplerate_count; i ++) {
           fprintf (stderr, "%d \n", myBuffer [i]);
           if (abs (myBuffer [i] - 2000000) < distance) {
              distance  = abs (myBuffer [i] - 2000000);
              inputRate = myBuffer [i];
           }
        }

	theBuffer		= new RingBuffer<DSPCOMPLEX> (256 *1024);
	connect (linearitySlider, SIGNAL (valueChanged (int)),
	         this, SLOT (set_linearity (int)));
	connect (sensitivitySlider, SIGNAL (valueChanged (int)),
	         this, SLOT (set_sensitivity (int)));
	connect (lnaSlider, SIGNAL (valueChanged (int)),
                 this, SLOT (set_lna_gain (int)));
        connect (vgaSlider, SIGNAL (valueChanged (int)),
                 this, SLOT (set_vga_gain (int)));
        connect (mixerSlider, SIGNAL (valueChanged (int)),
                 this, SLOT (set_mixer_gain (int)));

	connect (lnaButton, SIGNAL (clicked (void)),
	         this, SLOT (set_lna_agc (void)));
	connect (mixerButton, SIGNAL (clicked (void)),
	         this, SLOT (set_mixer_agc (void)));
	connect (biasButton, SIGNAL (clicked (void)),
	         this, SLOT (set_rf_bias (void)));
	connect (tabWidget, SIGNAL (currentChanged (int)),
                 this, SLOT (show_tab (int)));

	displaySerial	-> setText (getSerial ());
	show_tab (0);
	running		= false;
	*success	= true;
	return;
err:
#ifdef __MINGW32__
	FreeLibrary (Handle);
#else
	if (Handle != NULL)
	   dlclose (Handle);
#endif
	Handle		= NULL;
	libraryLoaded	= false;
	*success	= false;
	return;
}
Example #22
0
/*!
\author Luxor
*/
void cChar::walk()
{
	pChar pc_att = cSerializable::findCharBySerial( attackerserial );
	if ( !pc_att )
		pc_att = cSerializable::findCharBySerial( targserial );
	if ( !pc_att )
		war = 0;

	if ( war && npcWander != cNPC::WANDER_FLEE && ( pc_att->IsOnline() || pc_att->npc ) ) { //We are following a combat target
                follow( pc_att );
                return;
        }

	switch( npcWander )
	{
		case cNPC::WANDER_NOMOVE: //No movement
			break;
		case cNPC::WANDER_FOLLOW: //Follow the follow target
		{
			pChar pc = cSerializable::findCharBySerial( ftargserial );
			if ( !pc )
				break;
			if ( pc->isDead() )
				break;
			if ( pc->questDestRegion == region )
				((pNPC)this)->clearedEscordQuest( (pPC) pc );
			follow( pc );
		}
			break;
		case cNPC::WANDER_FREELY_CIRCLE: // Wander freely, in a defined circle
			npcwalk( this, (chance( 20 ) ? rand()%8 : dir), 2 );
			break;
		case cNPC::WANDER_FREELY_BOX: // Wander freely, within a defined box
			npcwalk( this, (chance( 20 ) ? rand()%8 : dir), 1 );
			break;
		case cNPC::WANDER_FREELY: // Wander freely, avoiding obstacles
			npcwalk( this, (chance( 20 ) ? rand()%8 : dir), 0 );
			break;
		case cNPC::WANDER_FLEE: //FLEE!!!!!!
		{
			pChar target = cSerializable::findCharBySerial( targserial );
			if ( target ) {
				if ( distFrom( target ) < VISRANGE )
					getDirFromXY( target->getBody()->getPosition() );
				npcwalk( this, npcSelectDir( this, getDirFromXY(target->getBody()->getPosition()) +4 ), 0);
			}
		}
			break;
		case cNPC::WANDER_AMX: // Sparhawk: script controlled movement
		{
			uint32_t l = dir;

			pFunctionHandle evt = getEvent(cChar::evtChrOnWalk);
			if( evt ) {
				cVariantVector params = cVariantVector(3);
				params[0] = pc->getSerial(); params[1] = dir; params[2] = dir;
				evt->setParams(params);
				evt->execute();
				if( evt->isBypassed() )
					return;
			}

			int k = dir;
			dir = l;
			l = npcmovetime;
			npcwalk( this, k, 0);
			if ( l != npcmovetime ) // it's been changed through small
				return;
		}
			break;
		default:
			LogError("Unknown npcwander [serial %u]\n", getSerial());
			break;
	}
	setNpcMoveTime();
}
Example #23
0
/**
  * Post constructor initialisation method.
  *
  * This call will initialised the scheduler, memory allocator and Bluetooth stack.
  *
  * This is required as the Bluetooth stack can't be brought up in a
  * static context i.e. in a constructor.
  *
  * @code
  * uBit.init();
  * @endcode
  *
  * @note This method must be called before user code utilises any functionality
  *       contained by uBit.
  */
void MicroBit::init()
{
    if (status & MICROBIT_INITIALIZED)
        return;

#if CONFIG_ENABLED(MICROBIT_HEAP_ALLOCATOR)
    // Bring up a nested heap allocator.
    microbit_create_nested_heap(MICROBIT_NESTED_HEAP_SIZE);
#endif

    // Bring up fiber scheduler.
    scheduler_init(messageBus);

    // Seed our random number generator
    seedRandom();

    // Create an event handler to trap any handlers being created for I2C services.
    // We do this to enable initialisation of those services only when they're used,
    // which saves processor time, memeory and battery life.
    messageBus.listen(MICROBIT_ID_MESSAGE_BUS_LISTENER, MICROBIT_EVT_ANY, this, &MicroBit::onListenerRegisteredEvent);

    status |= MICROBIT_INITIALIZED;

#if CONFIG_ENABLED(MICROBIT_BLE_PAIRING_MODE)
    // Test if we need to enter BLE pairing mode...
    int i=0;
    sleep(100);
    while (buttonA.isPressed() && buttonB.isPressed() && i<10)
    {
        sleep(100);
        i++;

        if (i == 10)
        {
#if CONFIG_ENABLED(MICROBIT_HEAP_ALLOCATOR) && CONFIG_ENABLED(MICROBIT_HEAP_REUSE_SD)
            microbit_create_heap(MICROBIT_SD_GATT_TABLE_START + MICROBIT_SD_GATT_TABLE_SIZE, MICROBIT_SD_LIMIT);
#endif
            // Start the BLE stack, if it isn't already running.
            if (!ble)
            {
                bleManager.init(getName(), getSerial(), messageBus, true);
                ble = bleManager.ble;
            }

            // Enter pairing mode, using the LED matrix for any necessary pairing operations
            bleManager.pairingMode(display, buttonA);
        }
    }
#endif

    // Attempt to bring up a second heap region, using unused memory normally reserved for Soft Device.
#if CONFIG_ENABLED(MICROBIT_HEAP_ALLOCATOR) && CONFIG_ENABLED(MICROBIT_HEAP_REUSE_SD)
#if CONFIG_ENABLED(MICROBIT_BLE_ENABLED)
    microbit_create_heap(MICROBIT_SD_GATT_TABLE_START + MICROBIT_SD_GATT_TABLE_SIZE, MICROBIT_SD_LIMIT);
#else
    microbit_create_heap(MICROBIT_SRAM_BASE, MICROBIT_SD_LIMIT);
#endif
#endif

#if CONFIG_ENABLED(MICROBIT_BLE_ENABLED)
    // Start the BLE stack, if it isn't already running.
    if (!ble)
    {
        bleManager.init(getName(), getSerial(), messageBus, false);
        ble = bleManager.ble;
    }
#endif
}