Sketched out basic outline of the superloop module.
This commit is contained in:
parent
2567e752fc
commit
952541f9b4
|
@ -1,15 +1,50 @@
|
|||
/*
|
||||
* Author: username
|
||||
* Date: 2024
|
||||
* Author: Jake G
|
||||
* Date: 2024-09-01
|
||||
* filename: SuperLoop.c
|
||||
* description: module_purpose
|
||||
* description: The RT super loop.
|
||||
*/
|
||||
|
||||
#include "SuperLoop.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
// dumb test function
|
||||
int add_two(int a) {
|
||||
int b = a;
|
||||
b += 2;
|
||||
return b;
|
||||
|
||||
static uint8_t iteration_target = 0;
|
||||
|
||||
/*
|
||||
* ####################################
|
||||
* PRIVATE FUNCTIONS
|
||||
* ####################################
|
||||
*/
|
||||
|
||||
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_Run(void)
|
||||
{
|
||||
for(uint8_t i = 0; continue_looping(i); i++) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* @brief PUT_TEXT_HERE
|
||||
* @details This file is...
|
||||
* @author username
|
||||
* @date todays_date
|
||||
* @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
|
||||
* @copyright None
|
||||
* @file SUPERLOOP.h
|
||||
*/
|
||||
|
@ -10,10 +10,21 @@
|
|||
#ifndef SUPERLOOP
|
||||
#define SUPERLOOP
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* A function that adds two to a number
|
||||
* @param a The first argument
|
||||
* A function that allows the user to set the number of loop iterations for
|
||||
* testing purposes.
|
||||
* @param n The number of times it will loop before breaking. (Zero is endless)
|
||||
*/
|
||||
int add_two(int a);
|
||||
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.
|
||||
*/
|
||||
void SuperLoop_Run(void);
|
||||
|
||||
|
||||
#endif // SUPERLOOP
|
||||
|
|
Loading…
Reference in New Issue