コード例 #1
0
ファイル: MainMenu.c プロジェクト: EnricoGiordano1992/Tesi
/*---------------------------------------------------------------------------*
 * Routine:  MainMenu
 *---------------------------------------------------------------------------*
 * Description:
 *      Present the main menu
 *---------------------------------------------------------------------------*/
void MainMenu(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;

    // Open the LCD and get the pixel buffer
    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDGetFrame(lcd, 0, (void **)&pixels);

#if (!FAsT_STARTUP)
        // Clear the screen
        TitleScreen();
        //while(1);
        PlayAudio(523, 100);
        PlayAudio(659, 100);
        PlayAudio(783, 100);
        PlayAudio(1046, 100);
        PlayAudio(783, 100);
        PlayAudio(659, 100);
        PlayAudio(523, 100);

        // Force calibration?
        Calibrate(CalibrateTestIfTouchscreenHeld());

        UEZTaskDelay(1000);
#else
        UEZLCDBacklight(lcd, 255);
        Calibrate(FALSE);
#endif
        AppMenu(&mainmenu);
        UEZLCDClose(lcd);
    }
}
コード例 #2
0
ファイル: TestMode.c プロジェクト: EnricoGiordano1992/Tesi
/*---------------------------------------------------------------------------*
 * 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();
    }
}
コード例 #3
0
ファイル: Calibration.c プロジェクト: FutureDesigns/uEZ
/*---------------------------------------------------------------------------*
 * 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();
    }
}
コード例 #4
0
ファイル: MainTask.c プロジェクト: FutureDesigns/uEZ
/*---------------------------------------------------------------------------*/
void ScreenOn(void)
{
    T_uezDevice lcd;
    int i;

    UEZLCDOpen("LCD", &lcd);
    if (!G_screenOn) {
        UEZLCDBacklight(lcd, 0);
        UEZLCDOn(lcd);
        for (i = 0; i < 255; i++) {
            UEZLCDBacklight(lcd, i);
            UEZTaskDelay(2);
        }
        G_screenOn = ETrue;
    }
    UEZLCDClose(lcd);
}
コード例 #5
0
ファイル: TestCmds.c プロジェクト: FutureDesigns/uEZ
int UEZGUICmdAmplifier(void *aWorkspace, int argc, char *argv[])
{
#if 0
    T_uezError error;
    T_uezDevice amp;

    if (argc == 2) {
        error = UEZAudioAmpOpen("AMP0", &amp);
        if (error) {
            FDICmdSendString(aWorkspace, "FAIL: No Driver\n");
        } else {
            error = UEZAudioAmpSetLevel(amp, FDICmdUValue(argv[1]));
            if (error) {
                FDICmdSendString(aWorkspace, "FAIL: Set Failed\n");
            } else {
                FDICmdSendString(aWorkspace, "PASS: OK\n");
            }
            UEZAudioAmpClose(amp);
        }
#else
    if (argc == 2) {
        UEZAudioMixerSetLevel(UEZ_AUDIO_MIXER_OUTPUT_ONBOARD_SPEAKER, FDICmdUValue(argv[1]));
        FDICmdSendString(aWorkspace, "PASS: OK\n");
#endif
    } else {
        FDICmdSendString(aWorkspace, "FAIL: Incorrect parameters\n");
    }
    return 0;
}

int UEZGUICmdBacklight(void *aWorkspace, int argc, char *argv[])
{
    T_testData testData;
    T_uezDevice lcd;

    if (argc == 1) {
        // Got no parameters
        // Now do the test
        IUEZGUICmdRunTest(aWorkspace, FuncTestBacklightMonitor, &testData);
    }  else if(argc == 2){
        if(UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE){
            UEZLCDBacklight(lcd, FDICmdUValue(argv[1]));
            UEZLCDClose(lcd);
        }
    }else {
        FDICmdSendString(aWorkspace, "FAIL: Incorrect parameters\n");
    }
    return 0;
}
コード例 #6
0
ファイル: uEZFailure.c プロジェクト: FutureDesigns/uEZ
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);
    }
}
コード例 #7
0
ファイル: MainMenu.c プロジェクト: EnricoGiordano1992/Tesi
/*---------------------------------------------------------------------------*
 * Routine:  MainMenu
 *---------------------------------------------------------------------------*
 * Description:
 *      Present the main menu
 *---------------------------------------------------------------------------*/
