• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pstorage_init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pstorage_init函数的典型用法代码示例。如果您正苦于以下问题:C++ pstorage_init函数的具体用法?C++ pstorage_init怎么用?C++ pstorage_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pstorage_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ladybug_flash_init

/**
 * \callgraph
 *\brief 	Initialize the blocks of flash memory used for reading/writing.
 *\details	Uses Nordic's pstorage software abstraction/API to cleanly access flash when the SoftDevice (for BLE)
 *		is also running.
 */
void ladybug_flash_init() {
  SEGGER_RTT_WriteString(0,"==> IN ladybug_flash_init\n");
  pstorage_module_param_t pstorage_param;   //Used when registering with pstorage
  pstorage_handle_t	  handle;	    //used to access the chunk-o-flash requested when registering
  //First thing is to initialize pstorage
  uint32_t err_code = pstorage_init();
  //if initialization was not successful, the error routine will be called and the code won't proceed.
  APP_ERROR_CHECK(err_code);
  //Next is to register amount of flash needed.  The smallest amount that can be requested is 16 bytes.  I'm requesting
  //32 bytes because this is the number of bytes needed for plant_info. Two blocks are used...one for plant info and one for hydro values.  I must make a
  //block request for the larger amount of bytes
  pstorage_param.block_size = BLOCK_SIZE;
  //request three blocks - one will be for pH, one for plant_info, and one for device name
  pstorage_param.block_count = 3;
  //assign a callback so know when a command has finished.
  pstorage_param.cb = ladybug_flash_handler;
  err_code = pstorage_register(&pstorage_param, &handle);
  APP_ERROR_CHECK(err_code);
  //Then get the handles to the blocks of flash
  pstorage_block_identifier_get(&handle, 0, &m_block_calibration_store_handle);
  pstorage_block_identifier_get(&handle,1,&m_block_plantInfo_store_handle);
  pstorage_block_identifier_get(&handle,2,&m_block_device_name_store_handle);
  // Create the timer.  This will be called before a Flash activity is requested to avoid forever hanging.
  create_timer();

}
开发者ID:BitKnitting,项目名称:LadybugLiteBlue_Firmware,代码行数:32,代码来源:Ladybug_Flash.c


示例2: SimpleQueue

Storage::Storage()
{
	u32 err;

	//Register with Terminal
	Terminal::AddTerminalCommandListener(this);

	//Initialize queue for queueing store and load tasks
	taskQueue = new SimpleQueue(taskBuffer, TASK_BUFFER_LENGTH);

	//Initialize pstorage library
	pstorage_module_param_t param;
	u8 num_blocks = STORAGE_BLOCK_NUMBER;

	bufferedOperationInProgress = false;

	param.block_size  = STORAGE_BLOCK_SIZE; //Multiple of 4 and divisor of page size (pagesize is usually 1024) in case total size is bigger than page size
	param.block_count = num_blocks;
	param.cb          = PstorageEventHandler;

	err = pstorage_init();
	APP_ERROR_CHECK(err);

	//Register a number of blocks
	if (pstorage_register(&param, &handle) != NRF_SUCCESS){
		logt("STORAGE", "Could not register storage");
	}
	for (u32 i = 0; i < num_blocks; ++i){
		pstorage_block_identifier_get(&handle, i, &block_handles[i]);
	}
}
开发者ID:Informatic,项目名称:fruitymesh,代码行数:31,代码来源:Storage.cpp


示例3: device_manager_init

/**@brief Function for the Device Manager initialization.
 */
