0

FDS example code for SDK 14.2

Syuan gravatar image

asked 2017-12-07 02:46:59 +0100

Petter gravatar image

updated 2017-12-07 07:53:49 +0100

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 "<unnamed>" 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 ?

edit retag flag offensive close delete report spam

1 answer

Sort by ยป oldest newest most voted
0
emdi gravatar image

answered 2017-12-07 09:58:22 +0100

Hi, try changing it from:

flash_record.p_header->t1.length_words

to

flash_record.p_header->length_words

Regards, emdi

edit flag offensive delete publish link more

Comments

thanks emdi~~

Syuan ( 2017-12-08 07:22:03 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower

Stats

Asked: 2017-12-07 02:46:59 +0100

Seen: 67 times

Last updated: des. 08