void MainMenu(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;

    // Open the LCD and get the pixel buffer
    if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
        UEZLCDGetFrame(lcd, 0, (void **)&pixels);

#if (!FAsT_STARTUP)
        // Clear the screen
        TitleScreen();
		//while(1);
        PlayAudio(523, 100);
        PlayAudio(659, 100);
        PlayAudio(783, 100);
        PlayAudio(1046, 100);
        PlayAudio(783, 100);
        PlayAudio(659, 100);
        PlayAudio(523, 100);

        // Force calibration?
        Calibrate(CalibrateTestIfTouchscreenHeld());

        UEZTaskDelay(1000);

#else
        UEZLCDBacklight(lcd, 255);
        Calibrate(FALSE);
#endif
        
        // Set the screen saver icon
        BouncingLogoSS_Setup(
            (TUInt8 *)G_uEZLogo,
            UEZ_ICON_WIDTH,
            UEZ_ICON_HEIGHT,
            DISPLAY_WIDTH,
            DISPLAY_HEIGHT);
        
        AppMenu(&mainmenu);
        UEZLCDClose(lcd);
    }
}
コード例 #8
0
ファイル: MainTask.c プロジェクト: FutureDesigns/uEZ
/*---------------------------------------------------------------------------*/
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();
}
コード例 #9
0
ファイル: MainMenu.c プロジェクト: EnricoGiordano1992/Tesi
/*---------------------------------------------------------------------------*
 * 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

    }
}
コード例 #10
0
ファイル: MainMenu.c プロジェクト: EnricoGiordano1992/Tesi
void MainMenu(void)
{
    T_uezDevice lcd;
    T_pixelColor *pixels;
    T_uezQueue queue;

    // Setup queue to receive touchscreen events
    if (UEZQueueCreate(1, sizeof(T_uezTSReading), &queue) == UEZ_ERROR_NONE) {
        // Open the LCD and get the pixel buffer
        if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE)  {
            UEZLCDGetFrame(lcd, 0, (void **)&pixels);
            UEZLCDOn(lcd);

#if (!FAST_STARTUP)
            // Clear the screen
            TitleScreen();

            PlayAudio(523, 100);
            PlayAudio(659, 100);
            PlayAudio(783, 100);
            PlayAudio(1046, 100);
            PlayAudio(783, 100);
            PlayAudio(659, 100);
            PlayAudio(523, 100);                


#if DKTS_BUTTON_SLIDE_SHOW_DEMO // show emwin on button 1, auto slideshow on buttons 2-4
#include <uEZButton.h>
#include <GUIDEMO.h>

            T_uezDevice ButtonBank;
            TUInt32 buttonsActive = 0x0F; // buttons 1-4
            TUInt32 ButtonsPressed;
            T_slideshowDefinition aDef;
            aDef.iDrive = 1;
            if (UEZButtonBankOpen("ButtonBank0", &ButtonBank) == UEZ_ERROR_NONE) {
                // the device opened properly
                if (UEZButtonBankSetActive(ButtonBank, buttonsActive) == UEZ_ERROR_NONE) {
                    // set active successful
                }
                if (UEZButtonBankRead(ButtonBank, &ButtonsPressed) == UEZ_ERROR_NONE) { // got buttons pressed
                    if (ButtonsPressed == 14) { // button 1 pressed
                        const T_choice aChoice = {0};
                        emWin(&aChoice);
                    }
                    else if (ButtonsPressed == 13) { // button 2 pressed
                        char str1[] = {'F','D','I',' ','O','v','e','r','v','i','e','w','\0'};
                        memcpy(aDef.iName,str1,strlen(str1)+1);
                        char str2[] = {'F','D','I','\0'};
                        memcpy(aDef.iDirectory,str2,strlen(str2)+1);
                        SingleSlideshowMode(&aDef);
                        
                        // change to Speedometer Demo here
                        
                    }
                    else if (ButtonsPressed == 11) { // button 3 pressed
                        char str3[] = {'u','E','Z','G','U','I',' ','F','a','m','i','l','y','\0'};
                        memcpy(aDef.iName,str3,strlen(str3)+1);
                        char str4[] = {'U','E','Z','G','U','I','\0'};
                        memcpy(aDef.iDirectory,str4,strlen(str4)+1);
                        SingleSlideshowMode(&aDef);
                    }
                    else if (ButtonsPressed == 7) { // button 4 pressed
                        char str5[] = {'D','e','m','o','n','s','t','r','a','t','i',
                        'o','n',' ','P','i','c','t','u','r','e','s','\0'};
                        memcpy(aDef.iName,str5,strlen(str5)+1);
                        char str6[] = {'D','E','M','O','P','I','C','S','\0'};
                        memcpy(aDef.iDirectory,str6,strlen(str6)+1);
                        SingleSlideshowMode(&aDef);
                    }
                    else{ }
                }
                if (UEZButtonBankClose(ButtonBank) != UEZ_ERROR_NONE) {// error closing button bank
                }
            } else {// an error occurred opening Button Bank
            }
            Calibrate(CalibrateTestIfTouchscreenHeld()); // turn touchscreen back on since touchscreen present on KOE
#else
            // Force calibration?
            Calibrate(CalibrateTestIfTouchscreenHeld());
#endif
            //UEZTaskDelay(1000);
#else
            UEZLCDBacklight(lcd, 255);
#endif
            UEZTaskDelay(10000);

            AppMenu(&mainmenu);
            UEZLCDClose(lcd);
        }
    }
}
コード例 #11
0
ファイル: MainMenu.c プロジェクト: EnricoGiordano1992/Tesi
/*---------------------------------------------------------------------------*
* 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

    }
}
コード例 #12
0
ファイル: Calibration.c プロジェクト: EnricoGiordano1992/Tesi
/*---------------------------------------------------------------------------*
 * 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();
  }
}