Skip to content

Commit

Permalink
Create cross-compile algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
KenwoodFox committed Oct 12, 2023
1 parent 4272198 commit 8774183
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
11 changes: 11 additions & 0 deletions Firmware/lib/algorithm/algorithm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "algorithm.h"

// Algorithm::Algorithm()
// {
// ;
// }

void Algorithm::init()
{
;
}
18 changes: 18 additions & 0 deletions Firmware/lib/algorithm/algorithm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @file algorithm.h
* @author Joe S
* @brief Prototypes for the micromouse algorithm
*/

#include <cstdint> // This include might have to be moved..

class Algorithm
{
private:
uint16_t maze[16][16];

public:
// Algorithm(/* args */);

void init();
};
2 changes: 1 addition & 1 deletion Firmware/sim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This project can be simulated using (https://github.com/mackorone/mms)[mms].
## Build

```shell
g++ -g -I lib/mms-cpp/ lib/mms-cpp/API.cpp main.cpp -o main
g++ -g -I lib/mms-cpp/ -I ../lib/algorithm/ ../lib/algorithm/algorithm.cpp lib/mms-cpp/API.cpp main.cpp -o main
```

## Run
Expand Down
Binary file modified Firmware/sim/main
Binary file not shown.
8 changes: 6 additions & 2 deletions Firmware/sim/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#include <iostream>
#include <string>

#include "API.h"
#include "API.h" // MMS Simulator API
#include "algorithm.h" // On-robot algorithm

static Algorithm alg; // Create a local instance of algorithm

void log(const std::string &text)
{
Expand All @@ -10,7 +13,8 @@ void log(const std::string &text)

int main(int argc, char *argv[])
{
log("Running...");
log("Initializing algorithm");
alg.init();
API::setColor(0, 0, 'G');
API::setText(0, 0, "abc");
while (true)
Expand Down

0 comments on commit 8774183

Please sign in to comment.