void FCTL_Screen(T_uezDevice lcd)
{
    T_pixelColor *pixels;

    SUIHidePage0();

    UEZLCDGetFrame(lcd, 0, (void **)&pixels);
    swim_window_open(
        &G_ttWin,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        YELLOW,
        RGB(0, 0, 0),
        RED);
    swim_set_font(&G_ttWin, &APP_DEMO_DEFAULT_FONT);
    swim_set_title(&G_ttWin, "Functional Test Loopback", BLUE);
    swim_set_pen_color(&G_ttWin, YELLOW);
    swim_set_fill_color(&G_ttWin, BLACK);

    swim_put_text_xy(&G_ttWin, "In this mode the ARM-TS-KIT serves as an RS232", TT_COLUMN_1, TT_ROW2_3);
    swim_put_text_xy(&G_ttWin, "and CAN loopback for functional test", TT_COLUMN_1, TT_ROW2_4);

    ChoicesDraw(&G_ttWin, G_ttChoices);

    SUIShowPage0();
}
static void AudioPlayerScreen(T_uezDevice lcd)
{
    T_pixelColor *pixels;

    SUIHidePage0();

    UEZLCDGetFrame(lcd, 0, (void **)&pixels);
	
    swim_window_open(
        &G_win,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        YELLOW,
        RGB(0, 0, 0),
        RED);
		
    swim_set_font(&G_win, &APP_DEMO_DEFAULT_FONT);
    swim_set_title(&G_win, "uEZ(tm) Audio Player", BLUE);
    swim_set_pen_color(&G_win, YELLOW);
    swim_set_font(&G_win, &font_winfreesys14x16);
    
    SUIShowPage0();
}
Example #3
0
/*---------------------------------------------------------------------------*
 * Routine:  CalibrateScreen
 *---------------------------------------------------------------------------*
 * Description:
 *      Draw the screen used for calibration.
 * Inputs:
 *      TUInt16 *aPixels            -- Pointer to pixel memory
 *      TUInt16 aX, aY              -- Coordinate of target to draw
 *---------------------------------------------------------------------------*/
void CalibrateScreen(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;
    SWIM_WINDOW_T win;

    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDOn(lcd);
        UEZLCDBacklight(lcd, 256);

        SUIHidePage0();

        UEZLCDGetFrame(lcd, 0, (void **)&pixels);
        swim_window_open(
            &win,
            DISPLAY_WIDTH,
            DISPLAY_HEIGHT,
            pixels,
            0,
            0,
            DISPLAY_WIDTH-1,
            DISPLAY_HEIGHT-1,
            2,
            YELLOW,
            RGB(0, 0, 0),
            RED);
        swim_set_font(&win, &APP_DEMO_DEFAULT_FONT);
        swim_set_title(&win, "Calibrate Touchscreen", BLUE);
        SUIShowPage0();
    }
}
Example #4
0
/*---------------------------------------------------------------------------*
 * Routine:  TestModeScreen
 *---------------------------------------------------------------------------*
 * Description:
 *      Draw the screen used for test mode.
 *---------------------------------------------------------------------------*/
void TestModeScreen(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;

    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDOn(lcd);
        UEZLCDBacklight(lcd, 256);

        SUIHidePage0();

        UEZLCDGetFrame(lcd, 0, (void **)&pixels);
        swim_window_open(
            &G_tmWin,
            DISPLAY_WIDTH,
            DISPLAY_HEIGHT,
            pixels,
            0,
            0,
            DISPLAY_WIDTH-1,
            DISPLAY_HEIGHT-1,
            2,
            YELLOW,
            RGB(0, 0, 0),
            RED);
        swim_set_font(&G_tmWin, &APP_DEMO_DEFAULT_FONT);
        swim_set_title(&G_tmWin, PROJECT_NAME " - Test Mode", BLUE);
        SUIShowPage0();
    }
}
Example #5
0
void BSODStart(const char *aLine)
{
    T_pixelColor *pixels;
    T_uezDevice lcd;
    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDOn(lcd);
        UEZLCDBacklight(lcd, 255);
        UEZLCDGetFrame(lcd, 0, (void **)&pixels);
        UEZLCDShowFrame(lcd, 0);
        swim_window_open(&G_bsodWin, UEZ_LCD_DISPLAY_WIDTH, UEZ_LCD_DISPLAY_HEIGHT,
                         (COLOR_T *)pixels, 0, 0, UEZ_LCD_DISPLAY_WIDTH-1,
                         UEZ_LCD_DISPLAY_HEIGHT-1, 2, WHITE, BLUE, WHITE);
        swim_set_font(&G_bsodWin, &font_winfreesys14x16_subset);
        swim_set_pen_color(&G_bsodWin, WHITE);
        G_bsodActive = ETrue;
        BSODPrint(aLine);
    }
}
Example #6
0
static void IClearScreen0(T_uezDevice aLCD)
{
    T_pixelColor *pixels;

    UEZLCDGetFrame(aLCD, 0, (void **)&pixels);
    swim_window_open(
        &G_tmWin,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        0,
        YELLOW,
        G_mmTestModeColor,
        RED);
    swim_set_font(&G_tmWin, &APP_DEMO_DEFAULT_FONT);
}
Example #7
0
void TestModeAlignmentBorder(T_uezDevice aLCD)
{
    T_pixelColor *pixels;

    UEZLCDGetFrame(aLCD, 0, (void **)&pixels);
    swim_window_open(
        &G_tmWin,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        WHITE,
        BLACK,
        RED);
    swim_set_font(&G_tmWin, &APP_DEMO_DEFAULT_FONT);
}
Example #8
0
/*---------------------------------------------------------------------------*/
void ScreenInit(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;

    UEZLCDOpen("LCD", &lcd);
    UEZLCDGetFrame(lcd, 0, (void **)&pixels);
    UEZLCDBacklight(lcd, 0);
    UEZLCDOff(lcd);

    swim_window_open(&G_win, DISPLAY_WIDTH, DISPLAY_HEIGHT, pixels, 0, 0,
            DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1, 1, WHITE, RGB(0, 0, 0),
            WHITE);

    swim_set_font(&G_win, &APP_DEMO_DEFAULT_FONT);

    print(PROJECT_NAME " " VERSION_AS_TEXT "\n\n"); // clear serial screen and put up banner
    
    ScreenOn();
}
Example #9
0
static void IClearScreen(T_uezDevice aLCD)
{
    T_pixelColor *pixels;

    UEZLCDGetFrame(aLCD, 0, (void **)&pixels);
    swim_window_open(
        &G_tmWin,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        YELLOW,
        RGB(0, 0, 0),
        RED);
    swim_set_font(&G_tmWin, &APP_DEMO_DEFAULT_FONT);
    swim_set_title(&G_tmWin, "uEZ GUI Test Mode", BLUE);
}
Example #10
0
/*---------------------------------------------------------------------------*
 * Routine:  DR_Screen
 *---------------------------------------------------------------------------*
 * Description:
 *      Draw the DrawMode screen.
 * Inputs:
 *      T_uezDevice lcd           -- LCD screen to use.
 *---------------------------------------------------------------------------*/
