From a034d350e6ddfa5788dff1bc189470728bc12d6f Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 31 Mar 2020 15:39:42 +0200 Subject: [PATCH] update libs Signed-off-by: andy --- .cproject | 87 ++ .gitignore | 2 + .project | 80 ++ .settings/language.settings.xml | 14 + .settings/org.eclipse.cdt.core.prefs | 504 +++++++++ I2Cdev/.gitignore | 1 + I2Cdev/I2Cdev.cpp | 1474 ++++++++++++++++++++++++++ I2Cdev/I2Cdev.h | 289 +++++ I2Cdev/keywords.txt | 38 + I2Cdev/library.json | 18 + IAQ2000+DHT11.ino | 229 ++++ IAQ2000/IAQ2000.cpp | 141 +++ IAQ2000/IAQ2000.h | 64 ++ IAQ2000/examples/IAQ2000/IAQ2000.ino | 162 +++ IAQ2000/keywords.txt | 25 + IAQ2000/library.json | 18 + spec.d | 2 + 17 files changed, 3148 insertions(+) create mode 100644 .cproject create mode 100644 .gitignore create mode 100644 .project create mode 100644 .settings/language.settings.xml create mode 100644 .settings/org.eclipse.cdt.core.prefs create mode 100644 I2Cdev/.gitignore create mode 100644 I2Cdev/I2Cdev.cpp create mode 100644 I2Cdev/I2Cdev.h create mode 100644 I2Cdev/keywords.txt create mode 100644 I2Cdev/library.json create mode 100644 IAQ2000+DHT11.ino create mode 100644 IAQ2000/IAQ2000.cpp create mode 100644 IAQ2000/IAQ2000.h create mode 100644 IAQ2000/examples/IAQ2000/IAQ2000.ino create mode 100644 IAQ2000/keywords.txt create mode 100644 IAQ2000/library.json create mode 100644 spec.d diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..682b26d --- /dev/null +++ b/.cproject @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dcd90ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/Release/ +/sloeber.ino.cpp diff --git a/.project b/.project new file mode 100644 index 0000000..6437264 --- /dev/null +++ b/.project @@ -0,0 +1,80 @@ + + + IAQ2000+DHT11 + + + + + + io.sloeber.core.inoToCpp + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + io.sloeber.arduinonature + + + + I2Cdev + 2 + PROJECT_LOC/I2Cdev + + + IAQ2000 + 2 + PROJECT_LOC/IAQ2000 + + + core/core + 2 + ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/cores/arduino + + + core/variant + 2 + ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/variants/eightanaloginputs + + + libraries/Adafruit_Unified_Sensor + 2 + ECLIPSE_HOME/arduinoPlugin/libraries/Adafruit_Unified_Sensor/1.1.2 + + + libraries/DHT_sensor_library + 2 + ECLIPSE_HOME/arduinoPlugin/libraries/DHT_sensor_library/1.3.8 + + + libraries/Ethernet + 2 + ECLIPSE_HOME/arduinoPlugin/libraries/Ethernet/2.0.0 + + + libraries/SPI + 2 + ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/libraries/SPI + + + libraries/Wire + 2 + ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/libraries/Wire + + + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml new file mode 100644 index 0000000..1414163 --- /dev/null +++ b/.settings/language.settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000..2d298b7 --- /dev/null +++ b/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,504 @@ +eclipse.preferences.version=1 +environment/project/io.sloeber.core.toolChain.release.662097424/A.ALT_SIZE_COMMAND/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.ALT_SIZE_COMMAND/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.ALT_SIZE_COMMAND/value="${A.COMPILER.PATH}${A.COMPILER.SIZE.CMD}" --format\=avr --mcu\=${A.BUILD.MCU} "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" +environment/project/io.sloeber.core.toolChain.release.662097424/A.ARCHIVE_FILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.ARCHIVE_FILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.ARCHIVE_FILE/value=arduino.ar +environment/project/io.sloeber.core.toolChain.release.662097424/A.ARCHIVE_FILE_PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.ARCHIVE_FILE_PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.ARCHIVE_FILE_PATH/value=${A.BUILD.PATH}/${A.ARCHIVE_FILE} +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.EXTENDED_FUSES/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.EXTENDED_FUSES/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.EXTENDED_FUSES/value=0xFD +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.FILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.FILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.FILE/value=atmega/ATmegaBOOT_168_atmega328.hex +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.HIGH_FUSES/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.HIGH_FUSES/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.HIGH_FUSES/value=0xDA +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.LOCK_BITS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.LOCK_BITS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.LOCK_BITS/value=0x0F +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.LOW_FUSES/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.LOW_FUSES/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.LOW_FUSES/value=0xFF +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.TOOL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.TOOL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.TOOL/value=avrdude +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.UNLOCK_BITS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.UNLOCK_BITS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BOOTLOADER.UNLOCK_BITS/value=0x3F +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.ARCH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.ARCH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.ARCH/value=AVR +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.BOARD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.BOARD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.BOARD/value=AVR_NANO +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.CORE.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.CORE.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.CORE.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\cores\\arduino +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.CORE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.CORE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.CORE/value=arduino +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.F_CPU/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.F_CPU/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.F_CPU/value=16000000L +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.MCU/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.MCU/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.MCU/value=atmega328p +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.PATH/value=${ProjDirPath}/${ConfigName} +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.PROJECT_NAME/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.PROJECT_NAME/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.PROJECT_NAME/value=${ProjName} +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.SYSTEM.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.SYSTEM.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.SYSTEM.PATH/value=${A.RUNTIME.PLATFORM.PATH}/system +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.USB_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.USB_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.USB_FLAGS/value=-DUSB_VID\=${A.BUILD.VID} -DUSB_PID\=${A.BUILD.PID} "-DUSB_MANUFACTURER\=${A.BUILD.USB_MANUFACTURER}" "-DUSB_PRODUCT\=${A.BUILD.USB_PRODUCT}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.USB_MANUFACTURER/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.USB_MANUFACTURER/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.USB_MANUFACTURER/value=\\"Unknown\\" +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.VARIANT.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.VARIANT.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.VARIANT.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\variants\\eightanaloginputs +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.VARIANT/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.VARIANT/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.BUILD.VARIANT/value=eightanaloginputs +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.CMD/value=avr-gcc-ar +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.AR.FLAGS/value=rcs +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.CMD/value=avr-gcc +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.CMD/value=avr-gcc +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.ELF.FLAGS/value=${A.COMPILER.WARNING_FLAGS} -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.C.FLAGS/value=-c -g -Os ${A.COMPILER.WARNING_FLAGS} -std\=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.CMD/value=avr-g++ +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.CPP.FLAGS/value=-c -g -Os ${A.COMPILER.WARNING_FLAGS} -std\=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error\=narrowing -MMD -flto +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.CMD/value=avr-objcopy +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.ELF2HEX.FLAGS/value=-O ihex -R .eeprom +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.LDFLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.LDFLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.LDFLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.CMD/value=avr-objcopy +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.EEP.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.EEP.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.OBJCOPY.EEP.FLAGS/value=-O ihex -j .eeprom --set-section-flags\=.eeprom\=alloc,load --no-change-warnings --change-section-lma .eeprom\=0 +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.PATH/value=${A.RUNTIME.TOOLS.AVR-GCC.PATH}/bin/ +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.S.EXTRA_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.S.EXTRA_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.S.EXTRA_FLAGS/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.S.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.S.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.S.FLAGS/value=-c -g -x assembler-with-cpp -flto -MMD +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.SIZE.CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.SIZE.CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.SIZE.CMD/value=avr-size +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.ALL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.ALL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.ALL/value=-Wall -Wextra +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.DEFAULT/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.DEFAULT/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.DEFAULT/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.MORE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.MORE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.MORE/value=-Wall +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.NONE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.NONE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS.NONE/value=-w +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.COMPILER.WARNING_FLAGS/value=${A.COMPILER.WARNING_FLAGS.ALL} +environment/project/io.sloeber.core.toolChain.release.662097424/A.ESP8266.NETWORK.UPLOAD.TOOL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.ESP8266.NETWORK.UPLOAD.TOOL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.ESP8266.NETWORK.UPLOAD.TOOL/value=esp8266OTA +environment/project/io.sloeber.core.toolChain.release.662097424/A.NAME/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.NAME/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.NAME/value=Arduino Nano +environment/project/io.sloeber.core.toolChain.release.662097424/A.PACKAGES/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.PACKAGES/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.PACKAGES/value=${eclipse_home}/arduinoPlugin/packages +environment/project/io.sloeber.core.toolChain.release.662097424/A.PREPROC.INCLUDES.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.PREPROC.INCLUDES.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.PREPROC.INCLUDES.FLAGS/value=-w -x c++ -M -MG -MP +environment/project/io.sloeber.core.toolChain.release.662097424/A.PREPROC.MACROS.FLAGS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.PREPROC.MACROS.FLAGS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.PREPROC.MACROS.FLAGS/value=-w -x c++ -E -CC +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.AR.CMD}" ${A.COMPILER.AR.FLAGS} ${A.COMPILER.AR.EXTRA_FLAGS} +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.2/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.2/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.2/value=\ +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.3/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.3/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN.3/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.AR.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.AR.CMD}" ${A.COMPILER.AR.FLAGS} ${A.COMPILER.AR.EXTRA_FLAGS} "${A.ARCHIVE_FILE_PATH}" "${A.OBJECT_FILE}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.C.ELF.CMD}" ${A.COMPILER.C.ELF.FLAGS} -mmcu\=${A.BUILD.MCU} ${A.COMPILER.C.ELF.EXTRA_FLAGS} -o "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.2/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.2/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.2/value=\ +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.3/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.3/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN.3/value=\ "-L${A.BUILD.PATH}" -lm +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.COMBINE.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.C.ELF.CMD}" ${A.COMPILER.C.ELF.FLAGS} -mmcu\=${A.BUILD.MCU} ${A.COMPILER.C.ELF.EXTRA_FLAGS} -o "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" ${A.OBJECT_FILES} "${A.BUILD.PATH}/${A.ARCHIVE_FILE}" "-L${A.BUILD.PATH}" -lm +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.C.CMD}" ${A.COMPILER.C.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.C.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.2/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.2/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.2/value=\ -o +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.3/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.3/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN.3/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.C.O.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.C.CMD}" ${A.COMPILER.C.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.C.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} "${A.SOURCE_FILE}" -o "${A.OBJECT_FILE}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.CPP.CMD}" ${A.COMPILER.CPP.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.CPP.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.2/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.2/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.2/value=\ -o +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.3/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.3/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN.3/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.CPP.O.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.CPP.CMD}" ${A.COMPILER.CPP.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.CPP.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} "${A.SOURCE_FILE}" -o "${A.OBJECT_FILE}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.EEP.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.EEP.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.EEP.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.OBJCOPY.CMD}" ${A.COMPILER.OBJCOPY.EEP.FLAGS} ${A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS} "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.eep" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.EEP.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.EEP.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.EEP.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.OBJCOPY.CMD}" ${A.COMPILER.OBJCOPY.EEP.FLAGS} ${A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS} "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.eep" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.HEX.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.HEX.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.HEX.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.ELF2HEX.CMD}" ${A.COMPILER.ELF2HEX.FLAGS} ${A.COMPILER.ELF2HEX.EXTRA_FLAGS} "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.hex" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.HEX.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.HEX.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OBJCOPY.HEX.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.ELF2HEX.CMD}" ${A.COMPILER.ELF2HEX.FLAGS} ${A.COMPILER.ELF2HEX.EXTRA_FLAGS} "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.hex" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OUTPUT.SAVE_FILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OUTPUT.SAVE_FILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OUTPUT.SAVE_FILE/value=${A.BUILD.PROJECT_NAME}.${A.BUILD.VARIANT}.hex +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OUTPUT.TMP_FILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OUTPUT.TMP_FILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.OUTPUT.TMP_FILE/value=${A.BUILD.PROJECT_NAME}.hex +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.PREPROC.INCLUDES/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.PREPROC.INCLUDES/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.PREPROC.INCLUDES/value="${A.COMPILER.PATH}${A.COMPILER.CPP.CMD}" ${A.COMPILER.CPP.FLAGS} ${A.PREPROC.INCLUDES.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.CPP.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} "${A.SOURCE_FILE}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.PREPROC.MACROS/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.PREPROC.MACROS/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.PREPROC.MACROS/value="${A.COMPILER.PATH}${A.COMPILER.CPP.CMD}" ${A.COMPILER.CPP.FLAGS} ${A.PREPROC.MACROS.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.CPP.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} "${A.SOURCE_FILE}" -o "${A.PREPROCESSED_FILE_PATH}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.C.CMD}" ${A.COMPILER.S.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.S.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.2/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.2/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.2/value=\ -o +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.3/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.3/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN.3/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.S.O.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.C.CMD}" ${A.COMPILER.S.FLAGS} -mmcu\=${A.BUILD.MCU} -DF_CPU\=${A.BUILD.F_CPU} -DARDUINO\=${A.RUNTIME.IDE.VERSION} -DARDUINO_${A.BUILD.BOARD} -DARDUINO_ARCH_${A.BUILD.ARCH} ${A.COMPILER.S.EXTRA_FLAGS} ${A.BUILD.EXTRA_FLAGS} ${A.INCLUDES} "${A.SOURCE_FILE}" -o "${A.OBJECT_FILE}" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.PATTERN.1/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.PATTERN.1/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.SIZE.CMD}" -A "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.SIZE.CMD}" -A "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf" +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX.DATA/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX.DATA/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX.DATA/value=^(?\:\\.data|\\.bss|\\.noinit)\\s+([0-9]+).* +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX.EEPROM/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX.EEPROM/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX.EEPROM/value=^(?\:\\.eeprom)\\s+([0-9]+).* +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RECIPE.SIZE.REGEX/value=^(?\:\\.text|\\.data|\\.bootloader)\\s+([0-9]+).* +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.CORE.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.CORE.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.CORE.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2 +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.UPLOAD.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.UPLOAD.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.UPLOAD.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2 +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.VARIANT.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.VARIANT.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.REFERENCED.VARIANT.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.HARDWARE.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.HARDWARE.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.HARDWARE.PATH/value=${eclipse_home}/arduinoPlugin/packages/arduino/hardware/avr +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.IDE.VERSION/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.IDE.VERSION/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.IDE.VERSION/value=10802 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.PLATFORM.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.PLATFORM.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.PLATFORM.PATH/value=${eclipse_home}/arduinoPlugin/packages/arduino/hardware/avr/1.8.2 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA-1.3.0.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA-1.3.0.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA-1.3.0.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\arduinoOTA\\1.3.0 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\arduinoOTA\\1.3.0 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA1.3.0.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA1.3.0.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.ARDUINOOTA1.3.0.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\arduinoOTA\\1.3.0 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC-7.3.0-ATMEL3.6.1-ARDUINO5.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC-7.3.0-ATMEL3.6.1-ARDUINO5.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC-7.3.0-ATMEL3.6.1-ARDUINO5.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC7.3.0-ATMEL3.6.1-ARDUINO5.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC7.3.0-ATMEL3.6.1-ARDUINO5.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVR-GCC7.3.0-ATMEL3.6.1-ARDUINO5.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE-6.3.0-ARDUINO17.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE-6.3.0-ARDUINO17.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE-6.3.0-ARDUINO17.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\avrdude\\6.3.0-arduino17 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\avrdude\\6.3.0-arduino17 +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE6.3.0-ARDUINO17.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE6.3.0-ARDUINO17.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.RUNTIME.TOOLS.AVRDUDE6.3.0-ARDUINO17.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\tools\\avrdude\\6.3.0-arduino17 +environment/project/io.sloeber.core.toolChain.release.662097424/A.SERIAL.PORT.FILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.SERIAL.PORT.FILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.SERIAL.PORT.FILE/value=${A.SERIAL.PORT} +environment/project/io.sloeber.core.toolChain.release.662097424/A.SERIAL.PORT/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.SERIAL.PORT/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.SERIAL.PORT/value=${JANTJE.COM_PORT} +environment/project/io.sloeber.core.toolChain.release.662097424/A.SOFTWARE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.SOFTWARE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.SOFTWARE/value=ARDUINO +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.QUIET/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.QUIET/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.QUIET/value=-q -q +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.VERBOSE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.VERBOSE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.VERBOSE/value=-v +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.BOOTLOADER.PATTERN/value="${A.TOOLS.AVRDUDE.CMD.PATH}" "-C${A.TOOLS.AVRDUDE.CONFIG.PATH}" ${A.TOOLS.AVRDUDE.BOOTLOADER.VERBOSE} -p${A.BUILD.MCU} -c${A.TOOLS.AVRDUDE.PROTOCOL} ${A.TOOLS.AVRDUDE.PROGRAM.EXTRA_PARAMS} "-Uflash\:w\:${A.RUNTIME.PLATFORM.PATH}/bootloaders/${A.BOOTLOADER.FILE}\:i" -Ulock\:w\:${A.BOOTLOADER.LOCK_BITS}\:m +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.CMD.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.CMD.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.CMD.PATH/value=${A.TOOLS.AVRDUDE.PATH}/bin/avrdude +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.CONFIG.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.CONFIG.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.CONFIG.PATH/value=${A.TOOLS.AVRDUDE.PATH}/etc/avrdude.conf +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PARAMS.QUIET/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PARAMS.QUIET/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PARAMS.QUIET/value=-q -q +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PARAMS.VERBOSE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PARAMS.VERBOSE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PARAMS.VERBOSE/value=-v +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.ERASE.PATTERN/value="${A.TOOLS.AVRDUDE.CMD.PATH}" "-C${A.TOOLS.AVRDUDE.CONFIG.PATH}" ${A.TOOLS.AVRDUDE.ERASE.VERBOSE} -p${A.BUILD.MCU} -c${A.TOOLS.AVRDUDE.PROTOCOL} ${A.TOOLS.AVRDUDE.PROGRAM.EXTRA_PARAMS} -e -Ulock\:w\:${A.BOOTLOADER.UNLOCK_BITS}\:m -Uefuse\:w\:${A.BOOTLOADER.EXTENDED_FUSES}\:m -Uhfuse\:w\:${A.BOOTLOADER.HIGH_FUSES}\:m -Ulfuse\:w\:${A.BOOTLOADER.LOW_FUSES}\:m +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.NETWORK_CMD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.NETWORK_CMD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.NETWORK_CMD/value=${A.RUNTIME.TOOLS.ARDUINOOTA.PATH}/bin/arduinoOTA +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PATH/value=${A.RUNTIME.TOOLS.AVRDUDE.PATH} +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.NOVERIFY/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.NOVERIFY/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.NOVERIFY/value=-V +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.QUIET/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.QUIET/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.QUIET/value=-q -q +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.VERBOSE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.VERBOSE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.VERBOSE/value=-v +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.PATTERN/value="${A.TOOLS.AVRDUDE.CMD.PATH}" "-C${A.TOOLS.AVRDUDE.CONFIG.PATH}" ${A.TOOLS.AVRDUDE.PROGRAM.VERBOSE} ${A.TOOLS.AVRDUDE.PROGRAM.VERIFY} -p${A.BUILD.MCU} -c${A.TOOLS.AVRDUDE.PROTOCOL} ${A.TOOLS.AVRDUDE.PROGRAM.EXTRA_PARAMS} "-Uflash\:w\:${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.hex\:i" +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.VERIFY/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.VERIFY/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.PROGRAM.VERIFY/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.NETWORK_PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.NETWORK_PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.NETWORK_PATTERN/value="${A.TOOLS.AVRDUDE.NETWORK_CMD}" -address ${A.SERIAL.PORT} -port ${A.TOOLS.AVRDUDE.UPLOAD.NETWORK.PORT} -sketch "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.hex" -upload ${A.TOOLS.AVRDUDE.UPLOAD.NETWORK.ENDPOINT_UPLOAD} -sync ${A.TOOLS.AVRDUDE.UPLOAD.NETWORK.ENDPOINT_SYNC} -reset ${A.TOOLS.AVRDUDE.UPLOAD.NETWORK.ENDPOINT_RESET} -sync_exp ${A.TOOLS.AVRDUDE.UPLOAD.NETWORK.SYNC_RETURN} +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.NOVERIFY/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.NOVERIFY/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.NOVERIFY/value=-V +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.QUIET/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.QUIET/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.QUIET/value=-q -q +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.VERBOSE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.VERBOSE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.VERBOSE/value=-v +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.PATTERN/value="${A.TOOLS.AVRDUDE.CMD.PATH}" "-C${A.TOOLS.AVRDUDE.CONFIG.PATH}" ${A.UPLOAD.VERBOSE} ${A.TOOLS.AVRDUDE.UPLOAD.VERIFY} -p${A.BUILD.MCU} -c${A.UPLOAD.PROTOCOL} "-P${A.SERIAL.PORT}" -b${A.UPLOAD.SPEED} -D "-Uflash\:w\:${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.hex\:i" +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.VERIFY/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.VERIFY/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE.UPLOAD.VERIFY/value= +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.PATTERN/value=/usr/bin/run-avrdude /tmp/sketch.hex ${A.UPLOAD.VERBOSE} -p${A.BUILD.MCU} +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.VERBOSE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.VERBOSE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.VERBOSE/value=-v +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESP8266OTA.UPLOAD.PATTERN/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESP8266OTA.UPLOAD.PATTERN/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESP8266OTA.UPLOAD.PATTERN/value=${A.TOOLS.ESP8266OTA.TOOLS.ESPTOOL.UPLOAD.NETWORK_PATTERN} +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESP8266OTA/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESP8266OTA/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESP8266OTA/value=${A.TOOLS.ESP8266OTA.TOOLS.ESPTOOL.NETWORK_CMD} +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESPTOOL.NETWORK.PASSWORD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESPTOOL.NETWORK.PASSWORD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.TOOLS.ESPTOOL.NETWORK.PASSWORD/value=${A.NETWORK.AUTH} +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.ALTID/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.ALTID/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.ALTID/value=no_altID +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.MAXIMUM_DATA_SIZE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.MAXIMUM_DATA_SIZE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.MAXIMUM_DATA_SIZE/value=2048 +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.MAXIMUM_SIZE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.MAXIMUM_SIZE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.MAXIMUM_SIZE/value=30720 +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.PROTOCOL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.PROTOCOL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.PROTOCOL/value=arduino +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.SPEED/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.SPEED/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.SPEED/value=57600 +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.TOOL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.TOOL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.TOOL/value=avrdude +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.USBID/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.USBID/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.UPLOAD.USBID/value=no_altID +environment/project/io.sloeber.core.toolChain.release.662097424/A.VERSION/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/A.VERSION/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/A.VERSION/value=1.8.2 +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.ARCHITECTURE_ID/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.ARCHITECTURE_ID/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.ARCHITECTURE_ID/value=avr +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARDS_FILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARDS_FILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARDS_FILE/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\boards.txt +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARD_ID/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARD_ID/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARD_ID/value=nano +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARD_NAME/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARD_NAME/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.BOARD_NAME/value=Arduino Nano +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.COM_PORT/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.COM_PORT/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.COM_PORT/value=COM5 +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.ECLIPSE_LOCATION/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.ECLIPSE_LOCATION/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.ECLIPSE_LOCATION/value=C\:\\Sloeber\\ +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ALL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ALL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ALL/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ARCHIVE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ARCHIVE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ARCHIVE/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ASSEMBLY/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ASSEMBLY/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.ASSEMBLY/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.C.COMPILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.C.COMPILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.C.COMPILE/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.COMPILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.COMPILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.COMPILE/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.CPP.COMPILE/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.CPP.COMPILE/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.CPP.COMPILE/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.LINK/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.LINK/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.EXTRA.LINK/value= +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.MAKE_LOCATION/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.MAKE_LOCATION/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.MAKE_LOCATION/value=C\:\\Sloeber\\arduinoPlugin\\tools\\make\\ +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.MENU/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.MENU/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.MENU/value=cpu\=atmega328old +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.OBJCOPY/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.OBJCOPY/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.OBJCOPY/value=${A.RECIPE.OBJCOPY.EEP.PATTERN}\n\t${A.RECIPE.OBJCOPY.HEX.PATTERN} +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.OS_NAME/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.OS_NAME/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.OS_NAME/value=win32 +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.PACKAGE_ID/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.PACKAGE_ID/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.PACKAGE_ID/value=arduino +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.PROJECT_NAME/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.PROJECT_NAME/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.PROJECT_NAME/value=IAQ2000+DHT11 +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.SELECTED.PLATFORM/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.SELECTED.PLATFORM/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.SELECTED.PLATFORM/value=${eclipse_home}/arduinoPlugin/packages/arduino/hardware/avr/1.8.2 +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.SIZE.SWITCH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.SIZE.SWITCH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.SIZE.SWITCH/value=${A.RECIPE.SIZE.PATTERN} +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.UPLOAD/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.UPLOAD/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.UPLOAD/value=Default +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.WARNING_LEVEL/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.WARNING_LEVEL/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.WARNING_LEVEL/value=true +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.WORKSPACE_LOCATION/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.WORKSPACE_LOCATION/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/JANTJE.WORKSPACE_LOCATION/value=C\:\\Users\\agr\\Documents\\sloeber-workspace +environment/project/io.sloeber.core.toolChain.release.662097424/PATH/delimiter=; +environment/project/io.sloeber.core.toolChain.release.662097424/PATH/operation=replace +environment/project/io.sloeber.core.toolChain.release.662097424/PATH/value=${A.COMPILER.PATH}${PathDelimiter}${A.BUILD.GENERIC.PATH}${PathDelimiter}${SystemRoot}\\system32${PathDelimiter}${SystemRoot}${PathDelimiter}${SystemRoot}\\system32\\Wbem${PathDelimiter}${sloeber_path_extension} +environment/project/io.sloeber.core.toolChain.release.662097424/append=true +environment/project/io.sloeber.core.toolChain.release.662097424/appendContributed=true diff --git a/I2Cdev/.gitignore b/I2Cdev/.gitignore new file mode 100644 index 0000000..c4c775f --- /dev/null +++ b/I2Cdev/.gitignore @@ -0,0 +1 @@ +/I2Cdev.cpp diff --git a/I2Cdev/I2Cdev.cpp b/I2Cdev/I2Cdev.cpp new file mode 100644 index 0000000..5525624 --- /dev/null +++ b/I2Cdev/I2Cdev.cpp @@ -0,0 +1,1474 @@ +// I2Cdev library collection - Main I2C device class +// Abstracts bit and byte I2C R/W functions into a convenient class +// 2013-06-05 by Jeff Rowberg +// +// Changelog: +// 2013-05-06 - add Francesco Ferrara's Fastwire v0.24 implementation with small modifications +// 2013-05-05 - fix issue with writing bit values to words (Sasquatch/Farzanegan) +// 2012-06-09 - fix major issue with reading > 32 bytes at a time with Arduino Wire +// - add compiler warnings when using outdated or IDE or limited I2Cdev implementation +// 2011-11-01 - fix write*Bits mask calculation (thanks sasquatch @ Arduino forums) +// 2011-10-03 - added automatic Arduino version detection for ease of use +// 2011-10-02 - added Gene Knight's NBWire TwoWire class implementation with small modifications +// 2011-08-31 - added support for Arduino 1.0 Wire library (methods are different from 0.x) +// 2011-08-03 - added optional timeout parameter to read* methods to easily change from default +// 2011-08-02 - added support for 16-bit registers +// - fixed incorrect Doxygen comments on some methods +// - added timeout value for read operations (thanks mem @ Arduino forums) +// 2011-07-30 - changed read/write function structures to return success or byte counts +// - made all methods static for multi-device memory savings +// 2011-07-28 - initial release + +/* ============================================ +I2Cdev device library code is placed under the MIT license +Copyright (c) 2013 Jeff Rowberg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +=============================================== +*/ + +#include "I2Cdev.h" + +#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE + + #ifdef I2CDEV_IMPLEMENTATION_WARNINGS + #if ARDUINO < 100 + #warning Using outdated Arduino IDE with Wire library is functionally limiting. + #warning Arduino IDE v1.6.5+ with I2Cdev Fastwire implementation is recommended. + #warning This I2Cdev implementation does not support: + #warning - Repeated starts conditions + #warning - Timeout detection (some Wire requests block forever) + #elif ARDUINO == 100 + #warning Using outdated Arduino IDE with Wire library is functionally limiting. + #warning Arduino IDE v1.6.5+ with I2Cdev Fastwire implementation is recommended. + #warning This I2Cdev implementation does not support: + #warning - Repeated starts conditions + #warning - Timeout detection (some Wire requests block forever) + #elif ARDUINO > 100 + /*#warning Using current Arduino IDE with Wire library is functionally limiting. + #warning Arduino IDE v1.6.5+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended. + #warning This I2Cdev implementation does not support: + #warning - Timeout detection (some Wire requests block forever)*/ + #endif + #endif + +#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE + + //#error The I2CDEV_BUILTIN_FASTWIRE implementation is known to be broken right now. Patience, Iago! + +#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE + + #ifdef I2CDEV_IMPLEMENTATION_WARNINGS + #warning Using I2CDEV_BUILTIN_NBWIRE implementation may adversely affect interrupt detection. + #warning This I2Cdev implementation does not support: + #warning - Repeated starts conditions + #endif + + // NBWire implementation based heavily on code by Gene Knight + // Originally posted on the Arduino forum at http://arduino.cc/forum/index.php/topic,70705.0.html + // Originally offered to the i2cdevlib project at http://arduino.cc/forum/index.php/topic,68210.30.html + TwoWire Wire; + +#endif + +#ifndef BUFFER_LENGTH +// band-aid fix for platforms without Wire-defined BUFFER_LENGTH (removed from some official implementations) +#define BUFFER_LENGTH 32 +#endif + +/** Default constructor. + */ +I2Cdev::I2Cdev() { +} + +/** Read a single bit from an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to read from + * @param bitNum Bit position to read (0-7) + * @param data Container for single bit value + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Status of read operation (true = success) + */ +int8_t I2Cdev::readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout) { + uint8_t b; + uint8_t count = readByte(devAddr, regAddr, &b, timeout); + *data = b & (1 << bitNum); + return count; +} + +/** Read a single bit from a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to read from + * @param bitNum Bit position to read (0-15) + * @param data Container for single bit value + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Status of read operation (true = success) + */ +int8_t I2Cdev::readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout) { + uint16_t b; + uint8_t count = readWord(devAddr, regAddr, &b, timeout); + *data = b & (1 << bitNum); + return count; +} + +/** Read multiple bits from an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to read from + * @param bitStart First bit position to read (0-7) + * @param length Number of bits to read (not more than 8) + * @param data Container for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05) + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Status of read operation (true = success) + */ +int8_t I2Cdev::readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout) { + // 01101001 read byte + // 76543210 bit numbers + // xxx args: bitStart=4, length=3 + // 010 masked + // -> 010 shifted + uint8_t count, b; + if ((count = readByte(devAddr, regAddr, &b, timeout)) != 0) { + uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1); + b &= mask; + b >>= (bitStart - length + 1); + *data = b; + } + return count; +} + +/** Read multiple bits from a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to read from + * @param bitStart First bit position to read (0-15) + * @param length Number of bits to read (not more than 16) + * @param data Container for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05) + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Status of read operation (1 = success, 0 = failure, -1 = timeout) + */ +int8_t I2Cdev::readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout) { + // 1101011001101001 read byte + // fedcba9876543210 bit numbers + // xxx args: bitStart=12, length=3 + // 010 masked + // -> 010 shifted + uint8_t count; + uint16_t w; + if ((count = readWord(devAddr, regAddr, &w, timeout)) != 0) { + uint16_t mask = ((1 << length) - 1) << (bitStart - length + 1); + w &= mask; + w >>= (bitStart - length + 1); + *data = w; + } + return count; +} + +/** Read single byte from an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to read from + * @param data Container for byte value read from device + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Status of read operation (true = success) + */ +int8_t I2Cdev::readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout) { + return readBytes(devAddr, regAddr, 1, data, timeout); +} + +/** Read single word from a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to read from + * @param data Container for word value read from device + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Status of read operation (true = success) + */ +int8_t I2Cdev::readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout) { + return readWords(devAddr, regAddr, 1, data, timeout); +} + +/** Read multiple bytes from an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr First register regAddr to read from + * @param length Number of bytes to read + * @param data Buffer to store read data in + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Number of bytes read (-1 indicates failure) + */ +int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout) { + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print("I2C (0x"); + Serial.print(devAddr, HEX); + Serial.print(") reading "); + Serial.print(length, DEC); + Serial.print(" bytes from 0x"); + Serial.print(regAddr, HEX); + Serial.print("..."); + #endif + + int8_t count = 0; + uint32_t t1 = millis(); + + #if (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + + #if (ARDUINO < 100) + // Arduino v00xx (before v1.0), Wire library + + // I2C/TWI subsystem uses internal buffer that breaks with large data requests + // so if user requests more than BUFFER_LENGTH bytes, we have to do it in + // smaller chunks instead of all at once + for (uint8_t k = 0; k < length; k += min((int)length, BUFFER_LENGTH)) { + Wire.beginTransmission(devAddr); + Wire.send(regAddr); + Wire.endTransmission(); + Wire.beginTransmission(devAddr); + Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH)); + + for (; Wire.available() && (timeout == 0 || millis() - t1 < timeout); count++) { + data[count] = Wire.receive(); + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); + #endif + } + + Wire.endTransmission(); + } + #elif (ARDUINO == 100) + // Arduino v1.0.0, Wire library + // Adds standardized write() and read() stream methods instead of send() and receive() + + // I2C/TWI subsystem uses internal buffer that breaks with large data requests + // so if user requests more than BUFFER_LENGTH bytes, we have to do it in + // smaller chunks instead of all at once + for (uint8_t k = 0; k < length; k += min((int)length, BUFFER_LENGTH)) { + Wire.beginTransmission(devAddr); + Wire.write(regAddr); + Wire.endTransmission(); + Wire.beginTransmission(devAddr); + Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH)); + + for (; Wire.available() && (timeout == 0 || millis() - t1 < timeout); count++) { + data[count] = Wire.read(); + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); + #endif + } + + Wire.endTransmission(); + } + #elif (ARDUINO > 100) + // Arduino v1.0.1+, Wire library + // Adds official support for repeated start condition, yay! + + // I2C/TWI subsystem uses internal buffer that breaks with large data requests + // so if user requests more than BUFFER_LENGTH bytes, we have to do it in + // smaller chunks instead of all at once + for (uint8_t k = 0; k < length; k += min((int)length, BUFFER_LENGTH)) { + Wire.beginTransmission(devAddr); + Wire.write(regAddr); + Wire.endTransmission(); + Wire.beginTransmission(devAddr); + Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH)); + + for (; Wire.available() && (timeout == 0 || millis() - t1 < timeout); count++) { + data[count] = Wire.read(); + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); + #endif + } + } + #endif + + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + + // Fastwire library + // no loop required for fastwire + uint8_t status = Fastwire::readBuf(devAddr << 1, regAddr, data, length); + if (status == 0) { + count = length; // success + } else { + count = -1; // error + } + + #endif + + // check for timeout + if (timeout > 0 && millis() - t1 >= timeout && count < length) count = -1; // timeout + + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(". Done ("); + Serial.print(count, DEC); + Serial.println(" read)."); + #endif + + return count; +} + +/** Read multiple words from a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr First register regAddr to read from + * @param length Number of words to read + * @param data Buffer to store read data in + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Number of words read (-1 indicates failure) + */ +int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout) { + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print("I2C (0x"); + Serial.print(devAddr, HEX); + Serial.print(") reading "); + Serial.print(length, DEC); + Serial.print(" words from 0x"); + Serial.print(regAddr, HEX); + Serial.print("..."); + #endif + + int8_t count = 0; + uint32_t t1 = millis(); + +#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE + + #if (ARDUINO < 100) + // Arduino v00xx (before v1.0), Wire library + + // I2C/TWI subsystem uses internal buffer that breaks with large data requests + // so if user requests more than BUFFER_LENGTH bytes, we have to do it in + // smaller chunks instead of all at once + for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) { + Wire.beginTransmission(devAddr); + Wire.send(regAddr); + Wire.endTransmission(); + Wire.beginTransmission(devAddr); + Wire.requestFrom(devAddr, (uint8_t)(length * 2)); // length=words, this wants bytes + + bool msb = true; // starts with MSB, then LSB + for (; Wire.available() && count < length && (timeout == 0 || millis() - t1 < timeout);) { + if (msb) { + // first byte is bits 15-8 (MSb=15) + data[count] = Wire.receive() << 8; + } else { + // second byte is bits 7-0 (LSb=0) + data[count] |= Wire.receive(); + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); + #endif + count++; + } + msb = !msb; + } + + Wire.endTransmission(); + } + #elif (ARDUINO == 100) + // Arduino v1.0.0, Wire library + // Adds standardized write() and read() stream methods instead of send() and receive() + + // I2C/TWI subsystem uses internal buffer that breaks with large data requests + // so if user requests more than BUFFER_LENGTH bytes, we have to do it in + // smaller chunks instead of all at once + for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) { + Wire.beginTransmission(devAddr); + Wire.write(regAddr); + Wire.endTransmission(); + Wire.beginTransmission(devAddr); + Wire.requestFrom(devAddr, (uint8_t)(length * 2)); // length=words, this wants bytes + + bool msb = true; // starts with MSB, then LSB + for (; Wire.available() && count < length && (timeout == 0 || millis() - t1 < timeout);) { + if (msb) { + // first byte is bits 15-8 (MSb=15) + data[count] = Wire.read() << 8; + } else { + // second byte is bits 7-0 (LSb=0) + data[count] |= Wire.read(); + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); + #endif + count++; + } + msb = !msb; + } + + Wire.endTransmission(); + } + #elif (ARDUINO > 100) + // Arduino v1.0.1+, Wire library + // Adds official support for repeated start condition, yay! + + // I2C/TWI subsystem uses internal buffer that breaks with large data requests + // so if user requests more than BUFFER_LENGTH bytes, we have to do it in + // smaller chunks instead of all at once + for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) { + Wire.beginTransmission(devAddr); + Wire.write(regAddr); + Wire.endTransmission(); + Wire.beginTransmission(devAddr); + Wire.requestFrom(devAddr, (uint8_t)(length * 2)); // length=words, this wants bytes + + bool msb = true; // starts with MSB, then LSB + for (; Wire.available() && count < length && (timeout == 0 || millis() - t1 < timeout);) { + if (msb) { + // first byte is bits 15-8 (MSb=15) + data[count] = Wire.read() << 8; + } else { + // second byte is bits 7-0 (LSb=0) + data[count] |= Wire.read(); + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); + #endif + count++; + } + msb = !msb; + } + + Wire.endTransmission(); + } + #endif + + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + + // Fastwire library + // no loop required for fastwire + uint8_t intermediate[(uint8_t)length*2]; + uint8_t status = Fastwire::readBuf(devAddr << 1, regAddr, intermediate, (uint8_t)(length * 2)); + if (status == 0) { + count = length; // success + for (uint8_t i = 0; i < length; i++) { + data[i] = (intermediate[2*i] << 8) | intermediate[2*i + 1]; + } + } else { + count = -1; // error + } + + #endif + + if (timeout > 0 && millis() - t1 >= timeout && count < length) count = -1; // timeout + + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(". Done ("); + Serial.print(count, DEC); + Serial.println(" read)."); + #endif + + return count; +} + +/** write a single bit in an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to write to + * @param bitNum Bit position to write (0-7) + * @param value New bit value to write + * @return Status of operation (true = success) + */ +bool I2Cdev::writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data) { + uint8_t b; + readByte(devAddr, regAddr, &b); + b = (data != 0) ? (b | (1 << bitNum)) : (b & ~(1 << bitNum)); + return writeByte(devAddr, regAddr, b); +} + +/** write a single bit in a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to write to + * @param bitNum Bit position to write (0-15) + * @param value New bit value to write + * @return Status of operation (true = success) + */ +bool I2Cdev::writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data) { + uint16_t w; + readWord(devAddr, regAddr, &w); + w = (data != 0) ? (w | (1 << bitNum)) : (w & ~(1 << bitNum)); + return writeWord(devAddr, regAddr, w); +} + +/** Write multiple bits in an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to write to + * @param bitStart First bit position to write (0-7) + * @param length Number of bits to write (not more than 8) + * @param data Right-aligned value to write + * @return Status of operation (true = success) + */ +bool I2Cdev::writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data) { + // 010 value to write + // 76543210 bit numbers + // xxx args: bitStart=4, length=3 + // 00011100 mask byte + // 10101111 original value (sample) + // 10100011 original & ~mask + // 10101011 masked | value + uint8_t b; + if (readByte(devAddr, regAddr, &b) != 0) { + uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1); + data <<= (bitStart - length + 1); // shift data into correct position + data &= mask; // zero all non-important bits in data + b &= ~(mask); // zero all important bits in existing byte + b |= data; // combine data with existing byte + return writeByte(devAddr, regAddr, b); + } else { + return false; + } +} + +/** Write multiple bits in a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register regAddr to write to + * @param bitStart First bit position to write (0-15) + * @param length Number of bits to write (not more than 16) + * @param data Right-aligned value to write + * @return Status of operation (true = success) + */ +bool I2Cdev::writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data) { + // 010 value to write + // fedcba9876543210 bit numbers + // xxx args: bitStart=12, length=3 + // 0001110000000000 mask word + // 1010111110010110 original value (sample) + // 1010001110010110 original & ~mask + // 1010101110010110 masked | value + uint16_t w; + if (readWord(devAddr, regAddr, &w) != 0) { + uint16_t mask = ((1 << length) - 1) << (bitStart - length + 1); + data <<= (bitStart - length + 1); // shift data into correct position + data &= mask; // zero all non-important bits in data + w &= ~(mask); // zero all important bits in existing word + w |= data; // combine data with existing word + return writeWord(devAddr, regAddr, w); + } else { + return false; + } +} + +/** Write single byte to an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register address to write to + * @param data New byte value to write + * @return Status of operation (true = success) + */ +bool I2Cdev::writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data) { + return writeBytes(devAddr, regAddr, 1, &data); +} + +/** Write single word to a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr Register address to write to + * @param data New word value to write + * @return Status of operation (true = success) + */ +bool I2Cdev::writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data) { + return writeWords(devAddr, regAddr, 1, &data); +} + +/** Write multiple bytes to an 8-bit device register. + * @param devAddr I2C slave device address + * @param regAddr First register address to write to + * @param length Number of bytes to write + * @param data Buffer to copy new data from + * @return Status of operation (true = success) + */ +bool I2Cdev::writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t* data) { + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print("I2C (0x"); + Serial.print(devAddr, HEX); + Serial.print(") writing "); + Serial.print(length, DEC); + Serial.print(" bytes to 0x"); + Serial.print(regAddr, HEX); + Serial.print("..."); + #endif + uint8_t status = 0; + #if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + Wire.beginTransmission(devAddr); + Wire.send((uint8_t) regAddr); // send address + #elif ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) \ + || (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100) \ + || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + Wire.beginTransmission(devAddr); + Wire.write((uint8_t) regAddr); // send address + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + Fastwire::beginTransmission(devAddr); + Fastwire::write(regAddr); + #endif + for (uint8_t i = 0; i < length; i++) { + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[i], HEX); + if (i + 1 < length) Serial.print(" "); + #endif + #if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + Wire.send((uint8_t) data[i]); + #elif ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) \ + || (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100) \ + || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + Wire.write((uint8_t) data[i]); + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + Fastwire::write((uint8_t) data[i]); + #endif + } + #if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + Wire.endTransmission(); + #elif ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) \ + || (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100) \ + || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + status = Wire.endTransmission(); + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + Fastwire::stop(); + //status = Fastwire::endTransmission(); + #endif + #ifdef I2CDEV_SERIAL_DEBUG + Serial.println(". Done."); + #endif + return status == 0; +} + +/** Write multiple words to a 16-bit device register. + * @param devAddr I2C slave device address + * @param regAddr First register address to write to + * @param length Number of words to write + * @param data Buffer to copy new data from + * @return Status of operation (true = success) + */ +bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t* data) { + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print("I2C (0x"); + Serial.print(devAddr, HEX); + Serial.print(") writing "); + Serial.print(length, DEC); + Serial.print(" words to 0x"); + Serial.print(regAddr, HEX); + Serial.print("..."); + #endif + uint8_t status = 0; + #if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + Wire.beginTransmission(devAddr); + Wire.send(regAddr); // send address + #elif ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) \ + || (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100) \ + || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + Wire.beginTransmission(devAddr); + Wire.write(regAddr); // send address + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + Fastwire::beginTransmission(devAddr); + Fastwire::write(regAddr); + #endif + for (uint8_t i = 0; i < length; i++) { + #ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[i], HEX); + if (i + 1 < length) Serial.print(" "); + #endif + #if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + Wire.send((uint8_t)(data[i] >> 8)); // send MSB + Wire.send((uint8_t)data[i]); // send LSB + #elif ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) \ + || (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100) \ + || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + Wire.write((uint8_t)(data[i] >> 8)); // send MSB + Wire.write((uint8_t)data[i]); // send LSB + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + Fastwire::write((uint8_t)(data[i] >> 8)); // send MSB + status = Fastwire::write((uint8_t)data[i]); // send LSB + if (status != 0) break; + #endif + } + #if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + Wire.endTransmission(); + #elif ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) \ + || (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100) \ + || I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE) + status = Wire.endTransmission(); + #elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE) + Fastwire::stop(); + //status = Fastwire::endTransmission(); + #endif + #ifdef I2CDEV_SERIAL_DEBUG + Serial.println(". Done."); + #endif + return status == 0; +} + +/** Default timeout value for read operations. + * Set this to 0 to disable timeout detection. + */ +uint16_t I2Cdev::readTimeout = I2CDEV_DEFAULT_READ_TIMEOUT; + +#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE + // I2C library + ////////////////////// + // Copyright(C) 2012 + // Francesco Ferrara + // ferrara[at]libero[point]it + ////////////////////// + + /* + FastWire + - 0.24 added stop + - 0.23 added reset + + This is a library to help faster programs to read I2C devices. + Copyright(C) 2012 Francesco Ferrara + occhiobello at gmail dot com + [used by Jeff Rowberg for I2Cdevlib with permission] + */ + + boolean Fastwire::waitInt() { + int l = 250; + while (!(TWCR & (1 << TWINT)) && l-- > 0); + return l > 0; + } + + void Fastwire::setup(int khz, boolean pullup) { + TWCR = 0; + #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__) + // activate internal pull-ups for twi (PORTC bits 4 & 5) + // as per note from atmega8 manual pg167 + if (pullup) PORTC |= ((1 << 4) | (1 << 5)); + else PORTC &= ~((1 << 4) | (1 << 5)); + #elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) + // activate internal pull-ups for twi (PORTC bits 0 & 1) + if (pullup) PORTC |= ((1 << 0) | (1 << 1)); + else PORTC &= ~((1 << 0) | (1 << 1)); + #else + // activate internal pull-ups for twi (PORTD bits 0 & 1) + // as per note from atmega128 manual pg204 + if (pullup) PORTD |= ((1 << 0) | (1 << 1)); + else PORTD &= ~((1 << 0) | (1 << 1)); + #endif + + TWSR = 0; // no prescaler => prescaler = 1 + TWBR = ((16000L / khz) - 16) / 2; // change the I2C clock rate + TWCR = 1 << TWEN; // enable twi module, no interrupt + } + + // added by Jeff Rowberg 2013-05-07: + // Arduino Wire-style "beginTransmission" function + // (takes 7-bit device address like the Wire method, NOT 8-bit: 0x68, not 0xD0/0xD1) + byte Fastwire::beginTransmission(byte device) { + byte twst, retry; + retry = 2; + do { + TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO) | (1 << TWSTA); + if (!waitInt()) return 1; + twst = TWSR & 0xF8; + if (twst != TW_START && twst != TW_REP_START) return 2; + + //Serial.print(device, HEX); + //Serial.print(" "); + TWDR = device << 1; // send device address without read bit (1) + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 3; + twst = TWSR & 0xF8; + } while (twst == TW_MT_SLA_NACK && retry-- > 0); + if (twst != TW_MT_SLA_ACK) return 4; + return 0; + } + + byte Fastwire::writeBuf(byte device, byte address, byte *data, byte num) { + byte twst, retry; + + retry = 2; + do { + TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO) | (1 << TWSTA); + if (!waitInt()) return 1; + twst = TWSR & 0xF8; + if (twst != TW_START && twst != TW_REP_START) return 2; + + //Serial.print(device, HEX); + //Serial.print(" "); + TWDR = device & 0xFE; // send device address without read bit (1) + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 3; + twst = TWSR & 0xF8; + } while (twst == TW_MT_SLA_NACK && retry-- > 0); + if (twst != TW_MT_SLA_ACK) return 4; + + //Serial.print(address, HEX); + //Serial.print(" "); + TWDR = address; // send data to the previously addressed device + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 5; + twst = TWSR & 0xF8; + if (twst != TW_MT_DATA_ACK) return 6; + + for (byte i = 0; i < num; i++) { + //Serial.print(data[i], HEX); + //Serial.print(" "); + TWDR = data[i]; // send data to the previously addressed device + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 7; + twst = TWSR & 0xF8; + if (twst != TW_MT_DATA_ACK) return 8; + } + //Serial.print("\n"); + + return 0; + } + + byte Fastwire::write(byte value) { + byte twst; + //Serial.println(value, HEX); + TWDR = value; // send data + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 1; + twst = TWSR & 0xF8; + if (twst != TW_MT_DATA_ACK) return 2; + return 0; + } + + byte Fastwire::readBuf(byte device, byte address, byte *data, byte num) { + byte twst, retry; + + retry = 2; + do { + TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO) | (1 << TWSTA); + if (!waitInt()) return 16; + twst = TWSR & 0xF8; + if (twst != TW_START && twst != TW_REP_START) return 17; + + //Serial.print(device, HEX); + //Serial.print(" "); + TWDR = device & 0xfe; // send device address to write + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 18; + twst = TWSR & 0xF8; + } while (twst == TW_MT_SLA_NACK && retry-- > 0); + if (twst != TW_MT_SLA_ACK) return 19; + + //Serial.print(address, HEX); + //Serial.print(" "); + TWDR = address; // send data to the previously addressed device + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 20; + twst = TWSR & 0xF8; + if (twst != TW_MT_DATA_ACK) return 21; + + /***/ + + retry = 2; + do { + TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO) | (1 << TWSTA); + if (!waitInt()) return 22; + twst = TWSR & 0xF8; + if (twst != TW_START && twst != TW_REP_START) return 23; + + //Serial.print(device, HEX); + //Serial.print(" "); + TWDR = device | 0x01; // send device address with the read bit (1) + TWCR = (1 << TWINT) | (1 << TWEN); + if (!waitInt()) return 24; + twst = TWSR & 0xF8; + } while (twst == TW_MR_SLA_NACK && retry-- > 0); + if (twst != TW_MR_SLA_ACK) return 25; + + for (uint8_t i = 0; i < num; i++) { + if (i == num - 1) + TWCR = (1 << TWINT) | (1 << TWEN); + else + TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWEA); + if (!waitInt()) return 26; + twst = TWSR & 0xF8; + if (twst != TW_MR_DATA_ACK && twst != TW_MR_DATA_NACK) return twst; + data[i] = TWDR; + //Serial.print(data[i], HEX); + //Serial.print(" "); + } + //Serial.print("\n"); + stop(); + + return 0; + } + + void Fastwire::reset() { + TWCR = 0; + } + + byte Fastwire::stop() { + TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO); + if (!waitInt()) return 1; + return 0; + } +#endif + +#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE + // NBWire implementation based heavily on code by Gene Knight + // Originally posted on the Arduino forum at http://arduino.cc/forum/index.php/topic,70705.0.html + // Originally offered to the i2cdevlib project at http://arduino.cc/forum/index.php/topic,68210.30.html + + /* + call this version 1.0 + + Offhand, the only funky part that I can think of is in nbrequestFrom, where the buffer + length and index are set *before* the data is actually read. The problem is that these + are variables local to the TwoWire object, and by the time we actually have read the + data, and know what the length actually is, we have no simple access to the object's + variables. The actual bytes read *is* given to the callback function, though. + + The ISR code for a slave receiver is commented out. I don't have that setup, and can't + verify it at this time. Save it for 2.0! + + The handling of the read and write processes here is much like in the demo sketch code: + the process is broken down into sequential functions, where each registers the next as a + callback, essentially. + + For example, for the Read process, twi_read00 just returns if TWI is not yet in a + ready state. When there's another interrupt, and the interface *is* ready, then it + sets up the read, starts it, and registers twi_read01 as the function to call after + the *next* interrupt. twi_read01, then, just returns if the interface is still in a + "reading" state. When the reading is done, it copies the information to the buffer, + cleans up, and calls the user-requested callback function with the actual number of + bytes read. + + The writing is similar. + + Questions, comments and problems can go to Gene@Telobot.com. + + Thumbs Up! + Gene Knight + + */ + + uint8_t TwoWire::rxBuffer[NBWIRE_BUFFER_LENGTH]; + uint8_t TwoWire::rxBufferIndex = 0; + uint8_t TwoWire::rxBufferLength = 0; + + uint8_t TwoWire::txAddress = 0; + uint8_t TwoWire::txBuffer[NBWIRE_BUFFER_LENGTH]; + uint8_t TwoWire::txBufferIndex = 0; + uint8_t TwoWire::txBufferLength = 0; + + //uint8_t TwoWire::transmitting = 0; + void (*TwoWire::user_onRequest)(void); + void (*TwoWire::user_onReceive)(int); + + static volatile uint8_t twi_transmitting; + static volatile uint8_t twi_state; + static uint8_t twi_slarw; + static volatile uint8_t twi_error; + static uint8_t twi_masterBuffer[TWI_BUFFER_LENGTH]; + static volatile uint8_t twi_masterBufferIndex; + static uint8_t twi_masterBufferLength; + static uint8_t twi_rxBuffer[TWI_BUFFER_LENGTH]; + static volatile uint8_t twi_rxBufferIndex; + //static volatile uint8_t twi_Interrupt_Continue_Command; + static volatile uint8_t twi_Return_Value; + static volatile uint8_t twi_Done; + void (*twi_cbendTransmissionDone)(int); + void (*twi_cbreadFromDone)(int); + + void twi_init() { + // initialize state + twi_state = TWI_READY; + + // activate internal pull-ups for twi + // as per note from atmega8 manual pg167 + sbi(PORTC, 4); + sbi(PORTC, 5); + + // initialize twi prescaler and bit rate + cbi(TWSR, TWPS0); // TWI Status Register - Prescaler bits + cbi(TWSR, TWPS1); + + /* twi bit rate formula from atmega128 manual pg 204 + SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR)) + note: TWBR should be 10 or higher for master mode + It is 72 for a 16mhz Wiring board with 100kHz TWI */ + + TWBR = ((CPU_FREQ / TWI_FREQ) - 16) / 2; // bitrate register + // enable twi module, acks, and twi interrupt + + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA); + + /* TWEN - TWI Enable Bit + TWIE - TWI Interrupt Enable + TWEA - TWI Enable Acknowledge Bit + TWINT - TWI Interrupt Flag + TWSTA - TWI Start Condition + */ + } + + typedef struct { + uint8_t address; + uint8_t* data; + uint8_t length; + uint8_t wait; + uint8_t i; + } twi_Write_Vars; + + twi_Write_Vars *ptwv = 0; + static void (*fNextInterruptFunction)(void) = 0; + + void twi_Finish(byte bRetVal) { + if (ptwv) { + free(ptwv); + ptwv = 0; + } + twi_Done = 0xFF; + twi_Return_Value = bRetVal; + fNextInterruptFunction = 0; + } + + uint8_t twii_WaitForDone(uint16_t timeout) { + uint32_t endMillis = millis() + timeout; + while (!twi_Done && (timeout == 0 || millis() < endMillis)) continue; + return twi_Return_Value; + } + + void twii_SetState(uint8_t ucState) { + twi_state = ucState; + } + + void twii_SetError(uint8_t ucError) { + twi_error = ucError ; + } + + void twii_InitBuffer(uint8_t ucPos, uint8_t ucLength) { + twi_masterBufferIndex = 0; + twi_masterBufferLength = ucLength; + } + + void twii_CopyToBuf(uint8_t* pData, uint8_t ucLength) { + uint8_t i; + for (i = 0; i < ucLength; ++i) { + twi_masterBuffer[i] = pData[i]; + } + } + + void twii_CopyFromBuf(uint8_t *pData, uint8_t ucLength) { + uint8_t i; + for (i = 0; i < ucLength; ++i) { + pData[i] = twi_masterBuffer[i]; + } + } + + void twii_SetSlaRW(uint8_t ucSlaRW) { + twi_slarw = ucSlaRW; + } + + void twii_SetStart() { + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA); + } + + void twi_write01() { + if (TWI_MTX == twi_state) return; // blocking test + twi_transmitting = 0 ; + if (twi_error == 0xFF) + twi_Finish (0); // success + else if (twi_error == TW_MT_SLA_NACK) + twi_Finish (2); // error: address send, nack received + else if (twi_error == TW_MT_DATA_NACK) + twi_Finish (3); // error: data send, nack received + else + twi_Finish (4); // other twi error + if (twi_cbendTransmissionDone) return twi_cbendTransmissionDone(twi_Return_Value); + return; + } + + + void twi_write00() { + if (TWI_READY != twi_state) return; // blocking test + if (TWI_BUFFER_LENGTH < ptwv -> length) { + twi_Finish(1); // end write with error 1 + return; + } + twi_Done = 0x00; // show as working + twii_SetState(TWI_MTX); // to transmitting + twii_SetError(0xFF); // to No Error + twii_InitBuffer(0, ptwv -> length); // pointer and length + twii_CopyToBuf(ptwv -> data, ptwv -> length); // get the data + twii_SetSlaRW((ptwv -> address << 1) | TW_WRITE); // write command + twii_SetStart(); // start the cycle + fNextInterruptFunction = twi_write01; // next routine + return twi_write01(); + } + + void twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait) { + uint8_t i; + ptwv = (twi_Write_Vars *)malloc(sizeof(twi_Write_Vars)); + ptwv -> address = address; + ptwv -> data = data; + ptwv -> length = length; + ptwv -> wait = wait; + fNextInterruptFunction = twi_write00; + return twi_write00(); + } + + void twi_read01() { + if (TWI_MRX == twi_state) return; // blocking test + if (twi_masterBufferIndex < ptwv -> length) ptwv -> length = twi_masterBufferIndex; + twii_CopyFromBuf(ptwv -> data, ptwv -> length); + twi_Finish(ptwv -> length); + if (twi_cbreadFromDone) return twi_cbreadFromDone(twi_Return_Value); + return; + } + + void twi_read00() { + if (TWI_READY != twi_state) return; // blocking test + if (TWI_BUFFER_LENGTH < ptwv -> length) twi_Finish(0); // error return + twi_Done = 0x00; // show as working + twii_SetState(TWI_MRX); // reading + twii_SetError(0xFF); // reset error + twii_InitBuffer(0, ptwv -> length - 1); // init to one less than length + twii_SetSlaRW((ptwv -> address << 1) | TW_READ); // read command + twii_SetStart(); // start cycle + fNextInterruptFunction = twi_read01; + return twi_read01(); + } + + void twi_readFrom(uint8_t address, uint8_t* data, uint8_t length) { + uint8_t i; + + ptwv = (twi_Write_Vars *)malloc(sizeof(twi_Write_Vars)); + ptwv -> address = address; + ptwv -> data = data; + ptwv -> length = length; + fNextInterruptFunction = twi_read00; + return twi_read00(); + } + + void twi_reply(uint8_t ack) { + // transmit master read ready signal, with or without ack + if (ack){ + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT) | _BV(TWEA); + } else { + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT); + } + } + + void twi_stop(void) { + // send stop condition + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO); + + // wait for stop condition to be exectued on bus + // TWINT is not set after a stop condition! + while (TWCR & _BV(TWSTO)) { + continue; + } + + // update twi state + twi_state = TWI_READY; + } + + void twi_releaseBus(void) { + // release bus + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT); + + // update twi state + twi_state = TWI_READY; + } + + SIGNAL(TWI_vect) { + switch (TW_STATUS) { + // All Master + case TW_START: // sent start condition + case TW_REP_START: // sent repeated start condition + // copy device address and r/w bit to output register and ack + TWDR = twi_slarw; + twi_reply(1); + break; + + // Master Transmitter + case TW_MT_SLA_ACK: // slave receiver acked address + case TW_MT_DATA_ACK: // slave receiver acked data + // if there is data to send, send it, otherwise stop + if (twi_masterBufferIndex < twi_masterBufferLength) { + // copy data to output register and ack + TWDR = twi_masterBuffer[twi_masterBufferIndex++]; + twi_reply(1); + } else { + twi_stop(); + } + break; + + case TW_MT_SLA_NACK: // address sent, nack received + twi_error = TW_MT_SLA_NACK; + twi_stop(); + break; + + case TW_MT_DATA_NACK: // data sent, nack received + twi_error = TW_MT_DATA_NACK; + twi_stop(); + break; + + case TW_MT_ARB_LOST: // lost bus arbitration + twi_error = TW_MT_ARB_LOST; + twi_releaseBus(); + break; + + // Master Receiver + case TW_MR_DATA_ACK: // data received, ack sent + // put byte into buffer + twi_masterBuffer[twi_masterBufferIndex++] = TWDR; + + case TW_MR_SLA_ACK: // address sent, ack received + // ack if more bytes are expected, otherwise nack + if (twi_masterBufferIndex < twi_masterBufferLength) { + twi_reply(1); + } else { + twi_reply(0); + } + break; + + case TW_MR_DATA_NACK: // data received, nack sent + // put final byte into buffer + twi_masterBuffer[twi_masterBufferIndex++] = TWDR; + + case TW_MR_SLA_NACK: // address sent, nack received + twi_stop(); + break; + + // TW_MR_ARB_LOST handled by TW_MT_ARB_LOST case + + // Slave Receiver (NOT IMPLEMENTED YET) + /* + case TW_SR_SLA_ACK: // addressed, returned ack + case TW_SR_GCALL_ACK: // addressed generally, returned ack + case TW_SR_ARB_LOST_SLA_ACK: // lost arbitration, returned ack + case TW_SR_ARB_LOST_GCALL_ACK: // lost arbitration, returned ack + // enter slave receiver mode + twi_state = TWI_SRX; + + // indicate that rx buffer can be overwritten and ack + twi_rxBufferIndex = 0; + twi_reply(1); + break; + + case TW_SR_DATA_ACK: // data received, returned ack + case TW_SR_GCALL_DATA_ACK: // data received generally, returned ack + // if there is still room in the rx buffer + if (twi_rxBufferIndex < TWI_BUFFER_LENGTH) { + // put byte in buffer and ack + twi_rxBuffer[twi_rxBufferIndex++] = TWDR; + twi_reply(1); + } else { + // otherwise nack + twi_reply(0); + } + break; + + case TW_SR_STOP: // stop or repeated start condition received + // put a null char after data if there's room + if (twi_rxBufferIndex < TWI_BUFFER_LENGTH) { + twi_rxBuffer[twi_rxBufferIndex] = 0; + } + + // sends ack and stops interface for clock stretching + twi_stop(); + + // callback to user defined callback + twi_onSlaveReceive(twi_rxBuffer, twi_rxBufferIndex); + + // since we submit rx buffer to "wire" library, we can reset it + twi_rxBufferIndex = 0; + + // ack future responses and leave slave receiver state + twi_releaseBus(); + break; + + case TW_SR_DATA_NACK: // data received, returned nack + case TW_SR_GCALL_DATA_NACK: // data received generally, returned nack + // nack back at master + twi_reply(0); + break; + + // Slave Transmitter + case TW_ST_SLA_ACK: // addressed, returned ack + case TW_ST_ARB_LOST_SLA_ACK: // arbitration lost, returned ack + // enter slave transmitter mode + twi_state = TWI_STX; + + // ready the tx buffer index for iteration + twi_txBufferIndex = 0; + + // set tx buffer length to be zero, to verify if user changes it + twi_txBufferLength = 0; + + // request for txBuffer to be filled and length to be set + // note: user must call twi_transmit(bytes, length) to do this + twi_onSlaveTransmit(); + + // if they didn't change buffer & length, initialize it + if (0 == twi_txBufferLength) { + twi_txBufferLength = 1; + twi_txBuffer[0] = 0x00; + } + + // transmit first byte from buffer, fall through + + case TW_ST_DATA_ACK: // byte sent, ack returned + // copy data to output register + TWDR = twi_txBuffer[twi_txBufferIndex++]; + + // if there is more to send, ack, otherwise nack + if (twi_txBufferIndex < twi_txBufferLength) { + twi_reply(1); + } else { + twi_reply(0); + } + break; + + case TW_ST_DATA_NACK: // received nack, we are done + case TW_ST_LAST_DATA: // received ack, but we are done already! + // ack future responses + twi_reply(1); + // leave slave receiver state + twi_state = TWI_READY; + break; + */ + + // all + case TW_NO_INFO: // no state information + break; + + case TW_BUS_ERROR: // bus error, illegal stop/start + twi_error = TW_BUS_ERROR; + twi_stop(); + break; + } + + if (fNextInterruptFunction) return fNextInterruptFunction(); + } + + TwoWire::TwoWire() { } + + void TwoWire::begin(void) { + rxBufferIndex = 0; + rxBufferLength = 0; + + txBufferIndex = 0; + txBufferLength = 0; + + twi_init(); + } + + void TwoWire::beginTransmission(uint8_t address) { + //beginTransmission((uint8_t)address); + + // indicate that we are transmitting + twi_transmitting = 1; + + // set address of targeted slave + txAddress = address; + + // reset tx buffer iterator vars + txBufferIndex = 0; + txBufferLength = 0; + } + + uint8_t TwoWire::endTransmission(uint16_t timeout) { + // transmit buffer (blocking) + //int8_t ret = + twi_cbendTransmissionDone = NULL; + twi_writeTo(txAddress, txBuffer, txBufferLength, 1); + int8_t ret = twii_WaitForDone(timeout); + + // reset tx buffer iterator vars + txBufferIndex = 0; + txBufferLength = 0; + + // indicate that we are done transmitting + // twi_transmitting = 0; + return ret; + } + + void TwoWire::nbendTransmission(void (*function)(int)) { + twi_cbendTransmissionDone = function; + twi_writeTo(txAddress, txBuffer, txBufferLength, 1); + return; + } + + void TwoWire::send(uint8_t data) { + if (twi_transmitting) { + // in master transmitter mode + // don't bother if buffer is full + if (txBufferLength >= NBWIRE_BUFFER_LENGTH) { + return; + } + + // put byte in tx buffer + txBuffer[txBufferIndex] = data; + ++txBufferIndex; + + // update amount in buffer + txBufferLength = txBufferIndex; + } else { + // in slave send mode + // reply to master + //twi_transmit(&data, 1); + } + } + + uint8_t TwoWire::receive(void) { + // default to returning null char + // for people using with char strings + uint8_t value = 0; + + // get each successive byte on each call + if (rxBufferIndex < rxBufferLength) { + value = rxBuffer[rxBufferIndex]; + ++rxBufferIndex; + } + + return value; + } + + uint8_t TwoWire::requestFrom(uint8_t address, int quantity, uint16_t timeout) { + // clamp to buffer length + if (quantity > NBWIRE_BUFFER_LENGTH) { + quantity = NBWIRE_BUFFER_LENGTH; + } + + // perform blocking read into buffer + twi_cbreadFromDone = NULL; + twi_readFrom(address, rxBuffer, quantity); + uint8_t read = twii_WaitForDone(timeout); + + // set rx buffer iterator vars + rxBufferIndex = 0; + rxBufferLength = read; + + return read; + } + + void TwoWire::nbrequestFrom(uint8_t address, int quantity, void (*function)(int)) { + // clamp to buffer length + if (quantity > NBWIRE_BUFFER_LENGTH) { + quantity = NBWIRE_BUFFER_LENGTH; + } + + // perform blocking read into buffer + twi_cbreadFromDone = function; + twi_readFrom(address, rxBuffer, quantity); + //uint8_t read = twii_WaitForDone(); + + // set rx buffer iterator vars + //rxBufferIndex = 0; + //rxBufferLength = read; + + rxBufferIndex = 0; + rxBufferLength = quantity; // this is a hack + + return; //read; + } + + uint8_t TwoWire::available(void) { + return rxBufferLength - rxBufferIndex; + } + +#endif diff --git a/I2Cdev/I2Cdev.h b/I2Cdev/I2Cdev.h new file mode 100644 index 0000000..60c3195 --- /dev/null +++ b/I2Cdev/I2Cdev.h @@ -0,0 +1,289 @@ +// I2Cdev library collection - Main I2C device class header file +// Abstracts bit and byte I2C R/W functions into a convenient class +// 2013-06-05 by Jeff Rowberg +// +// Changelog: +// 2020-01-20 - hardija : complete support for Teensy 3.x +// 2015-10-30 - simondlevy : support i2c_t3 for Teensy3.1 +// 2013-05-06 - add Francesco Ferrara's Fastwire v0.24 implementation with small modifications +// 2013-05-05 - fix issue with writing bit values to words (Sasquatch/Farzanegan) +// 2012-06-09 - fix major issue with reading > 32 bytes at a time with Arduino Wire +// - add compiler warnings when using outdated or IDE or limited I2Cdev implementation +// 2011-11-01 - fix write*Bits mask calculation (thanks sasquatch @ Arduino forums) +// 2011-10-03 - added automatic Arduino version detection for ease of use +// 2011-10-02 - added Gene Knight's NBWire TwoWire class implementation with small modifications +// 2011-08-31 - added support for Arduino 1.0 Wire library (methods are different from 0.x) +// 2011-08-03 - added optional timeout parameter to read* methods to easily change from default +// 2011-08-02 - added support for 16-bit registers +// - fixed incorrect Doxygen comments on some methods +// - added timeout value for read operations (thanks mem @ Arduino forums) +// 2011-07-30 - changed read/write function structures to return success or byte counts +// - made all methods static for multi-device memory savings +// 2011-07-28 - initial release + +/* ============================================ +I2Cdev device library code is placed under the MIT license +Copyright (c) 2013 Jeff Rowberg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +=============================================== +*/ + +#ifndef _I2CDEV_H_ +#define _I2CDEV_H_ + +// ----------------------------------------------------------------------------- +// I2C interface implementation setting +// ----------------------------------------------------------------------------- +#ifndef I2CDEV_IMPLEMENTATION +#define I2CDEV_IMPLEMENTATION I2CDEV_ARDUINO_WIRE +//#define I2CDEV_IMPLEMENTATION I2CDEV_TEENSY_3X_WIRE +//#define I2CDEV_IMPLEMENTATION I2CDEV_BUILTIN_SBWIRE +//#define I2CDEV_IMPLEMENTATION I2CDEV_BUILTIN_FASTWIRE +#endif // I2CDEV_IMPLEMENTATION + +// comment this out if you are using a non-optimal IDE/implementation setting +// but want the compiler to shut up about it +#define I2CDEV_IMPLEMENTATION_WARNINGS + +// ----------------------------------------------------------------------------- +// I2C interface implementation options +// ----------------------------------------------------------------------------- +#define I2CDEV_ARDUINO_WIRE 1 // Wire object from Arduino +#define I2CDEV_BUILTIN_NBWIRE 2 // Tweaked Wire object from Gene Knight's NBWire project + // ^^^ NBWire implementation is still buggy w/some interrupts! +#define I2CDEV_BUILTIN_FASTWIRE 3 // FastWire object from Francesco Ferrara's project +#define I2CDEV_I2CMASTER_LIBRARY 4 // I2C object from DSSCircuits I2C-Master Library at https://github.com/DSSCircuits/I2C-Master-Library +#define I2CDEV_BUILTIN_SBWIRE 5 // I2C object from Shuning (Steve) Bian's SBWire Library at https://github.com/freespace/SBWire +#define I2CDEV_TEENSY_3X_WIRE 6 // Teensy 3.x support using i2c_t3 library + +// ----------------------------------------------------------------------------- +// Arduino-style "Serial.print" debug constant (uncomment to enable) +// ----------------------------------------------------------------------------- +//#define I2CDEV_SERIAL_DEBUG + +#ifdef ARDUINO + #if ARDUINO < 100 + #include "WProgram.h" + #else + #include "Arduino.h" + #endif + #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE + #include + #endif + #if I2CDEV_IMPLEMENTATION == I2CDEV_TEENSY_3X_WIRE + #include + #endif + #if I2CDEV_IMPLEMENTATION == I2CDEV_I2CMASTER_LIBRARY + #include + #endif + #if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE + #include "SBWire.h" + #endif +#endif + +#ifdef SPARK + #include + #define ARDUINO 101 +#endif + + +// 1000ms default read timeout (modify with "I2Cdev::readTimeout = [ms];") +#define I2CDEV_DEFAULT_READ_TIMEOUT 1000 + +class I2Cdev { + public: + I2Cdev(); + + static int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); + static int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); + + static bool writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data); + static bool writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data); + static bool writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data); + static bool writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data); + static bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data); + static bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data); + static bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data); + static bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data); + + static uint16_t readTimeout; +}; + +#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE + ////////////////////// + // FastWire 0.24 + // This is a library to help faster programs to read I2C devices. + // Copyright(C) 2012 + // Francesco Ferrara + ////////////////////// + + /* Master */ + #define TW_START 0x08 + #define TW_REP_START 0x10 + + /* Master Transmitter */ + #define TW_MT_SLA_ACK 0x18 + #define TW_MT_SLA_NACK 0x20 + #define TW_MT_DATA_ACK 0x28 + #define TW_MT_DATA_NACK 0x30 + #define TW_MT_ARB_LOST 0x38 + + /* Master Receiver */ + #define TW_MR_ARB_LOST 0x38 + #define TW_MR_SLA_ACK 0x40 + #define TW_MR_SLA_NACK 0x48 + #define TW_MR_DATA_ACK 0x50 + #define TW_MR_DATA_NACK 0x58 + + #define TW_OK 0 + #define TW_ERROR 1 + + class Fastwire { + private: + static boolean waitInt(); + + public: + static void setup(int khz, boolean pullup); + static byte beginTransmission(byte device); + static byte write(byte value); + static byte writeBuf(byte device, byte address, byte *data, byte num); + static byte readBuf(byte device, byte address, byte *data, byte num); + static void reset(); + static byte stop(); + }; +#endif + +#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE + // NBWire implementation based heavily on code by Gene Knight + // Originally posted on the Arduino forum at http://arduino.cc/forum/index.php/topic,70705.0.html + // Originally offered to the i2cdevlib project at http://arduino.cc/forum/index.php/topic,68210.30.html + + #define NBWIRE_BUFFER_LENGTH 32 + + class TwoWire { + private: + static uint8_t rxBuffer[]; + static uint8_t rxBufferIndex; + static uint8_t rxBufferLength; + + static uint8_t txAddress; + static uint8_t txBuffer[]; + static uint8_t txBufferIndex; + static uint8_t txBufferLength; + + // static uint8_t transmitting; + static void (*user_onRequest)(void); + static void (*user_onReceive)(int); + static void onRequestService(void); + static void onReceiveService(uint8_t*, int); + + public: + TwoWire(); + void begin(); + void begin(uint8_t); + void begin(int); + void beginTransmission(uint8_t); + //void beginTransmission(int); + uint8_t endTransmission(uint16_t timeout=0); + void nbendTransmission(void (*function)(int)) ; + uint8_t requestFrom(uint8_t, int, uint16_t timeout=0); + //uint8_t requestFrom(int, int); + void nbrequestFrom(uint8_t, int, void (*function)(int)); + void send(uint8_t); + void send(uint8_t*, uint8_t); + //void send(int); + void send(char*); + uint8_t available(void); + uint8_t receive(void); + void onReceive(void (*)(int)); + void onRequest(void (*)(void)); + }; + + #define TWI_READY 0 + #define TWI_MRX 1 + #define TWI_MTX 2 + #define TWI_SRX 3 + #define TWI_STX 4 + + #define TW_WRITE 0 + #define TW_READ 1 + + #define TW_MT_SLA_NACK 0x20 + #define TW_MT_DATA_NACK 0x30 + + #define CPU_FREQ 16000000L + #define TWI_FREQ 100000L + #define TWI_BUFFER_LENGTH 32 + + /* TWI Status is in TWSR, in the top 5 bits: TWS7 - TWS3 */ + + #define TW_STATUS_MASK (_BV(TWS7)|_BV(TWS6)|_BV(TWS5)|_BV(TWS4)|_BV(TWS3)) + #define TW_STATUS (TWSR & TW_STATUS_MASK) + #define TW_START 0x08 + #define TW_REP_START 0x10 + #define TW_MT_SLA_ACK 0x18 + #define TW_MT_SLA_NACK 0x20 + #define TW_MT_DATA_ACK 0x28 + #define TW_MT_DATA_NACK 0x30 + #define TW_MT_ARB_LOST 0x38 + #define TW_MR_ARB_LOST 0x38 + #define TW_MR_SLA_ACK 0x40 + #define TW_MR_SLA_NACK 0x48 + #define TW_MR_DATA_ACK 0x50 + #define TW_MR_DATA_NACK 0x58 + #define TW_ST_SLA_ACK 0xA8 + #define TW_ST_ARB_LOST_SLA_ACK 0xB0 + #define TW_ST_DATA_ACK 0xB8 + #define TW_ST_DATA_NACK 0xC0 + #define TW_ST_LAST_DATA 0xC8 + #define TW_SR_SLA_ACK 0x60 + #define TW_SR_ARB_LOST_SLA_ACK 0x68 + #define TW_SR_GCALL_ACK 0x70 + #define TW_SR_ARB_LOST_GCALL_ACK 0x78 + #define TW_SR_DATA_ACK 0x80 + #define TW_SR_DATA_NACK 0x88 + #define TW_SR_GCALL_DATA_ACK 0x90 + #define TW_SR_GCALL_DATA_NACK 0x98 + #define TW_SR_STOP 0xA0 + #define TW_NO_INFO 0xF8 + #define TW_BUS_ERROR 0x00 + + //#define _MMIO_BYTE(mem_addr) (*(volatile uint8_t *)(mem_addr)) + //#define _SFR_BYTE(sfr) _MMIO_BYTE(_SFR_ADDR(sfr)) + + #ifndef sbi // set bit + #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) + #endif // sbi + + #ifndef cbi // clear bit + #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) + #endif // cbi + + extern TwoWire Wire; + +#endif // I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE + +#endif /* _I2CDEV_H_ */ diff --git a/I2Cdev/keywords.txt b/I2Cdev/keywords.txt new file mode 100644 index 0000000..4132a06 --- /dev/null +++ b/I2Cdev/keywords.txt @@ -0,0 +1,38 @@ +####################################### +# Syntax Coloring Map For I2Cdev +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### +I2Cdev KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +readBit KEYWORD2 +readBitW KEYWORD2 +readBits KEYWORD2 +readBitsW KEYWORD2 +readByte KEYWORD2 +readBytes KEYWORD2 +readWord KEYWORD2 +readWords KEYWORD2 +writeBit KEYWORD2 +writeBitW KEYWORD2 +writeBits KEYWORD2 +writeBitsW KEYWORD2 +writeByte KEYWORD2 +writeBytes KEYWORD2 +writeWord KEYWORD2 +writeWords KEYWORD2 + +####################################### +# Instances (KEYWORD2) +####################################### + +####################################### +# Constants (LITERAL1) +####################################### + diff --git a/I2Cdev/library.json b/I2Cdev/library.json new file mode 100644 index 0000000..074266d --- /dev/null +++ b/I2Cdev/library.json @@ -0,0 +1,18 @@ +{ + "name": "I2Cdevlib-Core", + "keywords": "i2cdevlib, i2c", + "description": "The I2C Device Library (I2Cdevlib) is a collection of uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices.", + "include": "Arduino/I2Cdev", + "repository": + { + "type": "git", + "url": "https://github.com/jrowberg/i2cdevlib.git" + }, + "frameworks": "arduino", + "platforms": "atmelavr", + "dependencies": [ + { + "name": "Wire" + } + ] +} diff --git a/IAQ2000+DHT11.ino b/IAQ2000+DHT11.ino new file mode 100644 index 0000000..912009f --- /dev/null +++ b/IAQ2000+DHT11.ino @@ -0,0 +1,229 @@ +#include +#include +#include +#include +#include "I2Cdev.h" +#include "IAQ2000.h" +#include + + + +#define dht_apin 5 + +IAQ2000 iaq; + +DHT dht(dht_apin, DHT11); + + +uint16_t airQuality; +int val = 0; +float Temperatur; +float Humidity; + +// Netzwerk-Einstellungen +// MAC-Adresse darf nur einmal im Netz vohanden sein +// Fuer jedes Geraet aendern!! +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x1A }; + +// Port fur Daten-Empfang +unsigned int localPort = 5010; + +// IP Adresse Loxone-MiniServer +IPAddress RecipientIP; + +// Port Loxone-MiniServer... An diesen Port werden die Daten gesendet +unsigned int RecipientPort = 5010; + +// Buffer fuer Daten-Empfang +char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; + +// Start der UDP-Instanz +EthernetUDP Udp; + + +// Initialize the Ethernet server library +// with the IP address and port you want to use +// (port 80 is default for HTTP): +EthernetServer server(80); + + +void setup() { + Wire.begin(); + Serial.begin(9600); + //serset w5100 + Ethernet.begin(mac); + if (!Ethernet.localIP()) { + Serial.println("dhcp failed"); + Serial.println(Ethernet.linkStatus()); + } + else { + Serial.print("IP is "); + Serial.println(Ethernet.localIP()); + } + Udp.begin(localPort); // Start UDP + SPI.begin(); + sendUDP("Raumluft - aktiv"); // send UDP Ready + + + + // start the Ethernet connection and the server: + server.begin(); + Serial.print("server is at "); + Serial.println(Ethernet.localIP()); + + // initialize device + Serial.println("Initialisierung des Sensor..."); + iaq.initialize(); + + // verify connection + Serial.println("Verbindung zum Sensor testen..."); + Serial.println(iaq.testConnection() ? "iAQ-2000 erfolgreich verbunden" : "iAQ-2000 Fehler bei der Verbindung"); + + + dht.begin(); //DHT11 Sensor starten + + //Serial leeren + clearAll(); + + Serial.println("Warte auf UDP-Befehl"); + +} + +void loop() { + String aq = String (airQuality); + String temp = String (Temperatur, 2); + String hum = String (Humidity, 2); + + dht.read(); //read data from pin 5 (DHT11) + + airQuality = iaq.getIaqpred(); + Temperatur = dht.readTemperature(); + Humidity = dht.readHumidity(); + + + + // schaut on ein UDP Befehl empfangen wurde + checkUDP(); + + if (!strcmp(packetBuffer, "000")) + { + Serial.print("CO2 = "); + Serial.print(airQuality); + Serial.print(" "); + Serial.println("[ppm]"); + + + + // Wert wird auf 3000ppm begrnezt + if (airQuality > 3000) + { + aq = "3000"; + } + else + { + aq = airQuality; + } + sendUDP(aq); + } + + if (!strcmp(packetBuffer, "001")) + { + sendUDP (temp); + } + + + if (!strcmp(packetBuffer, "002")) + { + sendUDP (hum); + } + clearAll(); + // listen for incoming clients + EthernetClient client = server.available(); + if (client) + { + Serial.println("new client"); + // an http request ends with a blank line + boolean currentLineIsBlank = true; + while (client.connected()) { + if (client.available()) { + char c = client.read(); + //Serial.write(c); + // if you've gotten to the end of the line (received a newline + // character) and the line is blank, the http request has ended, + // so you can send a reply + if (c == '\n' && currentLineIsBlank) { + // send a standard http response header + client.println("HTTP/1.1 200 OK"); + client.println("Content-Type: text/html"); + client.println("Connection: close"); + client.println(); + client.println(""); + client.println(""); + // add a meta refresh tag, so the browser pulls again every 5 seconds: + client.println(""); + // output the value of each analog input pin + + client.println("Current Humidity = "); //Prints information within qoutation + client.println(hum); //Prints the Humidity read from the DHT11 on PIN 5 + client.println("% "); + client.println("Temperature = "); + client.println(temp); //Prints the temperature read from the DHT11 on PIN 5 + client.println("C "); + client.println("CO2 = "); + client.println(aq); + client.println(" "); + client.println("[ppm]"); + client.println(""); + break; + } + if (c == '\n') { + // you're starting a new line + currentLineIsBlank = true; + } + else if (c != '\r') { + // you've gotten a character on the current line + currentLineIsBlank = false; + } + } + } + // give the web browser time to receive the data + delay(1); + // close the connection: + client.stop(); + Serial.println("client disonnected"); + + } +} + +//// Module //// +// Serial-Speicher loeschen +void clearAll() { + // Paket-Buffer leeren + for (int i = 0; i < UDP_TX_PACKET_MAX_SIZE; i++) packetBuffer[i] = (char)0; +} + +// empfangene UDP-Befehle auswerten +void checkUDP() +{ + // pruefen ob Daten vorhanden sind + int packetSize = Udp.parsePacket(); + if (packetSize) + { + Udp.read(packetBuffer, packetSize); + Serial.print("Packet Content: "); + Serial.println(packetBuffer); + RecipientIP=Udp.remoteIP(); + Serial.print("Remote IP: "); + Serial.println(RecipientIP); + } + delay(10); +} + +// UDP-Befehl senden +void sendUDP(String text) +{ + Udp.beginPacket(RecipientIP, RecipientPort); + Udp.print(text); + Udp.endPacket(); + delay(10); +} diff --git a/IAQ2000/IAQ2000.cpp b/IAQ2000/IAQ2000.cpp new file mode 100644 index 0000000..3430eb7 --- /dev/null +++ b/IAQ2000/IAQ2000.cpp @@ -0,0 +1,141 @@ +// I2Cdev library collection - iAQ-2000 I2C device class +// Based on AppliedSensor iAQ-2000 Interface Description, Version PA1, 2009 +// 2012-04-01 by Peteris Skorovs +// +// This I2C device library is using (and submitted as a part of) Jeff Rowberg's I2Cdevlib library, +// which should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib +// +// Changelog: +// 2012-04-01 - initial release +// 2012-11-08 - added TVoc and Status + +/* ============================================ +I2Cdev device library code is placed under the MIT license +Copyright (c) 2012 Peteris Skorovs, Jeff Rowberg + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + =============================================== + */ + +#include "IAQ2000.h" + +/** Default constructor, uses default I2C address. + * @see IAQ2000_DEFAULT_ADDRESS + */ +IAQ2000::IAQ2000() { + devAddr = IAQ2000_DEFAULT_ADDRESS; +} + +/** Specific address constructor. + * @param address I2C address + * @see IAQ2000_DEFAULT_ADDRESS + * @see IAQ2000_ADDRESS + */ +IAQ2000::IAQ2000(uint8_t address) { + devAddr = address; +} + +/** Power on and prepare for general usage. + */ +void IAQ2000::initialize() { + // Nothing is required, but + // the method should exist anyway. +} + +/** Very primitive method o verify the I2C connection. + * Make sure the device is connected and responds as expected. + * @return True if connection is valid, false otherwise + */ +bool IAQ2000::testConnection() { + if (getIaqpred() >= 450) { + return true; + } + else { + return false; + } +} + +/** Read iAQ-2000 indoor air quality sensor. + * @return Predicted CO2 concentration based on human induced volatile organic compounds (VOC) detection (in ppm VOC + CO2 equivalents) + */ +uint16_t IAQ2000::getIaqpred() { + // read bytes from the DATA0 AND DATA1 registers and bit-shifting them into a 16-bit value + readAllBytes(devAddr, 2, buffer); + return ((buffer[0] << 8) | buffer[1]); +} + +uint8_t IAQ2000::getIaqstatus() { + // read bytes from the DATA2 register + readAllBytes(devAddr, 3, buffer); + return (buffer[2]); +} + +uint16_t IAQ2000::getIaqtvoc() { + // read bytes from the DATA7 AND DATA8 registers and bit-shifting them into a 16-bit value + readAllBytes(devAddr, 9, buffer); + return ((buffer[7] << 8) | buffer[8]); +} + + + +/** Read bytes from a slave device. + * This is a "stripped-down" version of the standard Jeff Rowberg's I2Cdev::readBytes method + * intended to provide compatibility with iAQ-2000, + * which apparently does not support setting of an address pointer to indicate from which position is to start read from. + * @param devAddr Address of the slave device to read bytes from + * @param length Number of bytes to read + * @param data Buffer to store read data in + * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) + * @return Number of bytes read (0 indicates failure) + */ +int8_t IAQ2000::readAllBytes(uint8_t devAddr, uint8_t length, uint8_t *data, uint16_t timeout) { +#ifdef I2CDEV_SERIAL_DEBUG + Serial.print("I2C (0x"); + Serial.print(devAddr, HEX); + Serial.print(") reading "); + Serial.print(length, DEC); + Serial.print(" bytes..."); +#endif + + int8_t count = 0; + + Wire.requestFrom(devAddr, length); + + uint32_t t1 = millis(); + for (; Wire.available() && (timeout == 0 || millis() - t1 < timeout); count++) { +#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE) + data[count] = Wire.receive(); +#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100) + data[count] = Wire.read(); +#endif +#ifdef I2CDEV_SERIAL_DEBUG + Serial.print(data[count], HEX); + if (count + 1 < length) Serial.print(" "); +#endif + } + if (timeout > 0 && millis() - t1 >= timeout && count < length) count = -1; // timeout + +#ifdef I2CDEV_SERIAL_DEBUG + Serial.print(". Done ("); + Serial.print(count, DEC); + Serial.println(" read)."); +#endif + + return count; +} diff --git a/IAQ2000/IAQ2000.h b/IAQ2000/IAQ2000.h new file mode 100644 index 0000000..05a8a0b --- /dev/null +++ b/IAQ2000/IAQ2000.h @@ -0,0 +1,64 @@ +// I2Cdev library collection - iAQ-2000 I2C device class header file +// Based on AppliedSensor iAQ-2000 Interface Description, Version PA1, 2009 +// 2012-04-01 by Peteris Skorovs +// +// This I2C device library is using (and submitted as a part of) Jeff Rowberg's I2Cdevlib library, +// which should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib +// +// Changelog: +// 2012-04-01 - initial release +// 2015-11-08 - added TVoc and Status + +/* ============================================ +I2Cdev device library code is placed under the MIT license +Copyright (c) 2012 Peteris Skorovs, Jeff Rowberg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +=============================================== +*/ + +#ifndef _IAQ2000_H_ +#define _IAQ2000_H_ + +#include "I2Cdev.h" + +#define IAQ2000_ADDRESS 0x5A +#define IAQ2000_DEFAULT_ADDRESS IAQ2000_ADDRESS + +#define IAQ2000_RA_DATA1 0x00 +#define IAQ2000_RA_DATA2 0x01 + +class IAQ2000 { + public: + IAQ2000(); + IAQ2000(uint8_t address); + void initialize(); + bool testConnection(); + uint16_t getIaqtvoc(); + uint16_t getIaqpred(); + uint8_t getIaqstatus(); + + private: + uint8_t devAddr; + uint8_t buffer[8]; + + int8_t readAllBytes(uint8_t devAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); +}; + +#endif /* _IAQ200_H_ */ diff --git a/IAQ2000/examples/IAQ2000/IAQ2000.ino b/IAQ2000/examples/IAQ2000/IAQ2000.ino new file mode 100644 index 0000000..96dcf4f --- /dev/null +++ b/IAQ2000/examples/IAQ2000/IAQ2000.ino @@ -0,0 +1,162 @@ +// I2C device class (I2Cdev) demonstration Arduino sketch for IAQ2000 class +// 2012-04-01 by Peteris Skorovs +// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib +// I2C Device Library hosted at http://www.i2cdevlib.com +// +// Changelog: +// 2012-04-01 - initial release +// 2015-11-08 - added TVoc and Status + +/* ============================================ + IAQ2000 device library code is placed under the MIT license + Copyright (c) 2012 Peteris Skorovs, Jeff Rowberg + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + =============================================== +*/ + +// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation +// is used in I2Cdev.h +#include "Wire.h" + +// I2Cdev and IAQ2000 must be installed as libraries, or else the .cpp/.h files +// for both classes must be in the include path of your project +#include "I2Cdev.h" +#include "IAQ2000.h" + + +// class default I2C address is 0x5A +// specific I2C addresses may be passed as a parameter here +// but this device only supports one I2C address (0x5A) +IAQ2000 iaq; + +uint16_t airQuality; +uint8_t iAQstatus; +uint16_t airTvoc; + +unsigned long startTime; +uint16_t oldairQuality = 0; +uint8_t oldiAQstatus = 0; +uint16_t oldairTvoc = 0; +uint8_t result = 0; + + +#define LED_PIN 13 +bool blinkState = false; + + +void setup() { + // configure LED pin for output + pinMode(LED_PIN, OUTPUT); + // join I2C bus (I2Cdev library doesn't do this automatically) + Wire.begin(); + + // initialize serial communication + // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but + // it's really up to you depending on your project) + Serial.begin(38400); + delay(1000); + Serial.println("Initializing Serial..."); + delay(1000); + + while (!Serial) { + ; // wait for serial port to connect + } + + startTime = millis(); + + // initialize device + // Serial.println("Initializing I2C devices..."); + + + iaq.initialize(); + if (!iaq.testConnection()) { + blinkState = !blinkState; + digitalWrite(LED_PIN, blinkState); + delay(500); + } +} + +void loop() { + + // display predicted CO2 concentration based on human induced volatile organic compounds (VOC) detection (in ppm VOC + CO2 equivalents) + // during the first 6 hours of continuous operation (burn-in) the module will display 450ppm + // the successful burn-in is saved to the EEPROM, the run-in time after restart is 15min + Serial.print("CO2 = "); + Serial.print(airQuality); + Serial.print(" "); + Serial.print("[ppm] 450-2000"); + + // blink LED to indicate activity + blinkState = !blinkState; + digitalWrite(LED_PIN, blinkState); + + // wait five seconds + delay(5000); + + // read seansor + iAQstatus = iaq.getIaqstatus(); + + // display predicted CO2 concentration based on human induced volatile organic compounds (VOC) detection (in ppm VOC + CO2 equivalents) + // during the first 6 hours of continuous operation (burn-in) the module will display 450ppm + // the successful burn-in is saved to the EEPROM, the run-in time after restart is 15min + Serial.print(" -- Status = "); + if (iAQstatus == 0) + { + Serial.print("OK"); + } + if (iAQstatus == 1) + { + Serial.print("BUSY"); + } + if (iAQstatus == 16) + { + Serial.print("WARUMUP"); + } + if (iAQstatus == 128) + { + Serial.print("ERROR"); + } + + // blink LED to indicate activity + blinkState = !blinkState; + digitalWrite(LED_PIN, blinkState); + + // wait five seconds + delay(5000); + + // read seansor + airTvoc = iaq.getIaqtvoc(); + + // display predicted CO2 concentration based on human induced volatile organic compounds (VOC) detection (in ppm VOC + CO2 equivalents) + // during the first 6 hours of continuous operation (burn-in) the module will display 450ppm + // the successful burn-in is saved to the EEPROM, the run-in time after restart is 15min + Serial.print(" -- TVoc = "); + Serial.print(airTvoc); + Serial.print(" "); + Serial.println("[ppb] 125-600"); + + // blink LED to indicate activity + blinkState = !blinkState; + digitalWrite(LED_PIN, blinkState); + + // wait five seconds + delay(5000); + +} diff --git a/IAQ2000/keywords.txt b/IAQ2000/keywords.txt new file mode 100644 index 0000000..775b857 --- /dev/null +++ b/IAQ2000/keywords.txt @@ -0,0 +1,25 @@ +####################################### +# Syntax Coloring Map For IAQ2000 +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### +IAQ2000 KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +initialize KEYWORD2 +testConnection KEYWORD2 +getIaq KEYWORD2 + +####################################### +# Instances (KEYWORD2) +####################################### + +####################################### +# Constants (LITERAL1) +####################################### + diff --git a/IAQ2000/library.json b/IAQ2000/library.json new file mode 100644 index 0000000..5eb1595 --- /dev/null +++ b/IAQ2000/library.json @@ -0,0 +1,18 @@ +{ + "name": "I2Cdevlib-IAQ2000", + "keywords": "co2, carbon, dioxide, sensor, i2cdevlib, i2c", + "description": "The iAQ-2000 Indoor Air Quality Module is a sensitive, low-cost solution for detecting poor air quality", + "include": "Arduino/IAQ2000", + "repository": + { + "type": "git", + "url": "https://github.com/jrowberg/i2cdevlib.git" + }, + "dependencies": + { + "name": "I2Cdevlib-Core", + "frameworks": "arduino" + }, + "frameworks": "arduino", + "platforms": "atmelavr" +} diff --git a/spec.d b/spec.d new file mode 100644 index 0000000..0d55c87 --- /dev/null +++ b/spec.d @@ -0,0 +1,2 @@ +spec.o: \ + C:/Users/agr/Documents/sloeber-workspace/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.C