Add IoT_Carrier_Platformio which contains all skeleton platformio projects
This commit is contained in:
parent
fc969d9859
commit
481c5a4ad6
5
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.gitignore
vendored
Normal file
5
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
10
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.vscode/extensions.json
vendored
Normal file
10
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
37
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/README
Normal file
37
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/README
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
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 convention is to give header files names that end with `.h'.
|
||||
|
||||
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
|
||||
@ -0,0 +1,20 @@
|
||||
#ifndef battery_interfacing_H
|
||||
#define battery_interfacing_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS
|
||||
FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT)
|
||||
BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier
|
||||
|
||||
ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES
|
||||
THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL
|
||||
|
||||
DO NOT CHANGE PIN AND CONSTANT DEFINITIONS
|
||||
*/
|
||||
|
||||
#define BAT_EN_PIN 5//FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage
|
||||
#define BAT_ADC_PIN 1//ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB
|
||||
|
||||
#define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,14 @@
|
||||
#ifndef dust_sensor_pinout_H
|
||||
#define dust_sensor_pinout_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR ESP32 C3-DevKitM-1 BOARD ON
|
||||
IoT Carrier Board FOR USING GP2Y1010AU0F DUST SENSOR.
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define DUST_ADC_PIN 2//the ESP32 pin (GPIO2) to be used as ADC input for the dust sensor data
|
||||
#define DUST_LED_PIN 6//the ESP32 pin (GPIO6) to be used as digital output to drive the sensor led
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,17 @@
|
||||
#ifndef i2c_pinout_H
|
||||
#define i2c_pinout_H
|
||||
|
||||
/*
|
||||
I2C COMMUNICATION PINOUT DEFINITIONS FOR ESP32 C3-DevKitM-1
|
||||
BOARD ON IoT Carrier Board WHICH USE GPIO21 AND GPIO 20
|
||||
|
||||
I2C IS NECESSARY FOR USING THE SCD30 SENSOR OR ANY OTHER
|
||||
(3V3) SENSOR INTERFACED VIA QWICC CONNECTORS
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define I2C_SCL_PIN 21
|
||||
#define I2C_SDA_PIN 20
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,13 @@
|
||||
#ifndef noise_sensor_pinout_H
|
||||
#define noise_sensor_pinout_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR ESP32 C3-DevKitM-1 BOARD ON
|
||||
IoT Carrier Board FOR USING LMV324 NOISE SENSOR.
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define NOISE_ADC_PIN 0//the ESP32 pin (GPIO0) to be used as ADC input for the noise sensor data
|
||||
|
||||
#endif
|
||||
46
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/lib/README
Normal file
46
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/lib/README
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into the executable file.
|
||||
|
||||
The source code of each library should be placed in a separate directory
|
||||
("lib/your_library_name/[Code]").
|
||||
|
||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional. for 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
|
||||
|
||||
Example contents of `src/main.c` using Foo and Bar:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries by scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
17
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/platformio.ini
Normal file
17
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/platformio.ini
Normal file
@ -0,0 +1,17 @@
|
||||
; 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:esp32-c3-devkitm-1]
|
||||
platform = espressif32
|
||||
board = esp32-c3-devkitm-1
|
||||
framework = arduino
|
||||
|
||||
lib_deps =
|
||||
sensirion/Sensirion I2C SCD30
|
||||
51
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/src/main.cpp
Normal file
51
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/src/main.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
THE FOLLOWING IS A PROJECT SKELETON FOR IoT Carrier AND
|
||||
ESP32 C3-DevKitM-1 BOARD. IT CONTAINS THE BARE NECESSITIES FOR
|
||||
STARTING ANY PROJECT THAT USES THE CARRIER BOARD's FUNCTIONALITIES
|
||||
|
||||
PRESENT ARE HEADER FILES THAT LIST THE RESPECTIVE PRECONFIGURED PINOUTS:
|
||||
dust_sensor_pinout.h -- GP2Y1010AU0F DUST SENSOR
|
||||
noise_sensor_pinout.h -- LMV324 NOISE SENSOR
|
||||
battery_interfacing.h -- PINOUT FOR BATTERY MONITORING MECHANISM
|
||||
i2c_pinout.h -- I2C COMMUNICATION PINOUT
|
||||
|
||||
ADDITIONALLY, FOR SCD30 SENSOR WHICH REQUIRES A LIBRARY, IT IS ALREADY CONFIGURED
|
||||
TO USE JUST REMOVE THE COMMENT FROM : #include <SensirionI2cScd30.h>
|
||||
(the external library is already configured in platformio.ini file)
|
||||
|
||||
TO USE ANY OF THE HEADERS OR LIBRARY, SIMPLY REMOVE THE COMMENTS
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
//#include "dust_sensor_pinout.h"
|
||||
//#include "noise_sensor_pinout.h"
|
||||
//#include "battery_interfacing.h"
|
||||
//#include "i2c_pinout.h"
|
||||
//#include <SensirionI2cScd30.h>
|
||||
|
||||
//PUT FUNCTION DECLARATIONS BELOW:
|
||||
/*
|
||||
void foo(args);
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
/*
|
||||
ENTER ALL THE ONE TIME DEFINITIONS AND INITIALIZATIONS
|
||||
WITHIN THIS FUNCTION SCOPE,SUCH AS COMMUNICATION AND SENSOR
|
||||
SETUPS AND PIN ROLE INITIALIZATIONS
|
||||
*/
|
||||
}
|
||||
|
||||
void loop() {
|
||||
/*
|
||||
ENTER THE MAIN CODE HERE TO RUN REPEATEDLY FOR ALL THE
|
||||
PLANNED TASKS
|
||||
*/
|
||||
}
|
||||
|
||||
//PUT FUNCTION DEFINITIONS (USED IN SETUP OR LOOP) BELOW:
|
||||
/*
|
||||
void foo(variable_type args){
|
||||
~function body
|
||||
}
|
||||
*/
|
||||
11
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/test/README
Normal file
11
IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/test/README
Normal 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
|
||||
5
IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.gitignore
vendored
Normal file
5
IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
10
IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.vscode/extensions.json
vendored
Normal file
10
IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
|
||||
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 convention is to give header files names that end with `.h'.
|
||||
|
||||
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
|
||||
@ -0,0 +1,20 @@
|
||||
#ifndef battery_interfacing_H
|
||||
#define battery_interfacing_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS
|
||||
FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT)
|
||||
BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier
|
||||
|
||||
ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES
|
||||
THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL
|
||||
|
||||
DO NOT CHANGE PIN AND CONSTANT DEFINITIONS
|
||||
*/
|
||||
|
||||
#define BAT_EN_PIN 18//FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage
|
||||
#define BAT_ADC_PIN 33//ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB
|
||||
|
||||
#define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,14 @@
|
||||
#ifndef dust_sensor_pinout_H
|
||||
#define dust_sensor_pinout_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR DOIT ESP32 DEVKIT V1 BOARD ON
|
||||
IoT Carrier Board FOR USING GP2Y1010AU0F DUST SENSOR.
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define DUST_ADC_PIN 36//the ESP32 pin (GPIO36) to be used as ADC input for the dust sensor data
|
||||
#define DUST_LED_PIN 19//the ESP32 pin (GPIO19) to be used as digital output to drive the sensor led
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,17 @@
|
||||
#ifndef i2c_pinout_H
|
||||
#define i2c_pinout_H
|
||||
|
||||
/*
|
||||
I2C COMMUNICATION PINOUT DEFINITIONS FOR DOIT ESP32 DEVKIT V1
|
||||
BOARD ON IoT Carrier Board WHICH USE GPIO22 and GPIO21
|
||||
|
||||
I2C IS NECESSARY FOR USING THE SCD30 SENSOR OR ANY OTHER
|
||||
(3V3) SENSOR INTERFACED VIA QWICC CONNECTORS
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define I2C_SCL_PIN 22
|
||||
#define I2C_SDA_PIN 21
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,13 @@
|
||||
#ifndef noise_sensor_pinout_H
|
||||
#define noise_sensor_pinout_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR DOIT ESP32 DEVKIT V1 BOARD ON
|
||||
IoT Carrier Board FOR USING LMV324 NOISE SENSOR.
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define NOISE_ADC_PIN 32//the ESP32 pin (GPIO32) to be used as ADC input for the noise sensor data
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into the executable file.
|
||||
|
||||
The source code of each library should be placed in a separate directory
|
||||
("lib/your_library_name/[Code]").
|
||||
|
||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional. for 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
|
||||
|
||||
Example contents of `src/main.c` using Foo and Bar:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries by scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@ -0,0 +1,17 @@
|
||||
; 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:esp32doit-devkit-v1]
|
||||
platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
|
||||
lib_deps =
|
||||
sensirion/Sensirion I2C SCD30
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
THE FOLLOWING IS A PROJECT SKELETON FOR IoT Carrier AND
|
||||
DOIT ESP32 DEVKIT V1 BOARD. IT CONTAINS THE BARE NECESSITIES FOR
|
||||
STARTING ANY PROJECT THAT USES THE CARRIER BOARD's FUNCTIONALITIES
|
||||
|
||||
PRESENT ARE HEADER FILES THAT LIST THE RESPECTIVE PRECONFIGURED PINOUTS:
|
||||
dust_sensor_pinout.h -- GP2Y1010AU0F DUST SENSOR
|
||||
noise_sensor_pinout.h -- LMV324 NOISE SENSOR
|
||||
battery_interfacing.h -- PINOUT FOR BATTERY MONITORING MECHANISM
|
||||
i2c_pinout.h -- I2C COMMUNICATION PINOUT
|
||||
|
||||
ADDITIONALLY, FOR SCD30 SENSOR WHICH REQUIRES A LIBRARY, IT IS ALREADY CONFIGURED
|
||||
TO USE JUST REMOVE THE COMMENT FROM : #include <SensirionI2cScd30.h>
|
||||
(the external library is already configured in platformio.ini file)
|
||||
|
||||
TO USE ANY OF THE HEADERS OR LIBRARY, SIMPLY REMOVE THE COMMENTS
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
//#include "dust_sensor_pinout.h"
|
||||
//#include "noise_sensor_pinout.h"
|
||||
//#include "battery_interfacing.h"
|
||||
//#include "i2c_pinout.h"
|
||||
//#include <SensirionI2cScd30.h>
|
||||
|
||||
//PUT FUNCTION DECLARATIONS BELOW:
|
||||
/*
|
||||
void foo(args);
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
/*
|
||||
ENTER ALL THE ONE TIME DEFINITIONS AND INITIALIZATIONS
|
||||
WITHIN THIS FUNCTION SCOPE,SUCH AS COMMUNICATION AND SENSOR
|
||||
SETUPS AND PIN ROLE INITIALIZATIONS
|
||||
*/
|
||||
}
|
||||
|
||||
void loop() {
|
||||
/*
|
||||
ENTER THE MAIN CODE HERE TO RUN REPEATEDLY FOR ALL THE
|
||||
PLANNED TASKS
|
||||
*/
|
||||
}
|
||||
|
||||
//PUT FUNCTION DEFINITIONS (USED IN SETUP OR LOOP) BELOW:
|
||||
/*
|
||||
void foo(variable_type args){
|
||||
~function body
|
||||
}
|
||||
*/
|
||||
@ -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
|
||||
5
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.gitignore
vendored
Normal file
5
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
10
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.vscode/extensions.json
vendored
Normal file
10
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
|
||||
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 convention is to give header files names that end with `.h'.
|
||||
|
||||
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
|
||||
@ -0,0 +1,20 @@
|
||||
#ifndef battery_interfacing_H
|
||||
#define battery_interfacing_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS
|
||||
FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT)
|
||||
BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier
|
||||
|
||||
ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES
|
||||
THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL
|
||||
|
||||
DO NOT CHANGE PIN AND CONSTANT DEFINITIONS
|
||||
*/
|
||||
|
||||
#define BAT_EN_PIN 18//FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage
|
||||
#define BAT_ADC_PIN 33//ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB
|
||||
|
||||
#define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,14 @@
|
||||
#ifndef dust_sensor_pinout_H
|
||||
#define dust_sensor_pinout_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR ESP32 NodeMCU-32S BOARD ON
|
||||
IoT Carrier Board FOR USING GP2Y1010AU0F DUST SENSOR.
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define DUST_ADC_PIN 36//the ESP32 pin (GPIO36) to be used as ADC input for the dust sensor data
|
||||
#define DUST_LED_PIN 19//the ESP32 pin (GPIO19) to be used as digital output to drive the sensor led
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,17 @@
|
||||
#ifndef i2c_pinout_H
|
||||
#define i2c_pinout_H
|
||||
|
||||
/*
|
||||
I2C COMMUNICATION PINOUT DEFINITIONS FOR ESP32 NodeMCU-32S
|
||||
BOARD ON IoT Carrier Board WHICH USE GPIO22 AND GPIO 21
|
||||
|
||||
I2C IS NECESSARY FOR USING THE SCD30 SENSOR OR ANY OTHER
|
||||
(3V3) SENSOR INTERFACED VIA QWICC CONNECTORS
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define I2C_SCL_PIN 22
|
||||
#define I2C_SDA_PIN 21
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,13 @@
|
||||
#ifndef noise_sensor_pinout_H
|
||||
#define noise_sensor_pinout_H
|
||||
|
||||
/*
|
||||
PINOUT DEFINITIONS FOR ESP32 NodeMCU-32S BOARD ON
|
||||
IoT Carrier Board FOR USING LMV324 NOISE SENSOR.
|
||||
|
||||
DO NOT CHANGE PIN DEFINITIONS
|
||||
*/
|
||||
|
||||
#define NOISE_ADC_PIN 32//the ESP32 pin (GPIO32) to be used as ADC input for the noise sensor data
|
||||
|
||||
#endif
|
||||
46
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/lib/README
Normal file
46
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/lib/README
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into the executable file.
|
||||
|
||||
The source code of each library should be placed in a separate directory
|
||||
("lib/your_library_name/[Code]").
|
||||
|
||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional. for 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
|
||||
|
||||
Example contents of `src/main.c` using Foo and Bar:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries by scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@ -0,0 +1,17 @@
|
||||
; 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 = espressif32
|
||||
board = nodemcu-32s
|
||||
framework = arduino
|
||||
|
||||
lib_deps =
|
||||
sensirion/Sensirion I2C SCD30
|
||||
51
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/src/main.cpp
Normal file
51
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/src/main.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
THE FOLLOWING IS A PROJECT SKELETON FOR IoT Carrier AND
|
||||
ESP32 NodeMCU-32S BOARD. IT CONTAINS THE BARE NECESSITIES FOR
|
||||
STARTING ANY PROJECT THAT USES THE CARRIER BOARD's FUNCTIONALITIES
|
||||
|
||||
PRESENT ARE HEADER FILES THAT LIST THE RESPECTIVE PRECONFIGURED PINOUTS:
|
||||
dust_sensor_pinout.h -- GP2Y1010AU0F DUST SENSOR
|
||||
noise_sensor_pinout.h -- LMV324 NOISE SENSOR
|
||||
battery_interfacing.h -- PINOUT FOR BATTERY MONITORING MECHANISM
|
||||
i2c_pinout.h -- I2C COMMUNICATION PINOUT
|
||||
|
||||
ADDITIONALLY, FOR SCD30 SENSOR WHICH REQUIRES A LIBRARY, IT IS ALREADY CONFIGURED
|
||||
TO USE JUST REMOVE THE COMMENT FROM : #include <SensirionI2cScd30.h>
|
||||
(the external library is already configured in platformio.ini file)
|
||||
|
||||
TO USE ANY OF THE HEADERS OR LIBRARY, SIMPLY REMOVE THE COMMENTS
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
//#include "dust_sensor_pinout.h"
|
||||
//#include "noise_sensor_pinout.h"
|
||||
//#include "battery_interfacing.h"
|
||||
//#include "i2c_pinout.h"
|
||||
//#include <SensirionI2cScd30.h>
|
||||
|
||||
//PUT FUNCTION DECLARATIONS BELOW:
|
||||
/*
|
||||
void foo(args);
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
/*
|
||||
ENTER ALL THE ONE TIME DEFINITIONS AND INITIALIZATIONS
|
||||
WITHIN THIS FUNCTION SCOPE,SUCH AS COMMUNICATION AND SENSOR
|
||||
SETUPS AND PIN ROLE INITIALIZATIONS
|
||||
*/
|
||||
}
|
||||
|
||||
void loop() {
|
||||
/*
|
||||
ENTER THE MAIN CODE HERE TO RUN REPEATEDLY FOR ALL THE
|
||||
PLANNED TASKS
|
||||
*/
|
||||
}
|
||||
|
||||
//PUT FUNCTION DEFINITIONS (USED IN SETUP OR LOOP) BELOW:
|
||||
/*
|
||||
void foo(variable_type args){
|
||||
~function body
|
||||
}
|
||||
*/
|
||||
11
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/test/README
Normal file
11
IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/test/README
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user