ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Menu.h Source File

Menu.h

00001 #ifndef MENU_H
00002 #define MENU_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Front.h"
00008 
00009 /** Menu class
00010  * @author Luke Cartwright, University of Leeds
00011  * @brief manages all menu selection and movement
00012  * @date May 2020
00013 */
00014 
00015 class Menu
00016 {
00017 public://-----------------------------------------------------------------------
00018     //methods
00019     /**constructor */
00020     Menu();
00021 
00022     /**destructor */
00023     ~Menu();
00024 
00025     /**runs main menu code
00026     * @manages all main menu code and runs continually once called
00027     */
00028     void mainmenu(N5110 &lcd, Gamepad &pad);
00029 
00030     //sub menus
00031     /** Waveform submenu function
00032     * @Runs Waveform submenu code
00033     */
00034     void subwaveforms(N5110 &lcd, Gamepad &pad);
00035     
00036     /** Instructions submenu function
00037     * @Runs Instruction submenu code
00038     */
00039     void subinstructions(N5110 &lcd, Gamepad &pad);
00040     
00041     /** Settings submenu function
00042     * @Runs Settings submenu code
00043     */
00044     void subsettings(N5110 &lcd, Gamepad &pad);
00045     
00046     /** Credits submenu function
00047     * @Runs Credits submenu code
00048     */
00049     void subcredits(N5110 &lcd, Gamepad &pad);
00050     
00051     /** Scrolling function
00052     * @Function controlling scrolling in menus
00053     * @checks doesnt exceed bounds
00054     * @returns int value of menu item selected
00055     */
00056     int scroll(N5110 &lcd, Gamepad &pad, int submenu, int menusize);
00057     
00058     /** Volume adjust function
00059     * @Runs Volume adjustment code
00060     */
00061     void volumerun(N5110 &lcd, Gamepad &pad);
00062     
00063     /** Backlight adjust function
00064     * @toggles Backlight
00065     */
00066     void backlightrun(N5110 &lcd, Gamepad &pad);
00067     
00068     /** Contrast adjust function
00069     * @Runs Contrast adjustment code
00070     */
00071     void contrastrun(N5110 &lcd, Gamepad &pad);
00072     
00073     /** Screen Mode adjust function
00074     * @toggles inverse/normal mode
00075     */
00076     void inverse_mode(N5110 &lcd, Gamepad &pad);
00077     
00078 private: //---------------------------------------------------------------------
00079     //Global Variables
00080     int g_selecty; //variable to manage select box y coordinate
00081 
00082     //variables
00083     int menuflag; //flag to keep in menu loop
00084     int submenu; //submenu selected var
00085     int menusize; //size of each menu
00086     float contrast; //contrast float
00087     enum d; //direction
00088     int s; //current direction as int
00089     int s_1; //previous direction as int
00090     bool toggle; //Variable used for Backlight toggle 
00091 
00092     //Methods
00093     
00094     /** Prints Main Menu to LCD */
00095     void printmainmenu(N5110 &lcd);
00096     
00097     /** Prints Waveforms Submenu to LCD */
00098     void printsubwaveforms(N5110 &lcd);
00099     
00100     /** Prints Settings Submenu to LCD */
00101     void printsubsettings(N5110 &lcd);
00102     
00103     /** Prints Contrast adjust screen to LCD */
00104     void printcontrast(N5110 &lcd, float contrast);
00105     
00106     /**Function checks for joystick movement
00107     * @returns intiger value of scroll direction
00108     */
00109     int scroll_check(Gamepad &pad);
00110 };
00111 
00112 #endif