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

Communication via USB. 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 app_usb.c:

Go to the source code of this file.

Functions

void APP_USB_ProcessingRcvdFrame ()
 Processing USB frame.
 

Variables

rtc_time_u uniRTCTime
 
milliseoncd_time_tick_u uniMillisecondTimeTick
 
seoncd_time_tick_u uniSecondTimeTick
 
usb_frame_u uniUSBRecvFrame
 
unsigned long ulNumberOfCLEONSamplesInAFileCount
 
bool bFLAG_USBConnected
 
bool bFLAG_USBFrameReceived
 
bool bFLAG_IsTimeSynced
 
bool bFLAG_RTCTimeTickOfSecond
 
FIL fileObject
 
UINT bw
 
char sFilename [50]
 
unsigned long ulSampleCount
 
unsigned long ulSampleGap
 
unsigned long ulChunkCount
 
unsigned long ulChunkGap
 

Detailed Description

Communication via USB.

Definition in file app_usb.c.

Function Documentation

void APP_USB_ProcessingRcvdFrame ( void  )

Processing USB frame.

            - For every received USB frame, there will be an ack 
            - Ack frame will contain received command as data in data field
Returns
void
Parameters
void

Definition at line 53 of file app_usb.c.

{
// Check if USB frame has been received
// Identify command contained in the USB frame
// Transmit ACK
break;
// Transmit ACK
break;
// Transmit ACK
// Wait until millisecond part becomes zero
// Read RTC time and save it to 'uniRTCTime'
// Store 'uniRTCTime (8 bytes)' to the first entry of internal FLASH bank 3 (0x038000)
// This information will later be used to restore system time
HAL_FLASH_Write(sizeof(uniRTCTime), (unsigned char *)&uniRTCTime, (unsigned char *)MSP430_INTERNAL_FLASH_BANK3_ADDRESS);
// Store 'uniSecondTimeTick (8bytes)' next to 'uniRTCTime' stored to internal FLASH bank 3 (0x038008)
// This information will later be used to restore system time
HAL_FLASH_Write(sizeof(uniSecondTimeTick), (unsigned char *)&uniSecondTimeTick, (unsigned char *)(MSP430_INTERNAL_FLASH_BANK3_ADDRESS + sizeof(uniRTCTime)));
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
}
}
}
// Now that time is synchronized, set flag
// Turn LED3 off
break;
// Transmit ACK
ulSampleCount = ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[3] << 24)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[2] << 16)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[1] << 8)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[0]);
break;
// Transmit ACK
ulSampleGap = ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[3] << 24)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[2] << 16)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[1] << 8)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[0]);
break;
// Transmit ACK
ulChunkCount = ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[3] << 24)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[2] << 16)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[1] << 8)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[0]);
break;
// Transmit ACK
ulChunkGap = ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[3] << 24)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[2] << 16)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[1] << 8)
+ ((unsigned long)uniUSBRecvFrame.stUSBFrame.ucData[0]);
break;
default: break;
}
}
}

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

bool bFLAG_IsTimeSynced

Definition at line 23 of file hal_rtc.c.

bool bFLAG_RTCTimeTickOfSecond

Definition at line 24 of file hal_rtc.c.

bool bFLAG_USBConnected

Definition at line 20 of file sys_usb.c.

bool bFLAG_USBFrameReceived

Definition at line 19 of file sys_usb.c.

UINT bw

Definition at line 16 of file fs_init.c.

FIL fileObject

Definition at line 15 of file fs_init.c.

char sFilename[50]

Definition at line 25 of file app_log.c.

unsigned long ulChunkCount

Definition at line 44 of file app_log.c.

unsigned long ulChunkGap

Definition at line 45 of file app_log.c.

unsigned long ulNumberOfCLEONSamplesInAFileCount

Definition at line 39 of file app_log.c.

unsigned long ulSampleCount

Definition at line 42 of file app_log.c.

unsigned long ulSampleGap

Definition at line 43 of file app_log.c.

milliseoncd_time_tick_u uniMillisecondTimeTick

Definition at line 40 of file hal_rtc.c.

rtc_time_u uniRTCTime

Definition at line 37 of file hal_rtc.c.

seoncd_time_tick_u uniSecondTimeTick

Definition at line 41 of file hal_rtc.c.

usb_frame_u uniUSBRecvFrame

Definition at line 23 of file sys_usb.c.