void DR_Screen(T_uezDevice lcd)
{
    T_pixelColor *pixels;

    UEZLCDGetFrame(lcd, 0, (void **)&pixels);
    SUIHidePage0();
    swim_window_open(
        &G_drWin,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        YELLOW,
        RGB(0, 0, 0),
        RED);
    swim_set_font(&G_drWin, &APP_DEMO_DEFAULT_FONT);
    swim_set_title(&G_drWin, "uEZ(tm) Draw Demonstration", BLUE);
    swim_set_pen_color(&G_drWin, YELLOW);

    ChoicesDraw(&G_drWin, G_drChoices);

    // Now draw the drawing area
    swim_set_fill_color(
        &G_drWin,
        BLACK);
    swim_put_box(
        &G_drWin,
        DR_IMAGE_LEFT,
        DR_IMAGE_TOP,
        DR_IMAGE_RIGHT,
        DR_IMAGE_BOTTOM);

    SUIShowPage0();
}
Example #11
0
/**********************************************************************
 *
 * Function: c_entry
 *
 * Purpose: Application entry point from the startup code
 *
 * Processing:
 *     See function.
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 *********************************************************************/
void c_entry(void)
{
    SWIM_WINDOW_T win1;
    COLOR_T clr, *fblog;
    int idx;
    INT_32 lcddev;
    UNS_16 xgs, ygs, curx, cury, curym, xidx;

    /* Disable interrupts in ARM core */
    disable_irq_fiq();

    /* Set virtual address of MMU table */
    cp15_set_vmmu_addr((void *)
		(IRAM_BASE + (256 * 1024) - (16 * 1024)));

    /* Setup miscellaneous board functions */
    phy3250_board_init();
  
    /* Setup LCD muxing for STN Color 16BPP */
    clkpwr_setup_lcd(CLKPWR_LCDMUX_TFT16, 1);

    /* Enable clock to LCD block (HCLK_EN)*/
    clkpwr_clk_en_dis(CLKPWR_LCD_CLK, 1);
	
    /* Setup LCD paramaters in the LCD controller */
    lcddev = lcd_open(CLCDC, (INT_32) &LCD_DISPLAY);

    /* Upper Panel Frame Base Address register */
    lcd_ioctl(lcddev, LCD_SET_UP_FB, PHY_LCD_FRAME_BUF); 

    /* Enable LCD controller and power signals */
    lcd_ioctl(lcddev, LCD_PWENABLE, 1);

    /* Enable LCD backlight */
    phy3250_lcd_backlight_enable(TRUE);

    /* Enable LCD power */
    phy3250_lcd_power_enable(TRUE);

    /* Set frame buffer address */
    fblog = (COLOR_T *) 
            cp15_map_physical_to_virtual(PHY_LCD_FRAME_BUF);

    /* Create a SWIM window */
    swim_window_open(&win1, LCD_DISPLAY.pixels_per_line,
        LCD_DISPLAY.lines_per_panel, fblog, 0, 0,
		(LCD_DISPLAY.pixels_per_line - 1), 
		(LCD_DISPLAY.lines_per_panel - 1),1, WHITE, BLACK, BLACK);

    /* Compute vertical size for bars */
    ygs = LCD_DISPLAY.lines_per_panel / 3;

    /* Draw Red bars */
    cury = 0;
    curx = 0;
    curym = ygs - 1;
    xgs = LCD_DISPLAY.pixels_per_line / RED_COLORS;
    clr = BLACK;
    for (xidx = 0; xidx < RED_COLORS; xidx++)
    {
        swim_set_pen_color(&win1, clr);
        for (idx = 0; idx <= xgs; idx++)
        {
            swim_put_line(&win1, curx, cury, curx, curym);
            curx++;
        }
        clr = clr + 0x0800;
        }

    /* Draw green bars */
    cury = cury + ygs;
    curx = 0;
    curym = cury + (ygs - 1);
    xgs = LCD_DISPLAY.pixels_per_line / GREEN_COLORS;
    clr = BLACK;
    for (xidx = 0; xidx < GREEN_COLORS; xidx++)
    {
        swim_set_pen_color(&win1, clr);
        for (idx = 0; idx <= xgs; idx++)
        {
            swim_put_line(&win1, curx, cury, curx, curym);
            curx++;
        }
        clr = clr + 0x0020;
    }

    /* Draw blue bars */
    cury = cury + ygs;
    curx = 0;
    curym = cury + (ygs - 1);
    xgs = LCD_DISPLAY.pixels_per_line / BLUE_COLORS;
    clr = BLACK;
    for (xidx = 0; xidx < BLUE_COLORS; xidx++)
    {
        swim_set_pen_color(&win1, clr);
        for (idx = 0; idx <= xgs; idx++)
        {
            swim_put_line(&win1, curx, cury, curx, curym);
            curx++;
        }
        clr = clr + 0x0001;
    }
}
Example #12
0
/***********************************************************************
 *
 * Function: c_entry
 *
 * Purpose: Application entry point from the startup code
 *
 * Processing:
 *     See function.
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Always returns 1, or <0 on an error
 *
 * Notes: None
 *
 **********************************************************************/
