diff --git a/src/SuperLoop/SuperLoop.c b/src/SuperLoop/SuperLoop.c index 3800138..0d4abc7 100644 --- a/src/SuperLoop/SuperLoop.c +++ b/src/SuperLoop/SuperLoop.c @@ -1,14 +1,13 @@ /* - * Author: Jake G + * Author: Jake G * Date: 2024-09-01 * filename: SuperLoop.c - * description: The RT super loop. + * description: The RT super loop. */ #include "SuperLoop.h" #include - static uint8_t iteration_target = 0; /* @@ -17,34 +16,26 @@ static uint8_t iteration_target = 0; * #################################### */ -static bool continue_looping(uint8_t idx) -{ - if(iteration_target == 0 || idx <= iteration_target) { - return true; - } - return false; +static bool continue_looping(uint8_t idx) { + if (iteration_target == 0 || idx <= iteration_target) { + return true; + } + return false; } - /* * #################################### * PUBLIC FUNCTIONS * #################################### */ +void SuperLoop_SetIterations(uint8_t n) { iteration_target = n; } - -void SuperLoop_SetIterations(uint8_t n) -{ - iteration_target = n; +uint8_t SuperLoop_Run(void) { + uint8_t i; + for (i = 0; continue_looping(i); i++) { + continue; + } + return i - 1; } - -void SuperLoop_Run(void) -{ - for(uint8_t i = 0; continue_looping(i); i++) { - continue; - } -} - - diff --git a/src/SuperLoop/SuperLoop.h b/src/SuperLoop/SuperLoop.h index faf4786..4489135 100644 --- a/src/SuperLoop/SuperLoop.h +++ b/src/SuperLoop/SuperLoop.h @@ -1,8 +1,8 @@ /** - * @brief The Systems superloop that handles all the tasks. + * @brief The Systems superloop that handles all the tasks. * @details This file is the main program's logic that loops endlessly - * @author Jake G - * @date 2024-09-01 + * @author Jake G + * @date 2024-09-01 * @copyright None * @file SUPERLOOP.h */ @@ -19,12 +19,11 @@ */ void SuperLoop_SetIterations(uint8_t n); - /** * The super loop; it runs the main code in a loop endlessly unless the number * of iterations are set. + * @return The number of loops completed in iteration mode. */ -void SuperLoop_Run(void); - +uint8_t SuperLoop_Run(void); #endif // SUPERLOOP