-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
952 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: PlatformIO CI | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
pull_request: | ||
branches: [ main ] | ||
|
||
# Enables a button on Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pip | ||
~/.platformio/.cache | ||
key: ${{ runner.os }}-pio | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade platformio | ||
- name: Create sample config file | ||
run: | | ||
cp ./src/config/config_sample.h ./src/config/config.h | ||
- name: Compile with Platform IO | ||
run: | | ||
pio run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.pio | ||
.clang_complete | ||
.gcc-flags.json | ||
|
||
src/*.ino.cpp | ||
.vscode/ | ||
src/config/config.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# firmware_v5 | ||
Firmware Repository for Swarm Robot v5.0.0 | ||
[![PlatformIO CI](https://github.com/Pera-Swarm/firmware_v5/actions/workflows/main.yml/badge.svg)](https://github.com/Pera-Swarm/firmware_v5/actions/workflows/main.yml) | ||
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) | ||
|
||
# PeraSwarm Robot (Firmware v5) - Under Developing | ||
|
||
Platform IO-Based Firmware Repository for Swarm Robot v5.0.0 upward. | ||
|
||
### Online Documantations | ||
|
||
[ Not available yet ] | ||
- [Robot Firmware v5 Documentation](https://pera-swarm.ce.pdn.ac.lk/docs/robots/v5/firmware/) | ||
- [Robot Hardware v5 Documentation](https://pera-swarm.ce.pdn.ac.lk/docs/robots/v5/hardware/) | ||
|
||
#### Special Notes: | ||
|
||
- We are using _[email protected]_ due to latest versions not support the IR functionalities we used in here | ||
|
||
|
||
--- | ||
Firmware last build check: 2024-02-28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# Swarm Robot v5 | ||
Platform IO Based Firmware Repository for Swarm Robots | ||
|
||
### Build Instructions ### | ||
|
||
First need install ATOM IDE or VS Code first. | ||
Then need to install Platform IO with Espressif 32 Platform. | ||
|
||
[A tutorial on how to install Espressif 32 Platform on VSCode](https://www.instructables.com/id/Develop-ESP32-With-PlatformIO-IDE/) | ||
|
||
### Online Documantation ### | ||
|
||
Will Be updated soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
;PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; https://docs.platformio.org/page/projectconf.html | ||
|
||
[env:nodemcu-32s] | ||
platform = [email protected] | ||
board = nodemcu-32s | ||
framework = arduino | ||
|
||
; Serial Monitor options | ||
monitor_speed = 115200 | ||
|
||
; Automatic static checks for errors | ||
; https://docs.platformio.org/en/latest/plus/check-tools/cppcheck.html | ||
; check_tool = cppcheck | ||
; check_flags = --enable=all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
// This is the configuration file for the robot | ||
// Fill all the required the parameters and | ||
// rename this file as 'config.h' before use | ||
|
||
#ifndef _ROBOT_CONFIG_H | ||
#define _ROBOT_CONFIG_H | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
// Directions, do not remove | ||
#define LEFT 4 | ||
#define RIGHT 6 | ||
#define FORWARD 8 | ||
#define BACKWARD 2 | ||
|
||
// Rotation Directions | ||
#define CW 0 | ||
#define CCW 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
#pragma once | ||
|
||
#include <Arduino.h> | ||
|
||
extern uint8_t mode; | ||
extern uint8_t buttonStatus; | ||
extern int ROBOT_ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
// ------------------------------------------------------------------- GPIO Pins | ||
#define PIN_LED_INBUILT 2 | ||
|
||
// --------------------------------------------------------- Motors and Encoders | ||
|
||
// ----------------------------------------------------- Unused or reserved pins | ||
#define PIN_TX 1 | ||
#define PIN_RX 3 | ||
|
||
#define PIN_SCL 22 | ||
#define PIN_SDA 21 | ||
|
||
// ------------------------------------------------------------------ Other Pins | ||
|
||
// --------------------------------------------------------- I2C Port addresses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <Arduino.h> | ||
|
||
// Load the configuration details | ||
#include "config/config.h" | ||
|
||
// pin map | ||
#include "config/pins.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
#include <Arduino.h> | ||
#include "define.h" | ||
|
||
// This is to hide non-test related source code. | ||
// https://docs.platformio.org/en/latest/plus/unit-testing.html | ||
#ifndef UNIT_TEST | ||
|
||
void setup() | ||
{ | ||
// put your setup code here, to run once: | ||
|
||
// Enables Serial Communication with baudRate of 115200 | ||
Serial.begin(115200); | ||
Serial.println("PeraSwarm Robot v5"); | ||
|
||
pinMode(PIN_LED_INBUILT, OUTPUT); | ||
} | ||
|
||
void loop() | ||
{ | ||
// put your main code here, to run repeatedly: | ||
|
||
digitalWrite(PIN_LED_INBUILT, HIGH); | ||
delay(1000); | ||
digitalWrite(PIN_LED_INBUILT, LOW); | ||
delay(1000); | ||
} | ||
|
||
#endif |