CLEON  Version 1
Cloud-Offloaded GPS Receiver
sys_gps.c File Reference

GPS related functions. More...

#include "cleon_conf.h"
#include "app_define.h"
#include "sys_define.h"
#include "hal_define.h"
#include "fs_define.h"
Include dependency graph for sys_gps.c:

Go to the source code of this file.

Functions

void SYS_GPS_Init (void)
 Initializing GPS.
 
void SYS_GPS_InitDataIO (void)
 Initializing GPS data pins.
 
void SYS_GPS_InitControlIO (void)
 Initializing GPS control pins.
 
void SYS_GPS_InitProgramIO (void)
 Initializing GPS control pins.
 
void SYS_GPS_StartOperation (void)
 Starting GPS operation.
 
void SYS_GPS_StopOperation (void)
 Starting GPS operation.
 
bool SYS_GPS_TestGPS (unsigned int uiDelay)
 Test if GPS is initalized properly.
 

Variables

cleon_header_u uniCLEONHeader
 
cleon_gps_data_u uniCLEONGPSData
 
cleon_sensor_data_u uniCLEONSensorData
 
bool bFLAG_DMATransferCompleted
 

Detailed Description

GPS related functions.

Definition in file sys_gps.c.

Function Documentation

void SYS_GPS_Init ( void  )

Initializing GPS.

Returns
void
Parameters
void

Definition at line 29 of file sys_gps.c.

{
// Initializing GPS control pins
// Stop GPS operation before initialization
// Program the GPS with pre-configured mode
// Initializing GPS data pins
#if GPS_TEST_ON_INITIALIZATION == _ENABLE_
// Check if GPS is functional by sampling a chunk of GPS signal and take a look inside
for(int i = 1 ; i < MAX_NUMBER_OF_GPS_TEST_COUNT; i++){
// If fail, allow more time to settle (100ms, 200ms, 300ms ...)
if(SYS_GPS_TestGPS(100 * i) == _SUCCESS_){
// Return if it passes GPS test
return;
}
}
// If it fails the test, turn LED on
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SYS_GPS_InitControlIO ( void  )

Initializing GPS control pins.

Returns
void
Parameters
void

Definition at line 149 of file sys_gps.c.

Here is the caller graph for this function:

void SYS_GPS_InitDataIO ( void  )

Initializing GPS data pins.

Returns
void
Parameters
void

Definition at line 66 of file sys_gps.c.

{
}

Here is the caller graph for this function:

void SYS_GPS_InitProgramIO ( void  )

Initializing GPS control pins.

Returns
void
Parameters
void

Definition at line 168 of file sys_gps.c.

{
// CLEON uses default device state 2 (PGM:1, CS:0, SCLK:0, SDATA:1)
// - IF: 4092000 Hz
// - Sampling rate: 16368 samples/sec
// - CMOS level I0 and I1
// PGM pin is set to high
// CS pin is set to low
// SCLK pin is set to low
// SDATA pin is set to high
}

Here is the caller graph for this function:

void SYS_GPS_StartOperation ( void  )

Starting GPS operation.

Returns
void
Parameters
void

Definition at line 200 of file sys_gps.c.

{
// LDO for GPS is turned on
}

Here is the caller graph for this function:

void SYS_GPS_StopOperation ( void  )

Starting GPS operation.

Returns
void
Parameters
void

Definition at line 214 of file sys_gps.c.

{
// LDO for GPS is in shutdown mode
}

Here is the caller graph for this function:

bool SYS_GPS_TestGPS ( unsigned int  uiDelay)

Test if GPS is initalized properly.

Returns
void
Parameters
uiDelay- time for GPS to settle down (in milliseconds)

Definition at line 228 of file sys_gps.c.

{
unsigned int uiTestCountFor0xFF = 0;
unsigned int uiTestCountFor0x00 = 0;
// Start GPS operation
// Allow GPS time to settle
// Start DMA transfer
DMA0CTL |= DMAEN;
// Wait until DMA transfer completed
while((DMA0CTL & DMAIFG) != DMAIFG);
DMA0CTL &= ~DMAIFG;
// Count the number of '0xFF' and '0x00'
for(int i = 0 ; i < SIZE_OF_GPS_DATA_CHUNK_IN_BYTE ; i++ ){
if(uniCLEONGPSData.ucSignal[i] == 0xFF){
uiTestCountFor0xFF++;
}else if(uniCLEONGPSData.ucSignal[i] == 0x00){
uiTestCountFor0x00++;
}
}
// Stop GPS operation
// If number of '0xFF' or '0x00' exceeds half or total sampled signal, regards GPS chip is not functional
// (number of '0xFF' or '0x00' cannot exceed half of captured GPS signal due to signal's physical nature)
if((uiTestCountFor0xFF > (SIZE_OF_GPS_DATA_CHUNK_IN_BYTE/2))||(uiTestCountFor0x00 > (SIZE_OF_GPS_DATA_CHUNK_IN_BYTE/2))){
return _FAIL_;
}else{
return _SUCCESS_;
}
}

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

bool bFLAG_DMATransferCompleted

Definition at line 19 of file hal_dma.c.

cleon_gps_data_u uniCLEONGPSData

Definition at line 14 of file sys_init.c.

cleon_header_u uniCLEONHeader

Definition at line 13 of file sys_init.c.

cleon_sensor_data_u uniCLEONSensorData

Definition at line 15 of file sys_init.c.