Simone: a game of visual memory and speed
fsm_simone.h File Reference

Header for fsm_simone.c file. More...

#include <stdint.h>
#include "fsm_button.h"
#include "fsm_keyboard.h"
#include "fsm_rgb_light.h"

Data Structures

struct  fsm_simone_t
 Structure that contains the information of the Simone FSM. More...
 

Macros

#define KEY_RED
 
#define KEY_GREEN
 
#define KEY_BLUE
 
#define KEY_YELLOW
 
#define KEY_TURQUOISE
 
#define KEY_WHITE
 
#define KEY_INVALID_COLOR   ' '
 
#define LEVEL_MAX_INTENSITY
 
#define LEVEL_EASY_MIN_INTENSITY
 
#define LEVEL_MEDIUM_MIN_INTENSITY
 
#define LEVEL_HARD_MIN_INTENSITY
 
#define SEQUENCE_LENGTH
 
#define NUMBER_OF_COLORS_GAME
 
#define SIMONE_TIME_OFF_BETWEEN_COLORS_MS
 
#define SIMONE_TIME_VISUAL_FEEDBACK_MS
 
#define SIMONE_TIME_ON_LEVEL_EASY_MS
 
#define SIMONE_TIME_ON_LEVEL_MEDIUM_MS
 
#define SIMONE_TIME_ON_LEVEL_HARD_MS
 
#define SIMONE_TIME_WAIT_INPUT_MS
 

Enumerations

enum  FSM_SIMONE {
  IDLE = 0,
  ADD_COLOR,
  PLAYBACK,
  WAIT_KEY,
  VERIFY_INPUT,
  SLEEP_WHILE_IDLE,
  SLEEP_WHILE_PLAYBACK
}
 Enumerator for the Simone finite state machine. More...
 
enum  LEVELS {
  LEVEL_EASY = 0,
  LEVEL_MEDIUM,
  LEVEL_HARD
}
 Enumerator to define the difficulty levels of the Simone game.
 

Functions

fsm_simone_tfsm_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)
 Fire the Simone FSM.
 
void fsm_simone_destroy (fsm_simone_t *p_fsm)
 Destroy an Simone FSM.
 

Detailed Description

Header for fsm_simone.c file.

Author
Sistemas Digitales II
Date
2025-01-01

Macro Definition Documentation

◆ KEY_BLUE

#define KEY_BLUE

Key for BLUE color

◆ KEY_GREEN

#define KEY_GREEN

Key for GREEN color

◆ KEY_INVALID_COLOR

#define KEY_INVALID_COLOR   ' '

Invalid key

◆ KEY_RED

#define KEY_RED

Key for RED color

◆ KEY_TURQUOISE

#define KEY_TURQUOISE

Key for TURQUOISE color

◆ KEY_WHITE

#define KEY_WHITE

Key for WHITE color

◆ KEY_YELLOW

#define KEY_YELLOW

Key for YELLOW color

◆ LEVEL_EASY_MIN_INTENSITY

#define LEVEL_EASY_MIN_INTENSITY

Minimum intensity in % to play in the easy level of the game

◆ LEVEL_HARD_MIN_INTENSITY

#define LEVEL_HARD_MIN_INTENSITY

Minimum intensity in % to play the hard level of the game

◆ LEVEL_MAX_INTENSITY

#define LEVEL_MAX_INTENSITY

Max intensity in %

◆ LEVEL_MEDIUM_MIN_INTENSITY

#define LEVEL_MEDIUM_MIN_INTENSITY

Minimum intensity in % to play the medium level of the game

◆ NUMBER_OF_COLORS_GAME

#define NUMBER_OF_COLORS_GAME

Number of colors in the game

◆ SEQUENCE_LENGTH

#define SEQUENCE_LENGTH

Length of the sequence of colors

◆ SIMONE_TIME_OFF_BETWEEN_COLORS_MS

#define SIMONE_TIME_OFF_BETWEEN_COLORS_MS

Time off between colors in the sequence

◆ SIMONE_TIME_ON_LEVEL_EASY_MS

#define SIMONE_TIME_ON_LEVEL_EASY_MS

Time color on in easy level

◆ SIMONE_TIME_ON_LEVEL_HARD_MS

#define SIMONE_TIME_ON_LEVEL_HARD_MS

Time color on in hard level

◆ SIMONE_TIME_ON_LEVEL_MEDIUM_MS

#define SIMONE_TIME_ON_LEVEL_MEDIUM_MS

Time color on in medium level

◆ SIMONE_TIME_VISUAL_FEEDBACK_MS

#define SIMONE_TIME_VISUAL_FEEDBACK_MS

Time of the visual feedback when the player presses a key

◆ SIMONE_TIME_WAIT_INPUT_MS

#define SIMONE_TIME_WAIT_INPUT_MS

Time max between player key press

Enumeration Type Documentation

◆ FSM_SIMONE

enum FSM_SIMONE

Enumerator for the Simone finite state machine.

Enumerator
IDLE 

Starting state. Also comes here when no level has benne selected, the button has been pressed for the required time to turn IDLE the game.

ADD_COLOR 

State to add a color and intensity to the sequence.

PLAYBACK 

State to play the sequence.

WAIT_KEY 

State to read the keys pressed by the player.

VERIFY_INPUT 

State to verify the input key pressed by the player.

SLEEP_WHILE_IDLE 

State to start the low power mode while the Simone is IDLE

SLEEP_WHILE_PLAYBACK 

State to start the low power mode while the Simone is reproducing the sequence