Exemplo n.º 1
0
/*******************************************************************************************************************************
*	Function Name:		    vd_s_AppSysCheckUpdBgnd
*	Called By:				vd_g_AppSysCheckTask10ms
*	Timing:					10ms
*	Description:			Update Syscheck Background
*
*******************************************************************************************************************************/
static void vd_s_AppSysCheckUpdBgnd(void)
{
    U1 u1_t_btn;

    u1_t_btn = u1_g_IoGetBtnA();
    if(!(u1_t_btn))
    {
        swim_clear_screen(&syswin, GREEN);
    }


    u1_t_btn = u1_g_IoGetBtnB();
    if(!(u1_t_btn))
    {
        swim_clear_screen(&syswin, RED);
    }


    u1_t_btn = u1_g_IoGetBtnC();
    if(!(u1_t_btn))
    {
        swim_clear_screen(&syswin, YELLOW);
    }


    u1_t_btn = u1_g_IoGetBtnD();
    if(!(u1_t_btn))
    {
        swim_clear_screen(&syswin, BLUE);
    }
}
Exemplo n.º 2
0
/***********************************************************************
 *
 * Function: swim_window_open_p
 *
 * Purpose: Initializes a window and the default values for the window
 *
 * Processing:
 *     See function.
 *
 * Parameters:
 *     win          : Preallocated windows structure to fill
 *     xsize        : Physical horizontal dimension of the display
 *     ysize        : Physical vertical dimension of the display
 *     fbaddr       : Address of the display's frame buffer
 *     xwin_min     : Physical window left coordinate
 *     ywin_min     : Physical window top coordinate
 *     xwin_max     : Physical window right coordinate
 *     ywin_max     : Physical window bottom coordinate
 *     border_width : Width of the window border in pixels
 *     pcolor       : Pen color
 *     bkcolor      : Background color
 *     fcolor       : Fill color
 *     clear        : Clear window flag
 *
 * Outputs: None
 *
 * Returns:
 *  TRUE if the window was initialized correctly, otherwise FALSE
 *
 * Notes:
 *     This function must be called prior to any other window function
 *
 **********************************************************************/
BOOL_32 swim_window_open_p(
    SWIM_WINDOW_T *win,
    INT_32 xsize,
    INT_32 ysize,
    COLOR_T *fbaddr,
    INT_32 xwin_min,
    INT_32 ywin_min,
    INT_32 xwin_max,
    INT_32 ywin_max,
    INT_32 border_width,
    COLOR_T pcolor,
    COLOR_T bkcolor,
    COLOR_T fcolor,
    BOOL_32 clear)
{
    INT_32 i;
    BOOL_32 init = FALSE;

    /* Before continuing, check to see that the window size is
     in the physical dimensions of the display */
    if ((xwin_min >= 0) && (ywin_min >= 0) && (xwin_max < xsize)
        && (ywin_max < ysize)) {
        init = TRUE;
    } else {
        /* Window size is out of the physical display size, so it
         should be invalidated */
        win->winused = 0x0;
    }

    if (init == TRUE) {
        /* Save physical display dimensions */
        win->xpsize = xsize;
        win->ypsize = ysize;

        /* Save frame buffer address */
        win->fb0 = win->fb = fbaddr;
        win->page = 0;

        /* Save physical window dimensions and default colors */
        win->xpmin = xwin_min;
        win->ypmin = ywin_min;
        win->xpmax = xwin_max;
        win->ypmax = ywin_max;
        win->pen = pcolor;
        win->bkg = bkcolor;
        win->fill = fcolor;

        /* Compute physical window dimensions of draw area only */
        win->xpvmin = xwin_min + border_width;
        win->ypvmin = ywin_min + border_width;
        win->xpvmax = xwin_max - border_width;
        win->ypvmax = ywin_max - border_width;

        /* Compute virtual window size of draw area */
        win->xvsize = xwin_max - xwin_min - 2 * border_width;
        win->yvsize = ywin_max - ywin_min - 2 * border_width;

        /* Fill in any unused border padding between draw area and border
         will fill color */
        for (i = 0; i < border_width; i++) {
            swim_put_line_raw(win, (xwin_min + i), (ywin_min + i),
                (xwin_max - i), (ywin_min + i));
            swim_put_line_raw(win, (xwin_max - i), (ywin_min + i),
                (xwin_max - i), (ywin_max - i));
            swim_put_line_raw(win, (xwin_max - i), (ywin_max - i),
                (xwin_min + i), (ywin_max - i));
            swim_put_line_raw(win, (xwin_min + i), (ywin_max - i),
                (xwin_min + i), (ywin_min + i));
        }

        /* Clear draw area with background color */
        if (clear == TRUE) {
            swim_clear_screen(win, bkcolor);
        }

        /* Use no default font and make background transparent */
        win->font = 0;

        /* Set starting text position in upper left of window */
        win->xvpos = win->xpvmin;
        win->yvpos = win->ypvmin;

        /* Set fill to NOT be transparent */
        win->tfill = 0;
    }

    return init;
}