Merge pull request 'feat:init IOT project' (#6) from feat/init-IOT into master

Reviewed-on: https://gitea.cb85.software/Epitech-T-DEV-811/T-DEV-811/pulls/6
Reviewed-by: nico <nicolas.sansd@gmail.com>
This commit is contained in:
Clement 2023-03-07 13:19:16 +00:00
commit 9b4afa2b74
11 changed files with 234 additions and 0 deletions

4
IOT/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.pio
.vscode/*
secrets.ini

19
IOT/config.ini Normal file
View File

@ -0,0 +1,19 @@
; Project configuration file
[config]
; Hardware Serial baud rate
; Also available in the code as `MONITOR_SPEED`
monitor_speed = 115200
; Software Config
; note: additionnal flags are added by Platform.io (see total amount in `.vscode/c_cpp_properties.json` in the `defines` section)
; notworthy ones:
; __PLATFORMIO_BUILD_DEBUG__ = debug mode
build_flags =
; DO NOT TOUCH --- START
-D MONITOR_SPEED=${config.monitor_speed}
; DO NOT TOUCH --- END
-D EXAMPLE_NUMBER=69
-D EXAMPLE_STRING=\"Pouet\"

15
IOT/envs.ini Normal file
View File

@ -0,0 +1,15 @@
; Add additionnal environments in this file
; Default production environment
[env:prod]
; Debug environemnt
[env:debug]
build_type = debug
; Example additionnal env
; [env:example]
; ; note: keep the `${env.build_flags}` to includes others build flags
; build_flags = ${env.build_flags}
; -D POUET

21
IOT/include/Program.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef PROGRAM_H
#define PROGRAM_H
class Program{
public:
/**
* @brief Construct the maine Program object
*
*/
Program();
/**
* @brief main loop function
*
*/
void loop();
private:
/* data */
};
#endif

39
IOT/include/README Normal file
View File

@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

46
IOT/lib/README Normal file
View File

@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

51
IOT/platformio.ini Normal file
View File

@ -0,0 +1,51 @@
; PlatformIO Project Configuration File
; Additionnal files
; `secrets.ini`: Secret Build Flags that will be ignored in git (content: `[secrets]\nbuild_flags = `)
; `envs.ini`: Build environments
; Defaults
[secrets]
build_flags =
[platformio]
default_envs = debug
extra_configs =
secrets.ini
config.ini
envs.ini
[env]
; build Envs
build_flags = ${config.build_flags} ${secrets.build_flags}
; Device Settings
platform = atmelavr
board = megaatmega2560
framework = arduino
; Monitoring settings
monitor_speed = ${config.monitor_speed}
; note: make sure to rebuild after changing it (log2file add a .log file containing the monitor logs)
monitor_filters = esp32_exception_decoder, default ;, log2file
monitor_flags =
--echo
; upload settings
; upload_port = COM1
; librairies
lib_deps =
; example:
; erropix/ESP32 AnalogWrite@^0.2
; Checker settings
check_tool = clangtidy, cppcheck
check_patterns =
src/
include/
lib/
check_skip_packages = yes
check_flags =
clangtidy: --checks=abseil-*,boost-*,bugprone-*,cert-*,cppcoreguidelines-*,clang-analyzer-*,google-*,hicpp-*,modernize-*,performance-*,portability-*,readability-*,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-cppcoreguidelines-init-variables
cppcheck: --project=config.cppcheck

6
IOT/secrets.ini.example Normal file
View File

@ -0,0 +1,6 @@
; Add secrets token/logins/etc `secrets.ini`
; Add the sames values as blank in `secrets.ini.example
; To be able to reproduce it
[secrets]
build_flags =

10
IOT/src/Program.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "Program.h"
Program::Program(){
}
void Program::loop(){
}

12
IOT/src/main.cpp Normal file
View File

@ -0,0 +1,12 @@
#include <Arduino.h>
#include "Program.h"
Program* program;
void setup() {
program = new Program();
}
void loop() {
program->loop();
}

11
IOT/test/README Normal file
View File

@ -0,0 +1,11 @@
This directory is intended for PlatformIO Test Runner and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html