int c_entry(void)
{
  SWIM_WINDOW_T win1;
  COLOR_T *fblog;
  INT_32 lcddev;

  /* Disable interrupts in ARM core */
  disable_irq_fiq();

  /* Setup miscellaneous board functions */
  phy3250_board_init();

  /* Set virtual address of MMU table */
  cp15_set_vmmu_addr((void *)
                     (IRAM_BASE + (256 * 1024) - (16 * 1024)));

  /* Initialize interrupt system */
  int_initialize(0xFFFFFFFF);

  /* Install standard IRQ dispatcher at ARM IRQ vector */
  int_install_arm_vec_handler(IRQ_VEC, (PFV) lpc32xx_irq_handler);

  /* Install RTC interrupt handler as a IRQ interrupts */
  int_install_irq_handler(IRQ_RTC, (PFV) rtc_user_interrupt);

  /* Open RTC */
  rtcdev = rtc_open(RTC, 0);
  if (rtcdev == 0)
  {
    /* Error */
    return -1;
  }

  /* Set a 1s match rate */
  secs = lsecs = 0;
  mstp.match_num      = 0;
  mstp.use_match_int  = TRUE;
  mstp.enable_onsw    = FALSE;
  mstp.match_tick_val = secs + 1;
  rtc_ioctl(rtcdev, RTC_ENABLE, 0);
  rtc_ioctl(rtcdev, RTC_SET_COUNT, 0);
  rtc_ioctl(rtcdev, RTC_CLEAR_INTS, RTC_MATCH0_INT_STS);
  rtc_ioctl(rtcdev, RTC_SETUP_MATCH, (INT_32) &mstp);

  /* Setup LCD muxing for STN Color 16BPP */
  clkpwr_setup_lcd(CLKPWR_LCDMUX_TFT16, 1);

  /* Enable clock to LCD block (HCLK_EN)*/
  clkpwr_clk_en_dis(CLKPWR_LCD_CLK, 1);

  /* Setup LCD paramaters in the LCD controller */
  lcddev = lcd_open(CLCDC, (INT_32) & LCD_DISPLAY);

  /* Upper Panel Frame Base Address register */
  lcd_ioctl(lcddev, LCD_SET_UP_FB, PHY_LCD_FRAME_BUF);

  /* Enable LCD controller and power signals */
  lcd_ioctl(lcddev, LCD_PWENABLE, 1);

  /* Enable LCD backlight */
  phy3250_lcd_backlight_enable(TRUE);

  /* Enable LCD power */
  phy3250_lcd_power_enable(TRUE);

  /* Set frame buffer address */
  fblog = (COLOR_T *) cp15_map_physical_to_virtual(PHY_LCD_FRAME_BUF);

  /* Create a SWIM window */
  swim_window_open(&win1, LCD_DISPLAY.pixels_per_line,
                   LCD_DISPLAY.lines_per_panel, fblog, 0, 0,
                   (LCD_DISPLAY.pixels_per_line - 1), (LCD_DISPLAY.lines_per_panel - 1),
                   1, WHITE, BLACK, BLACK);
  swim_put_ltext(&win1, "RTC example: This example will print the message "
                 "TICK whenever an RTC interrupt occurs (1 second intervals). It will "
                 "quit after 10 seconds\n");

  /* Enable RTC (starts counting) */
  rtc_ioctl(rtcdev, RTC_ENABLE, 1);

  /* Enable RTC interrupt in the interrupt controller */
  int_enable(IRQ_RTC);

  /* Enable IRQ interrupts in the ARM core */
  enable_irq();

  /* Loop for 10 seconds and let interrupts toggle the LEDs */
  while (secs < 10)
  {
    if (lsecs < secs)
    {
      swim_put_ltext(&win1, "TICK\n");
      lsecs = secs;
    }
  }
  /* Disable RTC interrupt in the interrupt controller */
  int_disable(IRQ_RTC);

  /* Disable interrupts in ARM core */
  disable_irq_fiq();

  /* Prior to closing the RTC, the ONSW key value is set. This will
     allow the RTC to keep it's value across resets as long as RTC
   power is maintained */
  rtc_ioctl(rtcdev, RTC_SETCLR_KEY, 1);

  /* Close RTC and LCD */
  rtc_close(rtcdev);
  lcd_close(lcddev);

  return 1;
}
Example #13
0
/*---------------------------------------------------------------------------*
 * Routine:  TitleScreen
 *---------------------------------------------------------------------------*
 * Description:
 *      Draw the title screen at boot
 *---------------------------------------------------------------------------*/
