hi NORDIC,
is it possible to store float array in fds. i am able to store intrger values but unable to store float values. i am using example in this link :- github.com/.../nRF52-fds-example
i am writing float m_deadbeef[20][3]; //////(LIKE this i need to store 5 arrays and i should retrieve it back) in to flash.
i dont know it is writing or not but writing is successful.
but while reading back the data i am getting empty spaces.
here is how i am reading back data from FDS
float *data;
uint32_t err_code;
NRF_LOG_PRINTF("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_PRINTF("Found Record ID = %d\r\n",record_desc.record_id);
NRF_LOG_PRINTF("Data = ");
data = (float *) flash_record.p_data;
-------------------------------------
for (uint8_t i=0;i<flash_record.p_header->tl.length_words;i++)
{
NRF_LOG_PRINTF("%f ",data[i]);
}
NRF_LOG_PRINTF("\r\n");
i am getting emty data. please help me how to store float array in FDS.
> [EDIT]:
here is my write function...
static ret_code_t fds_test_write()
{
#define FILE_ID 0x1111
#define REC_KEY 0x2223
fds_record_t record;
fds_record_desc_t record_desc;
fds_record_chunk_t record_chunk;
// Set up data.
record_chunk.p_data = m_deadbeef;
record_chunk.length_words = sizeof(m_deadbeef)/sizeof(m_deadbeef[0][0]);
// Set up record.
record.file_id = FILE_ID;
record.key = REC_KEY;
record.data.p_chunks = &record_chunk;
record.data.num_chunks = 1;
ret_code_t ret = fds_record_write(&record_desc, &record);
if (ret != FDS_SUCCESS)
{
return ret;
}
NRF_LOG_PRINTF("Writing Record ID = %d \r\n",record_desc.record_id);
return NRF_SUCCESS;
}