예제 #1
0
void APP_Run(void) {
  MySegLCDPtr = SegLCD1_Init(NULL);  //initialize sLCD according to PEx 
  
  vfnLCD_Write_Msg((uint8 *)"8888");
  _LCD_DP1_ON(); /* dot for first digit */
  _LCD_DP2_ON(); /* dot for second digit */
  _LCD_DP3_ON(); /* dot for third digit */
  _LCD_COL_ON(); /* : between digit two and three */

  if (FRTOS1_xTaskCreate(
        MainTask,  /* pointer to the task */
        (signed char *)"Main", /* task name for kernel awareness debugging */
        configMINIMAL_STACK_SIZE, /* task stack size */
        (void*)NULL, /* optional task startup argument */
        tskIDLE_PRIORITY,  /* initial priority */
        (xTaskHandle*)NULL /* optional task handle to create */
      ) != pdPASS) {
    /*lint -e527 */
    for(;;){}; /* error! probably out of memory */
    /*lint +e527 */
  }
  FRTOS1_vTaskStartScheduler();
}
예제 #2
0
int main (void)
{
    	char ch,aux1 ,aux2;
      
     
            int UsbDetected = FALSE;
#ifdef CMSIS  // If we are conforming to CMSIS, we need to call start here
    start();
#endif
         vfnMcuConfig();
         
    
  	printf("\n\rRunning the FRDMKL46_Demo project.\n\r");
        vfnLCD_Init();
        gpio_init();
        Pit_init();
        TSI_Init();
        usb_init();
        next_task(vfn_led_test);
        accel_init();
        mag_init();
        eCompassInit();
        adc_init();        
        tpm_init();  //Green LED 50%SIM_SCGC5_PORTC_MASK
        

        
        
// character test        
        vfnLCD_Write_Msg("8888");
        _LCD_DP1_ON();
        _LCD_DP2_ON();
        _LCD_DP3_ON();
        _LCD_COL_ON();
         
 	while(1)
	{
        
#ifdef FRDM_REVA  
          if (uart_getchar_present(UART1_BASE_PTR))
#else
            
          if (uart0_getchar_present(UART0_BASE_PTR))
#endif
            
          {
            ch = in_char();
            printf("\n\r Received char = %c \n\r",ch);            
           if (ch==' ')
           {     
           printf("\n\r light_sensor  = %i",adc_light_sensor);
         //  printf("\n\r Yaw =%4d Pitch =%4d Roll =%4d \r", APhi6DOF, AThe6DOF, APsi6DOF);
           printf("\n\r Yaw =%4d Pitch =%4d Roll =%4d \r", APsi6DOF, APhi6DOF, AThe6DOF);
           
           printf("\n\r tsi %%= %03i  ", AbsolutePercentegePosition);
           }
         }
          
           if (input_rise(SW1_ON, &aux1))
            {  
              printf("\n\r SW1 \n\r");
            }
          
         
            if (input_rise(SW2_ON, &aux2))
            {  
              printf("\n\r SW2 \n\r ");
            }
          
             ptr_next_task();  // do the actual function
             TSI_SliderRead();
             usb_service();
            if (gu8USB_State == uENUMERATED && !UsbDetected) 
            {
              // next_task(vfn_rgb_test);
               UsbDetected = TRUE;
            }        
            
          adc_light_sensor = adc_read(3);
                
                    
              
                
        }
}
예제 #3
0
/*lint -save  -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
  /* Write your local variable definition here */


	  
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/
  LED_GREEN_NegVal();
  LED_RED_NegVal();

  
  MySegLCDPtr = SegLCD1_Init(NULL);  //initialize sLCD according to PEx 
  
  vfnLCD_Write_Msg((uint8 *)"8888");
  
  _LCD_DP1_ON();
  _LCD_DP2_ON();
  _LCD_DP3_ON();
  _LCD_COL_ON();

     
         
   for (main_counter=1000000 ; main_counter>0 ;main_counter--){}; //delay to show all symbol ON

     _LCD_DP1_OFF();
     _LCD_DP2_OFF();
     _LCD_DP3_OFF();
     _LCD_COL_OFF();

   
#ifdef CW
  // If we are using CodeWarrior, we must call this function to change
  // the buffer behavior such that a new line character, "\n", is not 
  // required to print characters to the terminal.  
  setvbuf(stdout, NULL, _IONBF, 0);
#endif
  
  printf("\n\r KL46 sLCD FRDM-KL46 test \n");
  printf("\n\r press a=all symbols on, 0=all symbols Off,  1 to 5 symbols");
  
  for(;;) 
   {
	  /*echoes all received character to terminal */
	  InpData[0] = getchar();
      printf("%c",InpData[0]);
      main_counter++;
      sprintf(sLCDBuffer,"%04i",main_counter%1000);
      vfnLCD_Write_Msg((uint8 *)sLCDBuffer);
      
      LED_GREEN_NegVal();
      LED_RED_NegVal();
    
      switch (InpData[0])
      {      
      case 'a':        	 
    	  _LCD_DP1_ON();
    	  _LCD_DP2_ON();
    	  _LCD_DP3_ON();
    	  _LCD_COL_ON();     	  
      break;
      
      case '0':        	 
          	  _LCD_DP1_OFF();
          	  _LCD_DP2_OFF();
          	  _LCD_DP3_OFF();
          	  _LCD_COL_OFF();     	  
            break;
      
        case '1':
    	  _LCD_DP1_ON();
    	  break;
    	  
        case '2':
      	  _LCD_DP2_ON();
      	  break;
    
        case '3':
      	  _LCD_DP3_ON();
      	  break;
    
        case '4':
      	  _LCD_COL_ON();
      	  break;
    
      	  
        default: 
    	  
        	  _LCD_DP1_OFF();
        	  _LCD_DP2_OFF();
        	  _LCD_DP3_OFF();
        	  _LCD_COL_OFF(); 
      }
  
   }
  
  
  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
  #ifdef PEX_RTOS_START
    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
  #endif
  /*** End of RTOS startup code.  ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;){}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/