|
Simone: a game of visual memory and speed
|
Simone FSM main file. More...
#include <stdlib.h>#include <stdio.h>#include <time.h>#include "port_system.h"#include "port_simone.h"#include "rgb_colors.h"#include "fsm.h"#include "fsm_simone.h"Functions | |
| static char | _get_key_from_color (rgb_color_t color) |
| Get the expected key from a given color. | |
| static rgb_color_t | _get_color_from_key (char key) |
| Get the color corresponding to a given key. | |
| static void | _add_color (fsm_simone_t *p_fsm_simone) |
| Add a new color and intensity to the sequence. | |
| static bool | check_on (fsm_t *p_this) |
| Check if the button has been pressed for the required time to turn ON the Simone system. | |
| static bool | check_off (fsm_t *p_this) |
| Check if the button has been pressed for the required time to turn IDLE the system. | |
| static bool | check_activity (fsm_t *p_this) |
| Check if any of the elements of the system is active. | |
| static bool | check_no_activity (fsm_t *p_this) |
| Check if all the elements of the system are inactive. | |
| static bool | check_winner (fsm_t *p_this) |
| Check if the player has won the game. | |
| static bool | check_playback_color_timeout (fsm_t *p_this) |
| Check if the playback color timeout has occurred. | |
| static bool | check_playback_over (fsm_t *p_this) |
| Check if the playback of the sequence is over and thus the player can start inputting the sequence. | |
| static bool | check_player_round_end (fsm_t *p_this) |
| Check if the player has finished the current sequence. | |
| static bool | check_player_key_timeout (fsm_t *p_this) |
| Check if the player key timeout has occurred. This is, the player has taken too long to press a key. | |
| static bool | check_color_added (fsm_t *p_this) |
| Check if a new color has been added to the sequence. | |
| static bool | check_input_valid (fsm_t *p_this) |
| Check if the input feedback time has finished and if the pressed key is correct. | |
| static bool | check_input_invalid (fsm_t *p_this) |
| Check if the input feedback time has finished and if the pressed key is correct. | |
| static bool | check_any_key_pressed (fsm_t *p_this) |
| Check if any key has been pressed by the player. | |
| static void | do_init_game (fsm_t *p_this) |
| Initialize the Simone game. | |
| void | do_add_color (fsm_t *p_this) |
| Add a new color to the current sequence. | |
| static void | do_sleep_idle (fsm_t *p_this) |
| Start the low power mode while the Simone is IDLE. | |
| static void | do_sleep_playback (fsm_t *p_this) |
| Start the low power mode while the Simone is PLAYBACK. | |
| static void | do_stop_simone (fsm_t *p_this) |
| Turn the Simone system IDLE. | |
| static void | do_winner (fsm_t *p_this) |
| Handle the winning status of the game. | |
| static void | do_game_over_timeout (fsm_t *p_this) |
| Handle the game over status of the game. More... | |
| static void | do_playback (fsm_t *p_this) |
| Handle the playback of the current sequence to the player. | |
| static void | do_start_player_sequence (fsm_t *p_this) |
| Start the player input sequence. Prepare the system for player input. | |
| static void | do_valid_key (fsm_t *p_this) |
| Handle a valid key press from the player. | |
| static void | do_game_over_invalid_key (fsm_t *p_this) |
| Handle an invalid key press from the player. | |
| static void | do_capture_input (fsm_t *p_this) |
| Capture the player's key input and provide visual feedback. | |
| static void | fsm_simone_init (fsm_simone_t *p_fsm_simone, fsm_button_t *p_fsm_button, uint32_t on_off_press_time_ms, fsm_keyboard_t *p_fsm_keyboard, fsm_rgb_light_t *p_fsm_rgb_light, uint8_t level) |
| Create a new Simone FSM. | |
| fsm_simone_t * | fsm_simone_new (fsm_button_t *p_fsm_button, uint32_t on_off_press_time_ms, fsm_keyboard_t *p_fsm_keyboard, fsm_rgb_light_t *p_fsm_rgb_light, uint8_t level) |
| Create a new Simone FSM. | |
| void | fsm_simone_fire (fsm_simone_t *p_fsm_simone) |
| Fire the Simone FSM. | |
| void | fsm_simone_destroy (fsm_simone_t *p_fsm) |
| Destroy an Simone FSM. | |
Variables | |
| const rgb_color_t * | p_colors_library [] = {&color_red, &color_green, &color_blue, &color_yellow, &color_turquoise, &color_white} |
| Library of colors used in the Simone game. More... | |
| fsm_trans_t | fsm_trans_simone [] |
| Array representing the transitions table of the FSM Simone. | |
Simone FSM main file.
|
static |
Handle the game over status of the game.
Logging for debugging and player feedback
| const rgb_color_t* p_colors_library[] = {&color_red, &color_green, &color_blue, &color_yellow, &color_turquoise, &color_white} |
Library of colors used in the Simone game.