Skip to content

Commit

Permalink
Implement the sensor-sample for PlatformIO
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorTwip committed May 27, 2023
1 parent 97036fa commit 254ee67
Show file tree
Hide file tree
Showing 8 changed files with 1,188 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/esp32_platformio/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
include/secrets.h

8 changes: 8 additions & 0 deletions examples/esp32_platformio/esp32_platformio.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
10 changes: 10 additions & 0 deletions examples/esp32_platformio/include/secrets.h.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#define SECRETS

// deveui, little-endian
static const std::uint8_t deveui[] = { 0xAA, 0xBB, 0xCC, 0x00, 0x00, 0xDD, 0xEE, 0xFF };

// appeui, little-endian
static const std::uint8_t appeui[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

// appkey: just a string of bytes, sometimes referred to as "big endian".
static const std::uint8_t appkey[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00 };
46 changes: 46 additions & 0 deletions examples/esp32_platformio/lib/README
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
29 changes: 29 additions & 0 deletions examples/esp32_platformio/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; 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:ttgo-lora32-v21]
platform = espressif32
board = ttgo-lora32-v21
framework = arduino
lib_deps =
https://github.com/mcci-catena/arduino-lorawan
; Ofiicial Release is missing a Patch that causes a Boot-Loop #204
; mcci-catena/MCCI Arduino LoRaWAN Library @ ^0.9.2
thesolarnomad/LoRa Serialization@^3.2.1

monitor_speed = 115200

build_flags =
; Define Frequancy
-DCFG_eu868
; mitigate "multiple definitions hal_init" - Bug
-D hal_init=LMICHAL_init
-DLMIC_DEBUG_LEVEL=1
-D_DEBUG_MODE_
Loading

0 comments on commit 254ee67

Please sign in to comment.