void proc_main_task(void)
{
    s32 ret;
    ST_MSG msg;
    bool keepGoing = TRUE;

        // Init serial port
    InitializeSerialPort();

    APP_DEBUG(MY_FILE_TAG);
    


    // START MESSAGE LOOP OF THIS TASK
    while (keepGoing)
    {
         Ql_OS_GetMessage(&msg);
        switch(msg.message)
        {
           
            case 0:
            {                
                break;
            }            
            default:
                break;
          
        }        
    }

}
예제 #2
0
파일: main.c 프로젝트: JCot/ProjectSix
void main(void) {
  /* put your own code here */ 
  int ServoIndex=0;
  InitializeSerialPort();
  Initialize();
  InitializeTimer();
  
  DDRA = 0x00;

  while(1 == 1) {
  
        //char temp= GetChar();
        GetChar();
        
      
  } /* loop forever */
}
예제 #3
0
// Function to call all the functions used to Initialize the System
//-----------------------------------------------------------------       
void hardwareinit(void)
{
  InitializeSerialPort();
  
  initPulseCapture()	;
  
  PortDeclaration()		;
  
  InitializeTimer()		;
  
  InitializePWM0()		;
  
  InitializePWM1()		;
  
  PWMDTY0	=	0x0D	;
  
  PWMDTY1	=	0x0D	;
}
void main(void) {
  
  UINT8 input_validity;
  UINT8 userInput1,userInput2,userInput3;
  UINT8 flag1, flag2;
  
  struct Stepper stepper1,stepper2;
  
	// set up serial port communication
  InitializeSerialPort();

  
  InitializePWM(); 
	
	//Intialize timer
	InitializeTimer();
	
	// allocate and fill receipe array
	InitializeRecipe();
	
	IntializeLED();
	
	set_stepper(&stepper1,PWM_CHANNEL_STEPPER1,STEPPER1_RECIPE);
	set_stepper(&stepper2,PWM_CHANNEL_STEPPER2,STEPPER2_RECIPE);
  
  if(1 == POST())
  {
    printf("POST failed\r\n");
    for(;;) 
    {
    }
    
  } 
  else 
  {
    printf("POST successful\r\n");  
  
    (void)printf(">");
    for(;;) {
      _FEED_COP();
   
      //check serial port for input
      if(1 == BufferEmpty()) 
      { 
        do
        {  
          userInput1 = GetChar();
          (void)printf("%c", userInput1);
          
          userInput2 = GetChar();
          (void)printf("%c", userInput2);
        
          //get <CR>
          userInput3 = GetChar();
          
          if( 'x' == userInput1 || 'X' == userInput1 || 'x' == userInput2 || 'X' == userInput2 ) 
          {
            input_validity = INVALID_INPUTS;  
          } 
          else
          {
            input_validity = VALID_INPUTS;
          }
          
        }while(INVALID_INPUTS == input_validity);
        
        // print <LF> and then '>'
        (void)printf("\r\n>");
        
        //set state of stepper1
        update_state(&stepper1,userInput1);
        
        //set state of stepper2
        update_state(&stepper2,userInput2);
      }
      
      // for stepper  1 take action according to state
      flag1 = take_action(&stepper1);
      
      // for stepper 2 take action acording to state  
  	  flag2 = take_action(&stepper2);
  	  
  	  glow_led(flag1,flag2);
  	  
  	  (void)wait_cycle();
    } 
  }
  
}
예제 #5
0
void proc_main_task(s32 taskId)
{
    s32 ret;
    ST_MSG msg;

    

    // Init serial port
    InitializeSerialPort();

    APP_DEBUG("\r\n<== OpenCPU: CSD Demo ==>\r\n");

    // START MESSAGE LOOP OF THIS TASK
    while(TRUE)
    {
        Ql_OS_GetMessage(&msg);
        switch(msg.message)
        {
        case MSG_ID_RIL_READY:
            APP_DEBUG("<-- RIL is ready -->\r\n");
            Ql_RIL_Initialize();
            break;
        case MSG_ID_URC_INDICATION:
            //APP_DEBUG("<-- Received URC: type: %d, -->\r\n", msg.param1);
            switch (msg.param1)
            {
            case URC_CFUN_STATE_IND:
                APP_DEBUG("<-- CFUN Status:%d -->\r\n", msg.param2);
                break;
            case URC_SYS_INIT_STATE_IND:
                APP_DEBUG("<-- Sys Init Status %d -->\r\n", msg.param2);
                break;
            case URC_SIM_CARD_STATE_IND:
                SIM_Card_State_Ind(msg.param2);
                break;
            case URC_GSM_NW_STATE_IND:
                APP_DEBUG("<-- GSM Network Status:%d -->\r\n", msg.param2);
                
                // If this program is host, then start to CSD dial
                if (NW_STAT_REGISTERED == msg.param2 && IS_CSD_CALLER)
                {// Start to CSD dial
                    CSD_Establish(CSD_DIAL_NUMBER);
                }
                break;
            case URC_CALL_STATE_IND:
                {
                    APP_DEBUG("<--call  Status:%d -->\r\n", msg.param2);
                    if(CALL_STATE_NO_CARRIER == msg.param2)
                    {
                        CSD_Disconnect();
                    } 
                }
                break;
            default:
                APP_DEBUG("<-- Other URC: type=%d\r\n", msg.param1);
                break;
            }
            break;
        default:
            break;
        }
    }
}