Beispiel #1
0
//******************************************************************************
//
// The main routine.
//
//******************************************************************************
int main( void )
{
   tRectangle sRect; 
   int i;
   int x = 0, y = 0;
   unsigned uColor;
   tContext *pContext;
   tDisplay *pDisplay;
   
   // Stop watchdog timer to prevent time out reset
 //  WDTCTL = WDTPW + WDTHOLD;
   
   
   //
   // Initialize the display driver.
   //
   GLCD_Initialize();
   GLCD_ClearGraphic();
   
   //
   // Initialize the graphics context.
   //
   GrContextInit(pContext, pDisplay);
  // GrCircleDraw(pContext, 0, 0,5);
   return 0;
}
Beispiel #2
0
void LCD_Initiate(void)
{
	//Initialize the LCD
	GLCD_Initialize();
	
	// Set font size
	GLCD_SetFont(&GLCD_Font_16x24);
	
	// Set background and foreground colors
	GLCD_SetBackgroundColor(GLCD_COLOR_WHITE);
	GLCD_SetForegroundColor(GLCD_COLOR_BLACK);
	
	// Clear the screen for first use
	GLCD_ClearScreen();
}
int main (void){
			
		ADC_Initialize          ();           // Initialize A/D Converter      
    GLCD_Initialize         ();           // Initialize Graphical LCD           
    Joystick_Initialize     ();           // Initialize joystick                

    GLCD_SetBackgroundColor (BackgroundColor);
    GLCD_SetForegroundColor (ForegroundColor);
    GLCD_SetFont            (&GLCD_Font_16x24);
		GLCD_ClearScreen();		
		
		// Select P0.16 as output 
		LPC_GPIO0->FIODIR |= 0x00010000;
			
		menuChoice = InitMenu;
		while (1)
			{
					switch(menuChoice)
					{
						case InitMenu:
							InitializeAppMenu();
							menuChoice = Menu;
							break;
						case Menu:
							AppMenu();
							break;
						case InitPong:
							initDMA();
							InitializeAppPong();
							menuChoice = Pong;
							break;
						case Pong:
							AppPong();
							break;
						case InitShooter:
							InitializeAppShooter();
							menuChoice = Shooter;
							break;
						case Shooter:
							AppShooter();
							menuChoice = InitMenu;
							break;
					}	
			

			}			
}
Beispiel #4
0
void main (void)
    {
    CMCON |= 7;
    ADCON1=0x0F;
    GLCD_Initialize();
    GLCD_ClearScreen();
while(1)
    {
    GLCD_WriteString("ETIQ TECHNOLOGIES");
    Delay_s(2);
    GLCD_Circle(64, 32, 28);
    Delay_s(2);
    GLCD_ClearScreen();
    GLCD_Rectangle(30, 12, 70,40);
    Delay_s(2);
    GLCD_ClearScreen();
    }
}
Beispiel #5
0
void vLCDTask( void *pvParameters )
{
	xLCDMessage xMessage;
	
	/* Initialise the LCD and display a startup message. */
	GLCD_Initialize();

	taskENTER_CRITICAL();
	GLCD_ClearScreen();
	taskEXIT_CRITICAL();
	
	for( ;; )
	{
		/* Wait for a message to arrive that requires displaying. */
		while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );

		/* Display the message.  Print each message to a different position. */
		GLCD_PutString(xMessage);
	}
}
Beispiel #6
0
int main (void) {
  int32_t max_num = LED_GetCount() - 1;
  int32_t num = 0;
  int32_t dir = 1;
  uint32_t keyMsk, adcVal;
  int32_t key  = -1;
  int32_t adc  = -1;

  SystemCoreClockUpdate();

  LED_Initialize();                         /* LED Initialization             */
  ADC_Initialize();                         /* A/D Converter Init             */
  Buttons_Initialize();                     /* Button initialization          */
  GLCD_Initialize();                        /* Initialize the GLCD            */

  SysTick_Config(SystemCoreClock/100);      /* Generate interrupt each 10 ms  */

  GLCD_SetBackgroundColor (GLCD_COLOR_WHITE);
  GLCD_ClearScreen ();

  GLCD_SetBackgroundColor (GLCD_COLOR_BLUE);
  GLCD_SetForegroundColor (GLCD_COLOR_WHITE);
  GLCD_SetFont            (&GLCD_Font_16x24);
  GLCD_DrawString (0*16, 0*24, " STM32303C-EVAL Demo");
  GLCD_DrawString (0*16, 1*24, "  Blinky Example    ");
  GLCD_DrawString (0*16, 2*24, "   www.keil.com     ");
  GLCD_SetBackgroundColor (GLCD_COLOR_WHITE);
  GLCD_SetForegroundColor (GLCD_COLOR_BLUE);

  GLCD_DrawString (0*16, 5*24, "LEDs:               ");
  GLCD_DrawString (0*16, 6*24, "AD value:           ");
  GLCD_DrawString (0*16, 7*24, "Buttons :           ");
  GLCD_SetForegroundColor (GLCD_COLOR_LIGHT_GREY);
  GLCD_DrawString (9*16, 5*24, "0123");

  while (1) {
    /* Force refresh */
    key = -1;
    adc = -1;

    if (LEDOn) {
      LEDOn = 0;
      LED_On (num);                         /* Turn specified LED on          */
      GLCD_SetForegroundColor (GLCD_COLOR_RED);
      GLCD_DrawChar ((9+num)*16, 5*24, numStr[num]);
    }

    if (LEDOff) {
      LEDOff = 0;
      LED_Off (num);                        /* Turn specified LED off         */
      GLCD_SetForegroundColor (GLCD_COLOR_LIGHT_GREY);
      GLCD_DrawChar ((9+num)*16, 5*24, numStr[num]);

      num += dir;                           /* Change LED number              */
      if (dir == 1 && num == max_num) {
        dir = -1;                           /* Change direction to down       */
      }
      else if (num == 0) {
        dir =  1;                           /* Change direction to up         */
      }
    }

    keyMsk = Buttons_GetState();            /* Show buttons state             */
    if (key ^ keyMsk) {
      GLCD_SetForegroundColor (GLCD_COLOR_BLACK);
      if (keyMsk & KEY_USER  )    { GLCD_DrawString (9*16, 7*24, "Key");   }

      GLCD_SetForegroundColor (GLCD_COLOR_LIGHT_GREY);
      if (!(keyMsk & KEY_USER  )) { GLCD_DrawString (9*16, 7*24, "Key");   }
    }

    ADC_StartConversion();                  /* Show A/D conversion bargraph   */
    adcVal = ADC_GetValue();
    if (adc ^ adcVal) {
      adc = adcVal;
      GLCD_SetForegroundColor (GLCD_COLOR_GREEN);
      GLCD_DrawBargraph (9*16, 6*24, 160, 20, (adcVal * 100) / ((1 << ADC_GetResolution()) - 1));
    }
  }
}