//=========================================================================== // Function name: gps_system_init // // Description: initializes the GPS module // // Passed : no variables passed // Locals: none // Returned: no values returned // Globals: // // Author: Mattia Muller // Date: Oct 2014 // Compiler: Built with IAR Embedded Workbench Version: V4.10A/W32 (5.40.1) //---------------------------------------------------------------------------- void gps_system_init(void){ time_pass_by = SET_0; PJOUT &= ~GPS_RESET; time_pass_by = SET_0; five_msec_sleep(SET_200); time_pass_by = SET_0; PJOUT |= GPS_RESET; five_msec_sleep(SET_20); PJOUT |= GPS_PWRCNTL; five_msec_sleep(SET_40); if (PJIN & GPS_PWRCHK) { PJOUT &= ~GPS_PWRCNTL; } }
void main(void){ //============================================================================== // Main Program // // Description: This function contains the while loop that runs continuously // to act for the operating system. It also calls all the functions to // initialize the system. // // Passed : no variables passed // Locals: no variables declared // Returned: no values returned // Globals: volatile unsigned int Time_Sequence; // volatile char one_time; // char* display_1 // char* display_2 // char* display_3 // char* display_4 // slow_input_down // control_state[CNTL_STATE_INDEX] // char big // char size_count; // char posL1 // char posL2 // char posL3 // char posL4 // // Author: David Pryor // Date: Feb 2016 // Compiler: Built with IAR Embedded Workbench Version: V4.10A/W32 (6.4.1) //============================================================================== Init_Ports(); // Initialize Ports Init_Clocks(); // Initialize Clock System Init_Conditions(); Time_Sequence = SWITCH_OFF; // Init_Timers(); // Initialize Timers five_msec_sleep(COUNT_TWOFIDDY_MSEC); // 250 msec delay for the clock to settle (50) Init_LEDs(); // Initialize LEDs Init_LCD(); // Initialize LCD // 1234567890 display_1 = "NCSU"; posL1 = LINE_POS_3; display_2 = "WOLFPACK"; posL2 = LINE_POS_1; display_3 = "ECE306"; posL3 = LINE_POS_2; display_4 = "D Pryor"; posL4 = LINE_POS_1; big = SWITCH_OFF; Display_Process(); //------------------------------------------------------------------------------ // Begining of the "While" Operating System //------------------------------------------------------------------------------ while(ALWAYS) { // Can the Operating system run switch(Time_Sequence){ case COUNT_TWELVEFIDDY_MSEC: // 1250 msec (250) if(one_time){ Init_LEDs(); // Initialize LEDs one_time = SWITCH_OFF; } Time_Sequence = SWITCH_OFF; // case COUNT_ONETHOUSAND_MSEC: // 1000 msec (200) if(one_time){ one_time = SWITCH_OFF; } case COUNT_SEVENFIDDY_MSEC: // 750 msec (150) if(one_time){ one_time = SWITCH_OFF; } case COUNT_FIVEHUNNED_MSEC: // 500 msec (100) if(one_time){ one_time = SWITCH_OFF; } case COUNT_TWOFIDDY_MSEC: // 250 msec (50) if(one_time){ one_time = SWITCH_OFF; } size_count++; if(size_count > MAX_SIZE_COUNT){ size_count = SWITCH_OFF; if(big){ //lcd_BIG_mid(); big = SWITCH_OFF; }else{ //lcd_4line(); big = SWITCH_ON; } } Display_Process(); break; // default: break; } Switches_Process(); // Check for switch state change if(Time_Sequence > COUNT_TWELVEFIDDY_MSEC){ Time_Sequence = SWITCH_OFF; } } //------------------------------------------------------------------------------ }
void changeMotion() { //------------------------------------------------------------------------------ // change motion based on current cat state // Author: Lingxiao Zheng // Date: 09/29/2015 //------------------------------------------------------------------------------ switch (Car_State) { case 0: // pause 0.5s case 2: case 4: case 6: case 8: case 10: if (resetTimerA0) changeTimerA0Interval(TA0_INTERVAL_0_5s); stop(); break; case 1: // move forward until BLK_LN if (!startADC) startADC=TRUE; move_forward(); break; case 3: // move reverse until BLK_LN move_reverse(); // recording time if (!isRecording) startRecording(); if (!startADC) { five_msec_sleep(SLEEP_1s/2); startADC=TRUE; } break; case 5: // go forward for half of time going reverse if (resetTimerA0) changeTimerA0Interval(TA0_INTERVAL_0_1s*HALF(getRecording())); move_forward(); break; case 7: // spin clockwise if (resetTimerA0) changeTimerA0Interval(TA0_INTERVAL_3s); spin_clockwise(); break; case 9: // spin counter clockwise if (resetTimerA0) changeTimerA0Interval(TA0_INTERVAL_5s); spin_counterclock(); break; default: // done, disable all ISR TA0CTL |= MC__STOP; ADC10IE &= ~ADC10IE0; while(ALWAYS) LPM4; } }