From b7a84658ee1cc6c74b30967d0f3e22314fe82346 Mon Sep 17 00:00:00 2001 From: IanH Date: Fri, 8 Dec 2017 18:53:26 +0100 Subject: [PATCH 1/3] Make MPR121 library compatible to platformio --- .travis.yml | 63 +++++++++++++++++++ .../DataStream/DataStream.ino | 0 .../DataStream/readme.md | 0 .../GPIOinverter/GPIOinverter.ino | 0 .../GPIOinverter/readme.md | 0 .../Examples => examples}/LEDfade/LEDfade.ino | 0 .../Examples => examples}/LEDfade/readme.md | 0 .../SimpleTouch/SimpleTouch.ino | 0 .../SimpleTouch/readme.md | 0 library.json | 12 ++++ {MPR121 => src}/MPR121.cpp | 0 {MPR121 => src}/MPR121.h | 0 {MPR121 => src}/MPR121_defs.h | 0 {MPR121 => src}/keywords.txt | 0 14 files changed, 75 insertions(+) create mode 100644 .travis.yml rename {MPR121/Examples => examples}/DataStream/DataStream.ino (100%) rename {MPR121/Examples => examples}/DataStream/readme.md (100%) rename {MPR121/Examples => examples}/GPIOinverter/GPIOinverter.ino (100%) rename {MPR121/Examples => examples}/GPIOinverter/readme.md (100%) rename {MPR121/Examples => examples}/LEDfade/LEDfade.ino (100%) rename {MPR121/Examples => examples}/LEDfade/readme.md (100%) rename {MPR121/Examples => examples}/SimpleTouch/SimpleTouch.ino (100%) rename {MPR121/Examples => examples}/SimpleTouch/readme.md (100%) create mode 100644 library.json rename {MPR121 => src}/MPR121.cpp (100%) rename {MPR121 => src}/MPR121.h (100%) rename {MPR121 => src}/MPR121_defs.h (100%) rename {MPR121 => src}/keywords.txt (100%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d2d94d9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,63 @@ +# 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/page/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/page/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/page/userguide/cmd_ci.html > +# +# +# Please choice 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=examples/main.cpp + +install: + - pip install -U platformio + +script: + - platformio ci --lib="." --src="examples/SimpleTouch" --board=esp01 diff --git a/MPR121/Examples/DataStream/DataStream.ino b/examples/DataStream/DataStream.ino similarity index 100% rename from MPR121/Examples/DataStream/DataStream.ino rename to examples/DataStream/DataStream.ino diff --git a/MPR121/Examples/DataStream/readme.md b/examples/DataStream/readme.md similarity index 100% rename from MPR121/Examples/DataStream/readme.md rename to examples/DataStream/readme.md diff --git a/MPR121/Examples/GPIOinverter/GPIOinverter.ino b/examples/GPIOinverter/GPIOinverter.ino similarity index 100% rename from MPR121/Examples/GPIOinverter/GPIOinverter.ino rename to examples/GPIOinverter/GPIOinverter.ino diff --git a/MPR121/Examples/GPIOinverter/readme.md b/examples/GPIOinverter/readme.md similarity index 100% rename from MPR121/Examples/GPIOinverter/readme.md rename to examples/GPIOinverter/readme.md diff --git a/MPR121/Examples/LEDfade/LEDfade.ino b/examples/LEDfade/LEDfade.ino similarity index 100% rename from MPR121/Examples/LEDfade/LEDfade.ino rename to examples/LEDfade/LEDfade.ino diff --git a/MPR121/Examples/LEDfade/readme.md b/examples/LEDfade/readme.md similarity index 100% rename from MPR121/Examples/LEDfade/readme.md rename to examples/LEDfade/readme.md diff --git a/MPR121/Examples/SimpleTouch/SimpleTouch.ino b/examples/SimpleTouch/SimpleTouch.ino similarity index 100% rename from MPR121/Examples/SimpleTouch/SimpleTouch.ino rename to examples/SimpleTouch/SimpleTouch.ino diff --git a/MPR121/Examples/SimpleTouch/readme.md b/examples/SimpleTouch/readme.md similarity index 100% rename from MPR121/Examples/SimpleTouch/readme.md rename to examples/SimpleTouch/readme.md diff --git a/library.json b/library.json new file mode 100644 index 0000000..8c8e306 --- /dev/null +++ b/library.json @@ -0,0 +1,12 @@ +{ + "name": "MPR121", + "version": "1.0.0", + "keywords": "MPR121, Touch, I2C", + "description": "Library for the MPR121 touch controller", + "repository": { + "type": "git", + "url": "https://github.com/BareConductive/mpr121" + }, + "frameworks": "arduino", + "platforms": "espressif8266" +} diff --git a/MPR121/MPR121.cpp b/src/MPR121.cpp similarity index 100% rename from MPR121/MPR121.cpp rename to src/MPR121.cpp diff --git a/MPR121/MPR121.h b/src/MPR121.h similarity index 100% rename from MPR121/MPR121.h rename to src/MPR121.h diff --git a/MPR121/MPR121_defs.h b/src/MPR121_defs.h similarity index 100% rename from MPR121/MPR121_defs.h rename to src/MPR121_defs.h diff --git a/MPR121/keywords.txt b/src/keywords.txt similarity index 100% rename from MPR121/keywords.txt rename to src/keywords.txt From 328a6faaf092b1e04d137c90bea5433cf0635c4c Mon Sep 17 00:00:00 2001 From: IanH Date: Fri, 8 Dec 2017 19:18:16 +0100 Subject: [PATCH 2/3] Support to build examples on travis-ci --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d2d94d9..6d68606 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,4 +60,8 @@ install: - pip install -U platformio script: - - platformio ci --lib="." --src="examples/SimpleTouch" --board=esp01 + - platformio ci --lib="." "examples/SimpleTouch" --board=esp01 + - platformio ci --lib="." "examples/GPIOinverter" --board=esp01 + - platformio ci --lib="." "examples/LEDfade" --board=esp01 + - platformio ci --lib="." "examples/DataStream" --board=esp01 + From 538519b4cd8c3c01f92a406604edc3b9e1f67c57 Mon Sep 17 00:00:00 2001 From: IanH Date: Sun, 11 Feb 2018 17:11:48 +0100 Subject: [PATCH 3/3] Fix crash in constructor Wire.begin() must not be called in ctor, because Wire may not be constructed yet. --- src/MPR121.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/MPR121.cpp b/src/MPR121.cpp index 3b89606..a4dc732 100644 --- a/src/MPR121.cpp +++ b/src/MPR121.cpp @@ -50,7 +50,6 @@ extern "C" { #define OUT_OF_RANGE_BIT 4 MPR121_t::MPR121_t(){ - Wire.begin(); address = 0x5C; // default address is 0x5C, for use with Bare Touch Board ECR_backup = 0x00; running = false; @@ -676,4 +675,4 @@ void MPR121_t::setSamplePeriod(mpr121_sample_interval_t period){ setRegister(MPR121_AFE2, (scratch & 0xF8) | (period & 0x07)); } -MPR121_t MPR121 = MPR121_t(); \ No newline at end of file +MPR121_t MPR121 = MPR121_t();