Dr. Davis and Dr. Dyer special studies robotics project
Dependencies: BSP_DISCO_F469NI LCD_DISCO_F469NI TS_DISCO_F469NI mbed Motordriver
Fork of Configurable_Robots by
Classes/RobotMVC/RobotView.cpp
- Committer:
- blu12758
- Date:
- 2017-02-08
- Revision:
- 8:1173b502b316
- Parent:
- 7:0f8c3dfbbb86
- Child:
- 9:4ae116881502
File content as of revision 8:1173b502b316:
//OU Configurable Robot Project //Spring 2017 //William Bonner #include "RobotView.h" //Constructors/Destructors RobotView::~RobotView() { //#TODO } RobotView::RobotView() { _page = 0; } //Initialize the screen to display the robot menu void RobotView::init() { //Show splash screen update(); wait(1); //Initialize touchscreen and display results uint8_t status = _ts.Init(_lcd.GetXSize(), _lcd.GetYSize()); if (status != TS_OK) { _lcd.Clear(LCD_COLOR_RED); _lcd.SetBackColor(LCD_COLOR_RED); _lcd.SetTextColor(LCD_COLOR_WHITE); _lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE); } else { _lcd.Clear(LCD_COLOR_GREEN); _lcd.SetBackColor(LCD_COLOR_GREEN); _lcd.SetTextColor(LCD_COLOR_WHITE); _lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE); } wait(1); } //Write the current page to the lcd void RobotView::update() { //Clear Screen clear(); switch(_page) { case 0://Welcome Screen _lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"Configurable Robot", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"University of Oklahoma", CENTER_MODE); break; case 1://Main Menu _lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"Configurable Robot", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(2), (uint8_t *)"University of Oklahoma", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Line Follower", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"Object Avoidance", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(11), (uint8_t *)"Object Seeking", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(14), (uint8_t *)"Light Avoidance", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(17), (uint8_t *)"TV Remote Control", CENTER_MODE); _lcd.DisplayStringAt(0, LINE(20), (uint8_t *)"Wiimote Control", CENTER_MODE); default: break; } //#TODO Display supply voltage } //Clear the screen void RobotView::clear() { _lcd.Clear(LCD_COLOR_WHITE); _lcd.SetBackColor(LCD_COLOR_WHITE); _lcd.SetTextColor(LCD_COLOR_BLUE); } //Check for touches on the screen bool RobotView::listen() { _ts.GetState(&TS_State); if (TS_State.touchDetected) { ts_x = TS_State.touchX[0]; ts_y = TS_State.touchY[0]; return true; } return false; }