static void device_manager_init(void)
{
    uint32_t                err_code;
    dm_init_param_t         init_data;
    dm_application_param_t  register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    // Clear all bonded centrals if the "delete all bonds" button is pushed.
    err_code = bsp_button_is_pressed(BOND_DELETE_ALL_WAKEUP_BUTTON_ID,&(init_data.clear_persistent_data));
    APP_ERROR_CHECK(err_code);
	
    err_code = dm_init(&init_data);
    APP_ERROR_CHECK(err_code);
    
    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

    register_param.sec_param.timeout      = SEC_PARAM_TIMEOUT;
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:34,代码来源:main.c


示例4: bootloader_dfu_start

uint32_t bootloader_dfu_start(void)
{
    uint32_t                err_code = NRF_SUCCESS;
    pstorage_module_param_t storage_params;

    storage_params.cb          = pstorage_callback_handler;
    storage_params.block_size  = sizeof(bootloader_settings_t);
    storage_params.block_count = 1;
    
    err_code = pstorage_init();
    if (err_code != NRF_SUCCESS)    
    {
        return err_code;
    }

    err_code = pstorage_register(&storage_params, &m_bootsettings_handle);
    if (err_code != NRF_SUCCESS)    
    {
        return err_code;
    }

    // Clear swap if banked update is used.    
    err_code = dfu_init(); 
    if (err_code != NRF_SUCCESS)    
    {
        return err_code;
    }
		  
    err_code = dfu_transport_update_start();

    wait_for_events();
    
    return err_code;
}
开发者ID:NordicSemiconductor,项目名称:nrf51-dfu-bootloader-for-gcc-compiler,代码行数:34,代码来源:bootloader.c


示例5: device_manager_init

/**@brief Function for the Device Manager initialization.
 */
static void device_manager_init(void)
{
    uint32_t                err_code;
    dm_init_param_t         init_data;
    dm_application_param_t  register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    // Clear all bonded centrals if the Bonds Delete button is pushed.
    init_data.clear_persistent_data = true;//(nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_ID) == 0);

    err_code = dm_init(&init_data);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

    //register_param.sec_param.timeout      = SEC_PARAM_TIMEOUT;
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_NONE;

    err_code = dm_register(&g_AppHandle, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:33,代码来源:LMXDisplayBleMain.c


示例6: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    APP_ERROR_CHECK(err_code);
    
    app_bond_init(&m_app_bond_table);
    
    for(uint8_t i = 0; i < DEVICE_MANAGER_MAX_BONDS; i++)
    {
        APP_LOG("[APP][ID: %d], Application context : %08X\r\n",m_app_bond_table.device_id[i],(unsigned int) m_app_bond_table.app_bond_cnt[i]);
    }
}
开发者ID:hshd123,项目名称:nRF51-ble-peripheral-bond-handling,代码行数:39,代码来源:main.c


示例7: loadURIBeaconConfigParams

/* Platform-specific implementation for persistence on the nRF5x. Based on the
 * pstorage module provided by the Nordic SDK. */
bool loadURIBeaconConfigParams(EddystoneService::EddystoneParams_t *paramsP)
{
    static bool pstorageInitied = false;
    if (!pstorageInitied) {
        pstorage_init();

        static pstorage_module_param_t pstorageParams = {
            .cb          = pstorageNotificationCallback,
            .block_size  = sizeof(PersistentParams_t),
            .block_count = 1
        };
        pstorage_register(&pstorageParams, &pstorageHandle);
        pstorageInitied = true;
    }

    PersistentParams_t persistentParams;
    if ((pstorage_load(reinterpret_cast<uint8_t *>(&persistentParams), &pstorageHandle, sizeof(PersistentParams_t), 0) != NRF_SUCCESS) ||
        (persistentParams.persistenceSignature != PersistentParams_t::MAGIC)) {
        // On failure zero out and let the service reset to defaults
        memset(paramsP, 0, sizeof(EddystoneService::EddystoneParams_t));
        return false;
    }

    memcpy(paramsP, &persistentParams.params, sizeof(EddystoneService::EddystoneParams_t));
    persistenceSignature = persistentParams.persistenceSignature;
    return true;
}
开发者ID:rgrover,项目名称:ble-examples,代码行数:29,代码来源:nrfConfigParamsPersistence.cpp


示例8: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof (ble_gap_sec_params_t));

    // Event handler to be registered with the module.
    register_param.evt_handler            = device_manager_event_handler;

    // Service or protocol context for device manager to load, store and apply on behalf of application.
    // Here set to client as application is a GATT client.
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_CLI_ID;

    // Secuirty parameters to be used for security procedures.
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.sec_param.kdist_periph.enc = 1;
    register_param.sec_param.kdist_periph.id  = 1;

    err_code = dm_register(&m_dm_app_id, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:39,代码来源:main.c


示例9: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
    
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:RobinLin,项目名称:Espruino,代码行数:32,代码来源:main.c


示例10: _StorageOpen

H_U32 _StorageOpen(void)
{
	H_U32 err_code; 
	// Initialize persistent storage module. 
	err_code = pstorage_init(); 
	APP_ERROR_CHECK(err_code);
	return err_code;
}
开发者ID:aleyds,项目名称:nrf51822Touch,代码行数:8,代码来源:wy_storage.c


示例11: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize
    app_trace_init();
    leds_init();

#ifdef COMMISSIONING_ENABLED
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);
#endif // COMMISSIONING_ENABLED

    timers_init();
    buttons_init();

    static ipv6_medium_init_params_t ipv6_medium_init_params;
    memset(&ipv6_medium_init_params, 0x00, sizeof(ipv6_medium_init_params));
    ipv6_medium_init_params.ipv6_medium_evt_handler    = on_ipv6_medium_evt;
    ipv6_medium_init_params.ipv6_medium_error_handler  = on_ipv6_medium_error;
    ipv6_medium_init_params.use_scheduler              = false;
#ifdef COMMISSIONING_ENABLED
    ipv6_medium_init_params.commissioning_id_mode_cb   = commissioning_id_mode_cb;
    ipv6_medium_init_params.commissioning_power_off_cb = commissioning_power_off_cb;
#endif // COMMISSIONING_ENABLED

    err_code = ipv6_medium_init(&ipv6_medium_init_params, \
                                IPV6_MEDIUM_ID_BLE,       \
                                &m_ipv6_medium);
    APP_ERROR_CHECK(err_code);

    eui48_t ipv6_medium_eui48;
    err_code = ipv6_medium_eui48_get(m_ipv6_medium.ipv6_medium_instance_id, \
                                     &ipv6_medium_eui48);

    ipv6_medium_eui48.identifier[EUI_48_SIZE - 1] = 0x00;

    err_code = ipv6_medium_eui48_set(m_ipv6_medium.ipv6_medium_instance_id, \
                                     &ipv6_medium_eui48);
    APP_ERROR_CHECK(err_code);

    ip_stack_init();
    ip_stack_timer_init();
    dns_client_init();

    APPL_LOG("\r\n");
    APPL_LOG("[APPL]: Init complete.\r\n");

    // Start execution
    connectable_mode_enter();

    // Enter main loop
    for (;;)
    {
        power_manage();
    }
}
开发者ID:sische,项目名称:MasterThesis,代码行数:58,代码来源:main.c