void TitleScreen(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;
    TUInt16 i;
    char buffer[15];

    G_romChecksumCalculated = EFalse;
    UEZTaskCreate(
        (T_uezTaskFunction)CalcChecksumTask,
        "Chksum",
        UEZ_TASK_STACK_BYTES(256),
        (void *)0,
        UEZ_PRIORITY_NORMAL,
        0);

    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDGetFrame(lcd, 0, (void **)&pixels);
        UEZLCDBacklight(lcd, 0);
        UEZLCDOff(lcd);

        SUIHidePage0();

        swim_window_open(
            &G_mmWin,
            DISPLAY_WIDTH,
            DISPLAY_HEIGHT,
            pixels,
            0,
            0,
            DISPLAY_WIDTH-1,
            DISPLAY_HEIGHT-1,
            2,
            BLACK,
            RGB(0, 0, 0),
            RED);

        swim_set_font(&G_mmWin, &APP_DEMO_DEFAULT_FONT);

        SUIDrawBitmap(
			G_uEZLogo,
            (DISPLAY_WIDTH-UEZ_ICON_WIDTH)/2,
            (DISPLAY_HEIGHT-UEZ_ICON_HEIGHT)/2);

        SUIShowPage0();

        UEZLCDOn(lcd);
#if FAST_STARTUP
        UEZLCDBacklight(lcd, 255);
#else
        for (i=0; i<255; i++)  {
            UEZLCDBacklight(lcd, i);
            UEZTaskDelay(1);
        }
#endif
        // Create checksum string
#if FAST_STARTUP
        sprintf(buffer, "CS:????");
#else
        while (!G_romChecksumCalculated)
            UEZTaskDelay(10);
        sprintf(buffer, "CS:%08X", G_romChecksum);
        swim_set_font_transparency(&G_mmWin, 1);
        swim_put_text_xy(
            &G_mmWin,
            buffer,
            5,
            DISPLAY_HEIGHT-15);
        swim_set_font_transparency(&G_mmWin, 0);
#endif

    }
}
Example #14
0
void TDMScreen(T_timeDateWorkspace *G_ws)
{
    T_pixelColor *pixels;
    T_region r;
    T_region rbuttons;
    T_region rbutton;
    T_region rbottom;
    T_region rsub;
    T_region rtemp;
    TUInt32 width;
    TUInt32 height;
    T_choice *p = G_ws->iChoices;

    SUIHidePage0();

    UEZLCDGetFrame(G_ws->iLCD, 0, (void **)&pixels);
    swim_window_open(
        &G_win,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        YELLOW,
        RGB(0, 0, 0),
        RED);
    swim_set_font(&G_win, &APP_DEMO_DEFAULT_FONT);
    G_ws->iFontHeight = swim_get_font_height(&G_win);
    swim_set_title(&G_win, "uEZ(tm) Time & Date Demonstration", BLUE);
    swim_set_pen_color(&G_win, YELLOW);
    swim_set_fill_color(&G_win, BLACK);

    r.iLeft = 0;
    r.iTop = 0;
    r.iRight = G_win.xvsize;
    r.iBottom = G_win.yvsize;

    // Come off the edges
    RegionShrink(&r, SCREEN_EDGE_MIN_PADDING-2);

    RegionSplitFromBottom(&r, &rbottom, 4+G_ws->iFontHeight+2+EXIT_BUTTON_HEIGHT, 2);
    rtemp = rbottom;

    // Up and Down arrow icons
    if (G_ws->iShowButtons) {
        RegionCenterLeftRight(&rtemp, &rsub, TDM_BUTTON_WIDTH*2+2);

        // Up arrow icon
        RegionSplitFromLeft(&rsub, &rbutton, TDM_BUTTON_WIDTH, 2);
        p->iLeft = rbutton.iLeft;
        p->iTop = rbutton.iTop;
        p->iRight = rbutton.iRight;
        p->iBottom = rbutton.iBottom;
        p->iText = "";
        p->iAction = PushUp;
        p->iIcon = G_upArrowIcon;
        p->iData = (void *)G_ws;
        p->iDraw = 0; // standard icon
        p->iFlags = SUI_FLAG_REPEAT;
        p++;

        // Down arrow icon
        RegionSplitFromLeft(&rsub, &rbutton, TDM_BUTTON_WIDTH, 0);
        p->iLeft = rbutton.iLeft;
        p->iTop = rbutton.iTop;
        p->iRight = rbutton.iRight;
        p->iBottom = rbutton.iBottom;
        p->iText = "";
        p->iAction = PushDown;
        p->iIcon = G_downArrowIcon;
        p->iData = (void *)G_ws;
        p->iDraw = 0; // standard icon
        p->iFlags = SUI_FLAG_REPEAT;
        p++;
    }

    // Add the back button
    RegionShrink(&rbottom, 1);
    p->iLeft = rbottom.iLeft;
    p->iRight = rbottom.iLeft+EXIT_BUTTON_WIDTH-1;
    p->iTop = rbottom.iTop;
    p->iBottom = rbottom.iTop+EXIT_BUTTON_HEIGHT-1;
    p->iText = "Exit";
    p->iAction = TDMExit;
    p->iIcon = G_exitIcon;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // Use default
    p->iFlags = 0;
    p++;

    swim_set_font_transparency(&G_win, 0);
    swim_set_fill_transparent(&G_win, 0);
    swim_set_font_transparency(&G_win, 1);
    swim_set_font(&G_win, &TIME_DATE_FONT);
    G_ws->iBigDigitWidth = 2+swim_get_font_char_width(&G_win, '1');
    G_ws->iBigWidthSlash = 1+swim_get_font_char_width(&G_win, '/');
    G_ws->iBigDigitHeight = swim_get_font_height(&G_win);
    width = G_ws->iBigDigitWidth*6+/*2+TDM_BUTTON_WIDTH*/+G_ws->iBigWidthSlash*2+2*2+2*2;
    height = (G_ws->iBigDigitHeight+4)*2;
//    if ((TDM_BUTTON_HEIGHT*2+2)>height)
//        height = (TDM_BUTTON_HEIGHT*2+2);
    height += 2*2;
    width += 2*2; // padding
//    height += TDM_BUTTON_HEIGHT+2;

    RegionCenterTopBottom(&r, &G_ws->iRMiddle, height);
#if 0
    RegionSplitFromBottom(&G_ws->iRMiddle, &rtemp, TDM_BUTTON_HEIGHT, 2);
#endif
    rbuttons = G_ws->iRMiddle;
    RegionCenterLeftRight(&rbuttons, &G_ws->iRMiddle, width);
    rbuttons = G_ws->iRMiddle;

    // Now create the fields
    RegionSplitFromTop(&rbuttons, &rsub, G_ws->iBigDigitHeight+4, 2);

    RegionSplitFromLeft(&rsub, &G_ws->iRField1, G_ws->iBigDigitWidth*2, 4);
    RegionSplitFromLeft(&rsub, &G_ws->iRSlash1, G_ws->iBigWidthSlash, 0);
    rbutton = G_ws->iRField1;
    p->iLeft = rbutton.iLeft;
    p->iTop = rbutton.iTop;
    p->iRight = rbutton.iRight;
    p->iBottom = rbutton.iBottom;
    p->iText = "";
    p->iAction = SelectField1;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // standard icon
    p->iFlags = 0;
    p++;
    RegionSplitFromLeft(&rsub, &G_ws->iRField2, G_ws->iBigDigitWidth*2, 4);
    RegionSplitFromLeft(&rsub, &G_ws->iRSlash2, G_ws->iBigWidthSlash, 0);
    rbutton = G_ws->iRField2;
    p->iLeft = rbutton.iLeft;
    p->iTop = rbutton.iTop;
    p->iRight = rbutton.iRight;
    p->iBottom = rbutton.iBottom;
    p->iText = "";
    p->iAction = SelectField2;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // standard icon
    p->iFlags = 0;
    p++;
    RegionSplitFromLeft(&rsub, &G_ws->iRField3, G_ws->iBigDigitWidth*2, 0);
    rbutton = G_ws->iRField3;
    p->iLeft = rbutton.iLeft;
    p->iTop = rbutton.iTop;
    p->iRight = rbutton.iRight;
    p->iBottom = rbutton.iBottom;
    p->iText = "";
    p->iAction = SelectField3;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // standard icon
    p->iFlags = 0;
    p++;

    // Now create the fields
    RegionSplitFromTop(&rbuttons, &rsub, G_ws->iBigDigitHeight+4, 0);
    RegionSplitFromLeft(&rsub, &G_ws->iRField4, G_ws->iBigDigitWidth*2, 4);
    RegionSplitFromLeft(&rsub, &G_ws->iRSlash4, G_ws->iBigWidthSlash, 0);
    rbutton = G_ws->iRField4;
    p->iLeft = rbutton.iLeft;
    p->iTop = rbutton.iTop;
    p->iRight = rbutton.iRight;
    p->iBottom = rbutton.iBottom;
    p->iText = "";
    p->iAction = SelectField4;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // standard icon
    p->iFlags = 0;
    p++;
    RegionSplitFromLeft(&rsub, &G_ws->iRField5, G_ws->iBigDigitWidth*2, 4);
    RegionSplitFromLeft(&rsub, &G_ws->iRSlash5, G_ws->iBigWidthSlash, 0);
    rbutton = G_ws->iRField5;
    p->iLeft = rbutton.iLeft;
    p->iTop = rbutton.iTop;
    p->iRight = rbutton.iRight;
    p->iBottom = rbutton.iBottom;
    p->iText = "";
    p->iAction = SelectField5;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // standard icon
    p->iFlags = 0;
    p++;
    RegionSplitFromLeft(&rsub, &G_ws->iRField6, G_ws->iBigDigitWidth*2, 0);
    rbutton = G_ws->iRField6;
    p->iLeft = rbutton.iLeft;
    p->iTop = rbutton.iTop;
    p->iRight = rbutton.iRight;
    p->iBottom = rbutton.iBottom;
    p->iText = "";
    p->iAction = SelectField6;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // standard icon
    p->iFlags = 0;
    p++;

    // Mark the end of the choices
    p->iText = 0;

    swim_set_font(&G_win, &APP_DEMO_DEFAULT_FONT);
    ChoicesDraw(&G_win, G_ws->iChoices);

    TDMUpdate(G_ws);

    SUIShowPage0();
}
Example #15
0
/*---------------------------------------------------------------------------*
 * Routine:  CalibrateScreen
 *---------------------------------------------------------------------------*
 * Description:
 *      Draw the screen used for calibration.
 * Inputs:
 *      TUInt16 *aPixels            -- Pointer to pixel memory
 *      TUInt16 aX, aY              -- Coordinate of target to draw
 *---------------------------------------------------------------------------*/
