Hendrik Langer
8 years ago
9 changed files with 93 additions and 65 deletions
@ -1,2 +1,4 @@ |
|||
build/ |
|||
sdkconfig.old |
|||
.pioenvs |
|||
.piolibdeps |
|||
.clang_complete |
|||
.gcc-flags.json |
|||
|
@ -1,10 +1,9 @@ |
|||
build: |
|||
image: espressif/esp32-ci-env |
|||
variables: |
|||
SDK_PATH: "$CI_PROJECT_DIR" |
|||
IDF_PATH: "$CI_PROJECT_DIR" |
|||
image: eclipse/platformio |
|||
script: |
|||
- make all |
|||
# - platformio lib -g install 1 |
|||
# - platformio ci --board=esp32thing |
|||
- platformio run |
|||
artifacts: |
|||
paths: |
|||
- "*.bin" |
@ -1,8 +0,0 @@ |
|||
#
|
|||
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
|
|||
# project subdirectory.
|
|||
#
|
|||
|
|||
PROJECT_NAME := app-template |
|||
|
|||
include $(IDF_PATH)/make/project.mk |
@ -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 <Foo.h> |
|||
#include <Bar.h> |
|||
|
|||
// 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 |
@ -1,8 +0,0 @@ |
|||
#
|
|||
# Main component makefile.
|
|||
#
|
|||
# This Makefile can be left empty. By default, it will take the sources in the
|
|||
# src/ directory, compile them and link them into lib(subdirectory_name).a
|
|||
# in the build directory. This behaviour is entirely configurable,
|
|||
# please read the ESP-IDF documents if you need to do this.
|
|||
#
|
@ -1,41 +0,0 @@ |
|||
#include "freertos/FreeRTOS.h" |
|||
#include "esp_wifi.h" |
|||
#include "esp_system.h" |
|||
#include "esp_event.h" |
|||
#include "esp_event_loop.h" |
|||
#include "nvs_flash.h" |
|||
#include "driver/gpio.h" |
|||
|
|||
esp_err_t event_handler(void *ctx, system_event_t *event) |
|||
{ |
|||
return ESP_OK; |
|||
} |
|||
|
|||
void app_main(void) |
|||
{ |
|||
nvs_flash_init(); |
|||
tcpip_adapter_init(); |
|||
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); |
|||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); |
|||
ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); |
|||
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); |
|||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); |
|||
wifi_config_t sta_config = { |
|||
.sta = { |
|||
.ssid = "access_point_name", |
|||
.password = "password", |
|||
.bssid_set = false |
|||
} |
|||
}; |
|||
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) ); |
|||
ESP_ERROR_CHECK( esp_wifi_start() ); |
|||
ESP_ERROR_CHECK( esp_wifi_connect() ); |
|||
|
|||
gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT); |
|||
int level = 0; |
|||
while (true) { |
|||
gpio_set_level(GPIO_NUM_4, level); |
|||
level = !level; |
|||
vTaskDelay(300 / portTICK_PERIOD_MS); |
|||
} |
|||
} |
@ -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 |
@ -0,0 +1,34 @@ |
|||
/**
|
|||
* 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" |
|||
|
|||
#ifndef LED_BUILTIN |
|||
#define LED_BUILTIN 13 |
|||
#endif |
|||
|
|||
void setup() |
|||
{ |
|||
// initialize LED digital pin as an output.
|
|||
pinMode(LED_BUILTIN, OUTPUT); |
|||
} |
|||
|
|||
void loop() |
|||
{ |
|||
// turn the LED on (HIGH is the voltage level)
|
|||
digitalWrite(LED_BUILTIN, HIGH); |
|||
|
|||
// wait for a second
|
|||
delay(1000); |
|||
|
|||
// turn the LED off by making the voltage LOW
|
|||
digitalWrite(LED_BUILTIN, LOW); |
|||
|
|||
// wait for a second
|
|||
delay(1000); |
|||
} |
Loading…
Reference in new issue