示例12: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    //Initialize.
    app_trace_init();
    leds_init();
    timers_init();
    iot_timer_init();

#ifdef COMMISSIONING_ENABLED
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    buttons_init();
#endif // COMMISSIONING_ENABLED

    static ipv6_medium_init_params_t ipv6_medium_init_params;
    memset(&ipv6_medium_init_params, 0x00, sizeof(ipv6_medium_init_params));
    ipv6_medium_init_params.ipv6_medium_evt_handler    = on_ipv6_medium_evt;
    ipv6_medium_init_params.ipv6_medium_error_handler  = on_ipv6_medium_error;
    ipv6_medium_init_params.use_scheduler              = false;
#ifdef COMMISSIONING_ENABLED
    ipv6_medium_init_params.commissioning_id_mode_cb   = commissioning_id_mode_cb;
    ipv6_medium_init_params.commissioning_power_off_cb = commissioning_power_off_cb;
#endif // COMMISSIONING_ENABLED

    err_code = ipv6_medium_init(&ipv6_medium_init_params, \
                                IPV6_MEDIUM_ID_BLE,       \
                                &m_ipv6_medium);
    APP_ERROR_CHECK(err_code);

    eui48_t ipv6_medium_eui48;
    err_code = ipv6_medium_eui48_get(m_ipv6_medium.ipv6_medium_instance_id, \
                                     &ipv6_medium_eui48);

    ipv6_medium_eui48.identifier[EUI_48_SIZE - 1] = 0x00;

    err_code = ipv6_medium_eui48_set(m_ipv6_medium.ipv6_medium_instance_id, \
                                     &ipv6_medium_eui48);
    APP_ERROR_CHECK(err_code);

    ip_stack_init();
    udp_port_setup();

    //Start execution.
    connectable_mode_enter();

    //Enter main loop.
    for (;;)
    {
        //Sleep waiting for an application event.
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:sische,项目名称:MasterThesis,代码行数:59,代码来源:main.c


示例13: device_manager_init

/**@brief Function for initializing the Device Manager.
 *
 * @details Device manager is initialized here.
 */
static void device_manager_init(void)
{
    dm_init_param_t init_param;
    uint32_t        err_code;

    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:BudzonMichal,项目名称:Wireless-sensor-network-Nordic-NRF51,代码行数:15,代码来源:main.c


示例14: bootloader_init

uint32_t bootloader_init(void)
{
    uint32_t                err_code;
    pstorage_module_param_t storage_params = {.cb = pstorage_callback_handler};

    err_code = pstorage_init();
    VERIFY_SUCCESS(err_code);

    m_bootsettings_handle.block_id = BOOTLOADER_SETTINGS_ADDRESS;
    err_code = pstorage_register(&storage_params, &m_bootsettings_handle);

    return err_code;
}
开发者ID:8bitgeek,项目名称:Espruino,代码行数:13,代码来源:bootloader.c


示例15: device_manager_init

/**@brief Function for the Device Manager initialization.
 *
 * @param[in] erase_bonds  Indicates whether bonding information should be cleared from
 *                         persistent storage during initialization of the Device Manager.
 */
static void device_manager_init(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t  register_param;
    
    // Initialize persistent storage module.
    err_code = pstorage_init();
    if (err_code == NRF_SUCCESS)
			debug_printf("Persistent storage module is ready!\r\n");
		else
		{
			debug_printf("Ooops.. Something went wrong with initialising the PS module..\r\n");
			APP_ERROR_CHECK(err_code);
		}
    
		err_code = dm_init(&init_param);
    if (err_code == NRF_SUCCESS)
			debug_printf("DM initialised!\r\n");
		else
		{
			debug_printf("Ooops.. Something went wrong with initialising the DM..\r\n");
			APP_ERROR_CHECK(err_code);
		}
    
		memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
    
    register_param.sec_param.bond         = SEC_PARAM_BOND;
    register_param.sec_param.mitm         = SEC_PARAM_MITM;
    register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    register_param.sec_param.oob          = SEC_PARAM_OOB;
    register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    register_param.evt_handler            = device_manager_evt_handler;
    register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

    err_code = dm_register(&m_app_handle, &register_param);
    if (err_code == NRF_SUCCESS)
			debug_printf("Registered parameters for DM!\r\n");
		else
		{
			debug_printf("Ooops.. Something went wrong with registering the parameters for the DM..\r\n");
			APP_ERROR_CHECK(err_code);
		}
}
开发者ID:stelios26,项目名称:Aphrodite,代码行数:50,代码来源:main.c


示例16: device_manager_init

/**@brief Function for initializing the Device Manager.
 *
 * @details Device manager is initialized here.
 */
static void device_manager_init(void)
{
    dm_application_param_t param;
    dm_init_param_t        init_param;

    uint32_t err_code;

    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);

	  init_param.clear_persistent_data = false;

#ifdef BOND_DELETE_ALL_BUTTON_PIN
    // Clear all bonded devices if user requests to.
    init_param.clear_persistent_data =
        ((nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_PIN) == 0)? true: false);
#endif
	
    err_code = dm_init(&init_param);
    APP_ERROR_CHECK(err_code);

    memset(&param.sec_param, 0, sizeof (ble_gap_sec_params_t));

    // Event handler to be registered with the module.
    param.evt_handler            = device_manager_event_handler;

    // Service or protocol context for device manager to load, store and apply on behalf of application.
    // Here set to client as application is a GATT client.
    param.service_type           = DM_PROTOCOL_CNTXT_GATT_CLI_ID;

    // Secuirty parameters to be used for security procedures.
    param.sec_param.bond         = SEC_PARAM_BOND;
    param.sec_param.mitm         = SEC_PARAM_MITM;
    param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
    param.sec_param.oob          = SEC_PARAM_OOB;
    param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
    param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
    param.sec_param.kdist_periph.enc = 1;
    param.sec_param.kdist_periph.id  = 1;

    err_code = dm_register(&m_dm_app_id,&param);
    APP_ERROR_CHECK(err_code);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:47,代码来源:main.c


示例17: bootloader_init

uint32_t bootloader_init(void)
{
    uint32_t err_code;
    pstorage_module_param_t storage_params;

    storage_params.cb          = pstorage_callback_handler;
    storage_params.block_size  = BOOTLOADER_SETTINGS_FLASH_BLOCK_SIZE;
    storage_params.block_count = BOOTLOADER_SETTINGS_FLASH_BLOCK_COUNT;

    err_code = pstorage_init();
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

    err_code = pstorage_register(&storage_params, &m_bootsettings_handle);

    m_delay_applied = false;
    return err_code;
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:20,代码来源:bootloader.c


示例18: pstorage_driver_init

bool pstorage_driver_init() 
{ 
    if (pstorage_init() != NRF_SUCCESS) 
    {
        return false;
    }
    
		// Configure pstorage driver.
    if(!pstorage_driver_cfg(0x20)) 
    {
        return false;
    }
    
    // Read SensorID from p_storage
    if(!init_global((uint8_t*)&sensor_bridge.sensorID, (uint8_t*)&DEFAULT_SENSOR_ID, sizeof(sensor_bridge.sensorID))) 
    {
        return false;
    }
    // Read SensorBeaconFrequency from p_storage
    if(!init_global((uint8_t*)&sensor_bridge.beaconFrequency, (uint8_t*)&DEFAULT_SENSOR_BEACON_FREQUENCY, sizeof(sensor_bridge.beaconFrequency))) 
    {
        return false;
    }
    // Read Config from p_storage
    if(!init_global((uint8_t*)&sensor_bridge.config, (uint8_t*)&DEFAULT_SENSOR_CONFIG, sizeof(sensor_bridge.config))) 
    {
        return false;
    }
    // Read Passkey from p_storage
    if(!init_global((uint8_t*)sensor_bridge.passkey, (uint8_t*)DEFAULT_SENSOR_PASSKEY, sizeof(sensor_bridge.passkey))) 
    {
        return false;
    }
    // Read mitm_req_flag from p_storage
    if(!init_global((uint8_t*)&sensor_bridge.mitm_req_flag, (uint8_t*)&DEFAULT_MITM_REQ_FLAG, sizeof(sensor_bridge.mitm_req_flag))) 
    {
        return false;
    }
    
    return true;
}
开发者ID:relayr,项目名称:WunderBar-firmware-release,代码行数:41,代码来源:main.c


示例19: bond_manager_init

 */
static void bond_manager_init(void)
{
    uint32_t            err_code;
    ble_bondmngr_init_t bond_init_data;
    bool                bonds_delete;

    // Initialize persistent storage module.
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);
    
    // Clear all bonded centrals if the Bonds Delete button is pushed
    bonds_delete = (nrf_gpio_pin_read(BONDMNGR_DELETE_BUTTON_PIN_NO) == 0);

    // Initialize the Bond Manager
    bond_init_data.evt_handler             = NULL;
    bond_init_data.error_handler           = bond_manager_error_handler;
    bond_init_data.bonds_delete            = bonds_delete;

    err_code = ble_bondmngr_init(&bond_init_data);
    APP_ERROR_CHECK(err_code);
开发者ID:Aidan-zhang,项目名称:nRF51SDK,代码行数:21,代码来源:main.c


示例20: bond_manager_init

/**@brief Function for initializing the Bond Manager.
 */
static void bond_manager_init(void)
{
    uint32_t            err_code;
    ble_bondmngr_init_t bond_init_data;
    bool                bonds_delete;

    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);
    
    // Clear all bonded masters if the Bonds Delete button is pushed.
    err_code = app_button_is_pushed(BONDMNGR_DELETE_BUTTON_PIN_NO, &bonds_delete);
    APP_ERROR_CHECK(err_code);

    // Initialize the Bond Manager.
    bond_init_data.evt_handler             = on_bond_mgmr_evt;
    bond_init_data.error_handler           = bond_manager_error_handler;
    bond_init_data.bonds_delete            = bonds_delete;
    
    err_code = ble_bondmngr_init(&bond_init_data);
    APP_ERROR_CHECK(err_code);
}
开发者ID:adan613,项目名称:OpenCloudEnvMonitor,代码行数:23,代码来源:main.c



注:本文中的pstorage_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pstrcat函数代码示例发布时间:2022-05-30
下一篇:
C++ pstdout_fprintf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap