![]() |
Zap'Em Blast'Em Robots
robots that play laser tag!
|
Header file for shoot task state machine and control logic. More...
#include <stdint.h>
#include "stm32f4xx_hal.h"
Go to the source code of this file.
Data Structures | |
struct | ShootTask |
Structure for shoot task configuration and state tracking. More... |
Typedefs | |
typedef struct ShootTask | ShootTask |
Forward declaration of ShootTask structure. | |
typedef void(* | shoot_fcn_t) (ShootTask *shoot_task) |
Function pointer type for shoot task state functions. |
Functions | |
void | shoot_task_state_0_init (ShootTask *shoot_task) |
Initializes the shoot task (state 0). | |
void | shoot_task_run (ShootTask *shoot_task) |
Executes the current shoot task state. | |
void | shoot_task_state_1_wait (ShootTask *shoot_task) |
Waits for user input to activate shoot sequence (state 1). | |
void | shoot_task_state_2_unshield (ShootTask *shoot_task) |
Lowers servo shield prior to firing laser (state 2). | |
void | shoot_task_state_3_shoot (ShootTask *shoot_task) |
Fires the laser and returns to wait state after release (state 3). |
Header file for shoot task state machine and control logic.
Created on: Jun 3, 2025
void shoot_task_run | ( | ShootTask * | shoot_task | ) |
Executes the current shoot task state.
shoot_task | Pointer to ShootTask structure. |
Executes the current shoot task state.
Checks that the current state index is valid and calls the corresponding state handler. Falls into an infinite loop if the state index is invalid.
shoot_task | Pointer to ShootTask structure. |
void shoot_task_state_0_init | ( | ShootTask * | shoot_task | ) |
void shoot_task_state_1_wait | ( | ShootTask * | shoot_task | ) |
Waits for user input to activate shoot sequence (state 1).
shoot_task | Pointer to ShootTask structure. |
Waits for user input to activate shoot sequence (state 1).
Keeps laser on and servo unshielded. Advances to state 2 when button is pressed.
shoot_task | Pointer to ShootTask structure. |
void shoot_task_state_2_unshield | ( | ShootTask * | shoot_task | ) |
Lowers servo shield prior to firing laser (state 2).
shoot_task | Pointer to ShootTask structure. |
Lowers servo shield prior to firing laser (state 2).
After lowering shield, transitions to state 3. Also checks for early button release to return to state 1.
shoot_task | Pointer to ShootTask structure. |
void shoot_task_state_3_shoot | ( | ShootTask * | shoot_task | ) |
Fires the laser and returns to wait state after release (state 3).
shoot_task | Pointer to ShootTask structure. |
Fires the laser and returns to wait state after release (state 3).
Turns off laser and returns to wait state once the button is released.
shoot_task | Pointer to ShootTask structure. |