Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Menu/Menu.h
- Committer:
- lewisgw
- Date:
- 2019-05-04
- Revision:
- 27:c920c5ec31af
- Parent:
- 25:aa145767fda5
- Child:
- 28:be77ad6c0bda
File content as of revision 27:c920c5ec31af:
#ifndef MENU_H
#define MENU_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "EngineController.h"
/** State for finite state machine struct */
struct State {
int output; /**< Integer for output number. */
int next_state[4]; /**< Array of integers for next possible states. */
};
/** Menu Class
* @brief Class to control the overall state of the game
* @author Lewis Wooltorton
* @date April 2019
*/
class Menu {
public:
// Constructor and Destructor.
/**
* @brief Constructor @details Non user specified.
*/
Menu();
/**
* @brief Destructor @details Non user specified.
*/
~Menu();
// Mutators
/**
* @brief Initialises the Menu object.
*/
void init();
/**
* @brief Runs the menu via a state machine.
* @param &lcd @details The lcd object from the N5110 class
* @param &gamepad @details The gamepad object from Gamepad class
*/
void run(N5110 &lcd, Gamepad &gamepad);
private:
void set_input(bool start, bool back, bool x);
void run_game(N5110 &lcd, Gamepad &gamepad);
void display_menu(N5110 &lcd, Gamepad &gamepad);
void display_controls(N5110 &lcd, Gamepad &gamepad);
void output(N5110 &lcd, Gamepad &gamepad);
void play_tone(Gamepad &gamepad);
void play_chord_a(Gamepad &gamepad);
void play_chord_b(Gamepad &gamepad);
int _menu_input;
EngineController _controller;
bool _button;
int _state;
int _output;
bool _tone_flag;
int _tone_counter;
int _chord_counter;
};
#endif