From 4d5107f9fdb00233d85f2b46ebcc5ce0076c2256 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Sun, 9 Apr 2017 11:18:04 +0200 Subject: [PATCH] new platformio project --- .gitignore | 4 ++++ .gitlab-ci.yml | 12 ++++++++++++ lib/readme.txt | 36 ++++++++++++++++++++++++++++++++++++ platformio.ini | 14 ++++++++++++++ src/main.cpp | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 lib/readme.txt create mode 100644 platformio.ini create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5dac9f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.pioenvs +.piolibdeps +.clang_complete +.gcc-flags.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..bd976b9 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,12 @@ +build: + image: eclipse/platformio + script: +# - platformio lib -g install 1 +# - platformio ci --board=esp32thing + - platformio run + - cp /home/user/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader.bin .pioenvs/esp32thing/ + - cp /home/user/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin .pioenvs/esp32thing/ +# to flash: esptool.py --before default_reset --after hard_reset --chip esp32 --port "/dev/ttyUSB0" --baud 115200 write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 "/home/user/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader.bin" 0x8000 ".pioenvs/esp32thing/partitions.bin" 0xe000 "/home/user/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin" 0x10000 .pioenvs/esp32thing/firmware.bin + artifacts: + paths: + - ".pioenvs/esp32thing/*.bin" diff --git a/lib/readme.txt b/lib/readme.txt new file mode 100644 index 0000000..dbadc3d --- /dev/null +++ b/lib/readme.txt @@ -0,0 +1,36 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +More information about PlatformIO Library Dependency Finder +- http://docs.platformio.org/page/librarymanager/ldf.html diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..777d273 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,14 @@ +; 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 +; http://docs.platformio.org/page/projectconf.html + +[env:esp32thing] +platform = espressif32 +board = esp32thing +framework = arduino diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..90d54ba --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,32 @@ +/** + * Blink + * + * Turns on an LED on for one second, + * then off for one second, repeatedly. + * + * https://github.com/platformio/platformio-examples/tree/develop/espressif + */ +#include "Arduino.h" + +#define LED_PIN 5 + +void setup() +{ + // initialize LED digital pin as an output. + pinMode(LED_PIN, OUTPUT); +} + +void loop() +{ + // turn the LED on (HIGH is the voltage level) + digitalWrite(LED_PIN, HIGH); + + // wait for a second + delay(1000); + + // turn the LED off by making the voltage LOW + digitalWrite(LED_PIN, LOW); + + // wait for a second + delay(1000); +}