forked from platformio/platformio-core
Move examples to own repo https://github.com/platformio/platformio-examples
This commit is contained in:
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,6 +0,0 @@
|
|||||||
[submodule "examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library"]
|
|
||||||
path = examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library
|
|
||||||
url = https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library.git
|
|
||||||
[submodule "examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library"]
|
|
||||||
path = examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library
|
|
||||||
url = https://github.com/adafruit/Adafruit-GFX-Library.git
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/adafruit-blink
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:flora8]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = flora8
|
|
||||||
|
|
||||||
[env:trinket3]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = trinket3
|
|
||||||
|
|
||||||
[env:protrinket5]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = protrinket5
|
|
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
Blink
|
|
||||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
|
||||||
|
|
||||||
This example code is in the public domain.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
|
||||||
|
|
||||||
// the setup routine runs once when you press reset:
|
|
||||||
void setup() {
|
|
||||||
// initialize the digital pin as an output.
|
|
||||||
pinMode(led, OUTPUT);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// the loop routine runs over and over again forever:
|
|
||||||
void loop() {
|
|
||||||
digitalWrite(led, HIGH);
|
|
||||||
delay(1000);
|
|
||||||
digitalWrite(led, LOW);
|
|
||||||
delay(1000);
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/arduino-external-libs
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
Submodule examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library deleted from 6d40eb3423
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:arduino_uno]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = uno
|
|
@ -1,350 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
This is an example sketch for our Monochrome Nokia 5110 LCD Displays
|
|
||||||
|
|
||||||
Pick one up today in the adafruit shop!
|
|
||||||
------> http://www.adafruit.com/products/338
|
|
||||||
|
|
||||||
These displays use SPI to communicate, 4 or 5 pins are required to
|
|
||||||
interface
|
|
||||||
|
|
||||||
Adafruit invests time and resources providing this open source code,
|
|
||||||
please support Adafruit and open-source hardware by purchasing
|
|
||||||
products from Adafruit!
|
|
||||||
|
|
||||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
|
||||||
BSD license, check license.txt for more information
|
|
||||||
All text above, and the splash screen must be included in any redistribution
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#include <SPI.h>
|
|
||||||
#include <Adafruit_GFX.h>
|
|
||||||
#include <Adafruit_PCD8544.h>
|
|
||||||
|
|
||||||
// Software SPI (slower updates, more flexible pin options):
|
|
||||||
// pin 7 - Serial clock out (SCLK)
|
|
||||||
// pin 6 - Serial data out (DIN)
|
|
||||||
// pin 5 - Data/Command select (D/C)
|
|
||||||
// pin 4 - LCD chip select (CS)
|
|
||||||
// pin 3 - LCD reset (RST)
|
|
||||||
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
|
|
||||||
|
|
||||||
// Hardware SPI (faster, but must use certain hardware pins):
|
|
||||||
// SCK is LCD serial clock (SCLK) - this is pin 13 on Arduino Uno
|
|
||||||
// MOSI is LCD DIN - this is pin 11 on an Arduino Uno
|
|
||||||
// pin 5 - Data/Command select (D/C)
|
|
||||||
// pin 4 - LCD chip select (CS)
|
|
||||||
// pin 3 - LCD reset (RST)
|
|
||||||
// Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3);
|
|
||||||
// Note with hardware SPI MISO and SS pins aren't used but will still be read
|
|
||||||
// and written to during SPI transfer. Be careful sharing these pins!
|
|
||||||
|
|
||||||
#define NUMFLAKES 10
|
|
||||||
#define XPOS 0
|
|
||||||
#define YPOS 1
|
|
||||||
#define DELTAY 2
|
|
||||||
|
|
||||||
|
|
||||||
#define LOGO16_GLCD_HEIGHT 16
|
|
||||||
#define LOGO16_GLCD_WIDTH 16
|
|
||||||
|
|
||||||
static const unsigned char PROGMEM logo16_glcd_bmp[] =
|
|
||||||
{ B00000000, B11000000,
|
|
||||||
B00000001, B11000000,
|
|
||||||
B00000001, B11000000,
|
|
||||||
B00000011, B11100000,
|
|
||||||
B11110011, B11100000,
|
|
||||||
B11111110, B11111000,
|
|
||||||
B01111110, B11111111,
|
|
||||||
B00110011, B10011111,
|
|
||||||
B00011111, B11111100,
|
|
||||||
B00001101, B01110000,
|
|
||||||
B00011011, B10100000,
|
|
||||||
B00111111, B11100000,
|
|
||||||
B00111111, B11110000,
|
|
||||||
B01111100, B11110000,
|
|
||||||
B01110000, B01110000,
|
|
||||||
B00000000, B00110000 };
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
display.begin();
|
|
||||||
// init done
|
|
||||||
|
|
||||||
// you can change the contrast around to adapt the display
|
|
||||||
// for the best viewing!
|
|
||||||
display.setContrast(50);
|
|
||||||
|
|
||||||
display.display(); // show splashscreen
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay(); // clears the screen and buffer
|
|
||||||
|
|
||||||
// draw a single pixel
|
|
||||||
display.drawPixel(10, 10, BLACK);
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// draw many lines
|
|
||||||
testdrawline();
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// draw rectangles
|
|
||||||
testdrawrect();
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// draw multiple rectangles
|
|
||||||
testfillrect();
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// draw mulitple circles
|
|
||||||
testdrawcircle();
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// draw a circle, 10 pixel radius
|
|
||||||
display.fillCircle(display.width()/2, display.height()/2, 10, BLACK);
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
testdrawroundrect();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
testfillroundrect();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
testdrawtriangle();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
testfilltriangle();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// draw the first ~12 characters in the font
|
|
||||||
testdrawchar();
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
display.clearDisplay();
|
|
||||||
|
|
||||||
// text display tests
|
|
||||||
display.setTextSize(1);
|
|
||||||
display.setTextColor(BLACK);
|
|
||||||
display.setCursor(0,0);
|
|
||||||
display.println("Hello, world!");
|
|
||||||
display.setTextColor(WHITE, BLACK); // 'inverted' text
|
|
||||||
display.println(3.141592);
|
|
||||||
display.setTextSize(2);
|
|
||||||
display.setTextColor(BLACK);
|
|
||||||
display.print("0x"); display.println(0xDEADBEEF, HEX);
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
|
|
||||||
// rotation example
|
|
||||||
display.clearDisplay();
|
|
||||||
display.setRotation(1); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further.
|
|
||||||
display.setTextSize(1);
|
|
||||||
display.setTextColor(BLACK);
|
|
||||||
display.setCursor(0,0);
|
|
||||||
display.println("Rotation");
|
|
||||||
display.setTextSize(2);
|
|
||||||
display.println("Example!");
|
|
||||||
display.display();
|
|
||||||
delay(2000);
|
|
||||||
|
|
||||||
// revert back to no rotation
|
|
||||||
display.setRotation(0);
|
|
||||||
|
|
||||||
// miniature bitmap display
|
|
||||||
display.clearDisplay();
|
|
||||||
display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1);
|
|
||||||
display.display();
|
|
||||||
|
|
||||||
// invert the display
|
|
||||||
display.invertDisplay(true);
|
|
||||||
delay(1000);
|
|
||||||
display.invertDisplay(false);
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
// draw a bitmap icon and 'animate' movement
|
|
||||||
testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_WIDTH, LOGO16_GLCD_HEIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
|
|
||||||
uint8_t icons[NUMFLAKES][3];
|
|
||||||
srandom(666); // whatever seed
|
|
||||||
|
|
||||||
// initialize
|
|
||||||
for (uint8_t f=0; f< NUMFLAKES; f++) {
|
|
||||||
icons[f][XPOS] = random() % display.width();
|
|
||||||
icons[f][YPOS] = 0;
|
|
||||||
icons[f][DELTAY] = random() % 5 + 1;
|
|
||||||
|
|
||||||
Serial.print("x: ");
|
|
||||||
Serial.print(icons[f][XPOS], DEC);
|
|
||||||
Serial.print(" y: ");
|
|
||||||
Serial.print(icons[f][YPOS], DEC);
|
|
||||||
Serial.print(" dy: ");
|
|
||||||
Serial.println(icons[f][DELTAY], DEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
// draw each icon
|
|
||||||
for (uint8_t f=0; f< NUMFLAKES; f++) {
|
|
||||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, BLACK);
|
|
||||||
}
|
|
||||||
display.display();
|
|
||||||
delay(200);
|
|
||||||
|
|
||||||
// then erase it + move it
|
|
||||||
for (uint8_t f=0; f< NUMFLAKES; f++) {
|
|
||||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, WHITE);
|
|
||||||
// move it
|
|
||||||
icons[f][YPOS] += icons[f][DELTAY];
|
|
||||||
// if its gone, reinit
|
|
||||||
if (icons[f][YPOS] > display.height()) {
|
|
||||||
icons[f][XPOS] = random() % display.width();
|
|
||||||
icons[f][YPOS] = 0;
|
|
||||||
icons[f][DELTAY] = random() % 5 + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void testdrawchar(void) {
|
|
||||||
display.setTextSize(1);
|
|
||||||
display.setTextColor(BLACK);
|
|
||||||
display.setCursor(0,0);
|
|
||||||
|
|
||||||
for (uint8_t i=0; i < 168; i++) {
|
|
||||||
if (i == '\n') continue;
|
|
||||||
display.write(i);
|
|
||||||
//if ((i > 0) && (i % 14 == 0))
|
|
||||||
//display.println();
|
|
||||||
}
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void testdrawcircle(void) {
|
|
||||||
for (int16_t i=0; i<display.height(); i+=2) {
|
|
||||||
display.drawCircle(display.width()/2, display.height()/2, i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testfillrect(void) {
|
|
||||||
uint8_t color = 1;
|
|
||||||
for (int16_t i=0; i<display.height()/2; i+=3) {
|
|
||||||
// alternate colors
|
|
||||||
display.fillRect(i, i, display.width()-i*2, display.height()-i*2, color%2);
|
|
||||||
display.display();
|
|
||||||
color++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testdrawtriangle(void) {
|
|
||||||
for (int16_t i=0; i<min(display.width(),display.height())/2; i+=5) {
|
|
||||||
display.drawTriangle(display.width()/2, display.height()/2-i,
|
|
||||||
display.width()/2-i, display.height()/2+i,
|
|
||||||
display.width()/2+i, display.height()/2+i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testfilltriangle(void) {
|
|
||||||
uint8_t color = BLACK;
|
|
||||||
for (int16_t i=min(display.width(),display.height())/2; i>0; i-=5) {
|
|
||||||
display.fillTriangle(display.width()/2, display.height()/2-i,
|
|
||||||
display.width()/2-i, display.height()/2+i,
|
|
||||||
display.width()/2+i, display.height()/2+i, color);
|
|
||||||
if (color == WHITE) color = BLACK;
|
|
||||||
else color = WHITE;
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testdrawroundrect(void) {
|
|
||||||
for (int16_t i=0; i<display.height()/2-2; i+=2) {
|
|
||||||
display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testfillroundrect(void) {
|
|
||||||
uint8_t color = BLACK;
|
|
||||||
for (int16_t i=0; i<display.height()/2-2; i+=2) {
|
|
||||||
display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, color);
|
|
||||||
if (color == WHITE) color = BLACK;
|
|
||||||
else color = WHITE;
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testdrawrect(void) {
|
|
||||||
for (int16_t i=0; i<display.height()/2; i+=2) {
|
|
||||||
display.drawRect(i, i, display.width()-2*i, display.height()-2*i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void testdrawline() {
|
|
||||||
for (int16_t i=0; i<display.width(); i+=4) {
|
|
||||||
display.drawLine(0, 0, i, display.height()-1, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
for (int16_t i=0; i<display.height(); i+=4) {
|
|
||||||
display.drawLine(0, 0, display.width()-1, i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
|
|
||||||
display.clearDisplay();
|
|
||||||
for (int16_t i=0; i<display.width(); i+=4) {
|
|
||||||
display.drawLine(0, display.height()-1, i, 0, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
for (int8_t i=display.height()-1; i>=0; i-=4) {
|
|
||||||
display.drawLine(0, display.height()-1, display.width()-1, i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
|
|
||||||
display.clearDisplay();
|
|
||||||
for (int16_t i=display.width()-1; i>=0; i-=4) {
|
|
||||||
display.drawLine(display.width()-1, display.height()-1, i, 0, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
for (int16_t i=display.height()-1; i>=0; i-=4) {
|
|
||||||
display.drawLine(display.width()-1, display.height()-1, 0, i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
|
|
||||||
display.clearDisplay();
|
|
||||||
for (int16_t i=0; i<display.height(); i+=4) {
|
|
||||||
display.drawLine(display.width()-1, 0, 0, i, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
for (int16_t i=0; i<display.width(); i+=4) {
|
|
||||||
display.drawLine(display.width()-1, 0, i, display.height()-1, BLACK);
|
|
||||||
display.display();
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/arduino-internal-libs
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:arduino_uno]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = uno
|
|
||||||
|
|
||||||
[env:arduino_ethernet]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = ethernet
|
|
||||||
|
|
||||||
[env:arduino_leonardo]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = leonardo
|
|
||||||
|
|
||||||
[env:arduino_pro16MHzatmega328]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = pro16MHzatmega328
|
|
||||||
|
|
||||||
[env:arduino_megaatmega1280]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = megaatmega1280
|
|
||||||
|
|
||||||
[env:arduino_micro]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = micro
|
|
||||||
|
|
||||||
[env:arduino_robotControl]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = robotControl
|
|
||||||
|
|
||||||
[env:arduino_yun]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = yun
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
Chat Server
|
|
||||||
|
|
||||||
A simple server that distributes any incoming messages to all
|
|
||||||
connected clients. To use telnet to your device's IP address and type.
|
|
||||||
You can see the client's input in the serial monitor as well.
|
|
||||||
Using an Arduino Wiznet Ethernet shield.
|
|
||||||
|
|
||||||
Circuit:
|
|
||||||
* Ethernet shield attached to pins 10, 11, 12, 13
|
|
||||||
* Analog inputs attached to pins A0 through A5 (optional)
|
|
||||||
|
|
||||||
created 18 Dec 2009
|
|
||||||
by David A. Mellis
|
|
||||||
modified 9 Apr 2012
|
|
||||||
by Tom Igoe
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <SPI.h>
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
// Enter a MAC address and IP address for your controller below.
|
|
||||||
// The IP address will be dependent on your local network.
|
|
||||||
// gateway and subnet are optional:
|
|
||||||
byte mac[] = {
|
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
|
||||||
};
|
|
||||||
IPAddress ip(192, 168, 1, 177);
|
|
||||||
IPAddress gateway(192, 168, 1, 1);
|
|
||||||
IPAddress subnet(255, 255, 0, 0);
|
|
||||||
|
|
||||||
|
|
||||||
// telnet defaults to port 23
|
|
||||||
EthernetServer server(23);
|
|
||||||
boolean alreadyConnected = false; // whether or not the client was connected previously
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// initialize the ethernet device
|
|
||||||
Ethernet.begin(mac, ip, gateway, subnet);
|
|
||||||
// start listening for clients
|
|
||||||
server.begin();
|
|
||||||
// Open serial communications and wait for port to open:
|
|
||||||
Serial.begin(9600);
|
|
||||||
while (!Serial) {
|
|
||||||
; // wait for serial port to connect. Needed for Leonardo only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Chat server address:");
|
|
||||||
Serial.println(Ethernet.localIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
// wait for a new client:
|
|
||||||
EthernetClient client = server.available();
|
|
||||||
|
|
||||||
// when the client sends the first byte, say hello:
|
|
||||||
if (client) {
|
|
||||||
if (!alreadyConnected) {
|
|
||||||
// clead out the input buffer:
|
|
||||||
client.flush();
|
|
||||||
Serial.println("We have a new client");
|
|
||||||
client.println("Hello, client!");
|
|
||||||
alreadyConnected = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client.available() > 0) {
|
|
||||||
// read the bytes incoming from the client:
|
|
||||||
char thisChar = client.read();
|
|
||||||
// echo the bytes back to the client:
|
|
||||||
server.write(thisChar);
|
|
||||||
// echo the bytes to the server as well:
|
|
||||||
Serial.write(thisChar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) Ivan Kravets <me@ikravets.com>
|
|
||||||
* See LICENSE for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LED_PIN
|
|
||||||
#define LED_PIN 13 // Most Arduino boards already have a LED attached to pin 13 on the board itself
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(LED_PIN, OUTPUT); // set pin as output
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
digitalWrite(LED_PIN, HIGH); // set the LED on
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
digitalWrite(LED_PIN, LOW); // set the LED off
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/arduino-own-src_dir
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[platformio]
|
|
||||||
src_dir = Blink
|
|
||||||
|
|
||||||
[env:arduino_uno]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = uno
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/atmelavr-native-blink
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:arduino_pro5v]
|
|
||||||
platform = atmelavr
|
|
||||||
board_mcu = atmega168
|
|
||||||
board_f_cpu = 16000000L
|
|
||||||
|
|
||||||
upload_protocol = arduino
|
|
||||||
upload_speed = 19200
|
|
||||||
|
|
||||||
# targets = upload
|
|
@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) Ivan Kravets <me@ikravets.com>
|
|
||||||
* See LICENSE for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
// make the LED pin an output for PORTB5
|
|
||||||
DDRB = 1 << 5;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
_delay_ms(500);
|
|
||||||
|
|
||||||
// toggle the LED
|
|
||||||
PORTB ^= 1 << 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/digitstump-mouse
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:digispark-tiny]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = digispark-tiny
|
|
||||||
|
|
||||||
[env:digispark-pro32]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = digispark-pro32
|
|
@ -1,41 +0,0 @@
|
|||||||
// DigiMouse test and usage documentation
|
|
||||||
// CAUTION!!!! This does click things!!!!!!!!
|
|
||||||
// Originally created by Sean Murphy (duckythescientist)
|
|
||||||
|
|
||||||
#include <DigiMouse.h>
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
DigiMouse.begin(); //start or reenumerate USB - BREAKING CHANGE from old versions that didn't require this
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
// If not using plentiful DigiMouse.delay(), make sure to call
|
|
||||||
// DigiMouse.update() at least every 50ms
|
|
||||||
|
|
||||||
// move across the screen
|
|
||||||
// these are signed chars
|
|
||||||
DigiMouse.moveY(10); //down 10
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
DigiMouse.moveX(20); //right 20
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
DigiMouse.scroll(5);
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
|
|
||||||
// or DigiMouse.move(X, Y, scroll) works
|
|
||||||
|
|
||||||
// three buttons are the three LSBs of an unsigned char
|
|
||||||
DigiMouse.setButtons(1<<0); //left click
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
DigiMouse.setButtons(0); //unclick all
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
|
|
||||||
//or you can use these functions to click
|
|
||||||
DigiMouse.rightClick();
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
DigiMouse.leftClick();
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
DigiMouse.middleClick();
|
|
||||||
DigiMouse.delay(500);
|
|
||||||
|
|
||||||
//for compatability with other libraries you can also use DigiMouse.move(X, Y, scroll, buttons)
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/engduino-magnetometer
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:engduinov3]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = engduinov3
|
|
||||||
lib_install = 574
|
|
@ -1,44 +0,0 @@
|
|||||||
#include <EngduinoMagnetometer.h>
|
|
||||||
#include <Wire.h>
|
|
||||||
|
|
||||||
// Magnetometer demo
|
|
||||||
//
|
|
||||||
// Print the field strength values
|
|
||||||
//
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
EngduinoMagnetometer.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
float magneticField[3];
|
|
||||||
|
|
||||||
// Read magnetic field strength. The values range from -20000
|
|
||||||
// to +20000 counts and are based on internal calibration
|
|
||||||
// values
|
|
||||||
//
|
|
||||||
EngduinoMagnetometer.xyz(magneticField);
|
|
||||||
|
|
||||||
float x = magneticField[0];
|
|
||||||
float y = magneticField[1];
|
|
||||||
float z = magneticField[2];
|
|
||||||
Serial.print("Magnetic field strength: x = ");
|
|
||||||
Serial.print(x);
|
|
||||||
Serial.print(" counts y = ");
|
|
||||||
Serial.print(y);
|
|
||||||
Serial.print(" counts z = ");
|
|
||||||
Serial.print(z);
|
|
||||||
Serial.println(" counts");
|
|
||||||
|
|
||||||
// Note that this is an uncalibrated temperature
|
|
||||||
// of the die itself. Whilst it should be a value
|
|
||||||
// in degrees C, the lack of calibration could mean
|
|
||||||
// that it's anything.
|
|
||||||
int8_t t = EngduinoMagnetometer.temperature();
|
|
||||||
Serial.print("Temperature: ");
|
|
||||||
Serial.println(t);
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/panstamp-blink
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:panStampAVR]
|
|
||||||
platform = atmelavr
|
|
||||||
framework = arduino
|
|
||||||
board = panStampAVR
|
|
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
Blink
|
|
||||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
|
||||||
|
|
||||||
Most Arduinos have an on-board LED you can control. On the Uno and
|
|
||||||
Leonardo, it is attached to digital pin 13. If you're unsure what
|
|
||||||
pin the on-board LED is connected to on your Arduino model, check
|
|
||||||
the documentation at http://arduino.cc
|
|
||||||
|
|
||||||
This example code is in the public domain.
|
|
||||||
|
|
||||||
modified 8 May 2014
|
|
||||||
by Scott Fitzgerald
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// the setup function runs once when you press reset or power the board
|
|
||||||
void setup() {
|
|
||||||
// initialize digital pin 13 as an output.
|
|
||||||
pinMode(13, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the loop function runs over and over again forever
|
|
||||||
void loop() {
|
|
||||||
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelsam-and-arduino/arduino-external-libs
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,387 +0,0 @@
|
|||||||
/*
|
|
||||||
SFE_BMP180.cpp
|
|
||||||
Bosch BMP180 pressure sensor library for the Arduino microcontroller
|
|
||||||
Mike Grusin, SparkFun Electronics
|
|
||||||
|
|
||||||
Uses floating-point equations from the Weather Station Data Logger project
|
|
||||||
http://wmrx00.sourceforge.net/
|
|
||||||
http://wmrx00.sourceforge.net/Arduino/BMP085-Calcs.pdf
|
|
||||||
|
|
||||||
Forked from BMP085 library by M.Grusin
|
|
||||||
|
|
||||||
version 1.0 2013/09/20 initial version
|
|
||||||
|
|
||||||
Our example code uses the "beerware" license. You can do anything
|
|
||||||
you like with this code. No really, anything. If you find it useful,
|
|
||||||
buy me a (root) beer someday.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <SFE_BMP180.h>
|
|
||||||
#include <Wire.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
|
|
||||||
SFE_BMP180::SFE_BMP180()
|
|
||||||
// Base library type
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::begin()
|
|
||||||
// Initialize library for subsequent pressure measurements
|
|
||||||
{
|
|
||||||
double c3,c4,b1;
|
|
||||||
|
|
||||||
// Start up the Arduino's "wire" (I2C) library:
|
|
||||||
|
|
||||||
Wire.begin();
|
|
||||||
|
|
||||||
// The BMP180 includes factory calibration data stored on the device.
|
|
||||||
// Each device has different numbers, these must be retrieved and
|
|
||||||
// used in the calculations when taking pressure measurements.
|
|
||||||
|
|
||||||
// Retrieve calibration data from device:
|
|
||||||
|
|
||||||
if (readInt(0xAA,AC1) &&
|
|
||||||
readInt(0xAC,AC2) &&
|
|
||||||
readInt(0xAE,AC3) &&
|
|
||||||
readUInt(0xB0,AC4) &&
|
|
||||||
readUInt(0xB2,AC5) &&
|
|
||||||
readUInt(0xB4,AC6) &&
|
|
||||||
readInt(0xB6,VB1) &&
|
|
||||||
readInt(0xB8,VB2) &&
|
|
||||||
readInt(0xBA,MB) &&
|
|
||||||
readInt(0xBC,MC) &&
|
|
||||||
readInt(0xBE,MD))
|
|
||||||
{
|
|
||||||
|
|
||||||
// All reads completed successfully!
|
|
||||||
|
|
||||||
// If you need to check your math using known numbers,
|
|
||||||
// you can uncomment one of these examples.
|
|
||||||
// (The correct results are commented in the below functions.)
|
|
||||||
|
|
||||||
// Example from Bosch datasheet
|
|
||||||
// AC1 = 408; AC2 = -72; AC3 = -14383; AC4 = 32741; AC5 = 32757; AC6 = 23153;
|
|
||||||
// B1 = 6190; B2 = 4; MB = -32768; MC = -8711; MD = 2868;
|
|
||||||
|
|
||||||
// Example from http://wmrx00.sourceforge.net/Arduino/BMP180-Calcs.pdf
|
|
||||||
// AC1 = 7911; AC2 = -934; AC3 = -14306; AC4 = 31567; AC5 = 25671; AC6 = 18974;
|
|
||||||
// VB1 = 5498; VB2 = 46; MB = -32768; MC = -11075; MD = 2432;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Serial.print("AC1: "); Serial.println(AC1);
|
|
||||||
Serial.print("AC2: "); Serial.println(AC2);
|
|
||||||
Serial.print("AC3: "); Serial.println(AC3);
|
|
||||||
Serial.print("AC4: "); Serial.println(AC4);
|
|
||||||
Serial.print("AC5: "); Serial.println(AC5);
|
|
||||||
Serial.print("AC6: "); Serial.println(AC6);
|
|
||||||
Serial.print("VB1: "); Serial.println(VB1);
|
|
||||||
Serial.print("VB2: "); Serial.println(VB2);
|
|
||||||
Serial.print("MB: "); Serial.println(MB);
|
|
||||||
Serial.print("MC: "); Serial.println(MC);
|
|
||||||
Serial.print("MD: "); Serial.println(MD);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Compute floating-point polynominals:
|
|
||||||
|
|
||||||
c3 = 160.0 * pow(2,-15) * AC3;
|
|
||||||
c4 = pow(10,-3) * pow(2,-15) * AC4;
|
|
||||||
b1 = pow(160,2) * pow(2,-30) * VB1;
|
|
||||||
c5 = (pow(2,-15) / 160) * AC5;
|
|
||||||
c6 = AC6;
|
|
||||||
mc = (pow(2,11) / pow(160,2)) * MC;
|
|
||||||
md = MD / 160.0;
|
|
||||||
x0 = AC1;
|
|
||||||
x1 = 160.0 * pow(2,-13) * AC2;
|
|
||||||
x2 = pow(160,2) * pow(2,-25) * VB2;
|
|
||||||
y0 = c4 * pow(2,15);
|
|
||||||
y1 = c4 * c3;
|
|
||||||
y2 = c4 * b1;
|
|
||||||
p0 = (3791.0 - 8.0) / 1600.0;
|
|
||||||
p1 = 1.0 - 7357.0 * pow(2,-20);
|
|
||||||
p2 = 3038.0 * 100.0 * pow(2,-36);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Serial.println();
|
|
||||||
Serial.print("c3: "); Serial.println(c3);
|
|
||||||
Serial.print("c4: "); Serial.println(c4);
|
|
||||||
Serial.print("c5: "); Serial.println(c5);
|
|
||||||
Serial.print("c6: "); Serial.println(c6);
|
|
||||||
Serial.print("b1: "); Serial.println(b1);
|
|
||||||
Serial.print("mc: "); Serial.println(mc);
|
|
||||||
Serial.print("md: "); Serial.println(md);
|
|
||||||
Serial.print("x0: "); Serial.println(x0);
|
|
||||||
Serial.print("x1: "); Serial.println(x1);
|
|
||||||
Serial.print("x2: "); Serial.println(x2);
|
|
||||||
Serial.print("y0: "); Serial.println(y0);
|
|
||||||
Serial.print("y1: "); Serial.println(y1);
|
|
||||||
Serial.print("y2: "); Serial.println(y2);
|
|
||||||
Serial.print("p0: "); Serial.println(p0);
|
|
||||||
Serial.print("p1: "); Serial.println(p1);
|
|
||||||
Serial.print("p2: "); Serial.println(p2);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Success!
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Error reading calibration data; bad component or connection?
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::readInt(char address, int &value)
|
|
||||||
// Read a signed integer (two bytes) from device
|
|
||||||
// address: register to start reading (plus subsequent register)
|
|
||||||
// value: external variable to store data (function modifies value)
|
|
||||||
{
|
|
||||||
unsigned char data[2];
|
|
||||||
|
|
||||||
data[0] = address;
|
|
||||||
if (readBytes(data,2))
|
|
||||||
{
|
|
||||||
value = (((int)data[0]<<8)|(int)data[1]);
|
|
||||||
//if (*value & 0x8000) *value |= 0xFFFF0000; // sign extend if negative
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
value = 0;
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::readUInt(char address, unsigned int &value)
|
|
||||||
// Read an unsigned integer (two bytes) from device
|
|
||||||
// address: register to start reading (plus subsequent register)
|
|
||||||
// value: external variable to store data (function modifies value)
|
|
||||||
{
|
|
||||||
unsigned char data[2];
|
|
||||||
|
|
||||||
data[0] = address;
|
|
||||||
if (readBytes(data,2))
|
|
||||||
{
|
|
||||||
value = (((unsigned int)data[0]<<8)|(unsigned int)data[1]);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
value = 0;
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::readBytes(unsigned char *values, char length)
|
|
||||||
// Read an array of bytes from device
|
|
||||||
// values: external array to hold data. Put starting register in values[0].
|
|
||||||
// length: number of bytes to read
|
|
||||||
{
|
|
||||||
char x;
|
|
||||||
|
|
||||||
Wire.beginTransmission(BMP180_ADDR);
|
|
||||||
Wire.write(values[0]);
|
|
||||||
_error = Wire.endTransmission();
|
|
||||||
if (_error == 0)
|
|
||||||
{
|
|
||||||
Wire.requestFrom(BMP180_ADDR,length);
|
|
||||||
while(Wire.available() != length) ; // wait until bytes are ready
|
|
||||||
for(x=0;x<length;x++)
|
|
||||||
{
|
|
||||||
values[x] = Wire.read();
|
|
||||||
}
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::writeBytes(unsigned char *values, char length)
|
|
||||||
// Write an array of bytes to device
|
|
||||||
// values: external array of data to write. Put starting register in values[0].
|
|
||||||
// length: number of bytes to write
|
|
||||||
{
|
|
||||||
char x;
|
|
||||||
|
|
||||||
Wire.beginTransmission(BMP180_ADDR);
|
|
||||||
Wire.write(values,length);
|
|
||||||
_error = Wire.endTransmission();
|
|
||||||
if (_error == 0)
|
|
||||||
return(1);
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::startTemperature(void)
|
|
||||||
// Begin a temperature reading.
|
|
||||||
// Will return delay in ms to wait, or 0 if I2C error
|
|
||||||
{
|
|
||||||
unsigned char data[2], result;
|
|
||||||
|
|
||||||
data[0] = BMP180_REG_CONTROL;
|
|
||||||
data[1] = BMP180_COMMAND_TEMPERATURE;
|
|
||||||
result = writeBytes(data, 2);
|
|
||||||
if (result) // good write?
|
|
||||||
return(5); // return the delay in ms (rounded up) to wait before retrieving data
|
|
||||||
else
|
|
||||||
return(0); // or return 0 if there was a problem communicating with the BMP
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::getTemperature(double &T)
|
|
||||||
// Retrieve a previously-started temperature reading.
|
|
||||||
// Requires begin() to be called once prior to retrieve calibration parameters.
|
|
||||||
// Requires startTemperature() to have been called prior and sufficient time elapsed.
|
|
||||||
// T: external variable to hold result.
|
|
||||||
// Returns 1 if successful, 0 if I2C error.
|
|
||||||
{
|
|
||||||
unsigned char data[2];
|
|
||||||
char result;
|
|
||||||
double tu, a;
|
|
||||||
|
|
||||||
data[0] = BMP180_REG_RESULT;
|
|
||||||
|
|
||||||
result = readBytes(data, 2);
|
|
||||||
if (result) // good read, calculate temperature
|
|
||||||
{
|
|
||||||
tu = (data[0] * 256.0) + data[1];
|
|
||||||
|
|
||||||
//example from Bosch datasheet
|
|
||||||
//tu = 27898;
|
|
||||||
|
|
||||||
//example from http://wmrx00.sourceforge.net/Arduino/BMP085-Calcs.pdf
|
|
||||||
//tu = 0x69EC;
|
|
||||||
|
|
||||||
a = c5 * (tu - c6);
|
|
||||||
T = a + (mc / (a + md));
|
|
||||||
|
|
||||||
/*
|
|
||||||
Serial.println();
|
|
||||||
Serial.print("tu: "); Serial.println(tu);
|
|
||||||
Serial.print("a: "); Serial.println(a);
|
|
||||||
Serial.print("T: "); Serial.println(*T);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::startPressure(char oversampling)
|
|
||||||
// Begin a pressure reading.
|
|
||||||
// Oversampling: 0 to 3, higher numbers are slower, higher-res outputs.
|
|
||||||
// Will return delay in ms to wait, or 0 if I2C error.
|
|
||||||
{
|
|
||||||
unsigned char data[2], result, delay;
|
|
||||||
|
|
||||||
data[0] = BMP180_REG_CONTROL;
|
|
||||||
|
|
||||||
switch (oversampling)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
data[1] = BMP180_COMMAND_PRESSURE0;
|
|
||||||
delay = 5;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
data[1] = BMP180_COMMAND_PRESSURE1;
|
|
||||||
delay = 8;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
data[1] = BMP180_COMMAND_PRESSURE2;
|
|
||||||
delay = 14;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
data[1] = BMP180_COMMAND_PRESSURE3;
|
|
||||||
delay = 26;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
data[1] = BMP180_COMMAND_PRESSURE0;
|
|
||||||
delay = 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
result = writeBytes(data, 2);
|
|
||||||
if (result) // good write?
|
|
||||||
return(delay); // return the delay in ms (rounded up) to wait before retrieving data
|
|
||||||
else
|
|
||||||
return(0); // or return 0 if there was a problem communicating with the BMP
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::getPressure(double &P, double &T)
|
|
||||||
// Retrieve a previously started pressure reading, calculate abolute pressure in mbars.
|
|
||||||
// Requires begin() to be called once prior to retrieve calibration parameters.
|
|
||||||
// Requires startPressure() to have been called prior and sufficient time elapsed.
|
|
||||||
// Requires recent temperature reading to accurately calculate pressure.
|
|
||||||
|
|
||||||
// P: external variable to hold pressure.
|
|
||||||
// T: previously-calculated temperature.
|
|
||||||
// Returns 1 for success, 0 for I2C error.
|
|
||||||
|
|
||||||
// Note that calculated pressure value is absolute mbars, to compensate for altitude call sealevel().
|
|
||||||
{
|
|
||||||
unsigned char data[3];
|
|
||||||
char result;
|
|
||||||
double pu,s,x,y,z;
|
|
||||||
|
|
||||||
data[0] = BMP180_REG_RESULT;
|
|
||||||
|
|
||||||
result = readBytes(data, 3);
|
|
||||||
if (result) // good read, calculate pressure
|
|
||||||
{
|
|
||||||
pu = (data[0] * 256.0) + data[1] + (data[2]/256.0);
|
|
||||||
|
|
||||||
//example from Bosch datasheet
|
|
||||||
//pu = 23843;
|
|
||||||
|
|
||||||
//example from http://wmrx00.sourceforge.net/Arduino/BMP085-Calcs.pdf, pu = 0x982FC0;
|
|
||||||
//pu = (0x98 * 256.0) + 0x2F + (0xC0/256.0);
|
|
||||||
|
|
||||||
s = T - 25.0;
|
|
||||||
x = (x2 * pow(s,2)) + (x1 * s) + x0;
|
|
||||||
y = (y2 * pow(s,2)) + (y1 * s) + y0;
|
|
||||||
z = (pu - x) / y;
|
|
||||||
P = (p2 * pow(z,2)) + (p1 * z) + p0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Serial.println();
|
|
||||||
Serial.print("pu: "); Serial.println(pu);
|
|
||||||
Serial.print("T: "); Serial.println(*T);
|
|
||||||
Serial.print("s: "); Serial.println(s);
|
|
||||||
Serial.print("x: "); Serial.println(x);
|
|
||||||
Serial.print("y: "); Serial.println(y);
|
|
||||||
Serial.print("z: "); Serial.println(z);
|
|
||||||
Serial.print("P: "); Serial.println(*P);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double SFE_BMP180::sealevel(double P, double A)
|
|
||||||
// Given a pressure P (mb) taken at a specific altitude (meters),
|
|
||||||
// return the equivalent pressure (mb) at sea level.
|
|
||||||
// This produces pressure readings that can be used for weather measurements.
|
|
||||||
{
|
|
||||||
return(P/pow(1-(A/44330.0),5.255));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double SFE_BMP180::altitude(double P, double P0)
|
|
||||||
// Given a pressure measurement P (mb) and the pressure at a baseline P0 (mb),
|
|
||||||
// return altitude (meters) above baseline.
|
|
||||||
{
|
|
||||||
return(44330.0*(1-pow(P/P0,1/5.255)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char SFE_BMP180::getError(void)
|
|
||||||
// If any library command fails, you can retrieve an extended
|
|
||||||
// error code using this command. Errors are from the wire library:
|
|
||||||
// 0 = Success
|
|
||||||
// 1 = Data too long to fit in transmit buffer
|
|
||||||
// 2 = Received NACK on transmit of address
|
|
||||||
// 3 = Received NACK on transmit of data
|
|
||||||
// 4 = Other error
|
|
||||||
{
|
|
||||||
return(_error);
|
|
||||||
}
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
SFE_BMP180.h
|
|
||||||
Bosch BMP180 pressure sensor library for the Arduino microcontroller
|
|
||||||
Mike Grusin, SparkFun Electronics
|
|
||||||
|
|
||||||
Uses floating-point equations from the Weather Station Data Logger project
|
|
||||||
http://wmrx00.sourceforge.net/
|
|
||||||
http://wmrx00.sourceforge.net/Arduino/BMP085-Calcs.pdf
|
|
||||||
|
|
||||||
Forked from BMP085 library by M.Grusin
|
|
||||||
|
|
||||||
version 1.0 2013/09/20 initial version
|
|
||||||
|
|
||||||
Our example code uses the "beerware" license. You can do anything
|
|
||||||
you like with this code. No really, anything. If you find it useful,
|
|
||||||
buy me a (root) beer someday.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SFE_BMP180_h
|
|
||||||
#define SFE_BMP180_h
|
|
||||||
|
|
||||||
#if defined(ARDUINO) && ARDUINO >= 100
|
|
||||||
#include "Arduino.h"
|
|
||||||
#else
|
|
||||||
#include "WProgram.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class SFE_BMP180
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SFE_BMP180(); // base type
|
|
||||||
|
|
||||||
char begin();
|
|
||||||
// call pressure.begin() to initialize BMP180 before use
|
|
||||||
// returns 1 if success, 0 if failure (bad component or I2C bus shorted?)
|
|
||||||
|
|
||||||
char startTemperature(void);
|
|
||||||
// command BMP180 to start a temperature measurement
|
|
||||||
// returns (number of ms to wait) for success, 0 for fail
|
|
||||||
|
|
||||||
char getTemperature(double &T);
|
|
||||||
// return temperature measurement from previous startTemperature command
|
|
||||||
// places returned value in T variable (deg C)
|
|
||||||
// returns 1 for success, 0 for fail
|
|
||||||
|
|
||||||
char startPressure(char oversampling);
|
|
||||||
// command BMP180 to start a pressure measurement
|
|
||||||
// oversampling: 0 - 3 for oversampling value
|
|
||||||
// returns (number of ms to wait) for success, 0 for fail
|
|
||||||
|
|
||||||
char getPressure(double &P, double &T);
|
|
||||||
// return absolute pressure measurement from previous startPressure command
|
|
||||||
// note: requires previous temperature measurement in variable T
|
|
||||||
// places returned value in P variable (mbar)
|
|
||||||
// returns 1 for success, 0 for fail
|
|
||||||
|
|
||||||
double sealevel(double P, double A);
|
|
||||||
// convert absolute pressure to sea-level pressure (as used in weather data)
|
|
||||||
// P: absolute pressure (mbar)
|
|
||||||
// A: current altitude (meters)
|
|
||||||
// returns sealevel pressure in mbar
|
|
||||||
|
|
||||||
double altitude(double P, double P0);
|
|
||||||
// convert absolute pressure to altitude (given baseline pressure; sea-level, runway, etc.)
|
|
||||||
// P: absolute pressure (mbar)
|
|
||||||
// P0: fixed baseline pressure (mbar)
|
|
||||||
// returns signed altitude in meters
|
|
||||||
|
|
||||||
char getError(void);
|
|
||||||
// If any library command fails, you can retrieve an extended
|
|
||||||
// error code using this command. Errors are from the wire library:
|
|
||||||
// 0 = Success
|
|
||||||
// 1 = Data too long to fit in transmit buffer
|
|
||||||
// 2 = Received NACK on transmit of address
|
|
||||||
// 3 = Received NACK on transmit of data
|
|
||||||
// 4 = Other error
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
char readInt(char address, int &value);
|
|
||||||
// read an signed int (16 bits) from a BMP180 register
|
|
||||||
// address: BMP180 register address
|
|
||||||
// value: external signed int for returned value (16 bits)
|
|
||||||
// returns 1 for success, 0 for fail, with result in value
|
|
||||||
|
|
||||||
char readUInt(char address, unsigned int &value);
|
|
||||||
// read an unsigned int (16 bits) from a BMP180 register
|
|
||||||
// address: BMP180 register address
|
|
||||||
// value: external unsigned int for returned value (16 bits)
|
|
||||||
// returns 1 for success, 0 for fail, with result in value
|
|
||||||
|
|
||||||
char readBytes(unsigned char *values, char length);
|
|
||||||
// read a number of bytes from a BMP180 register
|
|
||||||
// values: array of char with register address in first location [0]
|
|
||||||
// length: number of bytes to read back
|
|
||||||
// returns 1 for success, 0 for fail, with read bytes in values[] array
|
|
||||||
|
|
||||||
char writeBytes(unsigned char *values, char length);
|
|
||||||
// write a number of bytes to a BMP180 register (and consecutive subsequent registers)
|
|
||||||
// values: array of char with register address in first location [0]
|
|
||||||
// length: number of bytes to write
|
|
||||||
// returns 1 for success, 0 for fail
|
|
||||||
|
|
||||||
int AC1,AC2,AC3,VB1,VB2,MB,MC,MD;
|
|
||||||
unsigned int AC4,AC5,AC6;
|
|
||||||
double c5,c6,mc,md,x0,x1,x2,y0,y1,y2,p0,p1,p2;
|
|
||||||
char _error;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define BMP180_ADDR 0x77 // 7-bit address
|
|
||||||
|
|
||||||
#define BMP180_REG_CONTROL 0xF4
|
|
||||||
#define BMP180_REG_RESULT 0xF6
|
|
||||||
|
|
||||||
#define BMP180_COMMAND_TEMPERATURE 0x2E
|
|
||||||
#define BMP180_COMMAND_PRESSURE0 0x34
|
|
||||||
#define BMP180_COMMAND_PRESSURE1 0x74
|
|
||||||
#define BMP180_COMMAND_PRESSURE2 0xB4
|
|
||||||
#define BMP180_COMMAND_PRESSURE3 0xF4
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:arduino_due]
|
|
||||||
platform = atmelsam
|
|
||||||
framework = arduino
|
|
||||||
board = dueUSB
|
|
||||||
|
|
||||||
[env:arduino_digix]
|
|
||||||
platform = atmelsam
|
|
||||||
framework = arduino
|
|
||||||
board = digix
|
|
||||||
|
|
||||||
[env:arduino_zero]
|
|
||||||
platform = atmelsam
|
|
||||||
framework = arduino
|
|
||||||
board = zeroUSB
|
|
@ -1,168 +0,0 @@
|
|||||||
/* SFE_BMP180 altitude example sketch
|
|
||||||
|
|
||||||
This sketch shows how to use the Bosch BMP180 pressure sensor
|
|
||||||
as an altimiter.
|
|
||||||
https://www.sparkfun.com/products/11824
|
|
||||||
|
|
||||||
Like most pressure sensors, the BMP180 measures absolute pressure.
|
|
||||||
Since absolute pressure varies with altitude, you can use the pressure
|
|
||||||
to determine your altitude.
|
|
||||||
|
|
||||||
Because pressure also varies with weather, you must first take a pressure
|
|
||||||
reading at a known baseline altitude. Then you can measure variations
|
|
||||||
from that pressure
|
|
||||||
|
|
||||||
Hardware connections:
|
|
||||||
|
|
||||||
- (GND) to GND
|
|
||||||
+ (VDD) to 3.3V
|
|
||||||
|
|
||||||
(WARNING: do not connect + to 5V or the sensor will be damaged!)
|
|
||||||
|
|
||||||
You will also need to connect the I2C pins (SCL and SDA) to your
|
|
||||||
Arduino. The pins are different on different Arduinos:
|
|
||||||
|
|
||||||
Any Arduino pins labeled: SDA SCL
|
|
||||||
Uno, Redboard, Pro: A4 A5
|
|
||||||
Mega2560, Due: 20 21
|
|
||||||
Leonardo: 2 3
|
|
||||||
|
|
||||||
Leave the IO (VDDIO) pin unconnected. This pin is for connecting
|
|
||||||
the BMP180 to systems with lower logic levels such as 1.8V
|
|
||||||
|
|
||||||
Have fun! -Your friends at SparkFun.
|
|
||||||
|
|
||||||
The SFE_BMP180 library uses floating-point equations developed by the
|
|
||||||
Weather Station Data Logger project: http://wmrx00.sourceforge.net/
|
|
||||||
|
|
||||||
Our example code uses the "beerware" license. You can do anything
|
|
||||||
you like with this code. No really, anything. If you find it useful,
|
|
||||||
buy me a beer someday.
|
|
||||||
|
|
||||||
V10 Mike Grusin, SparkFun Electronics 10/24/2013
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Your sketch must #include this library, and the Wire library.
|
|
||||||
// (Wire is a standard library included with Arduino.):
|
|
||||||
|
|
||||||
#include <SFE_BMP180.h>
|
|
||||||
#include <Wire.h>
|
|
||||||
|
|
||||||
// You will need to create an SFE_BMP180 object, here called "pressure":
|
|
||||||
|
|
||||||
SFE_BMP180 pressure;
|
|
||||||
|
|
||||||
double baseline; // baseline pressure
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600);
|
|
||||||
Serial.println("REBOOT");
|
|
||||||
|
|
||||||
// Initialize the sensor (it is important to get calibration values stored on the device).
|
|
||||||
|
|
||||||
if (pressure.begin())
|
|
||||||
Serial.println("BMP180 init success");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Oops, something went wrong, this is usually a connection problem,
|
|
||||||
// see the comments at the top of this sketch for the proper connections.
|
|
||||||
|
|
||||||
Serial.println("BMP180 init fail (disconnected?)\n\n");
|
|
||||||
while(1); // Pause forever.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the baseline pressure:
|
|
||||||
|
|
||||||
baseline = getPressure();
|
|
||||||
|
|
||||||
Serial.print("baseline pressure: ");
|
|
||||||
Serial.print(baseline);
|
|
||||||
Serial.println(" mb");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
double a,P;
|
|
||||||
|
|
||||||
// Get a new pressure reading:
|
|
||||||
|
|
||||||
P = getPressure();
|
|
||||||
|
|
||||||
// Show the relative altitude difference between
|
|
||||||
// the new reading and the baseline reading:
|
|
||||||
|
|
||||||
a = pressure.altitude(P,baseline);
|
|
||||||
|
|
||||||
Serial.print("relative altitude: ");
|
|
||||||
if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
|
|
||||||
Serial.print(a,1);
|
|
||||||
Serial.print(" meters, ");
|
|
||||||
if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
|
|
||||||
Serial.print(a*3.28084,0);
|
|
||||||
Serial.println(" feet");
|
|
||||||
|
|
||||||
delay(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double getPressure()
|
|
||||||
{
|
|
||||||
char status;
|
|
||||||
double T,P,p0,a;
|
|
||||||
|
|
||||||
// You must first get a temperature measurement to perform a pressure reading.
|
|
||||||
|
|
||||||
// Start a temperature measurement:
|
|
||||||
// If request is successful, the number of ms to wait is returned.
|
|
||||||
// If request is unsuccessful, 0 is returned.
|
|
||||||
|
|
||||||
status = pressure.startTemperature();
|
|
||||||
if (status != 0)
|
|
||||||
{
|
|
||||||
// Wait for the measurement to complete:
|
|
||||||
|
|
||||||
delay(status);
|
|
||||||
|
|
||||||
// Retrieve the completed temperature measurement:
|
|
||||||
// Note that the measurement is stored in the variable T.
|
|
||||||
// Use '&T' to provide the address of T to the function.
|
|
||||||
// Function returns 1 if successful, 0 if failure.
|
|
||||||
|
|
||||||
status = pressure.getTemperature(T);
|
|
||||||
if (status != 0)
|
|
||||||
{
|
|
||||||
// Start a pressure measurement:
|
|
||||||
// The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
|
|
||||||
// If request is successful, the number of ms to wait is returned.
|
|
||||||
// If request is unsuccessful, 0 is returned.
|
|
||||||
|
|
||||||
status = pressure.startPressure(3);
|
|
||||||
if (status != 0)
|
|
||||||
{
|
|
||||||
// Wait for the measurement to complete:
|
|
||||||
delay(status);
|
|
||||||
|
|
||||||
// Retrieve the completed pressure measurement:
|
|
||||||
// Note that the measurement is stored in the variable P.
|
|
||||||
// Use '&P' to provide the address of P.
|
|
||||||
// Note also that the function requires the previous temperature measurement (T).
|
|
||||||
// (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
|
|
||||||
// Function returns 1 if successful, 0 if failure.
|
|
||||||
|
|
||||||
status = pressure.getPressure(P,T);
|
|
||||||
if (status != 0)
|
|
||||||
{
|
|
||||||
return(P);
|
|
||||||
}
|
|
||||||
else Serial.println("error retrieving pressure measurement\n");
|
|
||||||
}
|
|
||||||
else Serial.println("error starting pressure measurement\n");
|
|
||||||
}
|
|
||||||
else Serial.println("error retrieving temperature measurement\n");
|
|
||||||
}
|
|
||||||
else Serial.println("error starting temperature measurement\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/atmelsam-and-arduino/arduino-internal-libs
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:arduino_due]
|
|
||||||
platform = atmelsam
|
|
||||||
framework = arduino
|
|
||||||
board = dueUSB
|
|
||||||
|
|
||||||
[env:arduino_digix]
|
|
||||||
platform = atmelsam
|
|
||||||
framework = arduino
|
|
||||||
board = digix
|
|
||||||
|
|
||||||
[env:arduino_zero]
|
|
||||||
platform = atmelsam
|
|
||||||
framework = arduino
|
|
||||||
board = zeroUSB
|
|
@ -1,143 +0,0 @@
|
|||||||
/*
|
|
||||||
SCP1000 Barometric Pressure Sensor Display
|
|
||||||
|
|
||||||
Shows the output of a Barometric Pressure Sensor on a
|
|
||||||
Uses the SPI library. For details on the sensor, see:
|
|
||||||
http://www.sparkfun.com/commerce/product_info.php?products_id=8161
|
|
||||||
http://www.vti.fi/en/support/obsolete_products/pressure_sensors/
|
|
||||||
|
|
||||||
This sketch adapted from Nathan Seidle's SCP1000 example for PIC:
|
|
||||||
http://www.sparkfun.com/datasheets/Sensors/SCP1000-Testing.zip
|
|
||||||
|
|
||||||
Circuit:
|
|
||||||
SCP1000 sensor attached to pins 6, 7, 10 - 13:
|
|
||||||
DRDY: pin 6
|
|
||||||
CSB: pin 7
|
|
||||||
MOSI: pin 11
|
|
||||||
MISO: pin 12
|
|
||||||
SCK: pin 13
|
|
||||||
|
|
||||||
created 31 July 2010
|
|
||||||
modified 14 August 2010
|
|
||||||
by Tom Igoe
|
|
||||||
*/
|
|
||||||
|
|
||||||
// the sensor communicates using SPI, so include the library:
|
|
||||||
#include <SPI.h>
|
|
||||||
|
|
||||||
//Sensor's memory register addresses:
|
|
||||||
const int PRESSURE = 0x1F; //3 most significant bits of pressure
|
|
||||||
const int PRESSURE_LSB = 0x20; //16 least significant bits of pressure
|
|
||||||
const int TEMPERATURE = 0x21; //16 bit temperature reading
|
|
||||||
const byte READ = 0b11111100; // SCP1000's read command
|
|
||||||
const byte WRITE = 0b00000010; // SCP1000's write command
|
|
||||||
|
|
||||||
// pins used for the connection with the sensor
|
|
||||||
// the other you need are controlled by the SPI library):
|
|
||||||
const int dataReadyPin = 6;
|
|
||||||
const int chipSelectPin = 7;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
// start the SPI library:
|
|
||||||
SPI.begin();
|
|
||||||
|
|
||||||
// initalize the data ready and chip select pins:
|
|
||||||
pinMode(dataReadyPin, INPUT);
|
|
||||||
pinMode(chipSelectPin, OUTPUT);
|
|
||||||
|
|
||||||
//Configure SCP1000 for low noise configuration:
|
|
||||||
writeRegister(0x02, 0x2D);
|
|
||||||
writeRegister(0x01, 0x03);
|
|
||||||
writeRegister(0x03, 0x02);
|
|
||||||
// give the sensor time to set up:
|
|
||||||
delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
//Select High Resolution Mode
|
|
||||||
writeRegister(0x03, 0x0A);
|
|
||||||
|
|
||||||
// don't do anything until the data ready pin is high:
|
|
||||||
if (digitalRead(dataReadyPin) == HIGH) {
|
|
||||||
//Read the temperature data
|
|
||||||
int tempData = readRegister(0x21, 2);
|
|
||||||
|
|
||||||
// convert the temperature to celsius and display it:
|
|
||||||
float realTemp = (float)tempData / 20.0;
|
|
||||||
Serial.print("Temp[C]=");
|
|
||||||
Serial.print(realTemp);
|
|
||||||
|
|
||||||
|
|
||||||
//Read the pressure data highest 3 bits:
|
|
||||||
byte pressure_data_high = readRegister(0x1F, 1);
|
|
||||||
pressure_data_high &= 0b00000111; //you only needs bits 2 to 0
|
|
||||||
|
|
||||||
//Read the pressure data lower 16 bits:
|
|
||||||
unsigned int pressure_data_low = readRegister(0x20, 2);
|
|
||||||
//combine the two parts into one 19-bit number:
|
|
||||||
long pressure = ((pressure_data_high << 16) | pressure_data_low) / 4;
|
|
||||||
|
|
||||||
// display the temperature:
|
|
||||||
Serial.println("\tPressure [Pa]=" + String(pressure));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Read from or write to register from the SCP1000:
|
|
||||||
unsigned int readRegister(byte thisRegister, int bytesToRead ) {
|
|
||||||
byte inByte = 0; // incoming byte from the SPI
|
|
||||||
unsigned int result = 0; // result to return
|
|
||||||
Serial.print(thisRegister, BIN);
|
|
||||||
Serial.print("\t");
|
|
||||||
// SCP1000 expects the register name in the upper 6 bits
|
|
||||||
// of the byte. So shift the bits left by two bits:
|
|
||||||
thisRegister = thisRegister << 2;
|
|
||||||
// now combine the address and the command into one byte
|
|
||||||
byte dataToSend = thisRegister & READ;
|
|
||||||
Serial.println(thisRegister, BIN);
|
|
||||||
// take the chip select low to select the device:
|
|
||||||
digitalWrite(chipSelectPin, LOW);
|
|
||||||
// send the device the register you want to read:
|
|
||||||
SPI.transfer(dataToSend);
|
|
||||||
// send a value of 0 to read the first byte returned:
|
|
||||||
result = SPI.transfer(0x00);
|
|
||||||
// decrement the number of bytes left to read:
|
|
||||||
bytesToRead--;
|
|
||||||
// if you still have another byte to read:
|
|
||||||
if (bytesToRead > 0) {
|
|
||||||
// shift the first byte left, then get the second byte:
|
|
||||||
result = result << 8;
|
|
||||||
inByte = SPI.transfer(0x00);
|
|
||||||
// combine the byte you just got with the previous one:
|
|
||||||
result = result | inByte;
|
|
||||||
// decrement the number of bytes left to read:
|
|
||||||
bytesToRead--;
|
|
||||||
}
|
|
||||||
// take the chip select high to de-select:
|
|
||||||
digitalWrite(chipSelectPin, HIGH);
|
|
||||||
// return the result:
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Sends a write command to SCP1000
|
|
||||||
|
|
||||||
void writeRegister(byte thisRegister, byte thisValue) {
|
|
||||||
|
|
||||||
// SCP1000 expects the register address in the upper 6 bits
|
|
||||||
// of the byte. So shift the bits left by two bits:
|
|
||||||
thisRegister = thisRegister << 2;
|
|
||||||
// now combine the register address and the command into one byte:
|
|
||||||
byte dataToSend = thisRegister | WRITE;
|
|
||||||
|
|
||||||
// take the chip select low to select the device:
|
|
||||||
digitalWrite(chipSelectPin, LOW);
|
|
||||||
|
|
||||||
SPI.transfer(dataToSend); //Send register location
|
|
||||||
SPI.transfer(thisValue); //Send value to record into register
|
|
||||||
|
|
||||||
// take the chip select high to de-select:
|
|
||||||
digitalWrite(chipSelectPin, HIGH);
|
|
||||||
}
|
|
||||||
|
|
1
examples/desktop/hello-world/.gitignore
vendored
1
examples/desktop/hello-world/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/desktop/hello-world
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Run program
|
|
||||||
> .pioenvs/native/program
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:native]
|
|
||||||
platform = native
|
|
||||||
|
|
||||||
#
|
|
||||||
# If host OS is Mac OS X
|
|
||||||
#
|
|
||||||
|
|
||||||
# [env:darwin_x86_64]
|
|
||||||
# platform = native
|
|
||||||
|
|
||||||
# [env:linux_i686]
|
|
||||||
# platform = linux_i686
|
|
||||||
|
|
||||||
# [env:linux_x86_64]
|
|
||||||
# platform = linux_x86_64
|
|
||||||
|
|
||||||
# [env:windows_x86]
|
|
||||||
# platform = windows_x86
|
|
||||||
|
|
||||||
# [env:linux_armv6l]
|
|
||||||
# platform = linux_arm
|
|
||||||
# build_flags = -march=armv6
|
|
||||||
|
|
||||||
#
|
|
||||||
# If host OS is Linux
|
|
||||||
#
|
|
||||||
|
|
||||||
# [env:linux_i686]
|
|
||||||
# platform = linux_i686
|
|
||||||
|
|
||||||
# [env:linux_x86_64]
|
|
||||||
# platform = linux_x86_64
|
|
@ -1,7 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
printf("Hello World from PlatformIO!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
1
examples/espressif/esp8266-native/.gitignore
vendored
1
examples/espressif/esp8266-native/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/espressif/esp8266-native
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:esp01_8266]
|
|
||||||
platform = espressif
|
|
||||||
board = esp01
|
|
||||||
build_flags = -Wl,-T"eagle.app.v6.ld"
|
|
@ -1,36 +0,0 @@
|
|||||||
#include "ets_sys.h"
|
|
||||||
#include "osapi.h"
|
|
||||||
#include "gpio.h"
|
|
||||||
#include "os_type.h"
|
|
||||||
|
|
||||||
static const int pin = 1;
|
|
||||||
static volatile os_timer_t some_timer;
|
|
||||||
|
|
||||||
void some_timerfunc(void *arg)
|
|
||||||
{
|
|
||||||
//Do blinky stuff
|
|
||||||
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & (1 << pin))
|
|
||||||
{
|
|
||||||
// set gpio low
|
|
||||||
gpio_output_set(0, (1 << pin), 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// set gpio high
|
|
||||||
gpio_output_set((1 << pin), 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR user_init()
|
|
||||||
{
|
|
||||||
// init gpio sussytem
|
|
||||||
gpio_init();
|
|
||||||
|
|
||||||
// configure UART TXD to be GPIO1, set as output
|
|
||||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
|
|
||||||
gpio_output_set(0, 0, (1 << pin), 0);
|
|
||||||
|
|
||||||
// setup timer (500ms, repeating)
|
|
||||||
os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
|
|
||||||
os_timer_arm(&some_timer, 1000, 1);
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
#ifndef __USER_CONFIG_H__
|
|
||||||
#define __USER_CONFIG_H__
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/espressif/esp8266-webserver
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:esp01]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = esp01
|
|
||||||
|
|
||||||
[env:esp01_1m]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = esp01_1m
|
|
||||||
|
|
||||||
[env:nodemcu]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = nodemcu
|
|
||||||
|
|
||||||
[env:huzzah]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = huzzah
|
|
||||||
|
|
||||||
[env:thing]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = thing
|
|
@ -1,73 +0,0 @@
|
|||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <WiFiClient.h>
|
|
||||||
#include <ESP8266WebServer.h>
|
|
||||||
#include <ESP8266mDNS.h>
|
|
||||||
|
|
||||||
const char* ssid = "******";
|
|
||||||
const char* password = "******";
|
|
||||||
MDNSResponder mdns;
|
|
||||||
|
|
||||||
ESP8266WebServer server(80);
|
|
||||||
|
|
||||||
const int led = 13;
|
|
||||||
|
|
||||||
void handleRoot() {
|
|
||||||
digitalWrite(led, 1);
|
|
||||||
server.send(200, "text/plain", "hello from esp8266!");
|
|
||||||
digitalWrite(led, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleNotFound(){
|
|
||||||
digitalWrite(led, 1);
|
|
||||||
String message = "File Not Found\n\n";
|
|
||||||
message += "URI: ";
|
|
||||||
message += server.uri();
|
|
||||||
message += "\nMethod: ";
|
|
||||||
message += (server.method() == HTTP_GET)?"GET":"POST";
|
|
||||||
message += "\nArguments: ";
|
|
||||||
message += server.args();
|
|
||||||
message += "\n";
|
|
||||||
for (uint8_t i=0; i<server.args(); i++){
|
|
||||||
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
|
|
||||||
}
|
|
||||||
server.send(404, "text/plain", message);
|
|
||||||
digitalWrite(led, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup(void){
|
|
||||||
pinMode(led, OUTPUT);
|
|
||||||
digitalWrite(led, 0);
|
|
||||||
Serial.begin(115200);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
Serial.println("");
|
|
||||||
|
|
||||||
// Wait for connection
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
delay(500);
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
|
||||||
Serial.println("");
|
|
||||||
Serial.print("Connected to ");
|
|
||||||
Serial.println(ssid);
|
|
||||||
Serial.print("IP address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
|
|
||||||
if (mdns.begin("esp8266", WiFi.localIP())) {
|
|
||||||
Serial.println("MDNS responder started");
|
|
||||||
}
|
|
||||||
|
|
||||||
server.on("/", handleRoot);
|
|
||||||
|
|
||||||
server.on("/inline", [](){
|
|
||||||
server.send(200, "text/plain", "this works as well");
|
|
||||||
});
|
|
||||||
|
|
||||||
server.onNotFound(handleNotFound);
|
|
||||||
|
|
||||||
server.begin();
|
|
||||||
Serial.println("HTTP server started");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(void){
|
|
||||||
server.handleClient();
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
.pioenvs
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,29 +0,0 @@
|
|||||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
How to build PlatformIO based project
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
|
||||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
|
||||||
3. Extract ZIP archive
|
|
||||||
4. Run these commands:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Change directory to example
|
|
||||||
> cd platformio-develop/examples/espressif/esp8266-wifiscan
|
|
||||||
|
|
||||||
# Process example project
|
|
||||||
> platformio run
|
|
||||||
|
|
||||||
# Upload firmware
|
|
||||||
> platformio run --target upload
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Project Configuration File
|
|
||||||
#
|
|
||||||
# A detailed documentation with the EXAMPLES is located here:
|
|
||||||
# http://docs.platformio.org/en/latest/projectconf.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# A sign `#` at the beginning of the line indicates a comment
|
|
||||||
# Comment lines are ignored.
|
|
||||||
|
|
||||||
# Simple and base environment
|
|
||||||
# [env:mybaseenv]
|
|
||||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
|
||||||
# framework =
|
|
||||||
# board =
|
|
||||||
#
|
|
||||||
# Automatic targets - enable auto-uploading
|
|
||||||
# targets = upload
|
|
||||||
|
|
||||||
[env:esp01_8266]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = esp01
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* This sketch demonstrates how to scan WiFi networks.
|
|
||||||
* The API is almost the same as with the WiFi Shield library,
|
|
||||||
* the most obvious difference being the different file you need to include:
|
|
||||||
*/
|
|
||||||
#include "ESP8266WiFi.h"
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(115200);
|
|
||||||
|
|
||||||
// Set WiFi to station mode and disconnect from an AP if it was previously connected
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.disconnect();
|
|
||||||
delay(100);
|
|
||||||
|
|
||||||
Serial.println("Setup done");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Serial.println("scan start");
|
|
||||||
|
|
||||||
// WiFi.scanNetworks will return the number of networks found
|
|
||||||
int n = WiFi.scanNetworks();
|
|
||||||
Serial.println("scan done");
|
|
||||||
if (n == 0)
|
|
||||||
Serial.println("no networks found");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Serial.print(n);
|
|
||||||
Serial.println(" networks found");
|
|
||||||
for (int i = 0; i < n; ++i)
|
|
||||||
{
|
|
||||||
// Print SSID and RSSI for each network found
|
|
||||||
Serial.print(i + 1);
|
|
||||||
Serial.print(": ");
|
|
||||||
Serial.print(WiFi.SSID(i));
|
|
||||||
Serial.print(" (");
|
|
||||||
Serial.print(WiFi.RSSI(i));
|
|
||||||
Serial.print(")");
|
|
||||||
Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
|
|
||||||
delay(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Serial.println("");
|
|
||||||
|
|
||||||
// Wait a bit before scanning again
|
|
||||||
delay(5000);
|
|
||||||
}
|
|
2
examples/ide/clion/.gitignore
vendored
2
examples/ide/clion/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
.pioenvs
|
|
||||||
CMakeListsPrivate.txt
|
|
8
examples/ide/clion/.idea/clion.iml
generated
8
examples/ide/clion/.idea/clion.iml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="CPP_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
6
examples/ide/clion/.idea/encodings.xml
generated
6
examples/ide/clion/.idea/encodings.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Encoding">
|
|
||||||
<file url="PROJECT" charset="UTF-8" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
5
examples/ide/clion/.idea/misc.xml
generated
5
examples/ide/clion/.idea/misc.xml
generated
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
|
||||||
<component name="ProjectRootManager" version="2" />
|
|
||||||
</project>
|
|
9
examples/ide/clion/.idea/modules.xml
generated
9
examples/ide/clion/.idea/modules.xml
generated
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/clion.iml" filepath="$PROJECT_DIR$/.idea/clion.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/platformio.iml" filepath="$PROJECT_DIR$/.idea/platformio.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
8
examples/ide/clion/.idea/platformio.iml
generated
8
examples/ide/clion/.idea/platformio.iml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="CPP_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
6
examples/ide/clion/.idea/vcs.xml
generated
6
examples/ide/clion/.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
281
examples/ide/clion/.idea/workspace.xml
generated
281
examples/ide/clion/.idea/workspace.xml
generated
@ -1,281 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
|
|
||||||
<generated>
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO" />
|
|
||||||
<config projectName="clion" targetName="clion" />
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO_BUILD" />
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO_UPLOAD" />
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO_CLEAN" />
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO_PROGRAM" />
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO_UPLOADFS" />
|
|
||||||
<config projectName="clion" targetName="PLATFORMIO_UPDATE_ALL" />
|
|
||||||
<config projectName="clion" targetName="DEBUG" />
|
|
||||||
</generated>
|
|
||||||
</component>
|
|
||||||
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
|
|
||||||
<ADDITIONAL_GENERATION_ENVIRONMENT>
|
|
||||||
<envs />
|
|
||||||
</ADDITIONAL_GENERATION_ENVIRONMENT>
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="ec922180-b3d3-40f1-af0b-2568113a9075" name="Default" comment="" />
|
|
||||||
<ignored path="platformio.iws" />
|
|
||||||
<ignored path=".idea/workspace.xml" />
|
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
||||||
<option name="TRACKING_ENABLED" value="true" />
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
|
||||||
<component name="CreatePatchCommitExecutor">
|
|
||||||
<option name="PATCH_PATH" value="" />
|
|
||||||
</component>
|
|
||||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
|
||||||
<component name="FavoritesManager">
|
|
||||||
<favorites_list name="clion" />
|
|
||||||
</component>
|
|
||||||
<component name="FileEditorManager">
|
|
||||||
<leaf>
|
|
||||||
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state vertical-scroll-proportion="0.15758981">
|
|
||||||
<caret line="8" column="49" selection-start-line="8" selection-start-column="49" selection-end-line="8" selection-end-column="49" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="src/blink.cpp" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR/$src/blink.cpp">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state vertical-scroll-proportion="0.0">
|
|
||||||
<caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
|
||||||
</component>
|
|
||||||
<component name="JsBuildToolGruntFileManager" detection-done="true" />
|
|
||||||
<component name="JsGulpfileManager">
|
|
||||||
<detection-done>true</detection-done>
|
|
||||||
</component>
|
|
||||||
<component name="NamedScopeManager">
|
|
||||||
<order />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectFrameBounds">
|
|
||||||
<option name="x" value="252" />
|
|
||||||
<option name="y" value="21" />
|
|
||||||
<option name="width" value="1400" />
|
|
||||||
<option name="height" value="1000" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>C/C++</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
||||||
<OptionsSetting value="true" id="Add" />
|
|
||||||
<OptionsSetting value="true" id="Remove" />
|
|
||||||
<OptionsSetting value="true" id="Checkout" />
|
|
||||||
<OptionsSetting value="true" id="Update" />
|
|
||||||
<OptionsSetting value="true" id="Status" />
|
|
||||||
<OptionsSetting value="true" id="Edit" />
|
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectView">
|
|
||||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
|
||||||
<flattenPackages />
|
|
||||||
<showMembers />
|
|
||||||
<showModules />
|
|
||||||
<showLibraryContents />
|
|
||||||
<hideEmptyPackages />
|
|
||||||
<abbreviatePackageNames />
|
|
||||||
<autoscrollToSource />
|
|
||||||
<autoscrollFromSource />
|
|
||||||
<sortByType />
|
|
||||||
</navigator>
|
|
||||||
<panes>
|
|
||||||
<pane id="ProjectPane">
|
|
||||||
<subPane>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="clion" />
|
|
||||||
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="clion" />
|
|
||||||
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="clion" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="clion" />
|
|
||||||
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="clion" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="src" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
</subPane>
|
|
||||||
</pane>
|
|
||||||
</panes>
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">
|
|
||||||
<property name="recentsLimit" value="5" />
|
|
||||||
<property name="settings.editor.selected.configurable" value="CPPToolchains" />
|
|
||||||
<property name="settings.editor.splitter.proportion" value="0.2" />
|
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/CMakeLists.txt" />
|
|
||||||
<property name="restartRequiresConfirmation" value="true" />
|
|
||||||
<property name="FullScreen" value="false" />
|
|
||||||
</component>
|
|
||||||
<component name="RunManager" selected="Application.PLATFORMIO_BUILD">
|
|
||||||
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="clion" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
|
||||||
<node-options />
|
|
||||||
<gulpfile />
|
|
||||||
<tasks />
|
|
||||||
<arguments />
|
|
||||||
<pass-parent-envs>true</pass-parent-envs>
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="Build All" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" CONFIG_NAME="Debug" EXPLICIT_BUILD_TARGET_NAME="all">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_UPLOADFS" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPLOADFS" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_PROGRAM" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_PROGRAM" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_UPDATE" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPDATE_ALL" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<list size="7">
|
|
||||||
<item index="0" class="java.lang.String" itemvalue="Application.Build All" />
|
|
||||||
<item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" />
|
|
||||||
<item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" />
|
|
||||||
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
|
|
||||||
<item index="5" class="java.lang.String" itemvalue="Application.PLATFORMIO_PROGRAM" />
|
|
||||||
<item index="4" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOADFS" />
|
|
||||||
<item index="6" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPDATE" />
|
|
||||||
</list>
|
|
||||||
</component>
|
|
||||||
<component name="ShelveChangesManager" show_recycled="false" />
|
|
||||||
<component name="SvnConfiguration">
|
|
||||||
<configuration />
|
|
||||||
</component>
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="ec922180-b3d3-40f1-af0b-2568113a9075" name="Default" comment="" />
|
|
||||||
<created>1435919971910</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<updated>1435919971910</updated>
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="ToolWindowManager">
|
|
||||||
<frame x="252" y="21" width="1400" height="1000" extended-state="0" />
|
|
||||||
<editor active="true" />
|
|
||||||
<layout>
|
|
||||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
|
||||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.4631503" order="7" side_tool="true" content_ui="tabs" />
|
|
||||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
|
||||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32996634" sideWeight="0.53684974" order="7" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
|
||||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
||||||
</layout>
|
|
||||||
</component>
|
|
||||||
<component name="Vcs.Log.UiProperties">
|
|
||||||
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
|
||||||
<collection />
|
|
||||||
</option>
|
|
||||||
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
|
|
||||||
<collection />
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="VcsContentAnnotationSettings">
|
|
||||||
<option name="myLimit" value="2678400000" />
|
|
||||||
</component>
|
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<breakpoint-manager>
|
|
||||||
<option name="time" value="4" />
|
|
||||||
</breakpoint-manager>
|
|
||||||
<watches-manager />
|
|
||||||
</component>
|
|
||||||
<component name="masterDetails">
|
|
||||||
<states>
|
|
||||||
<state key="ScopeChooserConfigurable.UI">
|
|
||||||
<settings>
|
|
||||||
<splitter-proportions>
|
|
||||||
<option name="proportions">
|
|
||||||
<list>
|
|
||||||
<option value="0.2" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</splitter-proportions>
|
|
||||||
</settings>
|
|
||||||
</state>
|
|
||||||
</states>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,65 +0,0 @@
|
|||||||
# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choose one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
|
@ -1,51 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(clion)
|
|
||||||
|
|
||||||
include(CMakeListsPrivate.txt)
|
|
||||||
|
|
||||||
add_definitions(-DF_CPU=16000000L)
|
|
||||||
add_definitions(-DARDUINO_ARCH_AVR)
|
|
||||||
add_definitions(-DARDUINO_AVR_UNO)
|
|
||||||
add_definitions(-DARDUINO=10607)
|
|
||||||
add_definitions(-DPLATFORMIO=020805)
|
|
||||||
add_definitions(-D__AVR_ATmega328P__)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_BUILD ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_UPLOAD ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_CLEAN ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_PROGRAM ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_UPLOADFS ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_UPDATE_ALL ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion update
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(clion
|
|
||||||
src/blink.cpp
|
|
||||||
)
|
|
@ -1,8 +0,0 @@
|
|||||||
CLion IDE Integration
|
|
||||||
=====================
|
|
||||||
|
|
||||||
The detailed information and steps are described in the main documentation:
|
|
||||||
`PlatformIO integration with CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`_.
|
|
||||||
|
|
||||||
.. image:: http://docs.platformio.org/en/latest/_images/ide-platformio-clion.png
|
|
||||||
:target: http://docs.platformio.org/en/latest/ide/clion.html
|
|
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
|
||||||
|
|
||||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user