![]() |
Zap'Em Blast'Em Robots
robots that play laser tag!
|
Header file for the ADC task system. More...
#include <stdint.h>#include "stm32f4xx_hal.h"Go to the source code of this file.
Data Structures | |
| struct | GameTask |
| Structure that represents the game task state and configuration. More... | |
Typedefs | |
| typedef struct SoundTask | SoundTask |
| Forward declaration for SoundTask. | |
| typedef struct GameTask | GameTask |
| Forward declaration for GameTask. | |
| typedef void(* | game_fcn_t) (GameTask *game_task) |
| Function pointer type for ADC state functions. | |
Functions | |
| void | game_task_state_0_init (GameTask *game_task) |
| Initializes the game task (state 0). | |
| void | game_task_run (GameTask *game_task) |
| Executes the current game task state. | |
| void | game_task_state_1_home (GameTask *game_task) |
| Waits for player to initiate the game (state 1). | |
| void | game_task_state_2_play (GameTask *game_task) |
| Handles gameplay logic and scoring (state 2). | |
| void | game_task_state_3_end (GameTask *game_task) |
| Displays game over screen and resets (state 3). | |
Header file for the ADC task system.
Created on: May 22, 2025
| typedef void(* game_fcn_t) (GameTask *game_task) |
Function pointer type for ADC state functions.
Each state function must take a pointer to ADCTask as its argument.
| typedef struct GameTask GameTask |
| void game_task_run | ( | GameTask * | game_task | ) |
Executes the current game task state.
| game_task | Pointer to the GameTask instance. |
Executes the current game task state.
Checks whether the current state index is valid. If so, it calls the corresponding state function from the task's function pointer array.
| game_task | Pointer to the GameTask instance. |
| void game_task_state_0_init | ( | GameTask * | game_task | ) |
Initializes the game task (state 0).
Clears and sets up the LCD, then advances to state 1.
| game_task | Pointer to the GameTask instance. |
| void game_task_state_1_home | ( | GameTask * | game_task | ) |
Waits for player to initiate the game (state 1).
Displays title and instructions. When play_flag is set, transitions to the next state and triggers the start sound.
| game_task | Pointer to the GameTask instance. |
| void game_task_state_2_play | ( | GameTask * | game_task | ) |
Handles gameplay logic and scoring (state 2).
Increments scores based on photoresistor hit flags, updates LCD with score, and transitions to end state when a score threshold is reached.
| game_task | Pointer to the GameTask instance. |