CLEON  Version 1
Cloud-Offloaded GPS Receiver
app_log.h File Reference

Logging CLEON data. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APP_LOG_SAMPLES_IN_A_FILE   100000
 
#define APP_LOG_LED_INDICATION   _ENABLE_
 
#define APP_LOG_TEMP_AND_HUM_SENSORS   _ENABLE_
 
#define APP_LOG_LIGHT_SENSORS   _ENABLE_
 

Functions

void APP_Log (void)
 Collect CLEON data sample(s)
 

Detailed Description

Logging CLEON data.

Definition in file app_log.h.

Macro Definition Documentation

#define APP_LOG_LED_INDICATION   _ENABLE_

Definition at line 13 of file app_log.h.

#define APP_LOG_LIGHT_SENSORS   _ENABLE_

Definition at line 15 of file app_log.h.

#define APP_LOG_SAMPLES_IN_A_FILE   100000

Definition at line 10 of file app_log.h.

#define APP_LOG_TEMP_AND_HUM_SENSORS   _ENABLE_

Definition at line 14 of file app_log.h.

Function Documentation

void APP_Log ( void  )

Collect CLEON data sample(s)

Returns
void
Parameters
void

Definition at line 55 of file app_log.c.

{
#if TIME_MEASUREMENT == _ENABLE_
// Logging current system time tick
}
#endif
// Check if user button is pressed
// Check if time information is synchorinized
// Check if MicroSD is inserted
// Check if defined interval period has passed
#if APP_LOG_LED_INDICATION == _ENABLE_
// Turn LED2 on
#endif // APP_LOG_LED_INDICATION
// Start GPS
#if APP_LOG_TEMP_AND_HUM_SENSORS == _ENABLE_
// Turn SHT11 on
// Turn SHT11 off
#endif // APP_LOG_TEMP_AND_HUM_SENSORS
#if APP_LOG_LIGHT_SENSORS == _ENABLE_
// Start ADC conversion
// Stop ADC conversion
#endif // APP_LOG_LIGHT_SENSORS
// Declare variables for temporary time information
unsigned long long ullPreviousTimeTick = 0;
unsigned long long ullCurrentTimeTick = 0;
// Wait until GPS is fully up and running
SYS_GPS_TimingDealy(100); // 100ms delay
// If this is the first time to log, create a file that captured samples will be written to
if(ulSampleCount != 1){
// Initailize filename
memset(sFilename, 0, sizeof(sFilename));
// File name will start with CLEON's current system time
#if (APP_LOG_TEMP_AND_HUM_SENSORS == _ENABLE_) || (APP_LOG_LIGHT_SENSORS == _ENABLE_)
#else
#endif
// The created file will remain openned until the number of samples defined in 'APP_LOG_SAMPLES_IN_A_FILE' are captured
}
}
// Number of GPS samples in a CLEON sample
// Chunk gap information
if(ulChunkCount == 1){
}else{
}
// Update time tick information
#if TIME_MEASUREMENT == _ENABLE_
// Logging current system time tick
}
#endif
// Move pointer to the end of file to append
// Write captured CLEON header (44 bytes) to the openned file
// Flush cached information of a writing file
for(int i = 0 ; i < ulChunkCount ; i++){
// Check mutex for GPS DMA transfer
// P(bFLAG_GPSSignalIsBeingCaptured)
if( i == 0 ){
#if TIME_MEASUREMENT == _ENABLE_
// Logging current system time tick
}
#endif
// First sample will be captured immediately
ullPreviousTimeTick = ullCurrentTimeTick;
}else{
while(1){
// From second chunk, it will wait until time defined in 'uiChunkGap' has passed
if(((ullPreviousTimeTick/10000) + ulChunkGap) <= (ullCurrentTimeTick/10000)){
ullPreviousTimeTick = ullCurrentTimeTick;
break;
}
}
}
// Start DMA transfer
DMA0CTL |= DMAEN;
// Wait until DMA-transfer-complete-IF is set
// Move pointer to the end of file to append
// Write captured CLEON sample to the openned file
// Flush cached information of a writing file
// V(bFLAG_GPSSignalIsBeingCaptured)
}
}
#if (APP_LOG_TEMP_AND_HUM_SENSORS == _ENABLE_) || (APP_LOG_LIGHT_SENSORS == _ENABLE_)
// Move pointer to the end of file to append
// Write captured CLEON sample to the openned file
// Flush cached information of a writing file
#endif
// Stop GPS
// Increase the total number of samples written to the openned file
}
// If the total number of captured and written samples reach value defined in 'APP_LOG_SAMPLES_IN_A_FILE',
// close file and reset counter to zero
}
#if APP_LOG_LED_INDICATION == _ENABLE_
// Turn LED2 off
#endif // APP_LOG_LED_INDICATION
}
}
}
#if TIME_MEASUREMENT == _ENABLE_
for(int i = 0 ; i < NUMBER_OF_TIME_MEASUREMENT_TEST; i++){
/*
if(i == 0 ){
printf("Sample #\n");
printf("Time at APP_Log start - Time at user button press\n");
printf("Time at start writing header to SD card - Time at APP_Log start\n");
printf("Time at the first GPS signal chunk - Time at start writing header to SD card\n\n");
}
*/
printf("Sample %d\n", i);
printf("%lld ms\n", (stTimeMeasurement[i].ullTimeAtStartAPPLog - stTimeMeasurement[i].ullTimeAtUserButtonPressed) / 10000);
printf("%lld ms\n", (stTimeMeasurement[i].ullTimeAtWriteHeaderToSDCard - stTimeMeasurement[i].ullTimeAtStartAPPLog) / 10000);
printf("%lld ms\n\n", (stTimeMeasurement[i].ullTimeAtFirstChunk - stTimeMeasurement[i].ullTimeAtWriteHeaderToSDCard) / 10000);
}
}
#endif
// If sensing is set to on-demand mode, clear the flag
// This locates at the end of the fuction 'APP_Log()' to prevent the flag from being set again during the function is in operation
}
}

Here is the call graph for this function:

Here is the caller graph for this function: