Hello Supporters ,
I have built one application using NRF52 .in which i have interfaced sensors and Winbond[W25Q128FV] SPI Flash. now i want to store sensors data to SPI flash so how i can start store data and retrieve data .what is the programming flow,sample code, instructions for same.
I have to store one structure data which has sensors data to spi flash continuously .and fetch it from start when needed.
Here is the code which continuously send data to app.but now i want store data as well then send after fetch from SPI flash
i mean
First Store data to SPI flash
then fetch from same location
and send it to app
(till now it's sending direct to app)
Here is the one function where all sensor data is copied to one structure and send to app
void ON_Timeout(void * p_context) { sensor1=read_sensor1(); sensor1_filtered =(sensor1_filtered*sensor1_alpha) + (sensor1*(1-sensor1_alpha)); //Low pass filter sensor2=ADC_Read(AN2,AN0); ///########******GENERAL DATA********###### generalData.GeneralCounter=general_counter; generalData.Chest=sensor1; generalData.ChestRate=4095-sensor2; generalData.ECG_Reserved=sensor1_filtered; generalData.Acc_X=I2C_Read(0x68,0x3B); generalData.Acc_Y=I2C_Read(0x68,0x3D); generalData.Acc_Z=I2C_Read(0x68,0x3F); generalData.Gyr_X=I2C_Read(0x68,0x43); generalData.Gyr_Y=I2C_Read(0x68,0x45); generalData.Gyr_Z=I2C_Read(0x68,0x47); generalData.Mag_X=0; generalData.Mag_Y=0; generalData.Mag_Z=0; BT_UpdateGeneralData(&generalData); //read_battery_voltage(); //BT_UpdateBatteryLevel(state_of_charge); general_counter++; }
Here is the code which continuously send data to app
i have also SPI.h file in same project so how to use it for transfer data
//SPI.h contain following functions uint32_t* SPI_Init(SPI_config_t *pConfig); bool SPI_Transceive(uint16_t length, uint8_t *pTxBuff, uint8_t *pRxBuff); bool SPI_Transmit(uint16_t length, const uint8_t *pTxBuff); bool SPI_Receive(uint16_t length, uint8_t *pRxBuff); uint8_t spi_read(uint8_t value); uint8_t spi_write(uint8_t value);
Thanks