Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 89 additions & 2 deletions rpi/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,89 @@
all:
clang++ *.cpp -o bin
#==============================================================================
# Project folders
#==============================================================================

#Main folders
SRCFOLDER := src/
INCFOLDER := include/
BINFOLDER := bin/
LIBFOLDER := lib/
OBJFOLDER := obj/
TESTFOLDER := test/
OTHERFOLDER := other/
DOCFOLDER := doc/

#==============================================================================
# Project flags
#==============================================================================
CC = g++ $(SIMPLEWARNINGS)
SIMPLEWARNINGS := -Wall
ALLWARNINGS := -Wall -Wextra -pedantic -Wshadow -Wredundant-decls -Woverloaded-virtual -Wsynth
IFLAG = -I./$(INCFOLDER)
GOOGLETESTFLAG = -lgtest -lgtest_main

#==============================================================================
# Project Strings
#==============================================================================
TESTSEPARATOR = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
CLEANSEPARATOR = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
#==============================================================================
# Project files
#==============================================================================
CPPFILES = $(wildcard src/*.cpp)
TESTCPPFILES = $(wildcard test/*.cpp)

all: prepare rpi

rpi: srcObjects
$(CC) obj/*.o -o bin/app/$@ $(IFLAG)

#==============================================================================
# Preparing object files
#==============================================================================
# Files
srcObjects: $(CPPFILES:src/%.cpp=obj/%.o)

#Necessary use include for PostgreSQL library here too, if it is used in other file.
obj/%.o: src/%.cpp
$(CC) -c $< -o $@ $(IFLAG)

#==============================================================================
# Testing
# About: The command test compile all tests and put it in the folder bin/test.
# You should have a file in the src folder mapped into test. To make it
# organized, you should keep the same folder structure in test folder.
# Example:
# make test -> Compile all the tests
# make testModel -> Compile all the tests in model folder.
#==============================================================================
test: tests

# Test Model
tests: $(TESTCPPFILES:test/%_test.cpp=bin/test/%.bin)

bin/test/%.bin: test/%_test.cpp src/%.cpp
$(CC) $^ -o $@ $(IFLAG) $(GOOGLETESTFLAG)

#=====================================================================================
# Project Actions
#=====================================================================================
PHONY: clean prepare doxy runTest

doxy:
doxygen Doxyfile

run:
$(APPBINFOLDER)rpi

runTest:
$(TESTBINFOLDER)*.bin

prepare:
mkdir -p $(BINFOLDER)test
mkdir -p $(BINFOLDER)app

clean:
@echo $(CLEANSEPARATOR)
rm -fr bin/*
rm -fr obj/*

4 changes: 2 additions & 2 deletions rpi/def.h → rpi/include/def.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _DEF_H
#define _DEF_H
#ifndef _DEF_HPP_
#define _DEF_HPP_

typedef unsigned char byte;

Expand Down
9 changes: 4 additions & 5 deletions rpi/dfs.h → rpi/include/dfs.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#ifndef DEPTH_FIRST_SEARCH
#define DEPTH_FIRST_SEARCH
#ifndef _DEPTH_FIRST_SEARCH_HPP_
#define _DEPTH_FIRST_SEARCH_HPP_

#include <iostream>
#include "position.h"
#include "pathNode.h"
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <utility>

#include "position.hpp"
#include "pathNode.hpp"

class DepthFirstSearch
{
Expand Down Expand Up @@ -61,5 +61,4 @@ class DepthFirstSearch

};


#endif
10 changes: 6 additions & 4 deletions rpi/packet.h → rpi/include/packet.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef _PACKET_H
#define _PACKET_H
#ifndef _PACKET_HPP_
#define _PACKET_HPP_

#define MAX_PACKETS 16

struct _packet {
struct _packet
{
unsigned char tag;
unsigned char length;
unsigned char* value;
Expand All @@ -12,7 +13,8 @@ struct _packet {
typedef struct _packet packet;

/* Cria o pacote com o rótulo, tamanho e valoe especificado */
packet* packet_create(unsigned char tag, unsigned char length, unsigned char* data);
packet* packet_create(unsigned char tag, unsigned char length,
unsigned char* data);

/* Destrói um pacote da memória */
void packet_destroy(packet* p);
Expand Down
10 changes: 10 additions & 0 deletions rpi/include/pathFinder.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef _PATH_FINDER_HPP_
#define _PATH_FINDER_HPP_

class PathFinder
{

};


#endif
4 changes: 2 additions & 2 deletions rpi/pathNode.h → rpi/include/pathNode.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PATH_NODE_H
#define PATH_NODE_H
#ifndef _PATH_NODE_HPP_
#define _PATH_NODE_HPP_

class PathNode
{
Expand Down
6 changes: 3 additions & 3 deletions rpi/position.h → rpi/include/position.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POSITION_H
#define POSITION_H
#ifndef _POSITION_HPP_
#define _POSITION_HPP_

#include "def.h"
#include "def.hpp"

class Position
{
Expand Down
4 changes: 2 additions & 2 deletions rpi/serial.h → rpi/include/serial.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _SERIAL_H
#define _SERIAL_H
#ifndef _SERIAL_HPP_
#define _SERIAL_HPP_

#define SERIAL_DEVICE_NAME "/dev/ttyACM0"
#define SERIAL_DEVICE_BAUDRATE B57600
Expand Down
125 changes: 0 additions & 125 deletions rpi/main.cpp

This file was deleted.

Empty file added rpi/obj/.keep
Empty file.
12 changes: 0 additions & 12 deletions rpi/pathfinder.h

This file was deleted.

Loading