Пример #1
0
rtems_task Task_1(
  rtems_task_argument argument
)
{
  Screen1();
  rtems_test_pause_and_screen_number( 2 );

  Screen2();
  rtems_test_pause_and_screen_number( 3 );

  Screen3();
  rtems_test_pause_and_screen_number( 4 );

  Screen4();
  rtems_test_pause_and_screen_number( 5 );

  Screen5();
  rtems_test_pause_and_screen_number( 6 );

  Screen6();
  rtems_test_pause_and_screen_number( 7 );

  Screen7();
  rtems_test_pause_and_screen_number( 8 );

  Screen8();
  rtems_test_pause_and_screen_number( 9 );

  Screen9();
  rtems_test_pause_and_screen_number( 10 );

  Screen10();
  rtems_test_pause_and_screen_number( 11 );

  Screen11();
  rtems_test_pause_and_screen_number( 12 );

  Screen12();
  rtems_test_pause_and_screen_number( 13 );

  Screen13();
  rtems_test_pause_and_screen_number( 14 );

  Screen14();

  puts( "*** END OF TEST 9 ***" );
  rtems_test_exit( 0 );
}
Пример #2
0
void getScreen5()
{
    switch(gv_scr5state) {
        case SC5NULL:
            if (gv_short_sw) {
                nextSC5(SC5YEAR);
            }
            break;
        case SC5YEAR:
            blinkCursor(0, 0, true);

            if (gv_rot_active) {
                gv_rot_active = false;
                if (gv_rot_pos) {
                    gv_rot_pos = false;
                    gv_year_val++;
                }
                if (gv_rot_neg) {
                    gv_rot_neg = false;
                    gv_year_val--;
                }

                if (gv_year_val > 2099) {
                    gv_year_val = 2015;
                }

                if (gv_year_val < 2015) {
                    gv_year_val = 2099;
                }
            }

            lcd->setCursor(2,0);
            lcd->print(gv_year_val);
            lcd->setCursor(0,0);

            if (gv_short_sw) {
                nextSC5(SC5MON);
            }
            break;
        case SC5MON:
            blinkCursor(7, 0, true);

            if (gv_rot_active) {
                gv_rot_active = false;
                if (gv_rot_pos) {
                    gv_rot_pos = false;
                    gv_mon_num++;
                }
                if (gv_rot_neg) {
                    gv_rot_neg = false;
                    gv_mon_num--;
                }

                if (gv_mon_num > 12) {
                    gv_mon_num = 1;
                }

                if (gv_mon_num < 1) {
                    gv_mon_num = 12;
                }
            }

            lcd->setCursor(9,0);
            lcd->print(gv_mon_num);
            lcd->setCursor(7,0);

            if (gv_short_sw) {
                nextSC5(SC5DAY);
            }
            break;
        case SC5DAY:
            lcd->setCursor(12,0);
            blinkCursor(12, 0, true);

            if (gv_rot_active) {
                gv_rot_active = false;
                if (gv_rot_pos) {
                    gv_rot_pos = false;
                    gv_day_val++;
                }
                if (gv_rot_neg) {
                    gv_rot_neg = false;
                    gv_day_val--;
                }

                if (gv_day_val > 31) {
                    gv_day_val = 1;
                }

                if (gv_day_val < 1) {
                    gv_day_val = 31;
                }
            }

            lcd->setCursor(14,0);
            lcd->print(gv_day_val);
            lcd->setCursor(12,0);

            if (gv_short_sw) {
                nextSC5(SC5HOUR);
            }
            break;
        case SC5HOUR:
            blinkCursor(0, 1, true);

            if (gv_rot_active) {
                gv_rot_active = false;
                if (gv_rot_pos) {
                    gv_rot_pos = false;
                    gv_currhour++;
                }
                if (gv_rot_neg) {
                    gv_rot_neg = false;
                    gv_currhour--;
                }

                if (gv_currhour > 23) {
                    gv_currhour = 0;
                }

                if (gv_currhour < 0) {
                    gv_currhour = 23;
                }
            }

            lcd->setCursor(2,1);
            lcd->print("00");
            if (gv_currhour < 10)
                lcd->setCursor(3,1);
            else
                lcd->setCursor(2,1);
            lcd->print(gv_currhour);
            lcd->setCursor(0,1);

            if (gv_short_sw) {
                nextSC5(SC5MIN);
            }
            break;
        case SC5MIN:
            blinkCursor(5, 1, true);

            if (gv_rot_active) {
                gv_rot_active = false;
                if (gv_rot_pos) {
                    gv_rot_pos = false;
                    gv_currmin++;
                }
                if (gv_rot_neg) {
                    gv_rot_neg = false;
                    gv_currmin--;
                }

                if (gv_currmin > 59) {
                    gv_currmin = 0;
                }

                if (gv_currmin < 0) {
                    gv_currmin = 59;
                }
            }

            lcd->setCursor(7,1);
            lcd->print("00");
            if (gv_currmin < 10)
                lcd->setCursor(8,1);
            else
                lcd->setCursor(7,1);
            lcd->print(gv_currmin);
            lcd->setCursor(5,1);

            if (gv_short_sw) {
                nextSC5(SC5SET);
            }
            break;
        case SC5SET:
            lcd->clear();
            lcd->setCursor(0,0);
            // Set the RTC with new time/day values
            if (setTstatTime())
                lcd->print("Clock set OK");
            else
                lcd->print("Clock set failed");
            delay(2000);
            Screen5();

            nextSC5(SC5NULL);
            break;
    }
}
Пример #3
0
// Display control state machine
// Uses decoded control input to manipulate the display screens and settings.
// gv_input_active will remain true until screen 5 exit.
bool processInput()
{
    bool rc = false;

    switch(gv_dispstate) {
        case DS0:
            // The primary alternating status screens
            if (gv_long_sw && gv_saw_button) {
                nextLCDdisp(DS1);
                rc = true;
            }

            break;
        case DS1:       // Screen 3
            // Settings screen
            if (!gv_showscreen) {
                DispLED(true);
                Screen3(SHOW_ALL);
                gv_showscreen = true;
                gv_saw_button = false;
            }

            if (gv_dblclick && gv_saw_button) {
                gv_dblclick = false;
                nextLCDdisp(DS0);
            }
            else if (gv_long_sw && gv_saw_button) {
                nextLCDdisp(DS2);
            }
            else
                getScreen3();

            rc = true;

            break;
        case DS2:       // Screen 4
            // Profile edit screen
            if (!gv_showscreen) {
                DispLED(true);
                Screen4(gv_sc4mode);
                gv_showscreen = true;
                gv_saw_button = false;
            }

            if (gv_dblclick && gv_saw_button) {
                gv_dblclick = false;
                nextLCDdisp(DS0);
            }
            else if (gv_long_sw && gv_saw_button) {
                nextLCDdisp(DS3);
            }
            else
                getScreen4();

            rc = true;

            break;
        case DS3:       // Screen 5
            // Time/date setup screen
            if (!gv_showscreen) {
                DispLED(true);
                Screen5();
                gv_showscreen = true;
                gv_saw_button = false;
            }

            if (gv_dblclick && gv_saw_button) {
                gv_dblclick = false;
                nextLCDdisp(DS0);
            }
            else if (gv_long_sw && gv_saw_button) {
                nextLCDdisp(DS0);
                rc = false;
            }
            else {
                rc = true;
                getScreen5();
            }

            break;
    }

    return rc;
}