Add support for emonPi the OpenEnergyMonitor system // Resolve #687

This commit is contained in:
Ivan Kravets
2016-06-09 18:50:08 +03:00
parent c1a8fdb940
commit c5b5e80de4
7 changed files with 93 additions and 7 deletions

View File

@ -7,6 +7,9 @@ PlatformIO 2.0
2.9.5 (2016-06-??) 2.9.5 (2016-06-??)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Added support for `emonPi <https://github.com/openenergymonitor/emonpi>`__,
the OpenEnergyMonitor system
(`issue #687 <https://github.com/platformio/platformio/issues/687>`_)
* Added support for `Arduboy DevKit <https://www.arduboy.com>`__, the game system * Added support for `Arduboy DevKit <https://www.arduboy.com>`__, the game system
the size of a credit card the size of a credit card

View File

@ -1197,6 +1197,26 @@ OpenBCI
- 128 Kb - 128 Kb
- 32 Kb - 32 Kb
OpenEnergyMonitor
~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb
PONTECH PONTECH
~~~~~~~ ~~~~~~~

View File

@ -812,6 +812,26 @@ Microduino
- 64 Kb - 64 Kb
- 4 Kb - 4 Kb
OpenEnergyMonitor
~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb
PanStamp PanStamp
~~~~~~~~ ~~~~~~~~

View File

@ -1562,6 +1562,26 @@ OpenBCI
- 128 Kb - 128 Kb
- 32 Kb - 32 Kb
OpenEnergyMonitor
~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb
Outrageous Circuits Outrageous Circuits
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~

View File

@ -14,7 +14,7 @@
import sys import sys
VERSION = (2, 9, "5.dev0") VERSION = (2, 9, "5.dev1")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -43,6 +43,28 @@
"vendor": "BitWizard" "vendor": "BitWizard"
}, },
"emonpi": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR -DAVR_EMONPI",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"frameworks": ["arduino"],
"name": "emonPi",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"require_upload_port" : true,
"speed": 57600
},
"url": "https://github.com/openenergymonitor/emonpi",
"vendor": "OpenEnergyMonitor"
},
"sainSmartDue": { "sainSmartDue": {
"build": { "build": {
"core": "arduino", "core": "arduino",

View File

@ -49,18 +49,19 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.AutodetectUploadPort() env.AutodetectUploadPort()
env.Append(UPLOADERFLAGS=["-P", '"$UPLOAD_PORT"']) env.Append(UPLOADERFLAGS=["-P", '"$UPLOAD_PORT"'])
if env.subst("$BOARD") == "raspduino": if env.subst("$BOARD") in ("raspduino", "emonpi"):
def _rpi_sysgpio(path, value): def _rpi_sysgpio(path, value):
with open(path, "w") as f: with open(path, "w") as f:
f.write(str(value)) f.write(str(value))
_rpi_sysgpio("/sys/class/gpio/export", 18) pin_num = 18 if env.subst("$BOARD") == "raspduino" else 4
_rpi_sysgpio("/sys/class/gpio/gpio18/direction", "out") _rpi_sysgpio("/sys/class/gpio/export", pin_num)
_rpi_sysgpio("/sys/class/gpio/gpio18/value", 1) _rpi_sysgpio("/sys/class/gpio/gpio%d/direction" % pin_num, "out")
_rpi_sysgpio("/sys/class/gpio/gpio%d/value" % pin_num, 1)
sleep(0.1) sleep(0.1)
_rpi_sysgpio("/sys/class/gpio/gpio18/value", 0) _rpi_sysgpio("/sys/class/gpio/gpio%d/value" % pin_num, 0)
_rpi_sysgpio("/sys/class/gpio/unexport", 18) _rpi_sysgpio("/sys/class/gpio/unexport", pin_num)
else: else:
if not upload_options.get("disable_flushing", False): if not upload_options.get("disable_flushing", False):
env.FlushSerialBuffer("$UPLOAD_PORT") env.FlushSerialBuffer("$UPLOAD_PORT")