I am using the code below to save data from an ADC into a circular buffer.
static uint8_t data[2];
uint32_t data_len = sizeof(data);
uint32_t return_val;
data[0] = (uint8_t)(adc_value >> 8);
data[1] = (uint8_t)(adc_value);
data_len = sizeof(data);
return_val = app_fifo_write(&my_fifo, (uint8_t *)&data, &data_len);
I then want to save that buffer for retrieval later so I do:
record.file_id = FILE_ID;
record.key = RECORD_KEY_1;
record.data.p_data = &my_fifo;
record.data.length_words = sizeof(my_fifo) / 4; /* one word is four bytes. */
ret_code_t rc;
rc = fds_record_write(&record_desc, &record);
if (rc != FDS_SUCCESS) {
/* Handle error. */
NRF_LOG_INFO("Write failure...");
} else {
NRF_LOG_INFO("Writing file...");
}
//j = 1;
}
But when I look at the debug screen. It seems to just save the p_buf address; but not the data at that address; is there anyway using fds to save the corresponding data so I'm saving the entire circular array? This is being done on SDK15 also.