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

FDS example code for SDK 14.2

hello everbody~ I have a problem with the FDS example code.My sample code is SDK version 11.But I now use the SDK14.2 version and nrf 52832 MCU.

The SDK 11 detailed example code is...:

static ret_code_t fds_read(void)
{
		#define FILE_ID     0x1111
		#define REC_KEY     0x2222
		fds_flash_record_t  flash_record;
		fds_record_desc_t   record_desc;
		fds_find_token_t    ftok ;//Important, make sure you zero init the ftok token
	  
        /* It is required to zero the token before first use. */
        memset(&ftok, 0x00, sizeof(fds_find_token_t));
	
		uint32_t *idata;
		uint32_t err_code;
		
		NRF_LOG_INFO("Start searching... \r\n");
		// Loop until all records with the given key and file ID have been found.
		while (fds_record_find(FILE_ID, REC_KEY, &record_desc, &ftok) == FDS_SUCCESS)
		{
				err_code = fds_record_open(&record_desc, &flash_record);
				if ( err_code != FDS_SUCCESS)
				{
					return err_code;		
				}
				
				NRF_LOG_INFO("Found Record ID = %d\r\n",record_desc.record_id);
				NRF_LOG_INFO("Data = ");
				idata = (uint32_t *) flash_record.p_data;

				for (uint8_t i=0;i<flash_record.p_header->t1.length_words;i++)
				{
					NRF_LOG_INFO("0x%8x ",idata[i]);
				}

				NRF_LOG_INFO("\r\n");
				// Access the record through the flash_record structure.
				// Close the record when done.
				err_code = fds_record_close(&record_desc);
				if (err_code != FDS_SUCCESS)
				{
					return err_code;	
				}
		}
		return NRF_SUCCESS;
		
}

And now I have a question : I have error #136: struct "" has no field "t1" for (uint8_t i=0;i<flash_record.p_header->t1.length_words;i++)

Because t1.length_words is SDK 11 version , how to I change write in the SDK14.2 version ?

Related