This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pstorage example/issues

Does sample code exist for the pstorage module?

I am calling this code right before advertising_start() in the heart rate monitor application for the newest SDK. It doesn't seem to return from this function (from what I believe stem's from pstorage_clear(...)).

Can you spot any mistakes?

    static pstorage_handle_t       blockHandle;

void initFlash(void)
{
    

	uint32_t errCode;
    pstorage_handle_t       flashHandle;
    pstorage_module_param_t flashParam;

    

    errCode = pstorage_init();  //init the flash module API
    APP_ERROR_CHECK(errCode);



    flashParam.block_size  = PSTORAGE_MAX_BLOCK_SIZE;//sizeof(testresultstruct); //make a block the size of a test structure
    flashParam.block_count = 1;//MAX_NUMBER_OF_RESULTS; //give enough blocks to store 
    flashParam.cb          = flashCallBack;
        
    errCode = pstorage_register(&flashParam, &flashHandle);
    APP_ERROR_CHECK(errCode);



    errCode = pstorage_block_identifier_get( &flashHandle, 0, &blockHandle);
    APP_ERROR_CHECK(errCode);




    errCode = pstorage_clear(&flashHandle, NULL);
    APP_ERROR_CHECK(errCode);

}
Related