void CalibrateScreen()
{
  T_uezDevice lcd;
  T_pixelColor *pixels;
  SWIM_WINDOW_T win;
  TUInt16 fontHeight;

  if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
    UEZLCDOn(lcd);
    UEZLCDBacklight(lcd, 256);

    SUIHidePage0();

    UEZLCDGetFrame(lcd, 0, (void **)&pixels);
    swim_window_open(
                     &win,
                     DISPLAY_WIDTH,
                     DISPLAY_HEIGHT,
                     pixels,
                     0,
                     0,
                     DISPLAY_WIDTH-1,
                     DISPLAY_HEIGHT-1,
                     2,
                     YELLOW,
                     RGB(0, 0, 0),
                     RED);
    swim_set_font(&win, &APP_DEMO_DEFAULT_FONT);
    swim_set_title(&win, "Touchscreen Calibration", BLUE);
    fontHeight =  swim_get_font_height(&win);

    switch(G_calibrateState)
    {
    case FIRST_TARGET_RETRY:
      swim_put_text_horizontal_centered(&win,
                       "Calibration error, please try again.",
                       DISPLAY_WIDTH,
                       (fontHeight));
      swim_put_text_horizontal_centered(&win,
                       "Accurately press the center of the",
                       DISPLAY_WIDTH,
                       (DISPLAY_HEIGHT-(4*fontHeight)));
      swim_put_text_horizontal_centered(&win,
                       "red and white target shown.",
                       DISPLAY_WIDTH,
                       (DISPLAY_HEIGHT-(3*fontHeight)));
      break;
    case FIRST_TARGET:
    default:
      swim_put_text_horizontal_centered(&win,
                       "Before using this device, the touch",
                       DISPLAY_WIDTH,
                       (fontHeight));
            swim_put_text_horizontal_centered(&win,
                       "screen must be properly calibrated.",
                       DISPLAY_WIDTH,
                       (2*fontHeight));

            swim_put_text_horizontal_centered(&win,
                       "Accurately press the center of the",
                       DISPLAY_WIDTH,
                       (DISPLAY_HEIGHT-(4*fontHeight)));

            swim_put_text_horizontal_centered(&win,
                       "red and white target shown.",
                       DISPLAY_WIDTH,
                       (DISPLAY_HEIGHT-(3*fontHeight)));

      }
  SUIShowPage0();
  }
}
Example #16
0
/*******************************************************************************************************************************
*	Function Name:		    vd_g_AppSysCheckInitTask
*	Called By:				Initialization
*	Timing:					Initialization
*	Description:			Called to initialize syscheck screen
*
*******************************************************************************************************************************/
void vd_g_AppSysCheckInitTask(void) 
{
    u1_s_sound_state = (U1)SYSCHK_NO_SOUND;
    swim_window_open(&syswin, 480, 272, (COLOR_T *)FRAMEBUFFER_PRIMARY, 0, 0, 479, 271, 0, WHITE, BLACK, BLACK);
    vd_g_IoLcdSetBuffer(FRAMEBUFFER_PRIMARY);
}
Example #17
0
/*---------------------------------------------------------------------------*
* Routine:  TitleScreen
*---------------------------------------------------------------------------*
* Description:
*      Draw the title screen at boot
*---------------------------------------------------------------------------*/
void TitleScreen(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;
    TUInt16 i;
    char buffer[15];

    G_romChecksumCalculated = EFalse;
    UEZTaskCreate(
                  (T_uezTaskFunction)CalcChecksumTask,
                  "Chksum",
                  UEZ_TASK_STACK_BYTES(128),
                  (void *)0,
                  UEZ_PRIORITY_NORMAL,
                  0);

    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDGetFrame(lcd, 0, (void **)&pixels);
        UEZLCDBacklight(lcd, 0);
        UEZLCDOff(lcd);

        SUIHidePage0();

        swim_window_open(
                         &G_mmWin,
                         DISPLAY_WIDTH,
                         DISPLAY_HEIGHT,
                         pixels,
                         0,
                         0,
                         DISPLAY_WIDTH-1,
                         DISPLAY_HEIGHT-1,
                         2,
                         YELLOW,
                         RGB(0, 0, 0),
                         RED);

        swim_set_font(&G_mmWin, &APP_DEMO_DEFAULT_FONT);        
#if DKTS_BUTTON_SLIDE_SHOW_DEMO
        SUILoadPicture("1:SPLASH.TGA",0,0,(TUInt8 *)FRAME(0));
#else
        SUIDrawIcon(
                    G_titleScreen,
                    (DISPLAY_WIDTH-TITLE_SCREEN_WIDTH)/2,
                    (DISPLAY_HEIGHT-TITLE_SCREEN_HEIGHT)/2);

        swim_set_font_transparency(&G_mmWin, 1);
        swim_put_text_xy(
                         &G_mmWin,
                         VERSION_AS_TEXT,
                         DISPLAY_WIDTH-60,
                         DISPLAY_HEIGHT-15);
#endif
        SUIShowPage0();

        UEZLCDOn(lcd);
#if FAST_STARTUP
        UEZLCDBacklight(lcd, 255);
#else
        for (i=0; i<256; i++)  {
            UEZLCDBacklight(lcd, i);
            UEZTaskDelay(1);
        }
#endif
        // Create checksum string
#if FAST_STARTUP
        sprintf(buffer, "CS:????");
#else
        while (!G_romChecksumCalculated)
            UEZTaskDelay(10);
        sprintf(buffer, "CS:%08X", G_romChecksum);
        swim_set_font_transparency(&G_mmWin, 1);
#if DKTS_BUTTON_SLIDE_SHOW_DEMO // skip checksum print
#else
        swim_put_text_xy(
                         &G_mmWin,
                         buffer,
                         5,
                         DISPLAY_HEIGHT-15);
#endif
        swim_set_font_transparency(&G_mmWin, 0);
#endif

    }
}
Example #18
0
/**********************************************************************
 *
 * Function: c_entry
 *
 * Purpose: Application entry point from the startup code
 *
 * Processing:
 *     See function.
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 *********************************************************************/
void c_entry(void)
{
    SWIM_WINDOW_T win1;
    COLOR_T clr, *fblog;
    int idx;
    UNS_16 xgs, ygs, curx, cury, curym, xidx;

    /* Disable interrupts in ARM core */
    disable_irq_fiq();

    /* Set virtual address of MMU table */
    cp15_set_vmmu_addr((void *)
		(IRAM_BASE + (256 * 1024) - (16 * 1024)));

	/* Initialize interrupt system */
    int_initialize(0xFFFFFFFF);

    /* Install standard IRQ dispatcher at ARM IRQ vector */
    int_install_arm_vec_handler(IRQ_VEC, (PFV) lpc32xx_irq_handler);

    /* Setup miscellaneous board functions */
    phy3250_board_init();

    /* enable clock to ADC block - 32KHz clock */
    clkpwr_clk_en_dis(CLKPWR_ADC_CLK,1);

    /* TSC IRQ goes active when the FIFO reaches the Interrupt level */
    int_install_irq_handler(IRQ_TS_IRQ, (PFV) tsc_user_interrupt);

    /* Enable interrupt */
    int_enable(IRQ_TS_IRQ);

    /* Open TSC, sets default timing values, fifo = 16, 
	 resolution = 10bits */
    tscdev = tsc_open(TSC, 0);

    /* TSC Auto mode enable, this also sets AUTO bit */
    tsc_ioctl(tscdev,TSC_AUTO_EN, 1);
	  
    /* Setup LCD muxing for STN Color 16BPP */
    clkpwr_setup_lcd(CLKPWR_LCDMUX_TFT16, 1);

    /* Enable clock to LCD block (HCLK_EN)*/
    clkpwr_clk_en_dis(CLKPWR_LCD_CLK, 1);
	
    /* Setup LCD paramaters in the LCD controller */
    lcddev = lcd_open(CLCDC, (INT_32) &LCD_DISPLAY);

    /* Upper Panel Frame Base Address register */
    lcd_ioctl(lcddev, LCD_SET_UP_FB, PHY_LCD_FRAME_BUF); 

    /* Enable LCD controller and power signals */
    lcd_ioctl(lcddev, LCD_PWENABLE, 1);

    /* Enable LCD backlight */
    phy3250_lcd_backlight_enable(TRUE);

    /* Enable LCD power */
    phy3250_lcd_power_enable(TRUE);
	
    /* write cursor image array data to cursor image RAM */
    lcd_ioctl(lcddev, LCD_CRSR_INIT_IMG, (INT_32) &cursorimage[0]);

    /* enable the default cursor 0 */
    lcd_ioctl(lcddev,LCD_CRSR_EN,1);

    /* set the cursor X/Y position */
    lcd_ioctl(lcddev, LCD_CRSR_XY, 0x0); 

    /* set the cursor pallette BGR value, col0*/
    lcd_ioctl(lcddev, LCD_CRSR_PAL0, 0x00ff0000); 

    /* set the cursor pallette BGR value, col1 */
    lcd_ioctl(lcddev, LCD_CRSR_PAL1, 0x000000ff); 

    /* Enable IRQ interrupts in the ARM core */
    enable_irq();

    /* Set frame buffer address */
    fblog = (COLOR_T *)cp15_map_physical_to_virtual(PHY_LCD_FRAME_BUF);

    /* Create a SWIM window */
    swim_window_open(&win1, LCD_DISPLAY.pixels_per_line,
        LCD_DISPLAY.lines_per_panel, fblog, 0, 0,
		(LCD_DISPLAY.pixels_per_line - 1), 
		(LCD_DISPLAY.lines_per_panel - 1),
        1, WHITE, BLACK, BLACK);

	/* Compute vertical size for bars */
	ygs = LCD_DISPLAY.lines_per_panel / 3;

	/* Draw Red bars */
	cury = 0;
	curx = 0;
	curym = ygs - 1;
	xgs = LCD_DISPLAY.pixels_per_line / RED_COLORS;
	clr = BLACK;
	for (xidx = 0; xidx < RED_COLORS; xidx++)
	{
		swim_set_pen_color(&win1, clr);
		for (idx = 0; idx <= xgs; idx++)
		{
			swim_put_line(&win1, curx, cury, curx, curym);
			curx++;
		}

		clr = clr + 0x0800;
	}

	/* Draw green bars */
	cury = cury + ygs;
	curx = 0;
	curym = cury + (ygs - 1);
	xgs = LCD_DISPLAY.pixels_per_line / GREEN_COLORS;
	clr = BLACK;
	for (xidx = 0; xidx < GREEN_COLORS; xidx++)
	{
		swim_set_pen_color(&win1, clr);
		for (idx = 0; idx <= xgs; idx++)
		{
			swim_put_line(&win1, curx, cury, curx, curym);
			curx++;
		}

		clr = clr + 0x0020;
	}

	/* Draw blue bars */
	cury = cury + ygs;
	curx = 0;
	curym = cury + (ygs - 1);
	xgs = LCD_DISPLAY.pixels_per_line / BLUE_COLORS;
	clr = BLACK;
	for (xidx = 0; xidx < BLUE_COLORS; xidx++)
	{
		swim_set_pen_color(&win1, clr);
		for (idx = 0; idx <= xgs; idx++)
		{
			swim_put_line(&win1, curx, cury, curx, curym);
			curx++;
		}

		clr = clr + 0x0001;
	}


    /* lets stay here forever */
    while(1);

}
Example #19
0
static void BCMScreen(T_brightnessControlWorkspace *G_ws)
{
    T_pixelColor *pixels;
    T_region r;
    T_region rbottom;
    T_region rtemp;
    TUInt32 width;
    T_choice *p = G_ws->iChoices;
    TUInt32 padding;

    SUIHidePage0();

    UEZLCDGetFrame(G_ws->iLCD, 0, (void **)&pixels);
    swim_window_open(
        &G_win,
        DISPLAY_WIDTH,
        DISPLAY_HEIGHT,
        pixels,
        0,
        0,
        DISPLAY_WIDTH-1,
        DISPLAY_HEIGHT-1,
        2,
        YELLOW,
        RGB(0, 0, 0),
        RED);
    swim_set_font(&G_win, &APP_DEMO_DEFAULT_FONT);
    G_ws->iFontHeight = swim_get_font_height(&G_win);
    swim_set_title(&G_win, "uEZ(tm) Brightness Control", BLUE);
    swim_set_pen_color(&G_win, YELLOW);
    swim_set_fill_color(&G_win, BLACK);

    r.iLeft = 0;
    r.iTop = 0;
    r.iRight = G_win.xvsize;
    r.iBottom = G_win.yvsize;

    // Come off the edges
    RegionShrink(&r, SCREEN_EDGE_MIN_PADDING-2);

    // Add the back button
    RegionSplitFromBottom(&r, &rbottom, 4+G_ws->iFontHeight+2+EXIT_BUTTON_HEIGHT, 5);
    //RegionCenterLeftRight(&rbottom, &rtemp, EXIT_BUTTON_WIDTH);
    //rbottom = rtemp;

    rtemp = rbottom;
    RegionSplitFromLeft(&rtemp, &rbottom, EXIT_BUTTON_WIDTH, 5);

    RegionShrink(&rbottom, 1);
    p->iLeft = rbottom.iLeft;
    p->iRight = rbottom.iLeft+EXIT_BUTTON_WIDTH-1;
    p->iTop = rbottom.iTop;
    p->iBottom = rbottom.iTop+EXIT_BUTTON_HEIGHT-1;
    p->iText = "Exit";
    p->iAction = BCMExit;
    p->iIcon = G_exitIcon;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // Use default
    p++;

    rbottom = rtemp;
    RegionCenterLeftRight(&rbottom, &rtemp, 100);
    RegionSplitFromBottom(&rtemp, &G_ssOptionBox, (rtemp.iBottom-rtemp.iTop)/2+6, 5); // location of screen saver option box
    //RegionSplitFromLeft(&rtemp, &G_ssOptionBox, (rtemp.iBottom-rtemp.iTop)/2 - swim_get_font_height(&G_win)/2, 5);
    G_ssOptionBox.iRight = G_ssOptionBox.iLeft+swim_get_font_height(&G_win)+16; // size of screen saver option box
    G_ssOptionBox.iBottom = G_ssOptionBox.iTop+swim_get_font_height(&G_win)+16;

    p->iLeft = G_ssOptionBox.iLeft;
    p->iRight = G_ssOptionBox.iRight;
    p->iTop = G_ssOptionBox.iTop;
    p->iBottom = G_ssOptionBox.iBottom;
    p->iText = "";
    p->iAction = BCMScreenSaverToggle;
    p->iIcon = 0;
    p->iData = (void *)G_ws;
    p->iDraw = 0; // Use default
    p++;

    // Determine the spacing between slider and RGB
    // Determine width used
    width = BCM_COLORS_WIDTH+BCM_SLIDE_PANEL_INNER_PADDING*2+BCM_SLIDE_PANEL_OUTER_PADDING*2+BCM_GROOVE_WIDTH;
    // Now subtract that from the full width available.
    width = (1+r.iRight-r.iLeft)-width;
    // Split it 3 ways to divide it evenly
    padding = width/3;

    // Now use this padding to take a chunk out of the left
    RegionSplitFromLeft(&r, &rtemp, 0, padding);
    // Now determine the region for the slider
    RegionSplitFromLeft(
        &r,
        &G_ws->iRSlidePanel,
        BCM_SLIDE_PANEL_INNER_PADDING*2+BCM_SLIDE_PANEL_OUTER_PADDING*2+BCM_GROOVE_WIDTH,
        padding);
    RegionCenterLeftRight(&G_ws->iRSlidePanel, &G_ws->iRGroove, BCM_GROOVE_WIDTH);
    RegionShrinkTopBottom(&G_ws->iRGroove, BCM_SLIDE_PANEL_INNER_PADDING);

    // Now place the colors on the right
    RegionSplitFromLeft(
        &r,
        &rtemp,
        BCM_COLORS_WIDTH,
        0);
    RegionCenterTopBottom(
        &rtemp,
        &G_ws->iRColors,
        BCM_COLORS_HEIGHT);

    swim_set_font(&G_win, &APP_DEMO_DEFAULT_FONT);

    swim_set_font_transparency(&G_win, 1);
    swim_set_fill_transparent(&G_win, 0);
    swim_set_pen_color(&G_win, YELLOW);
    r = G_ws->iRSlidePanel;
    swim_put_box(
        &G_win,
        r.iLeft,
        r.iTop,
        r.iRight,
        r.iBottom);
    r = G_ws->iRGroove;
    swim_put_box(
        &G_win,
        r.iLeft,
        r.iTop,
        r.iRight,
        r.iBottom);

    DrawScreenSaverBox(G_ws);

    swim_put_text_xy(&G_win, "Screen Saver On/Off",
                     G_ssOptionBox.iLeft+swim_get_font_height(&G_win)+22,//x
                     G_ssOptionBox.iTop+8);//y

    // Now do the RTC
    // Now draw the fields
    IPatternOfColors(G_ws);

    swim_set_pen_color(&G_win, YELLOW);
    ChoicesDraw(&G_win, G_ws->iChoices);

    SUIShowPage0();
}