initial and working
This commit is contained in:
commit
bbbcad4f94
75
.cproject
Normal file
75
.cproject
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="it.baeyens.arduino.core.toolChain.release.956598117">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="it.baeyens.arduino.core.toolChain.release.956598117" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="it.baeyens.arduino.core.toolChain.release.956598117" name="Release" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
|
<folderInfo id="it.baeyens.arduino.core.toolChain.release.956598117.1306002394" name="/" resourcePath="">
|
||||||
|
<toolChain id="it.baeyens.arduino.core.toolChain.release.1137540184" name="Arduino Toolchain" superClass="it.baeyens.arduino.core.toolChain.release">
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="it.baeyens.arduino.targetplatform.2138054044" name="Arduino Target" osList="all" superClass="it.baeyens.arduino.targetplatform"/>
|
||||||
|
<builder buildPath="${workspace_loc:/RCS}/Release" id="it.baeyens.arduino.sketch.builder.1401431746" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Arduino sketch builder" superClass="it.baeyens.arduino.sketch.builder"/>
|
||||||
|
<tool id="it.baeyens.arduino.tool.sketch.compiler.cpp.1745269229" name="Arduino C++ Compiler" superClass="it.baeyens.arduino.tool.sketch.compiler.cpp">
|
||||||
|
<option id="it.baeyens.arduino.compiler.cpp.sketch.option.incpath.1476857592" name="Include Paths (-I)" superClass="it.baeyens.arduino.compiler.cpp.sketch.option.incpath" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/core/core}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/core/variant}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Adafruit_FT6206}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Adafruit-GFX}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/SPI}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/TFT_ILI9341}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Wire}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/RCSwitch}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Adafruit_TFTLCD}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="it.baeyens.arduino.compiler.cpp.sketch.input.1996155685" name="CPP source files" superClass="it.baeyens.arduino.compiler.cpp.sketch.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="it.baeyens.arduino.tool.compiler.c.504511352" name="Arduino C Compiler" superClass="it.baeyens.arduino.tool.compiler.c">
|
||||||
|
<option id="it.baeyens.arduino.compiler.c.sketch.option.incpath.299572117" name="Include Paths (-I)" superClass="it.baeyens.arduino.compiler.c.sketch.option.incpath" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/core/core}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/core/variant}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/RCSwitch}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Adafruit_FT6206}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Adafruit-GFX}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/SPI}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/TFT_ILI9341}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Wire}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/433Receiver/Adafruit_TFTLCD}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="it.baeyens.arduino.compiler.c.sketch.input.1794937448" name="C Source Files" superClass="it.baeyens.arduino.compiler.c.sketch.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="it.baeyens.arduino.tool.sketch.compiler.s.1590122054" name="Arduino Assembler" superClass="it.baeyens.arduino.tool.sketch.compiler.s"/>
|
||||||
|
<tool id="it.baeyens.arduino.tool.ar.1278591355" name="Arduino archiver" superClass="it.baeyens.arduino.tool.ar"/>
|
||||||
|
<tool id="it.baeyens.arduino.tool.combine.1378780108" name="Arduino combiner" superClass="it.baeyens.arduino.tool.combine"/>
|
||||||
|
<tool id="it.baeyens.arduino.tool.objcopy.eep.245057281" name="Arduino tool Create eeprom" superClass="it.baeyens.arduino.tool.objcopy.eep"/>
|
||||||
|
<tool id="it.baeyens.arduino.tool.objcopy.flash.1058274754" name="Arduino tool Create hex" superClass="it.baeyens.arduino.tool.objcopy.flash"/>
|
||||||
|
<tool id="it.baeyens.arduino.tool.size.379587471" name="Arduino tool Print Size" superClass="it.baeyens.arduino.tool.size"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry excluding="Adafruit_TFTLCD|RCSwitch|libraries/**/?xamples/**|libraries/**/?xtras/**|libraries/**/test/**|libraries/**/third-party/**|libraries**/._*" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Adafruit_TFTLCD"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="RCSwitch"/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="RCS.null.1710387019" name="RCS"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="refreshScope"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||||
|
</cproject>
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/Release/
|
45
.project
Normal file
45
.project
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>433Receiver</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>it.baeyens.arduino.core.inoToCpp</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
<nature>it.baeyens.arduinonature</nature>
|
||||||
|
</natures>
|
||||||
|
<linkedResources>
|
||||||
|
<link>
|
||||||
|
<name>core/core</name>
|
||||||
|
<type>2</type>
|
||||||
|
<location>/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/packages/arduino/hardware/avr/1.6.14/cores/arduino</location>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>core/variant</name>
|
||||||
|
<type>2</type>
|
||||||
|
<location>/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/packages/arduino/hardware/avr/1.6.14/variants/standard</location>
|
||||||
|
</link>
|
||||||
|
</linkedResources>
|
||||||
|
</projectDescription>
|
14
.settings/language.settings.xml
Normal file
14
.settings/language.settings.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<project>
|
||||||
|
<configuration id="it.baeyens.arduino.core.toolChain.release.956598117" name="Release">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="it.baeyens.arduino.toolchain.ArduinoLanguageProvider" console="false" env-hash="-495307737102899092" id="it.baeyens.arduino.languageSettingsProvider" keep-relative-paths="false" name="Arduino Compiler Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
465
.settings/org.eclipse.cdt.core.prefs
Normal file
465
.settings/org.eclipse.cdt.core.prefs
Normal file
@ -0,0 +1,465 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ALT_SIZE_COMMAND/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ALT_SIZE_COMMAND/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHITECTURE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHITECTURE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHITECTURE/value=AVR
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHIVE_FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHIVE_FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHIVE_FILE/value=arduino.ar
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHIVE_FILE_PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHIVE_FILE_PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.ARCHIVE_FILE_PATH/value=${A.BUILD.PATH}/${A.ARCHIVE_FILE}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.EXTENDED_FUSES/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.EXTENDED_FUSES/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.EXTENDED_FUSES/value=0x05
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.FILE/value=optiboot/optiboot_atmega328.hex
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.HIGH_FUSES/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.HIGH_FUSES/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.HIGH_FUSES/value=0xDE
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.LOCK_BITS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.LOCK_BITS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.LOCK_BITS/value=0x0F
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.LOW_FUSES/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.LOW_FUSES/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.LOW_FUSES/value=0xFF
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.TOOL/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.TOOL/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.TOOL/value=avrdude
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.UNLOCK_BITS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.UNLOCK_BITS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BOOTLOADER.UNLOCK_BITS/value=0x3F
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.ARCH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.ARCH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.ARCH/value=AVR
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.BOARD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.BOARD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.BOARD/value=AVR_UNO
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.CORE.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.CORE.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.CORE.PATH/value=${A.RUNTIME.PLATFORM.PATH}/cores/${A.BUILD.CORE}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.CORE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.CORE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.CORE/value=${JANTJE.BUILD_CORE}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.F_CPU/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.F_CPU/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.F_CPU/value=16000000L
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.MCU/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.MCU/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.MCU/value=atmega328p
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.PATH/value=${ProjDirPath}/${ConfigName}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.PROJECT_NAME/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.PROJECT_NAME/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.PROJECT_NAME/value=${ProjName}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.SYSTEM.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.SYSTEM.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.SYSTEM.PATH/value=${A.RUNTIME.PLATFORM.PATH}/system
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_FLAGS.WINDOWS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_FLAGS.WINDOWS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_FLAGS.WINDOWS/value=-DUSB_VID\=${A.BUILD.VID} -DUSB_PID\=${A.BUILD.PID} -DUSBCON -DUSB_MANUFACTURER\=\\"${A.BUILD.USB_MANUFACTURER}\\" -DUSB_PRODUCT\=\\"${A.BUILD.USB_PRODUCT}\\"
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_MANUFACTURER/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_MANUFACTURER/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.USB_MANUFACTURER/value="Unknown"
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.VARIANT.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.VARIANT.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.VARIANT.PATH/value=${A.RUNTIME.PLATFORM.PATH}/variants/${A.BUILD.VARIANT}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.VARIANT/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.VARIANT/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.BUILD.VARIANT/value=${JANTJE.BUILD_VARIANT}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.CMD/value=avr-gcc-ar
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.AR.FLAGS/value=rcs
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.CMD/value=avr-gcc
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.CMD/value=avr-gcc
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.ELF.FLAGS/value=${A.COMPILER.WARNING_FLAGS} -Os -flto -fuse-linker-plugin -Wl,--gc-sections
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.C.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.CMD/value=avr-g++
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.CPP.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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 -MMD -flto
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.CMD/value=avr-objcopy
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.ELF2HEX.FLAGS/value=-O ihex -R .eeprom
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.LDFLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.LDFLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.LDFLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.CMD/value=avr-objcopy
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.EEP.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.EEP.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.OBJCOPY.EEP.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.PATH/value=${A.RUNTIME.TOOLS.AVR-GCC.PATH}/bin/
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.S.EXTRA_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.S.EXTRA_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.S.EXTRA_FLAGS/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.S.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.S.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.S.FLAGS/value=-c -g -x assembler-with-cpp -flto
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.SIZE.CMD/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.SIZE.CMD/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.SIZE.CMD/value=avr-size
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.ALL/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.ALL/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.ALL/value=-Wall -Wextra
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.DEFAULT/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.DEFAULT/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.DEFAULT/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.MORE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.MORE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.MORE/value=-Wall
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.NONE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.NONE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS.NONE/value=-w
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.COMPILER.WARNING_FLAGS/value=-w
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.DTS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.DTS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.DTS/value=0
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.LOCAL/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.LOCAL/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.LOCAL/value=1477951905
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.UTC/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.UTC/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.UTC/value=1477948305
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.ZONE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.ZONE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.EXTRA.TIME.ZONE/value=3600
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.NAME/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.NAME/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.NAME/value=Arduino/Genuino Uno
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PATH/value=${A.TOOLS.AVRDUDE.PATH}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.0/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.0/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.0/value=0x0043
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.1/value=0x0001
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.2/value=0x0043
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.3/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.3/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PID.3/value=0x0243
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PREPROC.INCLUDES.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PREPROC.INCLUDES.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PREPROC.INCLUDES.FLAGS/value=-w -x c++ -M -MG -MP
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PREPROC.MACROS.FLAGS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PREPROC.MACROS.FLAGS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.PREPROC.MACROS.FLAGS/value=-w -x c++ -E -CC
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.AR.CMD}" ${A.COMPILER.AR.FLAGS} ${A.COMPILER.AR.EXTRA_FLAGS} "${A.ARCHIVE_FILE_PATH}"
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN.2/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.AR.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.2/value=\
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.3/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.3/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN.3/value=\ "-L${A.BUILD.PATH}" -lm
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.COMBINE.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.2/value=\ -o
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.3/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.3/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN.3/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.C.O.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.2/value=\ -o
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.3/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.3/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN.3/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.CPP.O.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.EEP.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.EEP.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.EEP.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.EEP.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.HEX.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.HEX.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.HEX.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OBJCOPY.HEX.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OUTPUT.SAVE_FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OUTPUT.SAVE_FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OUTPUT.SAVE_FILE/value=${A.BUILD.PROJECT_NAME}.${A.BUILD.VARIANT}.hex
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OUTPUT.TMP_FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OUTPUT.TMP_FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.OUTPUT.TMP_FILE/value=${A.BUILD.PROJECT_NAME}.hex
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.PREPROC.INCLUDES/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.PREPROC.INCLUDES/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.PREPROC.MACROS/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.PREPROC.MACROS/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.2/value=\ -o
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.3/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.3/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN.3/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.S.O.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/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/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.PATTERN.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.PATTERN.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.PATTERN.1/value="${A.COMPILER.PATH}${A.COMPILER.SIZE.CMD}" -A "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf"
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.PATTERN/value="${A.COMPILER.PATH}${A.COMPILER.SIZE.CMD}" -A "${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.elf"
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX.DATA/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX.DATA/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX.DATA/value=^(?\:\\.data|\\.bss|\\.noinit)\\s+([0-9]+).*
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX.EEPROM/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX.EEPROM/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX.EEPROM/value=^(?\:\\.eeprom)\\s+([0-9]+).*
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RECIPE.SIZE.REGEX/value=^(?\:\\.text|\\.data|\\.bootloader)\\s+([0-9]+).*
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.HARDWARE.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.HARDWARE.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.HARDWARE.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/packages/arduino/hardware
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.IDE.VERSION/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.IDE.VERSION/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.IDE.VERSION/value=10606
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.PLATFORM.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.PLATFORM.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.PLATFORM.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/packages/arduino/hardware/avr/1.6.14
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC-4.9.2-ATMEL3.5.3-ARDUINO2.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC-4.9.2-ATMEL3.5.3-ARDUINO2.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC-4.9.2-ATMEL3.5.3-ARDUINO2.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/tools/arduino/avr-gcc/4.9.2-atmel3.5.3-arduino2
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/tools/arduino/avr-gcc/4.9.2-atmel3.5.3-arduino2
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC4.9.2-ATMEL3.5.3-ARDUINO2.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC4.9.2-ATMEL3.5.3-ARDUINO2.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVR-GCC4.9.2-ATMEL3.5.3-ARDUINO2.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/tools/arduino/avr-gcc/4.9.2-atmel3.5.3-arduino2
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE-6.3.0-ARDUINO6.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE-6.3.0-ARDUINO6.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE-6.3.0-ARDUINO6.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/tools/arduino/avrdude/6.3.0-arduino6
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/tools/arduino/avrdude/6.3.0-arduino6
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE6.3.0-ARDUINO6.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE6.3.0-ARDUINO6.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.RUNTIME.TOOLS.AVRDUDE6.3.0-ARDUINO6.PATH/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/tools/arduino/avrdude/6.3.0-arduino6
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.SOFTWARE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.SOFTWARE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.SOFTWARE/value=baeyens
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.QUIET/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.QUIET/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.QUIET/value=-q -q
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.VERBOSE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.VERBOSE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PARAMS.VERBOSE/value=-v
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.BOOTLOADER.PATTERN/value="${A.CMD.PATH}" "-C${A.CONFIG.PATH}" ${A.BOOTLOADER.VERBOSE} -p${A.BUILD.MCU} -c${A.PROTOCOL} ${A.PROGRAM.EXTRA_PARAMS} "-Uflash\:w\:${A.RUNTIME.PLATFORM.PATH}/bootloaders/${A.BOOTLOADER.FILE}\:i" -Ulock\:w\:${A.BOOTLOADER.LOCK_BITS}\:m
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.CMD.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.CMD.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.CMD.PATH/value=${A.PATH}/bin/avrdude
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.CONFIG.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.CONFIG.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.CONFIG.PATH/value=${A.PATH}/etc/avrdude.conf
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PARAMS.QUIET/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PARAMS.QUIET/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PARAMS.QUIET/value=-q -q
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PARAMS.VERBOSE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PARAMS.VERBOSE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PARAMS.VERBOSE/value=-v
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.ERASE.PATTERN/value="${A.CMD.PATH}" "-C${A.CONFIG.PATH}" ${A.ERASE.VERBOSE} -p${A.BUILD.MCU} -c${A.PROTOCOL} ${A.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/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PATH/value=${A.RUNTIME.TOOLS.AVRDUDE.PATH}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.NOVERIFY/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.NOVERIFY/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.NOVERIFY/value=-V
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.QUIET/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.QUIET/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.QUIET/value=-q -q
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.VERBOSE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.VERBOSE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PARAMS.VERBOSE/value=-v
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.PROGRAM.PATTERN/value="${A.CMD.PATH}" "-C${A.CONFIG.PATH}" ${A.PROGRAM.VERBOSE} ${A.PROGRAM.VERIFY} -p${A.BUILD.MCU} -c${A.PROTOCOL} ${A.PROGRAM.EXTRA_PARAMS} "-Uflash\:w\:${A.BUILD.PATH}/${A.BUILD.PROJECT_NAME}.hex\:i"
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.NOVERIFY/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.NOVERIFY/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.NOVERIFY/value=-V
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.QUIET/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.QUIET/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.QUIET/value=-q -q
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.VERBOSE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.VERBOSE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PARAMS.VERBOSE/value=-v
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE.UPLOAD.PATTERN/value="${A.TOOLS.AVRDUDE.CMD.PATH}" "-C${A.TOOLS.AVRDUDE.CONFIG.PATH}" ${A.UPLOAD.VERBOSE} ${A.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/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.PATTERN/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.PATTERN/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.TOOLS.AVRDUDE_REMOTE.UPLOAD.PATTERN/value=/usr/bin/run-avrdude /tmp/sketch.hex ${A.UPLOAD.VERBOSE} -p${A.BUILD.MCU}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.MAXIMUM_DATA_SIZE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.MAXIMUM_DATA_SIZE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.MAXIMUM_DATA_SIZE/value=2048
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.MAXIMUM_SIZE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.MAXIMUM_SIZE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.MAXIMUM_SIZE/value=32256
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.PROTOCOL/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.PROTOCOL/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.PROTOCOL/value=arduino
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.SPEED/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.SPEED/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.SPEED/value=115200
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.TOOL/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.TOOL/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.UPLOAD.TOOL/value=avrdude
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VERSION/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VERSION/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VERSION/value=1.6.14
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.0/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.0/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.0/value=0x2341
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.1/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.1/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.1/value=0x2341
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.2/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.2/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.2/value=0x2A03
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.3/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.3/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/A.VID.3/value=0x2341
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.ARCHITECTURE_ID/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.ARCHITECTURE_ID/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.ARCHITECTURE_ID/value=avr
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARDS_FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARDS_FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARDS_FILE/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/packages/arduino/hardware/avr/1.6.14/boards.txt
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARD_ID/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARD_ID/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARD_ID/value=uno
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARD_NAME/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARD_NAME/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BOARD_NAME/value=Arduino/Genuino Uno
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BUILD_CORE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BUILD_CORE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BUILD_CORE/value=arduino
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BUILD_VARIANT/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BUILD_VARIANT/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.BUILD_VARIANT/value=standard
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.COM_PORT/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.COM_PORT/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.COM_PORT/value=/dev/ttyACM2
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.C.COMPILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.C.COMPILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.C.COMPILE/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.COMPILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.COMPILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.COMPILE/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.CPP.COMPILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.CPP.COMPILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.EXTRA.CPP.COMPILE/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PACKAGE.NAME/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PACKAGE.NAME/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PACKAGE.NAME/value=arduino
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PACKAGE_ID/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PACKAGE_ID/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PACKAGE_ID/value=arduino
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PLATFORM_FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PLATFORM_FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.PLATFORM_FILE/value=/opt/eclipse/eclipse-arduino/cpp-neon/eclipse/arduinoPlugin/packages/arduino/hardware/avr/1.6.14/platform.txt
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.Processor/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.Processor/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.Processor/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.REFERENCED_PLATFORM_FILE/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.REFERENCED_PLATFORM_FILE/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.REFERENCED_PLATFORM_FILE/value=
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.SIZE.SWITCH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.SIZE.SWITCH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.SIZE.SWITCH/value=${A.RECIPE.SIZE.PATTERN}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.WARNING_LEVEL/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.WARNING_LEVEL/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/JANTJE.WARNING_LEVEL/value=\ -Wall
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/PATH/delimiter=\:
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/PATH/operation=replace
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/PATH/value=${A.COMPILER.PATH}${PathDelimiter}${A.BUILD.GENERIC.PATH}${PathDelimiter}${PATH}
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/append=true
|
||||||
|
environment/project/it.baeyens.arduino.core.toolChain.release.956598117/appendContributed=true
|
70
433Receiver.cpp
Normal file
70
433Receiver.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#include <RCSwitch.h>
|
||||||
|
#include <Adafruit_GFX.h>
|
||||||
|
#include <Adafruit_TFTLCD.h>
|
||||||
|
|
||||||
|
#define BLACK 0x0000
|
||||||
|
#define WHITE 0xFFFF
|
||||||
|
|
||||||
|
#define LCD_CS A3
|
||||||
|
#define LCD_CD A2
|
||||||
|
#define LCD_WR A1
|
||||||
|
#define LCD_RD A0
|
||||||
|
#define LCD_RESET A4
|
||||||
|
|
||||||
|
RCSwitch mySwitch = RCSwitch();
|
||||||
|
|
||||||
|
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t lines = 0;
|
||||||
|
|
||||||
|
void clearScreen() {
|
||||||
|
if (lines >= 15) {
|
||||||
|
tft.fillScreen(BLACK);
|
||||||
|
tft.setCursor(0, 0);
|
||||||
|
lines = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
|
||||||
|
|
||||||
|
|
||||||
|
pinMode(5, OUTPUT);
|
||||||
|
digitalWrite(5, HIGH);
|
||||||
|
|
||||||
|
tft.begin();
|
||||||
|
tft.setRotation(1);
|
||||||
|
tft.setTextSize(2);
|
||||||
|
tft.fillScreen(BLACK);
|
||||||
|
|
||||||
|
clearScreen();
|
||||||
|
tft.println("Hello");
|
||||||
|
lines++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (mySwitch.available()) {
|
||||||
|
|
||||||
|
int value = mySwitch.getReceivedValue();
|
||||||
|
|
||||||
|
if (value == 0) {
|
||||||
|
clearScreen();
|
||||||
|
tft.println("Unknown encoding");
|
||||||
|
lines++;
|
||||||
|
} else {
|
||||||
|
clearScreen();
|
||||||
|
tft.print("Recv ");
|
||||||
|
tft.print( mySwitch.getReceivedValue() );
|
||||||
|
tft.print(" / ");
|
||||||
|
tft.print( mySwitch.getReceivedBitlength() );
|
||||||
|
tft.print(" ");
|
||||||
|
tft.print("Prot: ");
|
||||||
|
tft.println( mySwitch.getReceivedProtocol() );
|
||||||
|
lines++;
|
||||||
|
}
|
||||||
|
|
||||||
|
mySwitch.resetAvailable();
|
||||||
|
}
|
||||||
|
}
|
22
433Receiver.h
Normal file
22
433Receiver.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Only modify this file to include
|
||||||
|
// - function definitions (prototypes)
|
||||||
|
// - include files
|
||||||
|
// - extern variable definitions
|
||||||
|
// In the appropriate section
|
||||||
|
|
||||||
|
#ifndef _RCS_H_
|
||||||
|
#define _RCS_H_
|
||||||
|
#include "Arduino.h"
|
||||||
|
//add your includes for the project RCS here
|
||||||
|
|
||||||
|
|
||||||
|
//end of add your includes here
|
||||||
|
|
||||||
|
|
||||||
|
//add your function definitions for the project RCS here
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Do not add code below this line
|
||||||
|
#endif /* _RCS_H_ */
|
BIN
Adafruit-GFX/.DS_Store
vendored
Normal file
BIN
Adafruit-GFX/.DS_Store
vendored
Normal file
Binary file not shown.
1069
Adafruit-GFX/Adafruit_GFX.cpp
Normal file
1069
Adafruit-GFX/Adafruit_GFX.cpp
Normal file
File diff suppressed because it is too large
Load Diff
155
Adafruit-GFX/Adafruit_GFX.h
Normal file
155
Adafruit-GFX/Adafruit_GFX.h
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
#ifndef _ADAFRUIT_GFX_H
|
||||||
|
#define _ADAFRUIT_GFX_H
|
||||||
|
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "Print.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gfxfont.h"
|
||||||
|
|
||||||
|
class Adafruit_GFX : public Print {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Adafruit_GFX(int16_t w, int16_t h); // Constructor
|
||||||
|
|
||||||
|
// This MUST be defined by the subclass:
|
||||||
|
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
|
||||||
|
|
||||||
|
// These MAY be overridden by the subclass to provide device-specific
|
||||||
|
// optimized code. Otherwise 'generic' versions are used.
|
||||||
|
virtual void
|
||||||
|
drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color),
|
||||||
|
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
|
||||||
|
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
|
||||||
|
drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color),
|
||||||
|
fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color),
|
||||||
|
fillScreen(uint16_t color),
|
||||||
|
invertDisplay(boolean i);
|
||||||
|
|
||||||
|
// These exist only with Adafruit_GFX (no subclass overrides)
|
||||||
|
void
|
||||||
|
drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||||
|
drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
|
||||||
|
uint16_t color),
|
||||||
|
fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||||
|
fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
|
||||||
|
int16_t delta, uint16_t color),
|
||||||
|
drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||||
|
int16_t x2, int16_t y2, uint16_t color),
|
||||||
|
fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||||
|
int16_t x2, int16_t y2, uint16_t color),
|
||||||
|
drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||||
|
int16_t radius, uint16_t color),
|
||||||
|
fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||||
|
int16_t radius, uint16_t color),
|
||||||
|
drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
|
||||||
|
int16_t w, int16_t h, uint16_t color),
|
||||||
|
drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
|
||||||
|
int16_t w, int16_t h, uint16_t color, uint16_t bg),
|
||||||
|
drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
|
||||||
|
int16_t w, int16_t h, uint16_t color),
|
||||||
|
drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
|
||||||
|
int16_t w, int16_t h, uint16_t color, uint16_t bg),
|
||||||
|
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
|
||||||
|
int16_t w, int16_t h, uint16_t color),
|
||||||
|
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
|
||||||
|
uint16_t bg, uint8_t size),
|
||||||
|
setCursor(int16_t x, int16_t y),
|
||||||
|
setTextColor(uint16_t c),
|
||||||
|
setTextColor(uint16_t c, uint16_t bg),
|
||||||
|
setTextSize(uint8_t s),
|
||||||
|
setTextWrap(boolean w),
|
||||||
|
setRotation(uint8_t r),
|
||||||
|
cp437(boolean x=true),
|
||||||
|
setFont(const GFXfont *f = NULL),
|
||||||
|
getTextBounds(char *string, int16_t x, int16_t y,
|
||||||
|
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h),
|
||||||
|
getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
|
||||||
|
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
|
||||||
|
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
virtual size_t write(uint8_t);
|
||||||
|
#else
|
||||||
|
virtual void write(uint8_t);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int16_t height(void) const;
|
||||||
|
int16_t width(void) const;
|
||||||
|
|
||||||
|
uint8_t getRotation(void) const;
|
||||||
|
|
||||||
|
// get current cursor position (get rotation safe maximum values, using: width() for x, height() for y)
|
||||||
|
int16_t getCursorX(void) const;
|
||||||
|
int16_t getCursorY(void) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const int16_t
|
||||||
|
WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes
|
||||||
|
int16_t
|
||||||
|
_width, _height, // Display w/h as modified by current rotation
|
||||||
|
cursor_x, cursor_y;
|
||||||
|
uint16_t
|
||||||
|
textcolor, textbgcolor;
|
||||||
|
uint8_t
|
||||||
|
textsize,
|
||||||
|
rotation;
|
||||||
|
boolean
|
||||||
|
wrap, // If set, 'wrap' text at right edge of display
|
||||||
|
_cp437; // If set, use correct CP437 charset (default is off)
|
||||||
|
GFXfont
|
||||||
|
*gfxFont;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Adafruit_GFX_Button {
|
||||||
|
|
||||||
|
public:
|
||||||
|
Adafruit_GFX_Button(void);
|
||||||
|
void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y,
|
||||||
|
uint8_t w, uint8_t h, uint16_t outline, uint16_t fill,
|
||||||
|
uint16_t textcolor, char *label, uint8_t textsize);
|
||||||
|
void drawButton(boolean inverted = false);
|
||||||
|
boolean contains(int16_t x, int16_t y);
|
||||||
|
|
||||||
|
void press(boolean p);
|
||||||
|
boolean isPressed();
|
||||||
|
boolean justPressed();
|
||||||
|
boolean justReleased();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Adafruit_GFX *_gfx;
|
||||||
|
int16_t _x, _y;
|
||||||
|
uint16_t _w, _h;
|
||||||
|
uint8_t _textsize;
|
||||||
|
uint16_t _outlinecolor, _fillcolor, _textcolor;
|
||||||
|
char _label[10];
|
||||||
|
|
||||||
|
boolean currstate, laststate;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GFXcanvas1 : public Adafruit_GFX {
|
||||||
|
|
||||||
|
public:
|
||||||
|
GFXcanvas1(uint16_t w, uint16_t h);
|
||||||
|
~GFXcanvas1(void);
|
||||||
|
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||||
|
fillScreen(uint16_t color);
|
||||||
|
uint8_t *getBuffer(void);
|
||||||
|
private:
|
||||||
|
uint8_t *buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GFXcanvas16 : public Adafruit_GFX {
|
||||||
|
GFXcanvas16(uint16_t w, uint16_t h);
|
||||||
|
~GFXcanvas16(void);
|
||||||
|
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||||
|
fillScreen(uint16_t color);
|
||||||
|
uint16_t *getBuffer(void);
|
||||||
|
private:
|
||||||
|
uint16_t *buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _ADAFRUIT_GFX_H
|
24
Adafruit-GFX/gfxfont.h
Normal file
24
Adafruit-GFX/gfxfont.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Font structures for newer Adafruit_GFX (1.1 and later).
|
||||||
|
// Example fonts are included in 'Fonts' directory.
|
||||||
|
// To use a font in your Arduino sketch, #include the corresponding .h
|
||||||
|
// file and pass address of GFXfont struct to setFont(). Pass NULL to
|
||||||
|
// revert to 'classic' fixed-space bitmap font.
|
||||||
|
|
||||||
|
#ifndef _GFXFONT_H_
|
||||||
|
#define _GFXFONT_H_
|
||||||
|
|
||||||
|
typedef struct { // Data stored PER GLYPH
|
||||||
|
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
|
||||||
|
uint8_t width, height; // Bitmap dimensions in pixels
|
||||||
|
uint8_t xAdvance; // Distance to advance cursor (x axis)
|
||||||
|
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
|
||||||
|
} GFXglyph;
|
||||||
|
|
||||||
|
typedef struct { // Data stored for FONT AS A WHOLE:
|
||||||
|
uint8_t *bitmap; // Glyph bitmaps, concatenated
|
||||||
|
GFXglyph *glyph; // Glyph array
|
||||||
|
uint8_t first, last; // ASCII extents
|
||||||
|
uint8_t yAdvance; // Newline distance (y axis)
|
||||||
|
} GFXfont;
|
||||||
|
|
||||||
|
#endif // _GFXFONT_H_
|
276
Adafruit-GFX/glcdfont.c
Normal file
276
Adafruit-GFX/glcdfont.c
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
|
||||||
|
// See gfxfont.h for newer custom bitmap font info.
|
||||||
|
|
||||||
|
#ifndef FONT5X7_H
|
||||||
|
#define FONT5X7_H
|
||||||
|
|
||||||
|
#ifdef __AVR__
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#elif defined(ESP8266)
|
||||||
|
#include <pgmspace.h>
|
||||||
|
#else
|
||||||
|
#define PROGMEM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Standard ASCII 5x7 font
|
||||||
|
|
||||||
|
static const unsigned char font[] PROGMEM = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
|
||||||
|
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
|
||||||
|
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
|
||||||
|
0x18, 0x3C, 0x7E, 0x3C, 0x18,
|
||||||
|
0x1C, 0x57, 0x7D, 0x57, 0x1C,
|
||||||
|
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
|
||||||
|
0x00, 0x18, 0x3C, 0x18, 0x00,
|
||||||
|
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
|
||||||
|
0x00, 0x18, 0x24, 0x18, 0x00,
|
||||||
|
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
|
||||||
|
0x30, 0x48, 0x3A, 0x06, 0x0E,
|
||||||
|
0x26, 0x29, 0x79, 0x29, 0x26,
|
||||||
|
0x40, 0x7F, 0x05, 0x05, 0x07,
|
||||||
|
0x40, 0x7F, 0x05, 0x25, 0x3F,
|
||||||
|
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
|
||||||
|
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
|
||||||
|
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
|
||||||
|
0x14, 0x22, 0x7F, 0x22, 0x14,
|
||||||
|
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
|
||||||
|
0x06, 0x09, 0x7F, 0x01, 0x7F,
|
||||||
|
0x00, 0x66, 0x89, 0x95, 0x6A,
|
||||||
|
0x60, 0x60, 0x60, 0x60, 0x60,
|
||||||
|
0x94, 0xA2, 0xFF, 0xA2, 0x94,
|
||||||
|
0x08, 0x04, 0x7E, 0x04, 0x08,
|
||||||
|
0x10, 0x20, 0x7E, 0x20, 0x10,
|
||||||
|
0x08, 0x08, 0x2A, 0x1C, 0x08,
|
||||||
|
0x08, 0x1C, 0x2A, 0x08, 0x08,
|
||||||
|
0x1E, 0x10, 0x10, 0x10, 0x10,
|
||||||
|
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
|
||||||
|
0x30, 0x38, 0x3E, 0x38, 0x30,
|
||||||
|
0x06, 0x0E, 0x3E, 0x0E, 0x06,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x5F, 0x00, 0x00,
|
||||||
|
0x00, 0x07, 0x00, 0x07, 0x00,
|
||||||
|
0x14, 0x7F, 0x14, 0x7F, 0x14,
|
||||||
|
0x24, 0x2A, 0x7F, 0x2A, 0x12,
|
||||||
|
0x23, 0x13, 0x08, 0x64, 0x62,
|
||||||
|
0x36, 0x49, 0x56, 0x20, 0x50,
|
||||||
|
0x00, 0x08, 0x07, 0x03, 0x00,
|
||||||
|
0x00, 0x1C, 0x22, 0x41, 0x00,
|
||||||
|
0x00, 0x41, 0x22, 0x1C, 0x00,
|
||||||
|
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
|
||||||
|
0x08, 0x08, 0x3E, 0x08, 0x08,
|
||||||
|
0x00, 0x80, 0x70, 0x30, 0x00,
|
||||||
|
0x08, 0x08, 0x08, 0x08, 0x08,
|
||||||
|
0x00, 0x00, 0x60, 0x60, 0x00,
|
||||||
|
0x20, 0x10, 0x08, 0x04, 0x02,
|
||||||
|
0x3E, 0x51, 0x49, 0x45, 0x3E,
|
||||||
|
0x00, 0x42, 0x7F, 0x40, 0x00,
|
||||||
|
0x72, 0x49, 0x49, 0x49, 0x46,
|
||||||
|
0x21, 0x41, 0x49, 0x4D, 0x33,
|
||||||
|
0x18, 0x14, 0x12, 0x7F, 0x10,
|
||||||
|
0x27, 0x45, 0x45, 0x45, 0x39,
|
||||||
|
0x3C, 0x4A, 0x49, 0x49, 0x31,
|
||||||
|
0x41, 0x21, 0x11, 0x09, 0x07,
|
||||||
|
0x36, 0x49, 0x49, 0x49, 0x36,
|
||||||
|
0x46, 0x49, 0x49, 0x29, 0x1E,
|
||||||
|
0x00, 0x00, 0x14, 0x00, 0x00,
|
||||||
|
0x00, 0x40, 0x34, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x14, 0x22, 0x41,
|
||||||
|
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||||
|
0x00, 0x41, 0x22, 0x14, 0x08,
|
||||||
|
0x02, 0x01, 0x59, 0x09, 0x06,
|
||||||
|
0x3E, 0x41, 0x5D, 0x59, 0x4E,
|
||||||
|
0x7C, 0x12, 0x11, 0x12, 0x7C,
|
||||||
|
0x7F, 0x49, 0x49, 0x49, 0x36,
|
||||||
|
0x3E, 0x41, 0x41, 0x41, 0x22,
|
||||||
|
0x7F, 0x41, 0x41, 0x41, 0x3E,
|
||||||
|
0x7F, 0x49, 0x49, 0x49, 0x41,
|
||||||
|
0x7F, 0x09, 0x09, 0x09, 0x01,
|
||||||
|
0x3E, 0x41, 0x41, 0x51, 0x73,
|
||||||
|
0x7F, 0x08, 0x08, 0x08, 0x7F,
|
||||||
|
0x00, 0x41, 0x7F, 0x41, 0x00,
|
||||||
|
0x20, 0x40, 0x41, 0x3F, 0x01,
|
||||||
|
0x7F, 0x08, 0x14, 0x22, 0x41,
|
||||||
|
0x7F, 0x40, 0x40, 0x40, 0x40,
|
||||||
|
0x7F, 0x02, 0x1C, 0x02, 0x7F,
|
||||||
|
0x7F, 0x04, 0x08, 0x10, 0x7F,
|
||||||
|
0x3E, 0x41, 0x41, 0x41, 0x3E,
|
||||||
|
0x7F, 0x09, 0x09, 0x09, 0x06,
|
||||||
|
0x3E, 0x41, 0x51, 0x21, 0x5E,
|
||||||
|
0x7F, 0x09, 0x19, 0x29, 0x46,
|
||||||
|
0x26, 0x49, 0x49, 0x49, 0x32,
|
||||||
|
0x03, 0x01, 0x7F, 0x01, 0x03,
|
||||||
|
0x3F, 0x40, 0x40, 0x40, 0x3F,
|
||||||
|
0x1F, 0x20, 0x40, 0x20, 0x1F,
|
||||||
|
0x3F, 0x40, 0x38, 0x40, 0x3F,
|
||||||
|
0x63, 0x14, 0x08, 0x14, 0x63,
|
||||||
|
0x03, 0x04, 0x78, 0x04, 0x03,
|
||||||
|
0x61, 0x59, 0x49, 0x4D, 0x43,
|
||||||
|
0x00, 0x7F, 0x41, 0x41, 0x41,
|
||||||
|
0x02, 0x04, 0x08, 0x10, 0x20,
|
||||||
|
0x00, 0x41, 0x41, 0x41, 0x7F,
|
||||||
|
0x04, 0x02, 0x01, 0x02, 0x04,
|
||||||
|
0x40, 0x40, 0x40, 0x40, 0x40,
|
||||||
|
0x00, 0x03, 0x07, 0x08, 0x00,
|
||||||
|
0x20, 0x54, 0x54, 0x78, 0x40,
|
||||||
|
0x7F, 0x28, 0x44, 0x44, 0x38,
|
||||||
|
0x38, 0x44, 0x44, 0x44, 0x28,
|
||||||
|
0x38, 0x44, 0x44, 0x28, 0x7F,
|
||||||
|
0x38, 0x54, 0x54, 0x54, 0x18,
|
||||||
|
0x00, 0x08, 0x7E, 0x09, 0x02,
|
||||||
|
0x18, 0xA4, 0xA4, 0x9C, 0x78,
|
||||||
|
0x7F, 0x08, 0x04, 0x04, 0x78,
|
||||||
|
0x00, 0x44, 0x7D, 0x40, 0x00,
|
||||||
|
0x20, 0x40, 0x40, 0x3D, 0x00,
|
||||||
|
0x7F, 0x10, 0x28, 0x44, 0x00,
|
||||||
|
0x00, 0x41, 0x7F, 0x40, 0x00,
|
||||||
|
0x7C, 0x04, 0x78, 0x04, 0x78,
|
||||||
|
0x7C, 0x08, 0x04, 0x04, 0x78,
|
||||||
|
0x38, 0x44, 0x44, 0x44, 0x38,
|
||||||
|
0xFC, 0x18, 0x24, 0x24, 0x18,
|
||||||
|
0x18, 0x24, 0x24, 0x18, 0xFC,
|
||||||
|
0x7C, 0x08, 0x04, 0x04, 0x08,
|
||||||
|
0x48, 0x54, 0x54, 0x54, 0x24,
|
||||||
|
0x04, 0x04, 0x3F, 0x44, 0x24,
|
||||||
|
0x3C, 0x40, 0x40, 0x20, 0x7C,
|
||||||
|
0x1C, 0x20, 0x40, 0x20, 0x1C,
|
||||||
|
0x3C, 0x40, 0x30, 0x40, 0x3C,
|
||||||
|
0x44, 0x28, 0x10, 0x28, 0x44,
|
||||||
|
0x4C, 0x90, 0x90, 0x90, 0x7C,
|
||||||
|
0x44, 0x64, 0x54, 0x4C, 0x44,
|
||||||
|
0x00, 0x08, 0x36, 0x41, 0x00,
|
||||||
|
0x00, 0x00, 0x77, 0x00, 0x00,
|
||||||
|
0x00, 0x41, 0x36, 0x08, 0x00,
|
||||||
|
0x02, 0x01, 0x02, 0x04, 0x02,
|
||||||
|
0x3C, 0x26, 0x23, 0x26, 0x3C,
|
||||||
|
0x1E, 0xA1, 0xA1, 0x61, 0x12,
|
||||||
|
0x3A, 0x40, 0x40, 0x20, 0x7A,
|
||||||
|
0x38, 0x54, 0x54, 0x55, 0x59,
|
||||||
|
0x21, 0x55, 0x55, 0x79, 0x41,
|
||||||
|
0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut
|
||||||
|
0x21, 0x55, 0x54, 0x78, 0x40,
|
||||||
|
0x20, 0x54, 0x55, 0x79, 0x40,
|
||||||
|
0x0C, 0x1E, 0x52, 0x72, 0x12,
|
||||||
|
0x39, 0x55, 0x55, 0x55, 0x59,
|
||||||
|
0x39, 0x54, 0x54, 0x54, 0x59,
|
||||||
|
0x39, 0x55, 0x54, 0x54, 0x58,
|
||||||
|
0x00, 0x00, 0x45, 0x7C, 0x41,
|
||||||
|
0x00, 0x02, 0x45, 0x7D, 0x42,
|
||||||
|
0x00, 0x01, 0x45, 0x7C, 0x40,
|
||||||
|
0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut
|
||||||
|
0xF0, 0x28, 0x25, 0x28, 0xF0,
|
||||||
|
0x7C, 0x54, 0x55, 0x45, 0x00,
|
||||||
|
0x20, 0x54, 0x54, 0x7C, 0x54,
|
||||||
|
0x7C, 0x0A, 0x09, 0x7F, 0x49,
|
||||||
|
0x32, 0x49, 0x49, 0x49, 0x32,
|
||||||
|
0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut
|
||||||
|
0x32, 0x4A, 0x48, 0x48, 0x30,
|
||||||
|
0x3A, 0x41, 0x41, 0x21, 0x7A,
|
||||||
|
0x3A, 0x42, 0x40, 0x20, 0x78,
|
||||||
|
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
|
||||||
|
0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut
|
||||||
|
0x3D, 0x40, 0x40, 0x40, 0x3D,
|
||||||
|
0x3C, 0x24, 0xFF, 0x24, 0x24,
|
||||||
|
0x48, 0x7E, 0x49, 0x43, 0x66,
|
||||||
|
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
|
||||||
|
0xFF, 0x09, 0x29, 0xF6, 0x20,
|
||||||
|
0xC0, 0x88, 0x7E, 0x09, 0x03,
|
||||||
|
0x20, 0x54, 0x54, 0x79, 0x41,
|
||||||
|
0x00, 0x00, 0x44, 0x7D, 0x41,
|
||||||
|
0x30, 0x48, 0x48, 0x4A, 0x32,
|
||||||
|
0x38, 0x40, 0x40, 0x22, 0x7A,
|
||||||
|
0x00, 0x7A, 0x0A, 0x0A, 0x72,
|
||||||
|
0x7D, 0x0D, 0x19, 0x31, 0x7D,
|
||||||
|
0x26, 0x29, 0x29, 0x2F, 0x28,
|
||||||
|
0x26, 0x29, 0x29, 0x29, 0x26,
|
||||||
|
0x30, 0x48, 0x4D, 0x40, 0x20,
|
||||||
|
0x38, 0x08, 0x08, 0x08, 0x08,
|
||||||
|
0x08, 0x08, 0x08, 0x08, 0x38,
|
||||||
|
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
|
||||||
|
0x2F, 0x10, 0x28, 0x34, 0xFA,
|
||||||
|
0x00, 0x00, 0x7B, 0x00, 0x00,
|
||||||
|
0x08, 0x14, 0x2A, 0x14, 0x22,
|
||||||
|
0x22, 0x14, 0x2A, 0x14, 0x08,
|
||||||
|
0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
|
||||||
|
0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block
|
||||||
|
0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0x00,
|
||||||
|
0x10, 0x10, 0x10, 0xFF, 0x00,
|
||||||
|
0x14, 0x14, 0x14, 0xFF, 0x00,
|
||||||
|
0x10, 0x10, 0xFF, 0x00, 0xFF,
|
||||||
|
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||||
|
0x14, 0x14, 0x14, 0xFC, 0x00,
|
||||||
|
0x14, 0x14, 0xF7, 0x00, 0xFF,
|
||||||
|
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||||
|
0x14, 0x14, 0xF4, 0x04, 0xFC,
|
||||||
|
0x14, 0x14, 0x17, 0x10, 0x1F,
|
||||||
|
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||||
|
0x14, 0x14, 0x14, 0x1F, 0x00,
|
||||||
|
0x10, 0x10, 0x10, 0xF0, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x1F, 0x10,
|
||||||
|
0x10, 0x10, 0x10, 0x1F, 0x10,
|
||||||
|
0x10, 0x10, 0x10, 0xF0, 0x10,
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0x10,
|
||||||
|
0x10, 0x10, 0x10, 0x10, 0x10,
|
||||||
|
0x10, 0x10, 0x10, 0xFF, 0x10,
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0x14,
|
||||||
|
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||||
|
0x00, 0x00, 0x1F, 0x10, 0x17,
|
||||||
|
0x00, 0x00, 0xFC, 0x04, 0xF4,
|
||||||
|
0x14, 0x14, 0x17, 0x10, 0x17,
|
||||||
|
0x14, 0x14, 0xF4, 0x04, 0xF4,
|
||||||
|
0x00, 0x00, 0xFF, 0x00, 0xF7,
|
||||||
|
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||||
|
0x14, 0x14, 0xF7, 0x00, 0xF7,
|
||||||
|
0x14, 0x14, 0x14, 0x17, 0x14,
|
||||||
|
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||||
|
0x14, 0x14, 0x14, 0xF4, 0x14,
|
||||||
|
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||||
|
0x00, 0x00, 0x1F, 0x10, 0x1F,
|
||||||
|
0x00, 0x00, 0x00, 0x1F, 0x14,
|
||||||
|
0x00, 0x00, 0x00, 0xFC, 0x14,
|
||||||
|
0x00, 0x00, 0xF0, 0x10, 0xF0,
|
||||||
|
0x10, 0x10, 0xFF, 0x10, 0xFF,
|
||||||
|
0x14, 0x14, 0x14, 0xFF, 0x14,
|
||||||
|
0x10, 0x10, 0x10, 0x1F, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0xF0, 0x10,
|
||||||
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
|
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
|
||||||
|
0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||||
|
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
|
||||||
|
0x38, 0x44, 0x44, 0x38, 0x44,
|
||||||
|
0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta
|
||||||
|
0x7E, 0x02, 0x02, 0x06, 0x06,
|
||||||
|
0x02, 0x7E, 0x02, 0x7E, 0x02,
|
||||||
|
0x63, 0x55, 0x49, 0x41, 0x63,
|
||||||
|
0x38, 0x44, 0x44, 0x3C, 0x04,
|
||||||
|
0x40, 0x7E, 0x20, 0x1E, 0x20,
|
||||||
|
0x06, 0x02, 0x7E, 0x02, 0x02,
|
||||||
|
0x99, 0xA5, 0xE7, 0xA5, 0x99,
|
||||||
|
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
|
||||||
|
0x4C, 0x72, 0x01, 0x72, 0x4C,
|
||||||
|
0x30, 0x4A, 0x4D, 0x4D, 0x30,
|
||||||
|
0x30, 0x48, 0x78, 0x48, 0x30,
|
||||||
|
0xBC, 0x62, 0x5A, 0x46, 0x3D,
|
||||||
|
0x3E, 0x49, 0x49, 0x49, 0x00,
|
||||||
|
0x7E, 0x01, 0x01, 0x01, 0x7E,
|
||||||
|
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
|
||||||
|
0x44, 0x44, 0x5F, 0x44, 0x44,
|
||||||
|
0x40, 0x51, 0x4A, 0x44, 0x40,
|
||||||
|
0x40, 0x44, 0x4A, 0x51, 0x40,
|
||||||
|
0x00, 0x00, 0xFF, 0x01, 0x03,
|
||||||
|
0xE0, 0x80, 0xFF, 0x00, 0x00,
|
||||||
|
0x08, 0x08, 0x6B, 0x6B, 0x08,
|
||||||
|
0x36, 0x12, 0x36, 0x24, 0x36,
|
||||||
|
0x06, 0x0F, 0x09, 0x0F, 0x06,
|
||||||
|
0x00, 0x00, 0x18, 0x18, 0x00,
|
||||||
|
0x00, 0x00, 0x10, 0x10, 0x00,
|
||||||
|
0x30, 0x40, 0xFF, 0x01, 0x01,
|
||||||
|
0x00, 0x1F, 0x01, 0x01, 0x1E,
|
||||||
|
0x00, 0x19, 0x1D, 0x17, 0x12,
|
||||||
|
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP
|
||||||
|
};
|
||||||
|
#endif // FONT5X7_H
|
225
Adafruit_FT6206/Adafruit_FT6206.cpp
Normal file
225
Adafruit_FT6206/Adafruit_FT6206.cpp
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
/***************************************************
|
||||||
|
This is a library for the Adafruit Capacitive Touch Screens
|
||||||
|
|
||||||
|
----> http://www.adafruit.com/products/1947
|
||||||
|
|
||||||
|
Check out the links above for our tutorials and wiring diagrams
|
||||||
|
This chipset uses I2C to communicate
|
||||||
|
|
||||||
|
Adafruit invests time and resources providing this open source code,
|
||||||
|
please support Adafruit and open-source hardware by purchasing
|
||||||
|
products from Adafruit!
|
||||||
|
|
||||||
|
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
|
MIT license, all text above must be included in any redistribution
|
||||||
|
****************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
#include <Adafruit_FT6206.h>
|
||||||
|
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
|
#define Wire Wire1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Instantiates a new FT6206 class
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
// I2C, no address adjustments or pins
|
||||||
|
Adafruit_FT6206::Adafruit_FT6206() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Setups the HW
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
boolean Adafruit_FT6206::begin(uint8_t threshhold) {
|
||||||
|
Wire.begin();
|
||||||
|
|
||||||
|
// change threshhold to be higher/lower
|
||||||
|
writeRegister8(FT6206_REG_THRESHHOLD, threshhold);
|
||||||
|
|
||||||
|
if ((readRegister8(FT6206_REG_VENDID) != 17) || (readRegister8(FT6206_REG_CHIPID) != 6)) return false;
|
||||||
|
/*
|
||||||
|
Serial.print("Vend ID: "); Serial.println(readRegister8(FT6206_REG_VENDID));
|
||||||
|
Serial.print("Chip ID: "); Serial.println(readRegister8(FT6206_REG_CHIPID));
|
||||||
|
Serial.print("Firm V: "); Serial.println(readRegister8(FT6206_REG_FIRMVERS));
|
||||||
|
Serial.print("Point Rate Hz: "); Serial.println(readRegister8(FT6206_REG_POINTRATE));
|
||||||
|
Serial.print("Thresh: "); Serial.println(readRegister8(FT6206_REG_THRESHHOLD));
|
||||||
|
*/
|
||||||
|
// dump all registers
|
||||||
|
/*
|
||||||
|
for (int16_t i=0; i<0x20; i++) {
|
||||||
|
Serial.print("I2C $"); Serial.print(i, HEX);
|
||||||
|
Serial.print(" = 0x"); Serial.println(readRegister8(i), HEX);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DONT DO THIS - REALLY - IT DOESNT WORK
|
||||||
|
void Adafruit_FT6206::autoCalibrate(void) {
|
||||||
|
writeRegister8(FT6206_REG_MODE, FT6206_REG_FACTORYMODE);
|
||||||
|
delay(100);
|
||||||
|
//Serial.println("Calibrating...");
|
||||||
|
writeRegister8(FT6206_REG_CALIBRATE, 4);
|
||||||
|
delay(300);
|
||||||
|
for (uint8_t i = 0; i < 100; i++) {
|
||||||
|
uint8_t temp;
|
||||||
|
temp = readRegister8(FT6206_REG_MODE);
|
||||||
|
Serial.println(temp, HEX);
|
||||||
|
//return to normal mode, calibration finish
|
||||||
|
if (0x0 == ((temp & 0x70) >> 4))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
delay(200);
|
||||||
|
//Serial.println("Calibrated");
|
||||||
|
delay(300);
|
||||||
|
writeRegister8(FT6206_REG_MODE, FT6206_REG_FACTORYMODE);
|
||||||
|
delay(100);
|
||||||
|
writeRegister8(FT6206_REG_CALIBRATE, 5);
|
||||||
|
delay(300);
|
||||||
|
writeRegister8(FT6206_REG_MODE, FT6206_REG_WORKMODE);
|
||||||
|
delay(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean Adafruit_FT6206::touched(void) {
|
||||||
|
|
||||||
|
uint8_t n = readRegister8(FT6206_REG_NUMTOUCHES);
|
||||||
|
if ((n == 1) || (n == 2)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************/
|
||||||
|
|
||||||
|
void Adafruit_FT6206::readData(uint16_t *x, uint16_t *y) {
|
||||||
|
|
||||||
|
uint8_t i2cdat[16];
|
||||||
|
Wire.beginTransmission(FT6206_ADDR);
|
||||||
|
Wire.write((byte)0);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.beginTransmission(FT6206_ADDR);
|
||||||
|
Wire.requestFrom((byte)FT6206_ADDR, (byte)32);
|
||||||
|
for (uint8_t i=0; i<16; i++)
|
||||||
|
i2cdat[i] = Wire.read();
|
||||||
|
Wire.endTransmission();
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (int16_t i=0; i<0x20; i++) {
|
||||||
|
Serial.print("I2C $"); Serial.print(i, HEX); Serial.print(" = 0x"); Serial.println(i2cdat[i], HEX);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
touches = i2cdat[0x02];
|
||||||
|
|
||||||
|
//Serial.println(touches);
|
||||||
|
if (touches > 2) {
|
||||||
|
touches = 0;
|
||||||
|
*x = *y = 0;
|
||||||
|
}
|
||||||
|
if (touches == 0) {
|
||||||
|
*x = *y = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (touches == 2) Serial.print('2');
|
||||||
|
for (uint8_t i=0; i<16; i++) {
|
||||||
|
// Serial.print("0x"); Serial.print(i2cdat[i], HEX); Serial.print(" ");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Serial.println();
|
||||||
|
if (i2cdat[0x01] != 0x00) {
|
||||||
|
Serial.print("Gesture #");
|
||||||
|
Serial.println(i2cdat[0x01]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Serial.print("# Touches: "); Serial.print(touches);
|
||||||
|
for (uint8_t i=0; i<2; i++) {
|
||||||
|
touchX[i] = i2cdat[0x03 + i*6] & 0x0F;
|
||||||
|
touchX[i] <<= 8;
|
||||||
|
touchX[i] |= i2cdat[0x04 + i*6];
|
||||||
|
touchY[i] = i2cdat[0x05 + i*6] & 0x0F;
|
||||||
|
touchY[i] <<= 8;
|
||||||
|
touchY[i] |= i2cdat[0x06 + i*6];
|
||||||
|
touchID[i] = i2cdat[0x05 + i*6] >> 4;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Serial.println();
|
||||||
|
for (uint8_t i=0; i<touches; i++) {
|
||||||
|
Serial.print("ID #"); Serial.print(touchID[i]); Serial.print("\t("); Serial.print(touchX[i]);
|
||||||
|
Serial.print(", "); Serial.print(touchY[i]);
|
||||||
|
Serial.print (") ");
|
||||||
|
}
|
||||||
|
Serial.println();
|
||||||
|
*/
|
||||||
|
*x = touchX[0]; *y = touchY[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
TS_Point Adafruit_FT6206::getPoint(void) {
|
||||||
|
uint16_t x, y;
|
||||||
|
uint8_t z;
|
||||||
|
readData(&x, &y);
|
||||||
|
return TS_Point(x, y, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t Adafruit_FT6206::readRegister8(uint8_t reg) {
|
||||||
|
uint8_t x ;
|
||||||
|
// use i2c
|
||||||
|
Wire.beginTransmission(FT6206_ADDR);
|
||||||
|
Wire.write((byte)reg);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.beginTransmission(FT6206_ADDR);
|
||||||
|
Wire.requestFrom((byte)FT6206_ADDR, (byte)1);
|
||||||
|
x = Wire.read();
|
||||||
|
Wire.endTransmission();
|
||||||
|
|
||||||
|
// Serial.print("$"); Serial.print(reg, HEX);
|
||||||
|
// Serial.print(": 0x"); Serial.println(x, HEX);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Adafruit_FT6206::writeRegister8(uint8_t reg, uint8_t val) {
|
||||||
|
// use i2c
|
||||||
|
Wire.beginTransmission(FT6206_ADDR);
|
||||||
|
Wire.write((byte)reg);
|
||||||
|
Wire.write((byte)val);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************/
|
||||||
|
|
||||||
|
TS_Point::TS_Point(void) {
|
||||||
|
x = y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TS_Point::TS_Point(int16_t x0, int16_t y0, int16_t z0) {
|
||||||
|
x = x0;
|
||||||
|
y = y0;
|
||||||
|
z = z0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TS_Point::operator==(TS_Point p1) {
|
||||||
|
return ((p1.x == x) && (p1.y == y) && (p1.z == z));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TS_Point::operator!=(TS_Point p1) {
|
||||||
|
return ((p1.x != x) || (p1.y != y) || (p1.z != z));
|
||||||
|
}
|
81
Adafruit_FT6206/Adafruit_FT6206.h
Normal file
81
Adafruit_FT6206/Adafruit_FT6206.h
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/***************************************************
|
||||||
|
This is a library for the Adafruit Capacitive Touch Screens
|
||||||
|
|
||||||
|
----> http://www.adafruit.com/products/1947
|
||||||
|
|
||||||
|
Check out the links above for our tutorials and wiring diagrams
|
||||||
|
This chipset uses I2C to communicate
|
||||||
|
|
||||||
|
Adafruit invests time and resources providing this open source code,
|
||||||
|
please support Adafruit and open-source hardware by purchasing
|
||||||
|
products from Adafruit!
|
||||||
|
|
||||||
|
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
|
MIT license, all text above must be included in any redistribution
|
||||||
|
****************************************************/
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_FT6206_LIBRARY
|
||||||
|
#define ADAFRUIT_FT6206_LIBRARY
|
||||||
|
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define FT6206_ADDR 0x38
|
||||||
|
#define FT6206_G_FT5201ID 0xA8
|
||||||
|
#define FT6206_REG_NUMTOUCHES 0x02
|
||||||
|
|
||||||
|
#define FT6206_NUM_X 0x33
|
||||||
|
#define FT6206_NUM_Y 0x34
|
||||||
|
|
||||||
|
#define FT6206_REG_MODE 0x00
|
||||||
|
#define FT6206_REG_CALIBRATE 0x02
|
||||||
|
#define FT6206_REG_WORKMODE 0x00
|
||||||
|
#define FT6206_REG_FACTORYMODE 0x40
|
||||||
|
#define FT6206_REG_THRESHHOLD 0x80
|
||||||
|
#define FT6206_REG_POINTRATE 0x88
|
||||||
|
#define FT6206_REG_FIRMVERS 0xA6
|
||||||
|
#define FT6206_REG_CHIPID 0xA3
|
||||||
|
#define FT6206_REG_VENDID 0xA8
|
||||||
|
|
||||||
|
// calibrated for Adafruit 2.8" ctp screen
|
||||||
|
#define FT6206_DEFAULT_THRESSHOLD 128
|
||||||
|
|
||||||
|
class TS_Point {
|
||||||
|
public:
|
||||||
|
TS_Point(void);
|
||||||
|
TS_Point(int16_t x, int16_t y, int16_t z);
|
||||||
|
|
||||||
|
bool operator==(TS_Point);
|
||||||
|
bool operator!=(TS_Point);
|
||||||
|
|
||||||
|
int16_t x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Adafruit_FT6206 {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Adafruit_FT6206(void);
|
||||||
|
boolean begin(uint8_t thresh = FT6206_DEFAULT_THRESSHOLD);
|
||||||
|
|
||||||
|
void writeRegister8(uint8_t reg, uint8_t val);
|
||||||
|
uint8_t readRegister8(uint8_t reg);
|
||||||
|
|
||||||
|
void readData(uint16_t *x, uint16_t *y);
|
||||||
|
void autoCalibrate(void);
|
||||||
|
|
||||||
|
boolean touched(void);
|
||||||
|
TS_Point getPoint(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t touches;
|
||||||
|
uint16_t touchX[2], touchY[2], touchID[2];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //ADAFRUIT_FT6206_LIBRARY
|
1036
Adafruit_TFTLCD/Adafruit_TFTLCD.cpp
Normal file
1036
Adafruit_TFTLCD/Adafruit_TFTLCD.cpp
Normal file
File diff suppressed because it is too large
Load Diff
105
Adafruit_TFTLCD/Adafruit_TFTLCD.h
Normal file
105
Adafruit_TFTLCD/Adafruit_TFTLCD.h
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// IMPORTANT: SEE COMMENTS @ LINE 15 REGARDING SHIELD VS BREAKOUT BOARD USAGE.
|
||||||
|
|
||||||
|
// Graphics library by ladyada/adafruit with init code from Rossum
|
||||||
|
// MIT license
|
||||||
|
|
||||||
|
#ifndef _ADAFRUIT_TFTLCD_H_
|
||||||
|
#define _ADAFRUIT_TFTLCD_H_
|
||||||
|
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Adafruit_GFX.h>
|
||||||
|
|
||||||
|
// **** IF USING THE LCD BREAKOUT BOARD, COMMENT OUT THIS NEXT LINE. ****
|
||||||
|
// **** IF USING THE LCD SHIELD, LEAVE THE LINE ENABLED: ****
|
||||||
|
|
||||||
|
//#define USE_ADAFRUIT_SHIELD_PINOUT 1
|
||||||
|
|
||||||
|
class Adafruit_TFTLCD : public Adafruit_GFX {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Adafruit_TFTLCD(uint8_t cs, uint8_t cd, uint8_t wr, uint8_t rd, uint8_t rst);
|
||||||
|
Adafruit_TFTLCD(void);
|
||||||
|
|
||||||
|
void begin(uint16_t id = 0x9325);
|
||||||
|
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||||
|
void drawFastHLine(int16_t x0, int16_t y0, int16_t w, uint16_t color);
|
||||||
|
void drawFastVLine(int16_t x0, int16_t y0, int16_t h, uint16_t color);
|
||||||
|
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t c);
|
||||||
|
void fillScreen(uint16_t color);
|
||||||
|
void reset(void);
|
||||||
|
void setRegisters8(uint8_t *ptr, uint8_t n);
|
||||||
|
void setRegisters16(uint16_t *ptr, uint8_t n);
|
||||||
|
void setRotation(uint8_t x);
|
||||||
|
// These methods are public in order for BMP examples to work:
|
||||||
|
void setAddrWindow(int x1, int y1, int x2, int y2);
|
||||||
|
void pushColors(uint16_t *data, uint8_t len, boolean first);
|
||||||
|
|
||||||
|
uint16_t color565(uint8_t r, uint8_t g, uint8_t b),
|
||||||
|
readPixel(int16_t x, int16_t y),
|
||||||
|
readID(void);
|
||||||
|
uint32_t readReg(uint8_t r);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void init(),
|
||||||
|
// These items may have previously been defined as macros
|
||||||
|
// in pin_magic.h. If not, function versions are declared:
|
||||||
|
#ifndef write8
|
||||||
|
write8(uint8_t value),
|
||||||
|
#endif
|
||||||
|
#ifndef setWriteDir
|
||||||
|
setWriteDir(void),
|
||||||
|
#endif
|
||||||
|
#ifndef setReadDir
|
||||||
|
setReadDir(void),
|
||||||
|
#endif
|
||||||
|
#ifndef writeRegister8
|
||||||
|
writeRegister8(uint8_t a, uint8_t d),
|
||||||
|
#endif
|
||||||
|
#ifndef writeRegister16
|
||||||
|
writeRegister16(uint16_t a, uint16_t d),
|
||||||
|
#endif
|
||||||
|
writeRegister24(uint8_t a, uint32_t d),
|
||||||
|
writeRegister32(uint8_t a, uint32_t d),
|
||||||
|
#ifndef writeRegisterPair
|
||||||
|
writeRegisterPair(uint8_t aH, uint8_t aL, uint16_t d),
|
||||||
|
#endif
|
||||||
|
setLR(void),
|
||||||
|
flood(uint16_t color, uint32_t len);
|
||||||
|
uint8_t driver;
|
||||||
|
|
||||||
|
#ifndef read8
|
||||||
|
uint8_t read8fn(void);
|
||||||
|
#define read8isFunctionalized
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_ADAFRUIT_SHIELD_PINOUT
|
||||||
|
|
||||||
|
#ifdef __AVR__
|
||||||
|
volatile uint8_t *csPort , *cdPort , *wrPort , *rdPort;
|
||||||
|
uint8_t csPinSet , cdPinSet , wrPinSet , rdPinSet ,
|
||||||
|
csPinUnset, cdPinUnset, wrPinUnset, rdPinUnset,
|
||||||
|
_reset;
|
||||||
|
#endif
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
|
Pio *csPort , *cdPort , *wrPort , *rdPort;
|
||||||
|
uint32_t csPinSet , cdPinSet , wrPinSet , rdPinSet ,
|
||||||
|
csPinUnset, cdPinUnset, wrPinUnset, rdPinUnset,
|
||||||
|
_reset;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
// For compatibility with sketches written for older versions of library.
|
||||||
|
// Color function name was changed to 'color565' for parity with 2.2" LCD
|
||||||
|
// library.
|
||||||
|
#define Color565 color565
|
||||||
|
|
||||||
|
#endif
|
BIN
Adafruit_TFTLCD/bitmaps/miniwoof.bmp
Normal file
BIN
Adafruit_TFTLCD/bitmaps/miniwoof.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
Adafruit_TFTLCD/bitmaps/test.bmp
Normal file
BIN
Adafruit_TFTLCD/bitmaps/test.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 KiB |
BIN
Adafruit_TFTLCD/bitmaps/woof.bmp
Normal file
BIN
Adafruit_TFTLCD/bitmaps/woof.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 KiB |
410
Adafruit_TFTLCD/pin_magic.h
Normal file
410
Adafruit_TFTLCD/pin_magic.h
Normal file
@ -0,0 +1,410 @@
|
|||||||
|
#ifndef _pin_magic_
|
||||||
|
#define _pin_magic_
|
||||||
|
|
||||||
|
// This header file serves two purposes:
|
||||||
|
//
|
||||||
|
// 1) Isolate non-portable MCU port- and pin-specific identifiers and
|
||||||
|
// operations so the library code itself remains somewhat agnostic
|
||||||
|
// (PORTs and pin numbers are always referenced through macros).
|
||||||
|
//
|
||||||
|
// 2) GCC doesn't always respect the "inline" keyword, so this is a
|
||||||
|
// ham-fisted manner of forcing the issue to minimize function calls.
|
||||||
|
// This sometimes makes the library a bit bigger than before, but fast++.
|
||||||
|
// However, because they're macros, we need to be SUPER CAREFUL about
|
||||||
|
// parameters -- for example, write8(x) may expand to multiple PORT
|
||||||
|
// writes that all refer to x, so it needs to be a constant or fixed
|
||||||
|
// variable and not something like *ptr++ (which, after macro
|
||||||
|
// expansion, may increment the pointer repeatedly and run off into
|
||||||
|
// la-la land). Macros also give us fine-grained control over which
|
||||||
|
// operations are inlined on which boards (balancing speed against
|
||||||
|
// available program space).
|
||||||
|
|
||||||
|
// When using the TFT shield, control and data pins exist in set physical
|
||||||
|
// locations, but the ports and bitmasks corresponding to each vary among
|
||||||
|
// boards. A separate set of pin definitions is given for each supported
|
||||||
|
// board type.
|
||||||
|
// When using the TFT breakout board, control pins are configurable but
|
||||||
|
// the data pins are still fixed -- making every data pin configurable
|
||||||
|
// would be much too slow. The data pin layouts are not the same between
|
||||||
|
// the shield and breakout configurations -- for the latter, pins were
|
||||||
|
// chosen to keep the tutorial wiring manageable more than making optimal
|
||||||
|
// use of ports and bitmasks. So there's a second set of pin definitions
|
||||||
|
// given for each supported board.
|
||||||
|
|
||||||
|
// Shield pin usage:
|
||||||
|
// LCD Data Bit : 7 6 5 4 3 2 1 0
|
||||||
|
// Digital pin #: 7 6 13 4 11 10 9 8
|
||||||
|
// Uno port/pin : PD7 PD6 PB5 PD4 PB3 PB2 PB1 PB0
|
||||||
|
// Mega port/pin: PH4 PH3 PB7 PG5 PB5 PB4 PH6 PH5
|
||||||
|
// Leo port/pin : PE6 PD7 PC7 PD4 PB7 PB6 PB5 PB4
|
||||||
|
// Due port/pin : PC23 PC24 PB27 PC26 PD7 PC29 PC21 PC22
|
||||||
|
// Breakout pin usage:
|
||||||
|
// LCD Data Bit : 7 6 5 4 3 2 1 0
|
||||||
|
// Uno dig. pin : 7 6 5 4 3 2 9 8
|
||||||
|
// Uno port/pin : PD7 PD6 PD5 PD4 PD3 PD2 PB1 PB0
|
||||||
|
// Mega dig. pin: 29 28 27 26 25 24 23 22
|
||||||
|
// Mega port/pin: PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 (one contiguous PORT)
|
||||||
|
// Leo dig. pin : 7 6 5 4 3 2 9 8
|
||||||
|
// Leo port/pin : PE6 PD7 PC6 PD4 PD0 PD1 PB5 PB4
|
||||||
|
// Due dig. pin : 40 39 38 37 36 35 34 33
|
||||||
|
// Due port/pin : PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 (one contiguous PORT. -ish…)
|
||||||
|
|
||||||
|
// Pixel read operations require a minimum 400 nS delay from RD_ACTIVE
|
||||||
|
// to polling the input pins. At 16 MHz, one machine cycle is 62.5 nS.
|
||||||
|
// This code burns 7 cycles (437.5 nS) doing nothing; the RJMPs are
|
||||||
|
// equivalent to two NOPs each, final NOP burns the 7th cycle, and the
|
||||||
|
// last line is a radioactive mutant emoticon.
|
||||||
|
#define DELAY7 \
|
||||||
|
asm volatile( \
|
||||||
|
"rjmp .+0" "\n\t" \
|
||||||
|
"rjmp .+0" "\n\t" \
|
||||||
|
"rjmp .+0" "\n\t" \
|
||||||
|
"nop" "\n" \
|
||||||
|
::);
|
||||||
|
|
||||||
|
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__) || defined(__AVR_ATmega8__)
|
||||||
|
|
||||||
|
// Arduino Uno, Duemilanove, etc.
|
||||||
|
|
||||||
|
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
|
||||||
|
|
||||||
|
// LCD control lines:
|
||||||
|
// RD (read), WR (write), CD (command/data), CS (chip select)
|
||||||
|
#define RD_PORT PORTC /*pin A0 */
|
||||||
|
#define WR_PORT PORTC /*pin A1 */
|
||||||
|
#define CD_PORT PORTC /*pin A2 */
|
||||||
|
#define CS_PORT PORTC /*pin A3 */
|
||||||
|
#define RD_MASK B00000001
|
||||||
|
#define WR_MASK B00000010
|
||||||
|
#define CD_MASK B00000100
|
||||||
|
#define CS_MASK B00001000
|
||||||
|
|
||||||
|
// These are macros for I/O operations...
|
||||||
|
|
||||||
|
// Write 8-bit value to LCD data lines
|
||||||
|
#define write8inline(d) { \
|
||||||
|
PORTD = (PORTD & B00101111) | ((d) & B11010000); \
|
||||||
|
PORTB = (PORTB & B11010000) | ((d) & B00101111); \
|
||||||
|
WR_STROBE; } // STROBEs are defined later
|
||||||
|
|
||||||
|
// Read 8-bit value from LCD data lines. The signle argument
|
||||||
|
// is a destination variable; this isn't a function and doesn't
|
||||||
|
// return a value in the conventional sense.
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
DELAY7; \
|
||||||
|
result = (PIND & B11010000) | (PINB & B00101111); \
|
||||||
|
RD_IDLE; }
|
||||||
|
|
||||||
|
// These set the PORT directions as required before the write and read
|
||||||
|
// operations. Because write operations are much more common than reads,
|
||||||
|
// the data-reading functions in the library code set the PORT(s) to
|
||||||
|
// input before a read, and restore them back to the write state before
|
||||||
|
// returning. This avoids having to set it for output inside every
|
||||||
|
// drawing method. The default state has them initialized for writes.
|
||||||
|
#define setWriteDirInline() { DDRD |= B11010000; DDRB |= B00101111; }
|
||||||
|
#define setReadDirInline() { DDRD &= ~B11010000; DDRB &= ~B00101111; }
|
||||||
|
|
||||||
|
#else // Uno w/Breakout board
|
||||||
|
|
||||||
|
#define write8inline(d) { \
|
||||||
|
PORTD = (PORTD & B00000111) | ((d) & B11111000); \
|
||||||
|
PORTB = (PORTB & B11111100) | ((d) & B00000011); \
|
||||||
|
PORTC = (PORTC & B11011111) | (((d) & B00000100) << 3); \
|
||||||
|
WR_STROBE; }
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
DELAY7; \
|
||||||
|
result = (PIND & B11111000) | (PINB & B00000011) | ((PINC & B00100000) >> 3); \
|
||||||
|
RD_IDLE; }
|
||||||
|
#define setWriteDirInline() { DDRD |= B11111000; DDRB |= B00000011; DDRC |= B00100000; }
|
||||||
|
#define setReadDirInline() { DDRD &= ~B11111000; DDRB &= ~B00000011; DDRC &= ~B00100000; }
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// As part of the inline control, macros reference other macros...if any
|
||||||
|
// of these are left undefined, an equivalent function version (non-inline)
|
||||||
|
// is declared later. The Uno has a moderate amount of program space, so
|
||||||
|
// only write8() is inlined -- that one provides the most performance
|
||||||
|
// benefit, but unfortunately also generates the most bloat. This is
|
||||||
|
// why only certain cases are inlined for each board.
|
||||||
|
#define write8 write8inline
|
||||||
|
|
||||||
|
#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
|
||||||
|
|
||||||
|
// Arduino Mega, ADK, etc.
|
||||||
|
|
||||||
|
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
|
||||||
|
|
||||||
|
#define RD_PORT PORTF
|
||||||
|
#define WR_PORT PORTF
|
||||||
|
#define CD_PORT PORTF
|
||||||
|
#define CS_PORT PORTF
|
||||||
|
#define RD_MASK B00000001
|
||||||
|
#define WR_MASK B00000010
|
||||||
|
#define CD_MASK B00000100
|
||||||
|
#define CS_MASK B00001000
|
||||||
|
|
||||||
|
#define write8inline(d) { \
|
||||||
|
PORTH = (PORTH&B10000111)|(((d)&B11000000)>>3)|(((d)&B00000011)<<5); \
|
||||||
|
PORTB = (PORTB&B01001111)|(((d)&B00101100)<<2); \
|
||||||
|
PORTG = (PORTG&B11011111)|(((d)&B00010000)<<1); \
|
||||||
|
WR_STROBE; }
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
DELAY7; \
|
||||||
|
result = ((PINH & B00011000) << 3) | ((PINB & B10110000) >> 2) | \
|
||||||
|
((PING & B00100000) >> 1) | ((PINH & B01100000) >> 5); \
|
||||||
|
RD_IDLE; }
|
||||||
|
#define setWriteDirInline() { \
|
||||||
|
DDRH |= B01111000; DDRB |= B10110000; DDRG |= B00100000; }
|
||||||
|
#define setReadDirInline() { \
|
||||||
|
DDRH &= ~B01111000; DDRB &= ~B10110000; DDRG &= ~B00100000; }
|
||||||
|
|
||||||
|
#else // Mega w/Breakout board
|
||||||
|
|
||||||
|
#define write8inline(d) { PORTA = (d); WR_STROBE; }
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
DELAY7; \
|
||||||
|
result = PINA; \
|
||||||
|
RD_IDLE; }
|
||||||
|
#define setWriteDirInline() DDRA = 0xff
|
||||||
|
#define setReadDirInline() DDRA = 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// All of the functions are inlined on the Arduino Mega. When using the
|
||||||
|
// breakout board, the macro versions aren't appreciably larger than the
|
||||||
|
// function equivalents, and they're super simple and fast. When using
|
||||||
|
// the shield, the macros become pretty complicated...but this board has
|
||||||
|
// so much code space, the macros are used anyway. If you need to free
|
||||||
|
// up program space, some macros can be removed, at a minor cost in speed.
|
||||||
|
#define write8 write8inline
|
||||||
|
#define read8 read8inline
|
||||||
|
#define setWriteDir setWriteDirInline
|
||||||
|
#define setReadDir setReadDirInline
|
||||||
|
#define writeRegister8 writeRegister8inline
|
||||||
|
#define writeRegister16 writeRegister16inline
|
||||||
|
#define writeRegisterPair writeRegisterPairInline
|
||||||
|
|
||||||
|
#elif defined(__AVR_ATmega32U4__)
|
||||||
|
|
||||||
|
// Arduino Leonardo
|
||||||
|
|
||||||
|
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
|
||||||
|
|
||||||
|
#define RD_PORT PORTF
|
||||||
|
#define WR_PORT PORTF
|
||||||
|
#define CD_PORT PORTF
|
||||||
|
#define CS_PORT PORTF
|
||||||
|
#define RD_MASK B10000000
|
||||||
|
#define WR_MASK B01000000
|
||||||
|
#define CD_MASK B00100000
|
||||||
|
#define CS_MASK B00010000
|
||||||
|
|
||||||
|
#define write8inline(d) { \
|
||||||
|
PORTE = (PORTE & B10111111) | (((d) & B10000000)>>1); \
|
||||||
|
PORTD = (PORTD & B01101111) | (((d) & B01000000)<<1) | ((d) & B00010000); \
|
||||||
|
PORTC = (PORTC & B01111111) | (((d) & B00100000)<<2); \
|
||||||
|
PORTB = (PORTB & B00001111) | (((d) & B00001111)<<4); \
|
||||||
|
WR_STROBE; }
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
DELAY7; \
|
||||||
|
result = ((PINE & B01000000) << 1) | ((PIND & B10000000) >> 1) | \
|
||||||
|
((PINC & B10000000) >> 2) | ((PINB & B11110000) >> 4) | \
|
||||||
|
(PIND & B00010000); \
|
||||||
|
RD_IDLE; }
|
||||||
|
#define setWriteDirInline() { \
|
||||||
|
DDRE |= B01000000; DDRD |= B10010000; \
|
||||||
|
DDRC |= B10000000; DDRB |= B11110000; }
|
||||||
|
#define setReadDirInline() { \
|
||||||
|
DDRE &= ~B01000000; DDRD &= ~B10010000; \
|
||||||
|
DDRC &= ~B10000000; DDRB &= ~B11110000; }
|
||||||
|
|
||||||
|
#else // Leonardo w/Breakout board
|
||||||
|
|
||||||
|
#define write8inline(d) { \
|
||||||
|
uint8_t dr1 = (d) >> 1, dl1 = (d) << 1; \
|
||||||
|
PORTE = (PORTE & B10111111) | (dr1 & B01000000); \
|
||||||
|
PORTD = (PORTD & B01101100) | (dl1 & B10000000) | (((d) & B00001000)>>3) |\
|
||||||
|
(dr1 & B00000010) | ((d) & B00010000); \
|
||||||
|
PORTC = (PORTC & B10111111) | (dl1 & B01000000); \
|
||||||
|
PORTB = (PORTB & B11001111) |(((d) & B00000011)<<4); \
|
||||||
|
WR_STROBE; }
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
DELAY7; \
|
||||||
|
result = (((PINE & B01000000) | (PIND & B00000010)) << 1) | \
|
||||||
|
(((PINC & B01000000) | (PIND & B10000000)) >> 1) | \
|
||||||
|
((PIND & B00000001) << 3) | ((PINB & B00110000) >> 4) | \
|
||||||
|
(PIND & B00010000); \
|
||||||
|
RD_IDLE; }
|
||||||
|
#define setWriteDirInline() { \
|
||||||
|
DDRE |= B01000000; DDRD |= B10010011; \
|
||||||
|
DDRC |= B01000000; DDRB |= B00110000; }
|
||||||
|
#define setReadDirInline() { \
|
||||||
|
DDRE &= ~B01000000; DDRD &= ~B10010011; \
|
||||||
|
DDRC &= ~B01000000; DDRB &= ~B00110000; }
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// On the Leonardo, only the write8() macro is used -- though even that
|
||||||
|
// might be excessive given the code size and available program space
|
||||||
|
// on this board. You may need to disable this to get any sizable
|
||||||
|
// program to compile.
|
||||||
|
#define write8 write8inline
|
||||||
|
|
||||||
|
#elif defined(__SAM3X8E__)
|
||||||
|
|
||||||
|
// Arduino Due
|
||||||
|
|
||||||
|
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
|
||||||
|
|
||||||
|
#define RD_PORT PIOA /*pin A0 */
|
||||||
|
#define WR_PORT PIOA /*pin A1 */
|
||||||
|
#define CD_PORT PIOA /*pin A2 */
|
||||||
|
#define CS_PORT PIOA /*pin A3 */
|
||||||
|
#define RD_MASK 0x00010000
|
||||||
|
#define WR_MASK 0x01000000
|
||||||
|
#define CD_MASK 0x00800000
|
||||||
|
#define CS_MASK 0x00400000
|
||||||
|
|
||||||
|
#define write8inline(d) { \
|
||||||
|
PIO_Set(PIOD, (((d) & 0x08)<<(7-3))); \
|
||||||
|
PIO_Clear(PIOD, (((~d) & 0x08)<<(7-3))); \
|
||||||
|
PIO_Set(PIOC, (((d) & 0x01)<<(22-0)) | (((d) & 0x02)<<(21-1))| (((d) & 0x04)<<(29-2))| (((d) & 0x10)<<(26-4))| (((d) & 0x40)<<(24-6))| (((d) & 0x80)<<(23-7))); \
|
||||||
|
PIO_Clear(PIOC, (((~d) & 0x01)<<(22-0)) | (((~d) & 0x02)<<(21-1))| (((~d) & 0x04)<<(29-2))| (((~d) & 0x10)<<(26-4))| (((~d) & 0x40)<<(24-6))| (((~d) & 0x80)<<(23-7))); \
|
||||||
|
PIO_Set(PIOB, (((d) & 0x20)<<(27-5))); \
|
||||||
|
PIO_Clear(PIOB, (((~d) & 0x20)<<(27-5))); \
|
||||||
|
WR_STROBE; }
|
||||||
|
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
delayMicroseconds(1); \
|
||||||
|
result = (((PIOC->PIO_PDSR & (1<<23)) >> (23-7)) | ((PIOC->PIO_PDSR & (1<<24)) >> (24-6)) | \
|
||||||
|
((PIOB->PIO_PDSR & (1<<27)) >> (27-5)) | ((PIOC->PIO_PDSR & (1<<26)) >> (26-4)) | \
|
||||||
|
((PIOD->PIO_PDSR & (1<< 7)) >> ( 7-3)) | ((PIOC->PIO_PDSR & (1<<29)) >> (29-2)) | \
|
||||||
|
((PIOC->PIO_PDSR & (1<<21)) >> (21-1)) | ((PIOC->PIO_PDSR & (1<<22)) >> (22-0))); \
|
||||||
|
RD_IDLE;}
|
||||||
|
|
||||||
|
#define setWriteDirInline() { \
|
||||||
|
PIOD->PIO_MDDR |= 0x00000080; /*PIOD->PIO_SODR = 0x00000080;*/ PIOD->PIO_OER |= 0x00000080; PIOD->PIO_PER |= 0x00000080; \
|
||||||
|
PIOC->PIO_MDDR |= 0x25E00000; /*PIOC->PIO_SODR = 0x25E00000;*/ PIOC->PIO_OER |= 0x25E00000; PIOC->PIO_PER |= 0x25E00000; \
|
||||||
|
PIOB->PIO_MDDR |= 0x08000000; /*PIOB->PIO_SODR = 0x08000000;*/ PIOB->PIO_OER |= 0x08000000; PIOB->PIO_PER |= 0x08000000; }
|
||||||
|
|
||||||
|
#define setReadDirInline() { \
|
||||||
|
pmc_enable_periph_clk( ID_PIOD ) ; pmc_enable_periph_clk( ID_PIOC ) ; pmc_enable_periph_clk( ID_PIOB ) ; \
|
||||||
|
PIOD->PIO_PUDR |= 0x00000080; PIOD->PIO_IFDR |= 0x00000080; PIOD->PIO_ODR |= 0x00000080; PIOD->PIO_PER |= 0x00000080; \
|
||||||
|
PIOC->PIO_PUDR |= 0x25E00000; PIOC->PIO_IFDR |= 0x25E00000; PIOC->PIO_ODR |= 0x25E00000; PIOC->PIO_PER |= 0x25E00000; \
|
||||||
|
PIOB->PIO_PUDR |= 0x08000000; PIOB->PIO_IFDR |= 0x08000000; PIOB->PIO_ODR |= 0x08000000; PIOB->PIO_PER |= 0x08000000; }
|
||||||
|
|
||||||
|
// Control signals are ACTIVE LOW (idle is HIGH)
|
||||||
|
// Command/Data: LOW = command, HIGH = data
|
||||||
|
// These are single-instruction operations and always inline
|
||||||
|
#define RD_ACTIVE RD_PORT->PIO_CODR |= RD_MASK
|
||||||
|
#define RD_IDLE RD_PORT->PIO_SODR |= RD_MASK
|
||||||
|
#define WR_ACTIVE WR_PORT->PIO_CODR |= WR_MASK
|
||||||
|
#define WR_IDLE WR_PORT->PIO_SODR |= WR_MASK
|
||||||
|
#define CD_COMMAND CD_PORT->PIO_CODR |= CD_MASK
|
||||||
|
#define CD_DATA CD_PORT->PIO_SODR |= CD_MASK
|
||||||
|
#define CS_ACTIVE CS_PORT->PIO_CODR |= CS_MASK
|
||||||
|
#define CS_IDLE CS_PORT->PIO_SODR |= CS_MASK
|
||||||
|
|
||||||
|
|
||||||
|
#else // Due w/Breakout board
|
||||||
|
|
||||||
|
#define write8inline(d) { \
|
||||||
|
PIO_Set(PIOC, (((d) & 0xFF)<<1)); \
|
||||||
|
PIO_Clear(PIOC, (((~d) & 0xFF)<<1)); \
|
||||||
|
WR_STROBE; }
|
||||||
|
|
||||||
|
#define read8inline(result) { \
|
||||||
|
RD_ACTIVE; \
|
||||||
|
delayMicroseconds(1); \
|
||||||
|
result = ((PIOC->PIO_PDSR & 0x1FE) >> 1); \
|
||||||
|
RD_IDLE;}
|
||||||
|
|
||||||
|
#define setWriteDirInline() { \
|
||||||
|
PIOC->PIO_MDDR |= 0x000001FE; /*PIOC->PIO_SODR |= 0x000001FE;*/ PIOC->PIO_OER |= 0x000001FE; PIOC->PIO_PER |= 0x000001FE; }
|
||||||
|
|
||||||
|
#define setReadDirInline() { \
|
||||||
|
pmc_enable_periph_clk( ID_PIOC ) ; \
|
||||||
|
PIOC->PIO_PUDR |= 0x000001FE; PIOC->PIO_IFDR |= 0x000001FE; PIOC->PIO_ODR |= 0x000001FE; PIOC->PIO_PER |= 0x000001FE; }
|
||||||
|
|
||||||
|
// When using the TFT breakout board, control pins are configurable.
|
||||||
|
#define RD_ACTIVE rdPort->PIO_CODR |= rdPinSet //PIO_Clear(rdPort, rdPinSet)
|
||||||
|
#define RD_IDLE rdPort->PIO_SODR |= rdPinSet //PIO_Set(rdPort, rdPinSet)
|
||||||
|
#define WR_ACTIVE wrPort->PIO_CODR |= wrPinSet //PIO_Clear(wrPort, wrPinSet)
|
||||||
|
#define WR_IDLE wrPort->PIO_SODR |= wrPinSet //PIO_Set(wrPort, wrPinSet)
|
||||||
|
#define CD_COMMAND cdPort->PIO_CODR |= cdPinSet //PIO_Clear(cdPort, cdPinSet)
|
||||||
|
#define CD_DATA cdPort->PIO_SODR |= cdPinSet //PIO_Set(cdPort, cdPinSet)
|
||||||
|
#define CS_ACTIVE csPort->PIO_CODR |= csPinSet //PIO_Clear(csPort, csPinSet)
|
||||||
|
#define CS_IDLE csPort->PIO_SODR |= csPinSet //PIO_Set(csPort, csPinSet)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Board type unsupported / not recognized"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__SAM3X8E__)
|
||||||
|
// Stuff common to all Arduino AVR board types:
|
||||||
|
|
||||||
|
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
|
||||||
|
|
||||||
|
// Control signals are ACTIVE LOW (idle is HIGH)
|
||||||
|
// Command/Data: LOW = command, HIGH = data
|
||||||
|
// These are single-instruction operations and always inline
|
||||||
|
#define RD_ACTIVE RD_PORT &= ~RD_MASK
|
||||||
|
#define RD_IDLE RD_PORT |= RD_MASK
|
||||||
|
#define WR_ACTIVE WR_PORT &= ~WR_MASK
|
||||||
|
#define WR_IDLE WR_PORT |= WR_MASK
|
||||||
|
#define CD_COMMAND CD_PORT &= ~CD_MASK
|
||||||
|
#define CD_DATA CD_PORT |= CD_MASK
|
||||||
|
#define CS_ACTIVE CS_PORT &= ~CS_MASK
|
||||||
|
#define CS_IDLE CS_PORT |= CS_MASK
|
||||||
|
|
||||||
|
#else // Breakout board
|
||||||
|
|
||||||
|
// When using the TFT breakout board, control pins are configurable.
|
||||||
|
#define RD_ACTIVE *rdPort &= rdPinUnset
|
||||||
|
#define RD_IDLE *rdPort |= rdPinSet
|
||||||
|
#define WR_ACTIVE *wrPort &= wrPinUnset
|
||||||
|
#define WR_IDLE *wrPort |= wrPinSet
|
||||||
|
#define CD_COMMAND *cdPort &= cdPinUnset
|
||||||
|
#define CD_DATA *cdPort |= cdPinSet
|
||||||
|
#define CS_ACTIVE *csPort &= csPinUnset
|
||||||
|
#define CS_IDLE *csPort |= csPinSet
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Data write strobe, ~2 instructions and always inline
|
||||||
|
#define WR_STROBE { WR_ACTIVE; WR_IDLE; }
|
||||||
|
|
||||||
|
// These higher-level operations are usually functionalized,
|
||||||
|
// except on Mega where's there's gobs and gobs of program space.
|
||||||
|
|
||||||
|
// Set value of TFT register: 8-bit address, 8-bit value
|
||||||
|
#define writeRegister8inline(a, d) { \
|
||||||
|
CD_COMMAND; write8(a); CD_DATA; write8(d); }
|
||||||
|
|
||||||
|
// Set value of TFT register: 16-bit address, 16-bit value
|
||||||
|
// See notes at top about macro expansion, hence hi & lo temp vars
|
||||||
|
#define writeRegister16inline(a, d) { \
|
||||||
|
uint8_t hi, lo; \
|
||||||
|
hi = (a) >> 8; lo = (a); CD_COMMAND; write8(hi); write8(lo); \
|
||||||
|
hi = (d) >> 8; lo = (d); CD_DATA ; write8(hi); write8(lo); }
|
||||||
|
|
||||||
|
// Set value of 2 TFT registers: Two 8-bit addresses (hi & lo), 16-bit value
|
||||||
|
#define writeRegisterPairInline(aH, aL, d) { \
|
||||||
|
uint8_t hi = (d) >> 8, lo = (d); \
|
||||||
|
CD_COMMAND; write8(aH); CD_DATA; write8(hi); \
|
||||||
|
CD_COMMAND; write8(aL); CD_DATA; write8(lo); }
|
||||||
|
|
||||||
|
#endif // _pin_magic_
|
172
Adafruit_TFTLCD/registers.h
Normal file
172
Adafruit_TFTLCD/registers.h
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
// Register names from Peter Barrett's Microtouch code
|
||||||
|
#define ILI932X_START_OSC 0x00
|
||||||
|
#define ILI932X_DRIV_OUT_CTRL 0x01
|
||||||
|
#define ILI932X_DRIV_WAV_CTRL 0x02
|
||||||
|
#define ILI932X_ENTRY_MOD 0x03
|
||||||
|
#define ILI932X_RESIZE_CTRL 0x04
|
||||||
|
#define ILI932X_DISP_CTRL1 0x07
|
||||||
|
#define ILI932X_DISP_CTRL2 0x08
|
||||||
|
#define ILI932X_DISP_CTRL3 0x09
|
||||||
|
#define ILI932X_DISP_CTRL4 0x0A
|
||||||
|
#define ILI932X_RGB_DISP_IF_CTRL1 0x0C
|
||||||
|
#define ILI932X_FRM_MARKER_POS 0x0D
|
||||||
|
#define ILI932X_RGB_DISP_IF_CTRL2 0x0F
|
||||||
|
#define ILI932X_POW_CTRL1 0x10
|
||||||
|
#define ILI932X_POW_CTRL2 0x11
|
||||||
|
#define ILI932X_POW_CTRL3 0x12
|
||||||
|
#define ILI932X_POW_CTRL4 0x13
|
||||||
|
#define ILI932X_GRAM_HOR_AD 0x20
|
||||||
|
#define ILI932X_GRAM_VER_AD 0x21
|
||||||
|
#define ILI932X_RW_GRAM 0x22
|
||||||
|
#define ILI932X_POW_CTRL7 0x29
|
||||||
|
#define ILI932X_FRM_RATE_COL_CTRL 0x2B
|
||||||
|
#define ILI932X_GAMMA_CTRL1 0x30
|
||||||
|
#define ILI932X_GAMMA_CTRL2 0x31
|
||||||
|
#define ILI932X_GAMMA_CTRL3 0x32
|
||||||
|
#define ILI932X_GAMMA_CTRL4 0x35
|
||||||
|
#define ILI932X_GAMMA_CTRL5 0x36
|
||||||
|
#define ILI932X_GAMMA_CTRL6 0x37
|
||||||
|
#define ILI932X_GAMMA_CTRL7 0x38
|
||||||
|
#define ILI932X_GAMMA_CTRL8 0x39
|
||||||
|
#define ILI932X_GAMMA_CTRL9 0x3C
|
||||||
|
#define ILI932X_GAMMA_CTRL10 0x3D
|
||||||
|
#define ILI932X_HOR_START_AD 0x50
|
||||||
|
#define ILI932X_HOR_END_AD 0x51
|
||||||
|
#define ILI932X_VER_START_AD 0x52
|
||||||
|
#define ILI932X_VER_END_AD 0x53
|
||||||
|
#define ILI932X_GATE_SCAN_CTRL1 0x60
|
||||||
|
#define ILI932X_GATE_SCAN_CTRL2 0x61
|
||||||
|
#define ILI932X_GATE_SCAN_CTRL3 0x6A
|
||||||
|
#define ILI932X_PART_IMG1_DISP_POS 0x80
|
||||||
|
#define ILI932X_PART_IMG1_START_AD 0x81
|
||||||
|
#define ILI932X_PART_IMG1_END_AD 0x82
|
||||||
|
#define ILI932X_PART_IMG2_DISP_POS 0x83
|
||||||
|
#define ILI932X_PART_IMG2_START_AD 0x84
|
||||||
|
#define ILI932X_PART_IMG2_END_AD 0x85
|
||||||
|
#define ILI932X_PANEL_IF_CTRL1 0x90
|
||||||
|
#define ILI932X_PANEL_IF_CTRL2 0x92
|
||||||
|
#define ILI932X_PANEL_IF_CTRL3 0x93
|
||||||
|
#define ILI932X_PANEL_IF_CTRL4 0x95
|
||||||
|
#define ILI932X_PANEL_IF_CTRL5 0x97
|
||||||
|
#define ILI932X_PANEL_IF_CTRL6 0x98
|
||||||
|
|
||||||
|
#define HX8347G_COLADDRSTART_HI 0x02
|
||||||
|
#define HX8347G_COLADDRSTART_LO 0x03
|
||||||
|
#define HX8347G_COLADDREND_HI 0x04
|
||||||
|
#define HX8347G_COLADDREND_LO 0x05
|
||||||
|
#define HX8347G_ROWADDRSTART_HI 0x06
|
||||||
|
#define HX8347G_ROWADDRSTART_LO 0x07
|
||||||
|
#define HX8347G_ROWADDREND_HI 0x08
|
||||||
|
#define HX8347G_ROWADDREND_LO 0x09
|
||||||
|
#define HX8347G_MEMACCESS 0x16
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define ILI9341_SOFTRESET 0x01
|
||||||
|
#define ILI9341_SLEEPIN 0x10
|
||||||
|
#define ILI9341_SLEEPOUT 0x11
|
||||||
|
#define ILI9341_NORMALDISP 0x13
|
||||||
|
#define ILI9341_INVERTOFF 0x20
|
||||||
|
#define ILI9341_INVERTON 0x21
|
||||||
|
#define ILI9341_GAMMASET 0x26
|
||||||
|
#define ILI9341_DISPLAYOFF 0x28
|
||||||
|
#define ILI9341_DISPLAYON 0x29
|
||||||
|
#define ILI9341_COLADDRSET 0x2A
|
||||||
|
#define ILI9341_PAGEADDRSET 0x2B
|
||||||
|
#define ILI9341_MEMORYWRITE 0x2C
|
||||||
|
#define ILI9341_PIXELFORMAT 0x3A
|
||||||
|
#define ILI9341_FRAMECONTROL 0xB1
|
||||||
|
#define ILI9341_DISPLAYFUNC 0xB6
|
||||||
|
#define ILI9341_ENTRYMODE 0xB7
|
||||||
|
#define ILI9341_POWERCONTROL1 0xC0
|
||||||
|
#define ILI9341_POWERCONTROL2 0xC1
|
||||||
|
#define ILI9341_VCOMCONTROL1 0xC5
|
||||||
|
#define ILI9341_VCOMCONTROL2 0xC7
|
||||||
|
#define ILI9341_MEMCONTROL 0x36
|
||||||
|
#define ILI9341_MADCTL 0x36
|
||||||
|
|
||||||
|
#define ILI9341_MADCTL_MY 0x80
|
||||||
|
#define ILI9341_MADCTL_MX 0x40
|
||||||
|
#define ILI9341_MADCTL_MV 0x20
|
||||||
|
#define ILI9341_MADCTL_ML 0x10
|
||||||
|
#define ILI9341_MADCTL_RGB 0x00
|
||||||
|
#define ILI9341_MADCTL_BGR 0x08
|
||||||
|
#define ILI9341_MADCTL_MH 0x04
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define HX8357_NOP 0x00
|
||||||
|
#define HX8357_SWRESET 0x01
|
||||||
|
#define HX8357_RDDID 0x04
|
||||||
|
#define HX8357_RDDST 0x09
|
||||||
|
|
||||||
|
#define HX8357B_RDPOWMODE 0x0A
|
||||||
|
#define HX8357B_RDMADCTL 0x0B
|
||||||
|
#define HX8357B_RDCOLMOD 0x0C
|
||||||
|
#define HX8357B_RDDIM 0x0D
|
||||||
|
#define HX8357B_RDDSDR 0x0F
|
||||||
|
|
||||||
|
#define HX8357_SLPIN 0x10
|
||||||
|
#define HX8357_SLPOUT 0x11
|
||||||
|
#define HX8357B_PTLON 0x12
|
||||||
|
#define HX8357B_NORON 0x13
|
||||||
|
|
||||||
|
#define HX8357_INVOFF 0x20
|
||||||
|
#define HX8357_INVON 0x21
|
||||||
|
#define HX8357_DISPOFF 0x28
|
||||||
|
#define HX8357_DISPON 0x29
|
||||||
|
|
||||||
|
#define HX8357_CASET 0x2A
|
||||||
|
#define HX8357_PASET 0x2B
|
||||||
|
#define HX8357_RAMWR 0x2C
|
||||||
|
#define HX8357_RAMRD 0x2E
|
||||||
|
|
||||||
|
#define HX8357B_PTLAR 0x30
|
||||||
|
#define HX8357_TEON 0x35
|
||||||
|
#define HX8357_TEARLINE 0x44
|
||||||
|
#define HX8357_MADCTL 0x36
|
||||||
|
#define HX8357_COLMOD 0x3A
|
||||||
|
|
||||||
|
#define HX8357_SETOSC 0xB0
|
||||||
|
#define HX8357_SETPWR1 0xB1
|
||||||
|
#define HX8357B_SETDISPLAY 0xB2
|
||||||
|
#define HX8357_SETRGB 0xB3
|
||||||
|
#define HX8357D_SETCOM 0xB6
|
||||||
|
|
||||||
|
#define HX8357B_SETDISPMODE 0xB4
|
||||||
|
#define HX8357D_SETCYC 0xB4
|
||||||
|
#define HX8357B_SETOTP 0xB7
|
||||||
|
#define HX8357D_SETC 0xB9
|
||||||
|
|
||||||
|
#define HX8357B_SET_PANEL_DRIVING 0xC0
|
||||||
|
#define HX8357D_SETSTBA 0xC0
|
||||||
|
#define HX8357B_SETDGC 0xC1
|
||||||
|
#define HX8357B_SETID 0xC3
|
||||||
|
#define HX8357B_SETDDB 0xC4
|
||||||
|
#define HX8357B_SETDISPLAYFRAME 0xC5
|
||||||
|
#define HX8357B_GAMMASET 0xC8
|
||||||
|
#define HX8357B_SETCABC 0xC9
|
||||||
|
#define HX8357_SETPANEL 0xCC
|
||||||
|
|
||||||
|
|
||||||
|
#define HX8357B_SETPOWER 0xD0
|
||||||
|
#define HX8357B_SETVCOM 0xD1
|
||||||
|
#define HX8357B_SETPWRNORMAL 0xD2
|
||||||
|
|
||||||
|
#define HX8357B_RDID1 0xDA
|
||||||
|
#define HX8357B_RDID2 0xDB
|
||||||
|
#define HX8357B_RDID3 0xDC
|
||||||
|
#define HX8357B_RDID4 0xDD
|
||||||
|
|
||||||
|
#define HX8357D_SETGAMMA 0xE0
|
||||||
|
|
||||||
|
#define HX8357B_SETGAMMA 0xC8
|
||||||
|
#define HX8357B_SETPANELRELATED 0xE9
|
||||||
|
|
||||||
|
#define HX8357B_MADCTL_MY 0x80
|
||||||
|
#define HX8357B_MADCTL_MX 0x40
|
||||||
|
#define HX8357B_MADCTL_MV 0x20
|
||||||
|
#define HX8357B_MADCTL_ML 0x10
|
||||||
|
#define HX8357B_MADCTL_RGB 0x00
|
||||||
|
#define HX8357B_MADCTL_BGR 0x08
|
||||||
|
#define HX8357B_MADCTL_MH 0x04
|
696
RCSwitch/RCSwitch.cpp
Normal file
696
RCSwitch/RCSwitch.cpp
Normal file
@ -0,0 +1,696 @@
|
|||||||
|
/*
|
||||||
|
RCSwitch - Arduino libary for remote control outlet switches
|
||||||
|
Copyright (c) 2011 Suat Özgür. All right reserved.
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
- Andre Koehler / info(at)tomate-online(dot)de
|
||||||
|
- Gordeev Andrey Vladimirovich / gordeev(at)openpyro(dot)com
|
||||||
|
- Skineffect / http://forum.ardumote.com/viewtopic.php?f=2&t=46
|
||||||
|
- Dominik Fischer / dom_fischer(at)web(dot)de
|
||||||
|
- Frank Oltmanns / <first name>.<last name>(at)gmail(dot)com
|
||||||
|
- Andreas Steinel / A.<lastname>(at)gmail(dot)com
|
||||||
|
- Max Horn / max(at)quendi(dot)de
|
||||||
|
- Robert ter Vehn / <first name>.<last name>(at)gmail(dot)com
|
||||||
|
- Johann Richard / <first name>.<last name>(at)gmail(dot)com
|
||||||
|
- Vlad Gheorghe / <first name>.<last name>(at)gmail(dot)com https://github.com/vgheo
|
||||||
|
|
||||||
|
Project home: https://github.com/sui77/rc-switch/
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RCSwitch.h"
|
||||||
|
|
||||||
|
#ifdef RaspberryPi
|
||||||
|
// PROGMEM and _P functions are for AVR based microprocessors,
|
||||||
|
// so we must normalize these for the ARM processor:
|
||||||
|
#define PROGMEM
|
||||||
|
#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
|
// interrupt handler and related code must be in RAM on ESP8266,
|
||||||
|
// according to issue #46.
|
||||||
|
#define RECEIVE_ATTR ICACHE_RAM_ATTR
|
||||||
|
#else
|
||||||
|
#define RECEIVE_ATTR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Format for protocol definitions:
|
||||||
|
* {pulselength, Sync bit, "0" bit, "1" bit}
|
||||||
|
*
|
||||||
|
* pulselength: pulse length in microseconds, e.g. 350
|
||||||
|
* Sync bit: {1, 31} means 1 high pulse and 31 low pulses
|
||||||
|
* (perceived as a 31*pulselength long pulse, total length of sync bit is
|
||||||
|
* 32*pulselength microseconds), i.e:
|
||||||
|
* _
|
||||||
|
* | |_______________________________ (don't count the vertical bars)
|
||||||
|
* "0" bit: waveform for a data bit of value "0", {1, 3} means 1 high pulse
|
||||||
|
* and 3 low pulses, total length (1+3)*pulselength, i.e:
|
||||||
|
* _
|
||||||
|
* | |___
|
||||||
|
* "1" bit: waveform for a data bit of value "1", e.g. {3,1}:
|
||||||
|
* ___
|
||||||
|
* | |_
|
||||||
|
*
|
||||||
|
* These are combined to form Tri-State bits when sending or receiving codes.
|
||||||
|
*/
|
||||||
|
#ifdef ESP8266
|
||||||
|
static const RCSwitch::Protocol proto[] = {
|
||||||
|
#else
|
||||||
|
static const RCSwitch::Protocol PROGMEM proto[] = {
|
||||||
|
#endif
|
||||||
|
{ 350, { 1, 31 }, { 1, 3 }, { 3, 1 }, false }, // protocol 1
|
||||||
|
{ 650, { 1, 10 }, { 1, 2 }, { 2, 1 }, false }, // protocol 2
|
||||||
|
{ 100, { 30, 71 }, { 4, 11 }, { 9, 6 }, false }, // protocol 3
|
||||||
|
{ 380, { 1, 6 }, { 1, 3 }, { 3, 1 }, false }, // protocol 4
|
||||||
|
{ 500, { 6, 14 }, { 1, 2 }, { 2, 1 }, false }, // protocol 5
|
||||||
|
{ 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true } // protocol 6 (HT6P20B)
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
numProto = sizeof(proto) / sizeof(proto[0])
|
||||||
|
};
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
unsigned long RCSwitch::nReceivedValue = 0;
|
||||||
|
unsigned int RCSwitch::nReceivedBitlength = 0;
|
||||||
|
unsigned int RCSwitch::nReceivedDelay = 0;
|
||||||
|
unsigned int RCSwitch::nReceivedProtocol = 0;
|
||||||
|
int RCSwitch::nReceiveTolerance = 60;
|
||||||
|
const unsigned int RCSwitch::nSeparationLimit = 4600;
|
||||||
|
// separationLimit: minimum microseconds between received codes, closer codes are ignored.
|
||||||
|
// according to discussion on issue #14 it might be more suitable to set the separation
|
||||||
|
// limit to the same time as the 'low' part of the sync signal for the current protocol.
|
||||||
|
unsigned int RCSwitch::timings[RCSWITCH_MAX_CHANGES];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RCSwitch::RCSwitch() {
|
||||||
|
this->nTransmitterPin = -1;
|
||||||
|
this->setRepeatTransmit(10);
|
||||||
|
this->setProtocol(1);
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
this->nReceiverInterrupt = -1;
|
||||||
|
this->setReceiveTolerance(60);
|
||||||
|
RCSwitch::nReceivedValue = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the protocol to send.
|
||||||
|
*/
|
||||||
|
void RCSwitch::setProtocol(Protocol protocol) {
|
||||||
|
this->protocol = protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the protocol to send, from a list of predefined protocols
|
||||||
|
*/
|
||||||
|
void RCSwitch::setProtocol(int nProtocol) {
|
||||||
|
if (nProtocol < 1 || nProtocol > numProto) {
|
||||||
|
nProtocol = 1; // TODO: trigger an error, e.g. "bad protocol" ???
|
||||||
|
}
|
||||||
|
#ifdef ESP8266
|
||||||
|
this->protocol = proto[nProtocol-1];
|
||||||
|
#else
|
||||||
|
memcpy_P(&this->protocol, &proto[nProtocol-1], sizeof(Protocol));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the protocol to send with pulse length in microseconds.
|
||||||
|
*/
|
||||||
|
void RCSwitch::setProtocol(int nProtocol, int nPulseLength) {
|
||||||
|
setProtocol(nProtocol);
|
||||||
|
this->setPulseLength(nPulseLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets pulse length in microseconds
|
||||||
|
*/
|
||||||
|
void RCSwitch::setPulseLength(int nPulseLength) {
|
||||||
|
this->protocol.pulseLength = nPulseLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets Repeat Transmits
|
||||||
|
*/
|
||||||
|
void RCSwitch::setRepeatTransmit(int nRepeatTransmit) {
|
||||||
|
this->nRepeatTransmit = nRepeatTransmit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Receiving Tolerance
|
||||||
|
*/
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
void RCSwitch::setReceiveTolerance(int nPercent) {
|
||||||
|
RCSwitch::nReceiveTolerance = nPercent;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable transmissions
|
||||||
|
*
|
||||||
|
* @param nTransmitterPin Arduino Pin to which the sender is connected to
|
||||||
|
*/
|
||||||
|
void RCSwitch::enableTransmit(int nTransmitterPin) {
|
||||||
|
this->nTransmitterPin = nTransmitterPin;
|
||||||
|
pinMode(this->nTransmitterPin, OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable transmissions
|
||||||
|
*/
|
||||||
|
void RCSwitch::disableTransmit() {
|
||||||
|
this->nTransmitterPin = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch on (Type D REV)
|
||||||
|
*
|
||||||
|
* @param sGroup Code of the switch group (A,B,C,D)
|
||||||
|
* @param nDevice Number of the switch itself (1..3)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOn(char sGroup, int nDevice) {
|
||||||
|
this->sendTriState( this->getCodeWordD(sGroup, nDevice, true) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch off (Type D REV)
|
||||||
|
*
|
||||||
|
* @param sGroup Code of the switch group (A,B,C,D)
|
||||||
|
* @param nDevice Number of the switch itself (1..3)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOff(char sGroup, int nDevice) {
|
||||||
|
this->sendTriState( this->getCodeWordD(sGroup, nDevice, false) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch on (Type C Intertechno)
|
||||||
|
*
|
||||||
|
* @param sFamily Familycode (a..f)
|
||||||
|
* @param nGroup Number of group (1..4)
|
||||||
|
* @param nDevice Number of device (1..4)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOn(char sFamily, int nGroup, int nDevice) {
|
||||||
|
this->sendTriState( this->getCodeWordC(sFamily, nGroup, nDevice, true) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch off (Type C Intertechno)
|
||||||
|
*
|
||||||
|
* @param sFamily Familycode (a..f)
|
||||||
|
* @param nGroup Number of group (1..4)
|
||||||
|
* @param nDevice Number of device (1..4)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOff(char sFamily, int nGroup, int nDevice) {
|
||||||
|
this->sendTriState( this->getCodeWordC(sFamily, nGroup, nDevice, false) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch on (Type B with two rotary/sliding switches)
|
||||||
|
*
|
||||||
|
* @param nAddressCode Number of the switch group (1..4)
|
||||||
|
* @param nChannelCode Number of the switch itself (1..4)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOn(int nAddressCode, int nChannelCode) {
|
||||||
|
this->sendTriState( this->getCodeWordB(nAddressCode, nChannelCode, true) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch off (Type B with two rotary/sliding switches)
|
||||||
|
*
|
||||||
|
* @param nAddressCode Number of the switch group (1..4)
|
||||||
|
* @param nChannelCode Number of the switch itself (1..4)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOff(int nAddressCode, int nChannelCode) {
|
||||||
|
this->sendTriState( this->getCodeWordB(nAddressCode, nChannelCode, false) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated, use switchOn(const char* sGroup, const char* sDevice) instead!
|
||||||
|
* Switch a remote switch on (Type A with 10 pole DIP switches)
|
||||||
|
*
|
||||||
|
* @param sGroup Code of the switch group (refers to DIP switches 1..5 where "1" = on and "0" = off, if all DIP switches are on it's "11111")
|
||||||
|
* @param nChannelCode Number of the switch itself (1..5)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOn(const char* sGroup, int nChannel) {
|
||||||
|
const char* code[6] = { "00000", "10000", "01000", "00100", "00010", "00001" };
|
||||||
|
this->switchOn(sGroup, code[nChannel]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated, use switchOff(const char* sGroup, const char* sDevice) instead!
|
||||||
|
* Switch a remote switch off (Type A with 10 pole DIP switches)
|
||||||
|
*
|
||||||
|
* @param sGroup Code of the switch group (refers to DIP switches 1..5 where "1" = on and "0" = off, if all DIP switches are on it's "11111")
|
||||||
|
* @param nChannelCode Number of the switch itself (1..5)
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOff(const char* sGroup, int nChannel) {
|
||||||
|
const char* code[6] = { "00000", "10000", "01000", "00100", "00010", "00001" };
|
||||||
|
this->switchOff(sGroup, code[nChannel]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch on (Type A with 10 pole DIP switches)
|
||||||
|
*
|
||||||
|
* @param sGroup Code of the switch group (refers to DIP switches 1..5 where "1" = on and "0" = off, if all DIP switches are on it's "11111")
|
||||||
|
* @param sDevice Code of the switch device (refers to DIP switches 6..10 (A..E) where "1" = on and "0" = off, if all DIP switches are on it's "11111")
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOn(const char* sGroup, const char* sDevice) {
|
||||||
|
this->sendTriState( this->getCodeWordA(sGroup, sDevice, true) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch a remote switch off (Type A with 10 pole DIP switches)
|
||||||
|
*
|
||||||
|
* @param sGroup Code of the switch group (refers to DIP switches 1..5 where "1" = on and "0" = off, if all DIP switches are on it's "11111")
|
||||||
|
* @param sDevice Code of the switch device (refers to DIP switches 6..10 (A..E) where "1" = on and "0" = off, if all DIP switches are on it's "11111")
|
||||||
|
*/
|
||||||
|
void RCSwitch::switchOff(const char* sGroup, const char* sDevice) {
|
||||||
|
this->sendTriState( this->getCodeWordA(sGroup, sDevice, false) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a char[13], representing the code word to be send.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char* RCSwitch::getCodeWordA(const char* sGroup, const char* sDevice, bool bStatus) {
|
||||||
|
static char sReturn[13];
|
||||||
|
int nReturnPos = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
sReturn[nReturnPos++] = (sGroup[i] == '0') ? 'F' : '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
sReturn[nReturnPos++] = (sDevice[i] == '0') ? 'F' : '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
sReturn[nReturnPos++] = bStatus ? '0' : 'F';
|
||||||
|
sReturn[nReturnPos++] = bStatus ? 'F' : '0';
|
||||||
|
|
||||||
|
sReturn[nReturnPos] = '\0';
|
||||||
|
return sReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encoding for type B switches with two rotary/sliding switches.
|
||||||
|
*
|
||||||
|
* The code word is a tristate word and with following bit pattern:
|
||||||
|
*
|
||||||
|
* +-----------------------------+-----------------------------+----------+------------+
|
||||||
|
* | 4 bits address | 4 bits address | 3 bits | 1 bit |
|
||||||
|
* | switch group | switch number | not used | on / off |
|
||||||
|
* | 1=0FFF 2=F0FF 3=FF0F 4=FFF0 | 1=0FFF 2=F0FF 3=FF0F 4=FFF0 | FFF | on=F off=0 |
|
||||||
|
* +-----------------------------+-----------------------------+----------+------------+
|
||||||
|
*
|
||||||
|
* @param nAddressCode Number of the switch group (1..4)
|
||||||
|
* @param nChannelCode Number of the switch itself (1..4)
|
||||||
|
* @param bStatus Whether to switch on (true) or off (false)
|
||||||
|
*
|
||||||
|
* @return char[13], representing a tristate code word of length 12
|
||||||
|
*/
|
||||||
|
char* RCSwitch::getCodeWordB(int nAddressCode, int nChannelCode, bool bStatus) {
|
||||||
|
static char sReturn[13];
|
||||||
|
int nReturnPos = 0;
|
||||||
|
|
||||||
|
if (nAddressCode < 1 || nAddressCode > 4 || nChannelCode < 1 || nChannelCode > 4) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= 4; i++) {
|
||||||
|
sReturn[nReturnPos++] = (nAddressCode == i) ? '0' : 'F';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= 4; i++) {
|
||||||
|
sReturn[nReturnPos++] = (nChannelCode == i) ? '0' : 'F';
|
||||||
|
}
|
||||||
|
|
||||||
|
sReturn[nReturnPos++] = 'F';
|
||||||
|
sReturn[nReturnPos++] = 'F';
|
||||||
|
sReturn[nReturnPos++] = 'F';
|
||||||
|
|
||||||
|
sReturn[nReturnPos++] = bStatus ? 'F' : '0';
|
||||||
|
|
||||||
|
sReturn[nReturnPos] = '\0';
|
||||||
|
return sReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like getCodeWord (Type C = Intertechno)
|
||||||
|
*/
|
||||||
|
char* RCSwitch::getCodeWordC(char sFamily, int nGroup, int nDevice, bool bStatus) {
|
||||||
|
static char sReturn[13];
|
||||||
|
int nReturnPos = 0;
|
||||||
|
|
||||||
|
int nFamily = (int)sFamily - 'a';
|
||||||
|
if ( nFamily < 0 || nFamily > 15 || nGroup < 1 || nGroup > 4 || nDevice < 1 || nDevice > 4) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// encode the family into four bits
|
||||||
|
sReturn[nReturnPos++] = (nFamily & 1) ? 'F' : '0';
|
||||||
|
sReturn[nReturnPos++] = (nFamily & 2) ? 'F' : '0';
|
||||||
|
sReturn[nReturnPos++] = (nFamily & 4) ? 'F' : '0';
|
||||||
|
sReturn[nReturnPos++] = (nFamily & 8) ? 'F' : '0';
|
||||||
|
|
||||||
|
// encode the device and group
|
||||||
|
sReturn[nReturnPos++] = ((nDevice-1) & 1) ? 'F' : '0';
|
||||||
|
sReturn[nReturnPos++] = ((nDevice-1) & 2) ? 'F' : '0';
|
||||||
|
sReturn[nReturnPos++] = ((nGroup-1) & 1) ? 'F' : '0';
|
||||||
|
sReturn[nReturnPos++] = ((nGroup-1) & 2) ? 'F' : '0';
|
||||||
|
|
||||||
|
// encode the status code
|
||||||
|
sReturn[nReturnPos++] = '0';
|
||||||
|
sReturn[nReturnPos++] = 'F';
|
||||||
|
sReturn[nReturnPos++] = 'F';
|
||||||
|
sReturn[nReturnPos++] = bStatus ? 'F' : '0';
|
||||||
|
|
||||||
|
sReturn[nReturnPos] = '\0';
|
||||||
|
return sReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encoding for the REV Switch Type
|
||||||
|
*
|
||||||
|
* The code word is a tristate word and with following bit pattern:
|
||||||
|
*
|
||||||
|
* +-----------------------------+-------------------+----------+--------------+
|
||||||
|
* | 4 bits address | 3 bits address | 3 bits | 2 bits |
|
||||||
|
* | switch group | device number | not used | on / off |
|
||||||
|
* | A=1FFF B=F1FF C=FF1F D=FFF1 | 1=0FF 2=F0F 3=FF0 | 000 | on=10 off=01 |
|
||||||
|
* +-----------------------------+-------------------+----------+--------------+
|
||||||
|
*
|
||||||
|
* Source: http://www.the-intruder.net/funksteckdosen-von-rev-uber-arduino-ansteuern/
|
||||||
|
*
|
||||||
|
* @param sGroup Name of the switch group (A..D, resp. a..d)
|
||||||
|
* @param nDevice Number of the switch itself (1..3)
|
||||||
|
* @param bStatus Whether to switch on (true) or off (false)
|
||||||
|
*
|
||||||
|
* @return char[13], representing a tristate code word of length 12
|
||||||
|
*/
|
||||||
|
char* RCSwitch::getCodeWordD(char sGroup, int nDevice, bool bStatus) {
|
||||||
|
static char sReturn[13];
|
||||||
|
int nReturnPos = 0;
|
||||||
|
|
||||||
|
// sGroup must be one of the letters in "abcdABCD"
|
||||||
|
int nGroup = (sGroup >= 'a') ? (int)sGroup - 'a' : (int)sGroup - 'A';
|
||||||
|
if ( nGroup < 0 || nGroup > 3 || nDevice < 1 || nDevice > 3) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
sReturn[nReturnPos++] = (nGroup == i) ? '1' : 'F';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= 3; i++) {
|
||||||
|
sReturn[nReturnPos++] = (nDevice == i) ? '1' : 'F';
|
||||||
|
}
|
||||||
|
|
||||||
|
sReturn[nReturnPos++] = '0';
|
||||||
|
sReturn[nReturnPos++] = '0';
|
||||||
|
sReturn[nReturnPos++] = '0';
|
||||||
|
|
||||||
|
sReturn[nReturnPos++] = bStatus ? '1' : '0';
|
||||||
|
sReturn[nReturnPos++] = bStatus ? '0' : '1';
|
||||||
|
|
||||||
|
sReturn[nReturnPos] = '\0';
|
||||||
|
return sReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sCodeWord a tristate code word consisting of the letter 0, 1, F
|
||||||
|
*/
|
||||||
|
void RCSwitch::sendTriState(const char* sCodeWord) {
|
||||||
|
// turn the tristate code word into the corresponding bit pattern, then send it
|
||||||
|
unsigned long code = 0;
|
||||||
|
unsigned int length = 0;
|
||||||
|
for (const char* p = sCodeWord; *p; p++) {
|
||||||
|
code <<= 2L;
|
||||||
|
switch (*p) {
|
||||||
|
case '0':
|
||||||
|
// bit pattern 00
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
// bit pattern 01
|
||||||
|
code |= 1L;
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
// bit pattern 11
|
||||||
|
code |= 3L;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
this->send(code, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sCodeWord a binary code word consisting of the letter 0, 1
|
||||||
|
*/
|
||||||
|
void RCSwitch::send(const char* sCodeWord) {
|
||||||
|
// turn the tristate code word into the corresponding bit pattern, then send it
|
||||||
|
unsigned long code = 0;
|
||||||
|
unsigned int length = 0;
|
||||||
|
for (const char* p = sCodeWord; *p; p++) {
|
||||||
|
code <<= 1L;
|
||||||
|
if (*p != '0')
|
||||||
|
code |= 1L;
|
||||||
|
length++;
|
||||||
|
}
|
||||||
|
this->send(code, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transmit the first 'length' bits of the integer 'code'. The
|
||||||
|
* bits are sent from MSB to LSB, i.e., first the bit at position length-1,
|
||||||
|
* then the bit at position length-2, and so on, till finally the bit at position 0.
|
||||||
|
*/
|
||||||
|
void RCSwitch::send(unsigned long code, unsigned int length) {
|
||||||
|
if (this->nTransmitterPin == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
// make sure the receiver is disabled while we transmit
|
||||||
|
int nReceiverInterrupt_backup = nReceiverInterrupt;
|
||||||
|
if (nReceiverInterrupt_backup != -1) {
|
||||||
|
this->disableReceive();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int nRepeat = 0; nRepeat < nRepeatTransmit; nRepeat++) {
|
||||||
|
for (int i = length-1; i >= 0; i--) {
|
||||||
|
if (code & (1L << i))
|
||||||
|
this->transmit(protocol.one);
|
||||||
|
else
|
||||||
|
this->transmit(protocol.zero);
|
||||||
|
}
|
||||||
|
this->transmit(protocol.syncFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
// enable receiver again if we just disabled it
|
||||||
|
if (nReceiverInterrupt_backup != -1) {
|
||||||
|
this->enableReceive(nReceiverInterrupt_backup);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transmit a single high-low pulse.
|
||||||
|
*/
|
||||||
|
void RCSwitch::transmit(HighLow pulses) {
|
||||||
|
uint8_t firstLogicLevel = (this->protocol.invertedSignal) ? LOW : HIGH;
|
||||||
|
uint8_t secondLogicLevel = (this->protocol.invertedSignal) ? HIGH : LOW;
|
||||||
|
|
||||||
|
digitalWrite(this->nTransmitterPin, firstLogicLevel);
|
||||||
|
delayMicroseconds( this->protocol.pulseLength * pulses.high);
|
||||||
|
digitalWrite(this->nTransmitterPin, secondLogicLevel);
|
||||||
|
delayMicroseconds( this->protocol.pulseLength * pulses.low);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
/**
|
||||||
|
* Enable receiving data
|
||||||
|
*/
|
||||||
|
void RCSwitch::enableReceive(int interrupt) {
|
||||||
|
this->nReceiverInterrupt = interrupt;
|
||||||
|
this->enableReceive();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RCSwitch::enableReceive() {
|
||||||
|
if (this->nReceiverInterrupt != -1) {
|
||||||
|
RCSwitch::nReceivedValue = 0;
|
||||||
|
RCSwitch::nReceivedBitlength = 0;
|
||||||
|
#if defined(RaspberryPi) // Raspberry Pi
|
||||||
|
wiringPiISR(this->nReceiverInterrupt, INT_EDGE_BOTH, &handleInterrupt);
|
||||||
|
#else // Arduino
|
||||||
|
attachInterrupt(this->nReceiverInterrupt, handleInterrupt, CHANGE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable receiving data
|
||||||
|
*/
|
||||||
|
void RCSwitch::disableReceive() {
|
||||||
|
#if not defined(RaspberryPi) // Arduino
|
||||||
|
detachInterrupt(this->nReceiverInterrupt);
|
||||||
|
#endif // For Raspberry Pi (wiringPi) you can't unregister the ISR
|
||||||
|
this->nReceiverInterrupt = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RCSwitch::available() {
|
||||||
|
return RCSwitch::nReceivedValue != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RCSwitch::resetAvailable() {
|
||||||
|
RCSwitch::nReceivedValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long RCSwitch::getReceivedValue() {
|
||||||
|
return RCSwitch::nReceivedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int RCSwitch::getReceivedBitlength() {
|
||||||
|
return RCSwitch::nReceivedBitlength;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int RCSwitch::getReceivedDelay() {
|
||||||
|
return RCSwitch::nReceivedDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int RCSwitch::getReceivedProtocol() {
|
||||||
|
return RCSwitch::nReceivedProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int* RCSwitch::getReceivedRawdata() {
|
||||||
|
return RCSwitch::timings;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* helper function for the receiveProtocol method */
|
||||||
|
static inline unsigned int diff(int A, int B) {
|
||||||
|
return abs(A - B);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool RECEIVE_ATTR RCSwitch::receiveProtocol(const int p, unsigned int changeCount) {
|
||||||
|
#ifdef ESP8266
|
||||||
|
const Protocol &pro = proto[p-1];
|
||||||
|
#else
|
||||||
|
Protocol pro;
|
||||||
|
memcpy_P(&pro, &proto[p-1], sizeof(Protocol));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
unsigned long code = 0;
|
||||||
|
//Assuming the longer pulse length is the pulse captured in timings[0]
|
||||||
|
const unsigned int syncLengthInPulses = ((pro.syncFactor.low) > (pro.syncFactor.high)) ? (pro.syncFactor.low) : (pro.syncFactor.high);
|
||||||
|
const unsigned int delay = RCSwitch::timings[0] / syncLengthInPulses;
|
||||||
|
const unsigned int delayTolerance = delay * RCSwitch::nReceiveTolerance / 100;
|
||||||
|
|
||||||
|
/* For protocols that start low, the sync period looks like
|
||||||
|
* _________
|
||||||
|
* _____________| |XXXXXXXXXXXX|
|
||||||
|
*
|
||||||
|
* |--1st dur--|-2nd dur-|-Start data-|
|
||||||
|
*
|
||||||
|
* The 3rd saved duration starts the data.
|
||||||
|
*
|
||||||
|
* For protocols that start high, the sync period looks like
|
||||||
|
*
|
||||||
|
* ______________
|
||||||
|
* | |____________|XXXXXXXXXXXXX|
|
||||||
|
*
|
||||||
|
* |-filtered out-|--1st dur--|--Start data--|
|
||||||
|
*
|
||||||
|
* The 2nd saved duration starts the data
|
||||||
|
*/
|
||||||
|
const unsigned int firstDataTiming = (pro.invertedSignal) ? (2) : (1);
|
||||||
|
|
||||||
|
for (unsigned int i = firstDataTiming; i < changeCount - 1; i += 2) {
|
||||||
|
code <<= 1;
|
||||||
|
if (diff(RCSwitch::timings[i], delay * pro.zero.high) < delayTolerance &&
|
||||||
|
diff(RCSwitch::timings[i + 1], delay * pro.zero.low) < delayTolerance) {
|
||||||
|
// zero
|
||||||
|
} else if (diff(RCSwitch::timings[i], delay * pro.one.high) < delayTolerance &&
|
||||||
|
diff(RCSwitch::timings[i + 1], delay * pro.one.low) < delayTolerance) {
|
||||||
|
// one
|
||||||
|
code |= 1;
|
||||||
|
} else {
|
||||||
|
// Failed
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changeCount > 7) { // ignore very short transmissions: no device sends them, so this must be noise
|
||||||
|
RCSwitch::nReceivedValue = code;
|
||||||
|
RCSwitch::nReceivedBitlength = (changeCount - 1) / 2;
|
||||||
|
RCSwitch::nReceivedDelay = delay;
|
||||||
|
RCSwitch::nReceivedProtocol = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RECEIVE_ATTR RCSwitch::handleInterrupt() {
|
||||||
|
|
||||||
|
static unsigned int changeCount = 0;
|
||||||
|
static unsigned long lastTime = 0;
|
||||||
|
static unsigned int repeatCount = 0;
|
||||||
|
|
||||||
|
const long time = micros();
|
||||||
|
const unsigned int duration = time - lastTime;
|
||||||
|
|
||||||
|
if (duration > RCSwitch::nSeparationLimit) {
|
||||||
|
// A long stretch without signal level change occurred. This could
|
||||||
|
// be the gap between two transmission.
|
||||||
|
if (diff(duration, RCSwitch::timings[0]) < 200) {
|
||||||
|
// This long signal is close in length to the long signal which
|
||||||
|
// started the previously recorded timings; this suggests that
|
||||||
|
// it may indeed by a a gap between two transmissions (we assume
|
||||||
|
// here that a sender will send the signal multiple times,
|
||||||
|
// with roughly the same gap between them).
|
||||||
|
repeatCount++;
|
||||||
|
if (repeatCount == 2) {
|
||||||
|
for(unsigned int i = 1; i <= numProto; i++) {
|
||||||
|
if (receiveProtocol(i, changeCount)) {
|
||||||
|
// receive succeeded for protocol i
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repeatCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
changeCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// detect overflow
|
||||||
|
if (changeCount >= RCSWITCH_MAX_CHANGES) {
|
||||||
|
changeCount = 0;
|
||||||
|
repeatCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RCSwitch::timings[changeCount++] = duration;
|
||||||
|
lastTime = time;
|
||||||
|
}
|
||||||
|
#endif
|
154
RCSwitch/RCSwitch.h
Normal file
154
RCSwitch/RCSwitch.h
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
RCSwitch - Arduino libary for remote control outlet switches
|
||||||
|
Copyright (c) 2011 Suat Özgür. All right reserved.
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
- Andre Koehler / info(at)tomate-online(dot)de
|
||||||
|
- Gordeev Andrey Vladimirovich / gordeev(at)openpyro(dot)com
|
||||||
|
- Skineffect / http://forum.ardumote.com/viewtopic.php?f=2&t=46
|
||||||
|
- Dominik Fischer / dom_fischer(at)web(dot)de
|
||||||
|
- Frank Oltmanns / <first name>.<last name>(at)gmail(dot)com
|
||||||
|
- Max Horn / max(at)quendi(dot)de
|
||||||
|
- Robert ter Vehn / <first name>.<last name>(at)gmail(dot)com
|
||||||
|
|
||||||
|
Project home: https://github.com/sui77/rc-switch/
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
#ifndef _RCSwitch_h
|
||||||
|
#define _RCSwitch_h
|
||||||
|
|
||||||
|
#if defined(ARDUINO) && ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#elif defined(ENERGIA) // LaunchPad, FraunchPad and StellarPad specific
|
||||||
|
#include "Energia.h"
|
||||||
|
#elif defined(RPI) // Raspberry Pi
|
||||||
|
#define RaspberryPi
|
||||||
|
|
||||||
|
// Include libraries for RPi:
|
||||||
|
#include <string.h> /* memcpy */
|
||||||
|
#include <stdlib.h> /* abs */
|
||||||
|
#include <wiringPi.h>
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
// At least for the ATTiny X4/X5, receiving has to be disabled due to
|
||||||
|
// missing libm depencies (udivmodhi4)
|
||||||
|
#if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )
|
||||||
|
#define RCSwitchDisableReceiving
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Number of maximum High/Low changes per packet.
|
||||||
|
// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
|
||||||
|
#define RCSWITCH_MAX_CHANGES 67
|
||||||
|
|
||||||
|
class RCSwitch {
|
||||||
|
|
||||||
|
public:
|
||||||
|
RCSwitch();
|
||||||
|
|
||||||
|
void switchOn(int nGroupNumber, int nSwitchNumber);
|
||||||
|
void switchOff(int nGroupNumber, int nSwitchNumber);
|
||||||
|
void switchOn(const char* sGroup, int nSwitchNumber);
|
||||||
|
void switchOff(const char* sGroup, int nSwitchNumber);
|
||||||
|
void switchOn(char sFamily, int nGroup, int nDevice);
|
||||||
|
void switchOff(char sFamily, int nGroup, int nDevice);
|
||||||
|
void switchOn(const char* sGroup, const char* sDevice);
|
||||||
|
void switchOff(const char* sGroup, const char* sDevice);
|
||||||
|
void switchOn(char sGroup, int nDevice);
|
||||||
|
void switchOff(char sGroup, int nDevice);
|
||||||
|
|
||||||
|
void sendTriState(const char* sCodeWord);
|
||||||
|
void send(unsigned long code, unsigned int length);
|
||||||
|
void send(const char* sCodeWord);
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
void enableReceive(int interrupt);
|
||||||
|
void enableReceive();
|
||||||
|
void disableReceive();
|
||||||
|
bool available();
|
||||||
|
void resetAvailable();
|
||||||
|
|
||||||
|
unsigned long getReceivedValue();
|
||||||
|
unsigned int getReceivedBitlength();
|
||||||
|
unsigned int getReceivedDelay();
|
||||||
|
unsigned int getReceivedProtocol();
|
||||||
|
unsigned int* getReceivedRawdata();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void enableTransmit(int nTransmitterPin);
|
||||||
|
void disableTransmit();
|
||||||
|
void setPulseLength(int nPulseLength);
|
||||||
|
void setRepeatTransmit(int nRepeatTransmit);
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
void setReceiveTolerance(int nPercent);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct HighLow {
|
||||||
|
uint8_t high;
|
||||||
|
uint8_t low;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Protocol {
|
||||||
|
int pulseLength;
|
||||||
|
HighLow syncFactor;
|
||||||
|
HighLow zero;
|
||||||
|
HighLow one;
|
||||||
|
/** @brief if true inverts the high and low logic levels in the HighLow structs */
|
||||||
|
bool invertedSignal;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setProtocol(Protocol protocol);
|
||||||
|
void setProtocol(int nProtocol);
|
||||||
|
void setProtocol(int nProtocol, int nPulseLength);
|
||||||
|
|
||||||
|
private:
|
||||||
|
char* getCodeWordA(const char* sGroup, const char* sDevice, bool bStatus);
|
||||||
|
char* getCodeWordB(int nGroupNumber, int nSwitchNumber, bool bStatus);
|
||||||
|
char* getCodeWordC(char sFamily, int nGroup, int nDevice, bool bStatus);
|
||||||
|
char* getCodeWordD(char group, int nDevice, bool bStatus);
|
||||||
|
void transmit(HighLow pulses);
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
static void handleInterrupt();
|
||||||
|
static bool receiveProtocol(const int p, unsigned int changeCount);
|
||||||
|
int nReceiverInterrupt;
|
||||||
|
#endif
|
||||||
|
int nTransmitterPin;
|
||||||
|
int nRepeatTransmit;
|
||||||
|
|
||||||
|
Protocol protocol;
|
||||||
|
|
||||||
|
#if not defined( RCSwitchDisableReceiving )
|
||||||
|
static int nReceiveTolerance;
|
||||||
|
static unsigned long nReceivedValue;
|
||||||
|
static unsigned int nReceivedBitlength;
|
||||||
|
static unsigned int nReceivedDelay;
|
||||||
|
static unsigned int nReceivedProtocol;
|
||||||
|
const static unsigned int nSeparationLimit;
|
||||||
|
/*
|
||||||
|
* timings[0] contains sync timing, followed by a number of bits
|
||||||
|
*/
|
||||||
|
static unsigned int timings[RCSWITCH_MAX_CHANGES];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
201
SPI/SPI.cpp
Normal file
201
SPI/SPI.cpp
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010 by Cristian Maglie <c.maglie@arduino.cc>
|
||||||
|
* Copyright (c) 2014 by Paul Stoffregen <paul@pjrc.com> (Transaction API)
|
||||||
|
* Copyright (c) 2014 by Matthijs Kooijman <matthijs@stdin.nl> (SPISettings AVR)
|
||||||
|
* Copyright (c) 2014 by Andrew J. Kroll <xxxajk@gmail.com> (atomicity fixes)
|
||||||
|
* SPI Master library for arduino.
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of either the GNU General Public License version 2
|
||||||
|
* or the GNU Lesser General Public License version 2.1, both as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SPI.h"
|
||||||
|
|
||||||
|
SPIClass SPI;
|
||||||
|
|
||||||
|
uint8_t SPIClass::initialized = 0;
|
||||||
|
uint8_t SPIClass::interruptMode = 0;
|
||||||
|
uint8_t SPIClass::interruptMask = 0;
|
||||||
|
uint8_t SPIClass::interruptSave = 0;
|
||||||
|
#ifdef SPI_TRANSACTION_MISMATCH_LED
|
||||||
|
uint8_t SPIClass::inTransactionFlag = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void SPIClass::begin()
|
||||||
|
{
|
||||||
|
uint8_t sreg = SREG;
|
||||||
|
noInterrupts(); // Protect from a scheduler and prevent transactionBegin
|
||||||
|
if (!initialized) {
|
||||||
|
// Set SS to high so a connected chip will be "deselected" by default
|
||||||
|
uint8_t port = digitalPinToPort(SS);
|
||||||
|
uint8_t bit = digitalPinToBitMask(SS);
|
||||||
|
volatile uint8_t *reg = portModeRegister(port);
|
||||||
|
|
||||||
|
// if the SS pin is not already configured as an output
|
||||||
|
// then set it high (to enable the internal pull-up resistor)
|
||||||
|
if(!(*reg & bit)){
|
||||||
|
digitalWrite(SS, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the SS pin is set as OUTPUT, it can be used as
|
||||||
|
// a general purpose output port (it doesn't influence
|
||||||
|
// SPI operations).
|
||||||
|
pinMode(SS, OUTPUT);
|
||||||
|
|
||||||
|
// Warning: if the SS pin ever becomes a LOW INPUT then SPI
|
||||||
|
// automatically switches to Slave, so the data direction of
|
||||||
|
// the SS pin MUST be kept as OUTPUT.
|
||||||
|
SPCR |= _BV(MSTR);
|
||||||
|
SPCR |= _BV(SPE);
|
||||||
|
|
||||||
|
// Set direction register for SCK and MOSI pin.
|
||||||
|
// MISO pin automatically overrides to INPUT.
|
||||||
|
// By doing this AFTER enabling SPI, we avoid accidentally
|
||||||
|
// clocking in a single bit since the lines go directly
|
||||||
|
// from "input" to SPI control.
|
||||||
|
// http://code.google.com/p/arduino/issues/detail?id=888
|
||||||
|
pinMode(SCK, OUTPUT);
|
||||||
|
pinMode(MOSI, OUTPUT);
|
||||||
|
}
|
||||||
|
initialized++; // reference count
|
||||||
|
SREG = sreg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPIClass::end() {
|
||||||
|
uint8_t sreg = SREG;
|
||||||
|
noInterrupts(); // Protect from a scheduler and prevent transactionBegin
|
||||||
|
// Decrease the reference counter
|
||||||
|
if (initialized)
|
||||||
|
initialized--;
|
||||||
|
// If there are no more references disable SPI
|
||||||
|
if (!initialized) {
|
||||||
|
SPCR &= ~_BV(SPE);
|
||||||
|
interruptMode = 0;
|
||||||
|
#ifdef SPI_TRANSACTION_MISMATCH_LED
|
||||||
|
inTransactionFlag = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
SREG = sreg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mapping of interrupt numbers to bits within SPI_AVR_EIMSK
|
||||||
|
#if defined(__AVR_ATmega32U4__)
|
||||||
|
#define SPI_INT0_MASK (1<<INT0)
|
||||||
|
#define SPI_INT1_MASK (1<<INT1)
|
||||||
|
#define SPI_INT2_MASK (1<<INT2)
|
||||||
|
#define SPI_INT3_MASK (1<<INT3)
|
||||||
|
#define SPI_INT4_MASK (1<<INT6)
|
||||||
|
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
||||||
|
#define SPI_INT0_MASK (1<<INT0)
|
||||||
|
#define SPI_INT1_MASK (1<<INT1)
|
||||||
|
#define SPI_INT2_MASK (1<<INT2)
|
||||||
|
#define SPI_INT3_MASK (1<<INT3)
|
||||||
|
#define SPI_INT4_MASK (1<<INT4)
|
||||||
|
#define SPI_INT5_MASK (1<<INT5)
|
||||||
|
#define SPI_INT6_MASK (1<<INT6)
|
||||||
|
#define SPI_INT7_MASK (1<<INT7)
|
||||||
|
#elif defined(EICRA) && defined(EICRB) && defined(EIMSK)
|
||||||
|
#define SPI_INT0_MASK (1<<INT4)
|
||||||
|
#define SPI_INT1_MASK (1<<INT5)
|
||||||
|
#define SPI_INT2_MASK (1<<INT0)
|
||||||
|
#define SPI_INT3_MASK (1<<INT1)
|
||||||
|
#define SPI_INT4_MASK (1<<INT2)
|
||||||
|
#define SPI_INT5_MASK (1<<INT3)
|
||||||
|
#define SPI_INT6_MASK (1<<INT6)
|
||||||
|
#define SPI_INT7_MASK (1<<INT7)
|
||||||
|
#else
|
||||||
|
#ifdef INT0
|
||||||
|
#define SPI_INT0_MASK (1<<INT0)
|
||||||
|
#endif
|
||||||
|
#ifdef INT1
|
||||||
|
#define SPI_INT1_MASK (1<<INT1)
|
||||||
|
#endif
|
||||||
|
#ifdef INT2
|
||||||
|
#define SPI_INT2_MASK (1<<INT2)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void SPIClass::usingInterrupt(uint8_t interruptNumber)
|
||||||
|
{
|
||||||
|
uint8_t mask = 0;
|
||||||
|
uint8_t sreg = SREG;
|
||||||
|
noInterrupts(); // Protect from a scheduler and prevent transactionBegin
|
||||||
|
switch (interruptNumber) {
|
||||||
|
#ifdef SPI_INT0_MASK
|
||||||
|
case 0: mask = SPI_INT0_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT1_MASK
|
||||||
|
case 1: mask = SPI_INT1_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT2_MASK
|
||||||
|
case 2: mask = SPI_INT2_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT3_MASK
|
||||||
|
case 3: mask = SPI_INT3_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT4_MASK
|
||||||
|
case 4: mask = SPI_INT4_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT5_MASK
|
||||||
|
case 5: mask = SPI_INT5_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT6_MASK
|
||||||
|
case 6: mask = SPI_INT6_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT7_MASK
|
||||||
|
case 7: mask = SPI_INT7_MASK; break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
interruptMode = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
interruptMask |= mask;
|
||||||
|
if (!interruptMode)
|
||||||
|
interruptMode = 1;
|
||||||
|
SREG = sreg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPIClass::notUsingInterrupt(uint8_t interruptNumber)
|
||||||
|
{
|
||||||
|
// Once in mode 2 we can't go back to 0 without a proper reference count
|
||||||
|
if (interruptMode == 2)
|
||||||
|
return;
|
||||||
|
uint8_t mask = 0;
|
||||||
|
uint8_t sreg = SREG;
|
||||||
|
noInterrupts(); // Protect from a scheduler and prevent transactionBegin
|
||||||
|
switch (interruptNumber) {
|
||||||
|
#ifdef SPI_INT0_MASK
|
||||||
|
case 0: mask = SPI_INT0_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT1_MASK
|
||||||
|
case 1: mask = SPI_INT1_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT2_MASK
|
||||||
|
case 2: mask = SPI_INT2_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT3_MASK
|
||||||
|
case 3: mask = SPI_INT3_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT4_MASK
|
||||||
|
case 4: mask = SPI_INT4_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT5_MASK
|
||||||
|
case 5: mask = SPI_INT5_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT6_MASK
|
||||||
|
case 6: mask = SPI_INT6_MASK; break;
|
||||||
|
#endif
|
||||||
|
#ifdef SPI_INT7_MASK
|
||||||
|
case 7: mask = SPI_INT7_MASK; break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
// this case can't be reached
|
||||||
|
}
|
||||||
|
interruptMask &= ~mask;
|
||||||
|
if (!interruptMask)
|
||||||
|
interruptMode = 0;
|
||||||
|
SREG = sreg;
|
||||||
|
}
|
324
SPI/SPI.h
Normal file
324
SPI/SPI.h
Normal file
@ -0,0 +1,324 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010 by Cristian Maglie <c.maglie@arduino.cc>
|
||||||
|
* Copyright (c) 2014 by Paul Stoffregen <paul@pjrc.com> (Transaction API)
|
||||||
|
* Copyright (c) 2014 by Matthijs Kooijman <matthijs@stdin.nl> (SPISettings AVR)
|
||||||
|
* Copyright (c) 2014 by Andrew J. Kroll <xxxajk@gmail.com> (atomicity fixes)
|
||||||
|
* SPI Master library for arduino.
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of either the GNU General Public License version 2
|
||||||
|
* or the GNU Lesser General Public License version 2.1, both as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SPI_H_INCLUDED
|
||||||
|
#define _SPI_H_INCLUDED
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
// SPI_HAS_TRANSACTION means SPI has beginTransaction(), endTransaction(),
|
||||||
|
// usingInterrupt(), and SPISetting(clock, bitOrder, dataMode)
|
||||||
|
#define SPI_HAS_TRANSACTION 1
|
||||||
|
|
||||||
|
// SPI_HAS_NOTUSINGINTERRUPT means that SPI has notUsingInterrupt() method
|
||||||
|
#define SPI_HAS_NOTUSINGINTERRUPT 1
|
||||||
|
|
||||||
|
// SPI_ATOMIC_VERSION means that SPI has atomicity fixes and what version.
|
||||||
|
// This way when there is a bug fix you can check this define to alert users
|
||||||
|
// of your code if it uses better version of this library.
|
||||||
|
// This also implies everything that SPI_HAS_TRANSACTION as documented above is
|
||||||
|
// available too.
|
||||||
|
#define SPI_ATOMIC_VERSION 1
|
||||||
|
|
||||||
|
// Uncomment this line to add detection of mismatched begin/end transactions.
|
||||||
|
// A mismatch occurs if other libraries fail to use SPI.endTransaction() for
|
||||||
|
// each SPI.beginTransaction(). Connect an LED to this pin. The LED will turn
|
||||||
|
// on if any mismatch is ever detected.
|
||||||
|
//#define SPI_TRANSACTION_MISMATCH_LED 5
|
||||||
|
|
||||||
|
#ifndef LSBFIRST
|
||||||
|
#define LSBFIRST 0
|
||||||
|
#endif
|
||||||
|
#ifndef MSBFIRST
|
||||||
|
#define MSBFIRST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SPI_CLOCK_DIV4 0x00
|
||||||
|
#define SPI_CLOCK_DIV16 0x01
|
||||||
|
#define SPI_CLOCK_DIV64 0x02
|
||||||
|
#define SPI_CLOCK_DIV128 0x03
|
||||||
|
#define SPI_CLOCK_DIV2 0x04
|
||||||
|
#define SPI_CLOCK_DIV8 0x05
|
||||||
|
#define SPI_CLOCK_DIV32 0x06
|
||||||
|
|
||||||
|
#define SPI_MODE0 0x00
|
||||||
|
#define SPI_MODE1 0x04
|
||||||
|
#define SPI_MODE2 0x08
|
||||||
|
#define SPI_MODE3 0x0C
|
||||||
|
|
||||||
|
#define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR
|
||||||
|
#define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR
|
||||||
|
#define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR
|
||||||
|
|
||||||
|
// define SPI_AVR_EIMSK for AVR boards with external interrupt pins
|
||||||
|
#if defined(EIMSK)
|
||||||
|
#define SPI_AVR_EIMSK EIMSK
|
||||||
|
#elif defined(GICR)
|
||||||
|
#define SPI_AVR_EIMSK GICR
|
||||||
|
#elif defined(GIMSK)
|
||||||
|
#define SPI_AVR_EIMSK GIMSK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class SPISettings {
|
||||||
|
public:
|
||||||
|
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) {
|
||||||
|
if (__builtin_constant_p(clock)) {
|
||||||
|
init_AlwaysInline(clock, bitOrder, dataMode);
|
||||||
|
} else {
|
||||||
|
init_MightInline(clock, bitOrder, dataMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SPISettings() {
|
||||||
|
init_AlwaysInline(4000000, MSBFIRST, SPI_MODE0);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
void init_MightInline(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) {
|
||||||
|
init_AlwaysInline(clock, bitOrder, dataMode);
|
||||||
|
}
|
||||||
|
void init_AlwaysInline(uint32_t clock, uint8_t bitOrder, uint8_t dataMode)
|
||||||
|
__attribute__((__always_inline__)) {
|
||||||
|
// Clock settings are defined as follows. Note that this shows SPI2X
|
||||||
|
// inverted, so the bits form increasing numbers. Also note that
|
||||||
|
// fosc/64 appears twice
|
||||||
|
// SPR1 SPR0 ~SPI2X Freq
|
||||||
|
// 0 0 0 fosc/2
|
||||||
|
// 0 0 1 fosc/4
|
||||||
|
// 0 1 0 fosc/8
|
||||||
|
// 0 1 1 fosc/16
|
||||||
|
// 1 0 0 fosc/32
|
||||||
|
// 1 0 1 fosc/64
|
||||||
|
// 1 1 0 fosc/64
|
||||||
|
// 1 1 1 fosc/128
|
||||||
|
|
||||||
|
// We find the fastest clock that is less than or equal to the
|
||||||
|
// given clock rate. The clock divider that results in clock_setting
|
||||||
|
// is 2 ^^ (clock_div + 1). If nothing is slow enough, we'll use the
|
||||||
|
// slowest (128 == 2 ^^ 7, so clock_div = 6).
|
||||||
|
uint8_t clockDiv;
|
||||||
|
|
||||||
|
// When the clock is known at compiletime, use this if-then-else
|
||||||
|
// cascade, which the compiler knows how to completely optimize
|
||||||
|
// away. When clock is not known, use a loop instead, which generates
|
||||||
|
// shorter code.
|
||||||
|
if (__builtin_constant_p(clock)) {
|
||||||
|
if (clock >= F_CPU / 2) {
|
||||||
|
clockDiv = 0;
|
||||||
|
} else if (clock >= F_CPU / 4) {
|
||||||
|
clockDiv = 1;
|
||||||
|
} else if (clock >= F_CPU / 8) {
|
||||||
|
clockDiv = 2;
|
||||||
|
} else if (clock >= F_CPU / 16) {
|
||||||
|
clockDiv = 3;
|
||||||
|
} else if (clock >= F_CPU / 32) {
|
||||||
|
clockDiv = 4;
|
||||||
|
} else if (clock >= F_CPU / 64) {
|
||||||
|
clockDiv = 5;
|
||||||
|
} else {
|
||||||
|
clockDiv = 6;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uint32_t clockSetting = F_CPU / 2;
|
||||||
|
clockDiv = 0;
|
||||||
|
while (clockDiv < 6 && clock < clockSetting) {
|
||||||
|
clockSetting /= 2;
|
||||||
|
clockDiv++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compensate for the duplicate fosc/64
|
||||||
|
if (clockDiv == 6)
|
||||||
|
clockDiv = 7;
|
||||||
|
|
||||||
|
// Invert the SPI2X bit
|
||||||
|
clockDiv ^= 0x1;
|
||||||
|
|
||||||
|
// Pack into the SPISettings class
|
||||||
|
spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
|
||||||
|
(dataMode & SPI_MODE_MASK) | ((clockDiv >> 1) & SPI_CLOCK_MASK);
|
||||||
|
spsr = clockDiv & SPI_2XCLOCK_MASK;
|
||||||
|
}
|
||||||
|
uint8_t spcr;
|
||||||
|
uint8_t spsr;
|
||||||
|
friend class SPIClass;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class SPIClass {
|
||||||
|
public:
|
||||||
|
// Initialize the SPI library
|
||||||
|
static void begin();
|
||||||
|
|
||||||
|
// If SPI is used from within an interrupt, this function registers
|
||||||
|
// that interrupt with the SPI library, so beginTransaction() can
|
||||||
|
// prevent conflicts. The input interruptNumber is the number used
|
||||||
|
// with attachInterrupt. If SPI is used from a different interrupt
|
||||||
|
// (eg, a timer), interruptNumber should be 255.
|
||||||
|
static void usingInterrupt(uint8_t interruptNumber);
|
||||||
|
// And this does the opposite.
|
||||||
|
static void notUsingInterrupt(uint8_t interruptNumber);
|
||||||
|
// Note: the usingInterrupt and notUsingInterrupt functions should
|
||||||
|
// not to be called from ISR context or inside a transaction.
|
||||||
|
// For details see:
|
||||||
|
// https://github.com/arduino/Arduino/pull/2381
|
||||||
|
// https://github.com/arduino/Arduino/pull/2449
|
||||||
|
|
||||||
|
// Before using SPI.transfer() or asserting chip select pins,
|
||||||
|
// this function is used to gain exclusive access to the SPI bus
|
||||||
|
// and configure the correct settings.
|
||||||
|
inline static void beginTransaction(SPISettings settings) {
|
||||||
|
if (interruptMode > 0) {
|
||||||
|
uint8_t sreg = SREG;
|
||||||
|
noInterrupts();
|
||||||
|
|
||||||
|
#ifdef SPI_AVR_EIMSK
|
||||||
|
if (interruptMode == 1) {
|
||||||
|
interruptSave = SPI_AVR_EIMSK;
|
||||||
|
SPI_AVR_EIMSK &= ~interruptMask;
|
||||||
|
SREG = sreg;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
interruptSave = sreg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SPI_TRANSACTION_MISMATCH_LED
|
||||||
|
if (inTransactionFlag) {
|
||||||
|
pinMode(SPI_TRANSACTION_MISMATCH_LED, OUTPUT);
|
||||||
|
digitalWrite(SPI_TRANSACTION_MISMATCH_LED, HIGH);
|
||||||
|
}
|
||||||
|
inTransactionFlag = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SPCR = settings.spcr;
|
||||||
|
SPSR = settings.spsr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write to the SPI bus (MOSI pin) and also receive (MISO pin)
|
||||||
|
inline static uint8_t transfer(uint8_t data) {
|
||||||
|
SPDR = data;
|
||||||
|
/*
|
||||||
|
* The following NOP introduces a small delay that can prevent the wait
|
||||||
|
* loop form iterating when running at the maximum speed. This gives
|
||||||
|
* about 10% more speed, even if it seems counter-intuitive. At lower
|
||||||
|
* speeds it is unnoticed.
|
||||||
|
*/
|
||||||
|
asm volatile("nop");
|
||||||
|
while (!(SPSR & _BV(SPIF))) ; // wait
|
||||||
|
return SPDR;
|
||||||
|
}
|
||||||
|
inline static uint16_t transfer16(uint16_t data) {
|
||||||
|
union { uint16_t val; struct { uint8_t lsb; uint8_t msb; }; } in, out;
|
||||||
|
in.val = data;
|
||||||
|
if (!(SPCR & _BV(DORD))) {
|
||||||
|
SPDR = in.msb;
|
||||||
|
asm volatile("nop"); // See transfer(uint8_t) function
|
||||||
|
while (!(SPSR & _BV(SPIF))) ;
|
||||||
|
out.msb = SPDR;
|
||||||
|
SPDR = in.lsb;
|
||||||
|
asm volatile("nop");
|
||||||
|
while (!(SPSR & _BV(SPIF))) ;
|
||||||
|
out.lsb = SPDR;
|
||||||
|
} else {
|
||||||
|
SPDR = in.lsb;
|
||||||
|
asm volatile("nop");
|
||||||
|
while (!(SPSR & _BV(SPIF))) ;
|
||||||
|
out.lsb = SPDR;
|
||||||
|
SPDR = in.msb;
|
||||||
|
asm volatile("nop");
|
||||||
|
while (!(SPSR & _BV(SPIF))) ;
|
||||||
|
out.msb = SPDR;
|
||||||
|
}
|
||||||
|
return out.val;
|
||||||
|
}
|
||||||
|
inline static void transfer(void *buf, size_t count) {
|
||||||
|
if (count == 0) return;
|
||||||
|
uint8_t *p = (uint8_t *)buf;
|
||||||
|
SPDR = *p;
|
||||||
|
while (--count > 0) {
|
||||||
|
uint8_t out = *(p + 1);
|
||||||
|
while (!(SPSR & _BV(SPIF))) ;
|
||||||
|
uint8_t in = SPDR;
|
||||||
|
SPDR = out;
|
||||||
|
*p++ = in;
|
||||||
|
}
|
||||||
|
while (!(SPSR & _BV(SPIF))) ;
|
||||||
|
*p = SPDR;
|
||||||
|
}
|
||||||
|
// After performing a group of transfers and releasing the chip select
|
||||||
|
// signal, this function allows others to access the SPI bus
|
||||||
|
inline static void endTransaction(void) {
|
||||||
|
#ifdef SPI_TRANSACTION_MISMATCH_LED
|
||||||
|
if (!inTransactionFlag) {
|
||||||
|
pinMode(SPI_TRANSACTION_MISMATCH_LED, OUTPUT);
|
||||||
|
digitalWrite(SPI_TRANSACTION_MISMATCH_LED, HIGH);
|
||||||
|
}
|
||||||
|
inTransactionFlag = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (interruptMode > 0) {
|
||||||
|
#ifdef SPI_AVR_EIMSK
|
||||||
|
uint8_t sreg = SREG;
|
||||||
|
#endif
|
||||||
|
noInterrupts();
|
||||||
|
#ifdef SPI_AVR_EIMSK
|
||||||
|
if (interruptMode == 1) {
|
||||||
|
SPI_AVR_EIMSK = interruptSave;
|
||||||
|
SREG = sreg;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
SREG = interruptSave;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable the SPI bus
|
||||||
|
static void end();
|
||||||
|
|
||||||
|
// This function is deprecated. New applications should use
|
||||||
|
// beginTransaction() to configure SPI settings.
|
||||||
|
inline static void setBitOrder(uint8_t bitOrder) {
|
||||||
|
if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
|
||||||
|
else SPCR &= ~(_BV(DORD));
|
||||||
|
}
|
||||||
|
// This function is deprecated. New applications should use
|
||||||
|
// beginTransaction() to configure SPI settings.
|
||||||
|
inline static void setDataMode(uint8_t dataMode) {
|
||||||
|
SPCR = (SPCR & ~SPI_MODE_MASK) | dataMode;
|
||||||
|
}
|
||||||
|
// This function is deprecated. New applications should use
|
||||||
|
// beginTransaction() to configure SPI settings.
|
||||||
|
inline static void setClockDivider(uint8_t clockDiv) {
|
||||||
|
SPCR = (SPCR & ~SPI_CLOCK_MASK) | (clockDiv & SPI_CLOCK_MASK);
|
||||||
|
SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((clockDiv >> 2) & SPI_2XCLOCK_MASK);
|
||||||
|
}
|
||||||
|
// These undocumented functions should not be used. SPI.transfer()
|
||||||
|
// polls the hardware flag which is automatically cleared as the
|
||||||
|
// AVR responds to SPI's interrupt
|
||||||
|
inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
|
||||||
|
inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static uint8_t initialized;
|
||||||
|
static uint8_t interruptMode; // 0=none, 1=mask, 2=global
|
||||||
|
static uint8_t interruptMask; // which interrupts to mask
|
||||||
|
static uint8_t interruptSave; // temp storage, to restore state
|
||||||
|
#ifdef SPI_TRANSACTION_MISMATCH_LED
|
||||||
|
static uint8_t inTransactionFlag;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
extern SPIClass SPI;
|
||||||
|
|
||||||
|
#endif
|
725
TFT_ILI9341/Adafruit_ILI9341.cpp
Executable file
725
TFT_ILI9341/Adafruit_ILI9341.cpp
Executable file
@ -0,0 +1,725 @@
|
|||||||
|
/***************************************************
|
||||||
|
This is our library for the Adafruit ILI9341 Breakout and Shield
|
||||||
|
----> http://www.adafruit.com/products/1651
|
||||||
|
|
||||||
|
Check out the links above for our tutorials and wiring diagrams
|
||||||
|
These displays use SPI to communicate, 4 or 5 pins are required to
|
||||||
|
interface (RST is optional)
|
||||||
|
Adafruit invests time and resources providing this open source code,
|
||||||
|
please support Adafruit and open-source hardware by purchasing
|
||||||
|
products from Adafruit!
|
||||||
|
|
||||||
|
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
|
MIT license, all text above must be included in any redistribution
|
||||||
|
****************************************************/
|
||||||
|
|
||||||
|
#include "Adafruit_ILI9341.h"
|
||||||
|
#ifdef __AVR
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#elif defined(ESP8266)
|
||||||
|
#include <pgmspace.h>
|
||||||
|
#endif
|
||||||
|
#include <limits.h>
|
||||||
|
#include "pins_arduino.h"
|
||||||
|
#include "wiring_private.h"
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
|
|
||||||
|
// If the SPI library has transaction support, these functions
|
||||||
|
// establish settings and protect from interference from other
|
||||||
|
// libraries. Otherwise, they simply do nothing.
|
||||||
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
|
static inline void spi_begin(void) __attribute__((always_inline));
|
||||||
|
static inline void spi_begin(void) {
|
||||||
|
#if defined (ARDUINO_ARCH_ARC32)
|
||||||
|
// max speed!
|
||||||
|
SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));
|
||||||
|
#else
|
||||||
|
// max speed!
|
||||||
|
SPI.beginTransaction(SPISettings(24000000, MSBFIRST, SPI_MODE0));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
static inline void spi_end(void) __attribute__((always_inline));
|
||||||
|
static inline void spi_end(void) {
|
||||||
|
SPI.endTransaction();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define spi_begin()
|
||||||
|
#define spi_end()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Constructor when using software SPI. All output pins are configurable.
|
||||||
|
Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t mosi,
|
||||||
|
int8_t sclk, int8_t rst, int8_t miso) : Adafruit_GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) {
|
||||||
|
_cs = cs;
|
||||||
|
_dc = dc;
|
||||||
|
_mosi = mosi;
|
||||||
|
_miso = miso;
|
||||||
|
_sclk = sclk;
|
||||||
|
_rst = rst;
|
||||||
|
hwSPI = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Constructor when using hardware SPI. Faster, but must use SPI pins
|
||||||
|
// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
|
||||||
|
Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t rst) : Adafruit_GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) {
|
||||||
|
_cs = cs;
|
||||||
|
_dc = dc;
|
||||||
|
_rst = rst;
|
||||||
|
hwSPI = true;
|
||||||
|
_mosi = _sclk = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::spiwrite(uint8_t c) {
|
||||||
|
|
||||||
|
//Serial.print("0x"); Serial.print(c, HEX); Serial.print(", ");
|
||||||
|
|
||||||
|
if (hwSPI) {
|
||||||
|
#if defined (__AVR__)
|
||||||
|
#ifndef SPI_HAS_TRANSACTION
|
||||||
|
uint8_t backupSPCR = SPCR;
|
||||||
|
SPCR = mySPCR;
|
||||||
|
#endif
|
||||||
|
SPDR = c;
|
||||||
|
while(!(SPSR & _BV(SPIF)));
|
||||||
|
#ifndef SPI_HAS_TRANSACTION
|
||||||
|
SPCR = backupSPCR;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
SPI.transfer(c);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#if defined(ESP8266) || defined (ARDUINO_ARCH_ARC32)
|
||||||
|
for(uint8_t bit = 0x80; bit; bit >>= 1) {
|
||||||
|
if(c & bit) {
|
||||||
|
digitalWrite(_mosi, HIGH);
|
||||||
|
} else {
|
||||||
|
digitalWrite(_mosi, LOW);
|
||||||
|
}
|
||||||
|
digitalWrite(_sclk, HIGH);
|
||||||
|
digitalWrite(_sclk, LOW);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// Fast SPI bitbang swiped from LPD8806 library
|
||||||
|
for(uint8_t bit = 0x80; bit; bit >>= 1) {
|
||||||
|
if(c & bit) {
|
||||||
|
//digitalWrite(_mosi, HIGH);
|
||||||
|
*mosiport |= mosipinmask;
|
||||||
|
} else {
|
||||||
|
//digitalWrite(_mosi, LOW);
|
||||||
|
*mosiport &= ~mosipinmask;
|
||||||
|
}
|
||||||
|
//digitalWrite(_sclk, HIGH);
|
||||||
|
*clkport |= clkpinmask;
|
||||||
|
//digitalWrite(_sclk, LOW);
|
||||||
|
*clkport &= ~clkpinmask;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::writecommand(uint8_t c) {
|
||||||
|
#if defined (USE_FAST_PINIO)
|
||||||
|
*dcport &= ~dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, LOW);
|
||||||
|
digitalWrite(_sclk, LOW);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiwrite(c);
|
||||||
|
|
||||||
|
#if defined (USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::writedata(uint8_t c) {
|
||||||
|
#if defined (USE_FAST_PINIO)
|
||||||
|
*dcport |= dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiwrite(c);
|
||||||
|
|
||||||
|
#if defined (USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Rather than a bazillion writecommand() and writedata() calls, screen
|
||||||
|
// initialization commands and arguments are organized in these tables
|
||||||
|
// stored in PROGMEM. The table may look bulky, but that's mostly the
|
||||||
|
// formatting -- storage-wise this is hundreds of bytes more compact
|
||||||
|
// than the equivalent code. Companion function follows.
|
||||||
|
#define DELAY 0x80
|
||||||
|
|
||||||
|
|
||||||
|
// Companion code to the above tables. Reads and issues
|
||||||
|
// a series of LCD commands stored in PROGMEM byte array.
|
||||||
|
void Adafruit_ILI9341::commandList(uint8_t *addr) {
|
||||||
|
|
||||||
|
uint8_t numCommands, numArgs;
|
||||||
|
uint16_t ms;
|
||||||
|
|
||||||
|
numCommands = pgm_read_byte(addr++); // Number of commands to follow
|
||||||
|
while(numCommands--) { // For each command...
|
||||||
|
writecommand(pgm_read_byte(addr++)); // Read, issue command
|
||||||
|
numArgs = pgm_read_byte(addr++); // Number of args to follow
|
||||||
|
ms = numArgs & DELAY; // If hibit set, delay follows args
|
||||||
|
numArgs &= ~DELAY; // Mask out delay bit
|
||||||
|
while(numArgs--) { // For each argument...
|
||||||
|
writedata(pgm_read_byte(addr++)); // Read, issue argument
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ms) {
|
||||||
|
ms = pgm_read_byte(addr++); // Read post-command delay time (ms)
|
||||||
|
if(ms == 255) ms = 500; // If 255, delay for 500 ms
|
||||||
|
delay(ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::begin(void) {
|
||||||
|
if (_rst > 0) {
|
||||||
|
pinMode(_rst, OUTPUT);
|
||||||
|
digitalWrite(_rst, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
pinMode(_dc, OUTPUT);
|
||||||
|
pinMode(_cs, OUTPUT);
|
||||||
|
|
||||||
|
#if defined (USE_FAST_PINIO)
|
||||||
|
csport = portOutputRegister(digitalPinToPort(_cs));
|
||||||
|
cspinmask = digitalPinToBitMask(_cs);
|
||||||
|
dcport = portOutputRegister(digitalPinToPort(_dc));
|
||||||
|
dcpinmask = digitalPinToBitMask(_dc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(hwSPI) { // Using hardware SPI
|
||||||
|
SPI.begin();
|
||||||
|
|
||||||
|
#ifndef SPI_HAS_TRANSACTION
|
||||||
|
SPI.setBitOrder(MSBFIRST);
|
||||||
|
SPI.setDataMode(SPI_MODE0);
|
||||||
|
#if defined (_AVR__)
|
||||||
|
SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
|
||||||
|
mySPCR = SPCR;
|
||||||
|
#elif defined(TEENSYDUINO)
|
||||||
|
SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
|
||||||
|
#elif defined (__arm__)
|
||||||
|
SPI.setClockDivider(11); // 8-ish MHz (full! speed!)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
pinMode(_sclk, OUTPUT);
|
||||||
|
pinMode(_mosi, OUTPUT);
|
||||||
|
pinMode(_miso, INPUT);
|
||||||
|
|
||||||
|
#if defined (USE_FAST_PINIO)
|
||||||
|
clkport = portOutputRegister(digitalPinToPort(_sclk));
|
||||||
|
clkpinmask = digitalPinToBitMask(_sclk);
|
||||||
|
mosiport = portOutputRegister(digitalPinToPort(_mosi));
|
||||||
|
mosipinmask = digitalPinToBitMask(_mosi);
|
||||||
|
*clkport &= ~clkpinmask;
|
||||||
|
*mosiport &= ~mosipinmask;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// toggle RST low to reset
|
||||||
|
if (_rst > 0) {
|
||||||
|
digitalWrite(_rst, HIGH);
|
||||||
|
delay(5);
|
||||||
|
digitalWrite(_rst, LOW);
|
||||||
|
delay(20);
|
||||||
|
digitalWrite(_rst, HIGH);
|
||||||
|
delay(150);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
uint8_t x = readcommand8(ILI9341_RDMODE);
|
||||||
|
Serial.print("\nDisplay Power Mode: 0x"); Serial.println(x, HEX);
|
||||||
|
x = readcommand8(ILI9341_RDMADCTL);
|
||||||
|
Serial.print("\nMADCTL Mode: 0x"); Serial.println(x, HEX);
|
||||||
|
x = readcommand8(ILI9341_RDPIXFMT);
|
||||||
|
Serial.print("\nPixel Format: 0x"); Serial.println(x, HEX);
|
||||||
|
x = readcommand8(ILI9341_RDIMGFMT);
|
||||||
|
Serial.print("\nImage Format: 0x"); Serial.println(x, HEX);
|
||||||
|
x = readcommand8(ILI9341_RDSELFDIAG);
|
||||||
|
Serial.print("\nSelf Diagnostic: 0x"); Serial.println(x, HEX);
|
||||||
|
*/
|
||||||
|
//if(cmdList) commandList(cmdList);
|
||||||
|
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
writecommand(0xEF);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x80);
|
||||||
|
writedata(0x02);
|
||||||
|
|
||||||
|
writecommand(0xCF);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0XC1);
|
||||||
|
writedata(0X30);
|
||||||
|
|
||||||
|
writecommand(0xED);
|
||||||
|
writedata(0x64);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0X12);
|
||||||
|
writedata(0X81);
|
||||||
|
|
||||||
|
writecommand(0xE8);
|
||||||
|
writedata(0x85);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x78);
|
||||||
|
|
||||||
|
writecommand(0xCB);
|
||||||
|
writedata(0x39);
|
||||||
|
writedata(0x2C);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x34);
|
||||||
|
writedata(0x02);
|
||||||
|
|
||||||
|
writecommand(0xF7);
|
||||||
|
writedata(0x20);
|
||||||
|
|
||||||
|
writecommand(0xEA);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(ILI9341_PWCTR1); //Power control
|
||||||
|
writedata(0x23); //VRH[5:0]
|
||||||
|
|
||||||
|
writecommand(ILI9341_PWCTR2); //Power control
|
||||||
|
writedata(0x10); //SAP[2:0];BT[3:0]
|
||||||
|
|
||||||
|
writecommand(ILI9341_VMCTR1); //VCM control
|
||||||
|
writedata(0x3e); //¶Ô±È¶Èµ÷½Ú
|
||||||
|
writedata(0x28);
|
||||||
|
|
||||||
|
writecommand(ILI9341_VMCTR2); //VCM control2
|
||||||
|
writedata(0x86); //--
|
||||||
|
|
||||||
|
writecommand(ILI9341_MADCTL); // Memory Access Control
|
||||||
|
writedata(0x48);
|
||||||
|
|
||||||
|
writecommand(ILI9341_PIXFMT);
|
||||||
|
writedata(0x55);
|
||||||
|
|
||||||
|
writecommand(ILI9341_FRMCTR1);
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x18);
|
||||||
|
|
||||||
|
writecommand(ILI9341_DFUNCTR); // Display Function Control
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x82);
|
||||||
|
writedata(0x27);
|
||||||
|
|
||||||
|
writecommand(0xF2); // 3Gamma Function Disable
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(ILI9341_GAMMASET); //Gamma curve selected
|
||||||
|
writedata(0x01);
|
||||||
|
|
||||||
|
writecommand(ILI9341_GMCTRP1); //Set Gamma
|
||||||
|
writedata(0x0F);
|
||||||
|
writedata(0x31);
|
||||||
|
writedata(0x2B);
|
||||||
|
writedata(0x0C);
|
||||||
|
writedata(0x0E);
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x4E);
|
||||||
|
writedata(0xF1);
|
||||||
|
writedata(0x37);
|
||||||
|
writedata(0x07);
|
||||||
|
writedata(0x10);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x0E);
|
||||||
|
writedata(0x09);
|
||||||
|
writedata(0x00);
|
||||||
|
|
||||||
|
writecommand(ILI9341_GMCTRN1); //Set Gamma
|
||||||
|
writedata(0x00);
|
||||||
|
writedata(0x0E);
|
||||||
|
writedata(0x14);
|
||||||
|
writedata(0x03);
|
||||||
|
writedata(0x11);
|
||||||
|
writedata(0x07);
|
||||||
|
writedata(0x31);
|
||||||
|
writedata(0xC1);
|
||||||
|
writedata(0x48);
|
||||||
|
writedata(0x08);
|
||||||
|
writedata(0x0F);
|
||||||
|
writedata(0x0C);
|
||||||
|
writedata(0x31);
|
||||||
|
writedata(0x36);
|
||||||
|
writedata(0x0F);
|
||||||
|
|
||||||
|
writecommand(ILI9341_SLPOUT); //Exit Sleep
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
delay(120);
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
writecommand(ILI9341_DISPON); //Display on
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1,
|
||||||
|
uint16_t y1) {
|
||||||
|
|
||||||
|
writecommand(ILI9341_CASET); // Column addr set
|
||||||
|
writedata(x0 >> 8);
|
||||||
|
writedata(x0 & 0xFF); // XSTART
|
||||||
|
writedata(x1 >> 8);
|
||||||
|
writedata(x1 & 0xFF); // XEND
|
||||||
|
|
||||||
|
writecommand(ILI9341_PASET); // Row addr set
|
||||||
|
writedata(y0>>8);
|
||||||
|
writedata(y0); // YSTART
|
||||||
|
writedata(y1>>8);
|
||||||
|
writedata(y1); // YEND
|
||||||
|
|
||||||
|
writecommand(ILI9341_RAMWR); // write to RAM
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::pushColor(uint16_t color) {
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*dcport |= dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiwrite(color >> 8);
|
||||||
|
spiwrite(color);
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||||
|
|
||||||
|
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
|
||||||
|
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
setAddrWindow(x,y,x+1,y+1);
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*dcport |= dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiwrite(color >> 8);
|
||||||
|
spiwrite(color);
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::drawFastVLine(int16_t x, int16_t y, int16_t h,
|
||||||
|
uint16_t color) {
|
||||||
|
|
||||||
|
// Rudimentary clipping
|
||||||
|
if((x >= _width) || (y >= _height)) return;
|
||||||
|
|
||||||
|
if((y+h-1) >= _height)
|
||||||
|
h = _height-y;
|
||||||
|
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
setAddrWindow(x, y, x, y+h-1);
|
||||||
|
|
||||||
|
uint8_t hi = color >> 8, lo = color;
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*dcport |= dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (h--) {
|
||||||
|
spiwrite(hi);
|
||||||
|
spiwrite(lo);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::drawFastHLine(int16_t x, int16_t y, int16_t w,
|
||||||
|
uint16_t color) {
|
||||||
|
|
||||||
|
// Rudimentary clipping
|
||||||
|
if((x >= _width) || (y >= _height)) return;
|
||||||
|
if((x+w-1) >= _width) w = _width-x;
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
setAddrWindow(x, y, x+w-1, y);
|
||||||
|
|
||||||
|
uint8_t hi = color >> 8, lo = color;
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*dcport |= dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
while (w--) {
|
||||||
|
spiwrite(hi);
|
||||||
|
spiwrite(lo);
|
||||||
|
}
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::fillScreen(uint16_t color) {
|
||||||
|
fillRect(0, 0, _width, _height, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill a rectangle
|
||||||
|
void Adafruit_ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||||
|
uint16_t color) {
|
||||||
|
|
||||||
|
// rudimentary clipping (drawChar w/big text requires this)
|
||||||
|
if((x >= _width) || (y >= _height)) return;
|
||||||
|
if((x + w - 1) >= _width) w = _width - x;
|
||||||
|
if((y + h - 1) >= _height) h = _height - y;
|
||||||
|
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
setAddrWindow(x, y, x+w-1, y+h-1);
|
||||||
|
|
||||||
|
uint8_t hi = color >> 8, lo = color;
|
||||||
|
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*dcport |= dcpinmask;
|
||||||
|
*csport &= ~cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for(y=h; y>0; y--) {
|
||||||
|
for(x=w; x>0; x--) {
|
||||||
|
spiwrite(hi);
|
||||||
|
spiwrite(lo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if defined(USE_FAST_PINIO)
|
||||||
|
*csport |= cspinmask;
|
||||||
|
#else
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Pass 8-bit (each) R,G,B, get back 16-bit packed color
|
||||||
|
uint16_t Adafruit_ILI9341::color565(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MADCTL_MY 0x80
|
||||||
|
#define MADCTL_MX 0x40
|
||||||
|
#define MADCTL_MV 0x20
|
||||||
|
#define MADCTL_ML 0x10
|
||||||
|
#define MADCTL_RGB 0x00
|
||||||
|
#define MADCTL_BGR 0x08
|
||||||
|
#define MADCTL_MH 0x04
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::setRotation(uint8_t m) {
|
||||||
|
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
writecommand(ILI9341_MADCTL);
|
||||||
|
rotation = m % 4; // can't be higher than 3
|
||||||
|
switch (rotation) {
|
||||||
|
case 0:
|
||||||
|
writedata(MADCTL_MX | MADCTL_BGR);
|
||||||
|
_width = ILI9341_TFTWIDTH;
|
||||||
|
_height = ILI9341_TFTHEIGHT;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
writedata(MADCTL_MV | MADCTL_BGR);
|
||||||
|
_width = ILI9341_TFTHEIGHT;
|
||||||
|
_height = ILI9341_TFTWIDTH;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
writedata(MADCTL_MY | MADCTL_BGR);
|
||||||
|
_width = ILI9341_TFTWIDTH;
|
||||||
|
_height = ILI9341_TFTHEIGHT;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
writedata(MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
|
||||||
|
_width = ILI9341_TFTHEIGHT;
|
||||||
|
_height = ILI9341_TFTWIDTH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Adafruit_ILI9341::invertDisplay(boolean i) {
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
writecommand(i ? ILI9341_INVON : ILI9341_INVOFF);
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////// stuff not actively being used, but kept for posterity
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t Adafruit_ILI9341::spiread(void) {
|
||||||
|
uint8_t r = 0;
|
||||||
|
|
||||||
|
if (hwSPI) {
|
||||||
|
#if defined (__AVR__)
|
||||||
|
#ifndef SPI_HAS_TRANSACTION
|
||||||
|
uint8_t backupSPCR = SPCR;
|
||||||
|
SPCR = mySPCR;
|
||||||
|
#endif
|
||||||
|
SPDR = 0x00;
|
||||||
|
while(!(SPSR & _BV(SPIF)));
|
||||||
|
r = SPDR;
|
||||||
|
|
||||||
|
#ifndef SPI_HAS_TRANSACTION
|
||||||
|
SPCR = backupSPCR;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
r = SPI.transfer(0x00);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (uint8_t i=0; i<8; i++) {
|
||||||
|
digitalWrite(_sclk, LOW);
|
||||||
|
digitalWrite(_sclk, HIGH);
|
||||||
|
r <<= 1;
|
||||||
|
if (digitalRead(_miso))
|
||||||
|
r |= 0x1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Serial.print("read: 0x"); Serial.print(r, HEX);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Adafruit_ILI9341::readdata(void) {
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
uint8_t r = spiread();
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t Adafruit_ILI9341::readcommand8(uint8_t c, uint8_t index) {
|
||||||
|
if (hwSPI) spi_begin();
|
||||||
|
digitalWrite(_dc, LOW); // command
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
spiwrite(0xD9); // woo sekret command?
|
||||||
|
digitalWrite(_dc, HIGH); // data
|
||||||
|
spiwrite(0x10 + index);
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
|
||||||
|
digitalWrite(_dc, LOW);
|
||||||
|
digitalWrite(_sclk, LOW);
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
spiwrite(c);
|
||||||
|
|
||||||
|
digitalWrite(_dc, HIGH);
|
||||||
|
uint8_t r = spiread();
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
if (hwSPI) spi_end();
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
uint16_t Adafruit_ILI9341::readcommand16(uint8_t c) {
|
||||||
|
digitalWrite(_dc, LOW);
|
||||||
|
if (_cs)
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
|
||||||
|
spiwrite(c);
|
||||||
|
pinMode(_sid, INPUT); // input!
|
||||||
|
uint16_t r = spiread();
|
||||||
|
r <<= 8;
|
||||||
|
r |= spiread();
|
||||||
|
if (_cs)
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
|
||||||
|
pinMode(_sid, OUTPUT); // back to output
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Adafruit_ILI9341::readcommand32(uint8_t c) {
|
||||||
|
digitalWrite(_dc, LOW);
|
||||||
|
if (_cs)
|
||||||
|
digitalWrite(_cs, LOW);
|
||||||
|
spiwrite(c);
|
||||||
|
pinMode(_sid, INPUT); // input!
|
||||||
|
|
||||||
|
dummyclock();
|
||||||
|
dummyclock();
|
||||||
|
|
||||||
|
uint32_t r = spiread();
|
||||||
|
r <<= 8;
|
||||||
|
r |= spiread();
|
||||||
|
r <<= 8;
|
||||||
|
r |= spiread();
|
||||||
|
r <<= 8;
|
||||||
|
r |= spiread();
|
||||||
|
if (_cs)
|
||||||
|
digitalWrite(_cs, HIGH);
|
||||||
|
|
||||||
|
pinMode(_sid, OUTPUT); // back to output
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
181
TFT_ILI9341/Adafruit_ILI9341.h
Executable file
181
TFT_ILI9341/Adafruit_ILI9341.h
Executable file
@ -0,0 +1,181 @@
|
|||||||
|
/***************************************************
|
||||||
|
This is our library for the Adafruit ILI9341 Breakout and Shield
|
||||||
|
----> http://www.adafruit.com/products/1651
|
||||||
|
|
||||||
|
Check out the links above for our tutorials and wiring diagrams
|
||||||
|
These displays use SPI to communicate, 4 or 5 pins are required to
|
||||||
|
interface (RST is optional)
|
||||||
|
Adafruit invests time and resources providing this open source code,
|
||||||
|
please support Adafruit and open-source hardware by purchasing
|
||||||
|
products from Adafruit!
|
||||||
|
|
||||||
|
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
|
MIT license, all text above must be included in any redistribution
|
||||||
|
****************************************************/
|
||||||
|
|
||||||
|
#ifndef _ADAFRUIT_ILI9341H_
|
||||||
|
#define _ADAFRUIT_ILI9341H_
|
||||||
|
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "Print.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
#include <Adafruit_GFX.h>
|
||||||
|
#ifdef __AVR
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#elif defined(ESP8266)
|
||||||
|
#include <pgmspace.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (__AVR__) || defined(TEENSYDUINO) || defined (__arm__)
|
||||||
|
#define USE_FAST_PINIO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ILI9341_TFTWIDTH 240
|
||||||
|
#define ILI9341_TFTHEIGHT 320
|
||||||
|
|
||||||
|
#define ILI9341_NOP 0x00
|
||||||
|
#define ILI9341_SWRESET 0x01
|
||||||
|
#define ILI9341_RDDID 0x04
|
||||||
|
#define ILI9341_RDDST 0x09
|
||||||
|
|
||||||
|
#define ILI9341_SLPIN 0x10
|
||||||
|
#define ILI9341_SLPOUT 0x11
|
||||||
|
#define ILI9341_PTLON 0x12
|
||||||
|
#define ILI9341_NORON 0x13
|
||||||
|
|
||||||
|
#define ILI9341_RDMODE 0x0A
|
||||||
|
#define ILI9341_RDMADCTL 0x0B
|
||||||
|
#define ILI9341_RDPIXFMT 0x0C
|
||||||
|
#define ILI9341_RDIMGFMT 0x0D
|
||||||
|
#define ILI9341_RDSELFDIAG 0x0F
|
||||||
|
|
||||||
|
#define ILI9341_INVOFF 0x20
|
||||||
|
#define ILI9341_INVON 0x21
|
||||||
|
#define ILI9341_GAMMASET 0x26
|
||||||
|
#define ILI9341_DISPOFF 0x28
|
||||||
|
#define ILI9341_DISPON 0x29
|
||||||
|
|
||||||
|
#define ILI9341_CASET 0x2A
|
||||||
|
#define ILI9341_PASET 0x2B
|
||||||
|
#define ILI9341_RAMWR 0x2C
|
||||||
|
#define ILI9341_RAMRD 0x2E
|
||||||
|
|
||||||
|
#define ILI9341_PTLAR 0x30
|
||||||
|
#define ILI9341_MADCTL 0x36
|
||||||
|
#define ILI9341_PIXFMT 0x3A
|
||||||
|
|
||||||
|
#define ILI9341_FRMCTR1 0xB1
|
||||||
|
#define ILI9341_FRMCTR2 0xB2
|
||||||
|
#define ILI9341_FRMCTR3 0xB3
|
||||||
|
#define ILI9341_INVCTR 0xB4
|
||||||
|
#define ILI9341_DFUNCTR 0xB6
|
||||||
|
|
||||||
|
#define ILI9341_PWCTR1 0xC0
|
||||||
|
#define ILI9341_PWCTR2 0xC1
|
||||||
|
#define ILI9341_PWCTR3 0xC2
|
||||||
|
#define ILI9341_PWCTR4 0xC3
|
||||||
|
#define ILI9341_PWCTR5 0xC4
|
||||||
|
#define ILI9341_VMCTR1 0xC5
|
||||||
|
#define ILI9341_VMCTR2 0xC7
|
||||||
|
|
||||||
|
#define ILI9341_RDID1 0xDA
|
||||||
|
#define ILI9341_RDID2 0xDB
|
||||||
|
#define ILI9341_RDID3 0xDC
|
||||||
|
#define ILI9341_RDID4 0xDD
|
||||||
|
|
||||||
|
#define ILI9341_GMCTRP1 0xE0
|
||||||
|
#define ILI9341_GMCTRN1 0xE1
|
||||||
|
/*
|
||||||
|
#define ILI9341_PWCTR6 0xFC
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Color definitions
|
||||||
|
#define ILI9341_BLACK 0x0000 /* 0, 0, 0 */
|
||||||
|
#define ILI9341_NAVY 0x000F /* 0, 0, 128 */
|
||||||
|
#define ILI9341_DARKGREEN 0x03E0 /* 0, 128, 0 */
|
||||||
|
#define ILI9341_DARKCYAN 0x03EF /* 0, 128, 128 */
|
||||||
|
#define ILI9341_MAROON 0x7800 /* 128, 0, 0 */
|
||||||
|
#define ILI9341_PURPLE 0x780F /* 128, 0, 128 */
|
||||||
|
#define ILI9341_OLIVE 0x7BE0 /* 128, 128, 0 */
|
||||||
|
#define ILI9341_LIGHTGREY 0xC618 /* 192, 192, 192 */
|
||||||
|
#define ILI9341_DARKGREY 0x7BEF /* 128, 128, 128 */
|
||||||
|
#define ILI9341_BLUE 0x001F /* 0, 0, 255 */
|
||||||
|
#define ILI9341_GREEN 0x07E0 /* 0, 255, 0 */
|
||||||
|
#define ILI9341_CYAN 0x07FF /* 0, 255, 255 */
|
||||||
|
#define ILI9341_RED 0xF800 /* 255, 0, 0 */
|
||||||
|
#define ILI9341_MAGENTA 0xF81F /* 255, 0, 255 */
|
||||||
|
#define ILI9341_YELLOW 0xFFE0 /* 255, 255, 0 */
|
||||||
|
#define ILI9341_WHITE 0xFFFF /* 255, 255, 255 */
|
||||||
|
#define ILI9341_ORANGE 0xFD20 /* 255, 165, 0 */
|
||||||
|
#define ILI9341_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
|
||||||
|
#define ILI9341_PINK 0xF81F
|
||||||
|
|
||||||
|
class Adafruit_ILI9341 : public Adafruit_GFX {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK,
|
||||||
|
int8_t _RST, int8_t _MISO);
|
||||||
|
Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1);
|
||||||
|
|
||||||
|
void begin(void),
|
||||||
|
setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1),
|
||||||
|
pushColor(uint16_t color),
|
||||||
|
fillScreen(uint16_t color),
|
||||||
|
drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||||
|
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
|
||||||
|
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
|
||||||
|
fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||||
|
uint16_t color),
|
||||||
|
setRotation(uint8_t r),
|
||||||
|
invertDisplay(boolean i);
|
||||||
|
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
|
||||||
|
/* These are not for current use, 8-bit protocol only! */
|
||||||
|
uint8_t readdata(void),
|
||||||
|
readcommand8(uint8_t reg, uint8_t index = 0);
|
||||||
|
/*
|
||||||
|
uint16_t readcommand16(uint8_t);
|
||||||
|
uint32_t readcommand32(uint8_t);
|
||||||
|
void dummyclock(void);
|
||||||
|
*/
|
||||||
|
|
||||||
|
void spiwrite(uint8_t),
|
||||||
|
writecommand(uint8_t c),
|
||||||
|
writedata(uint8_t d),
|
||||||
|
commandList(uint8_t *addr);
|
||||||
|
uint8_t spiread(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t tabcolor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
boolean hwSPI;
|
||||||
|
#if defined (__AVR__) || defined(TEENSYDUINO)
|
||||||
|
uint8_t mySPCR;
|
||||||
|
volatile uint8_t *mosiport, *clkport, *dcport, *rsport, *csport;
|
||||||
|
int8_t _cs, _dc, _rst, _mosi, _miso, _sclk;
|
||||||
|
uint8_t mosipinmask, clkpinmask, cspinmask, dcpinmask;
|
||||||
|
////This def is for the Arduino.ORG M0!!!
|
||||||
|
//#elif defined(ARDUINO_SAM_ZERO)
|
||||||
|
// volatile PORT_OUT_Type *mosiport, *clkport, *dcport, *rsport, *csport;
|
||||||
|
// int32_t _cs, _dc, _rst, _mosi, _miso, _sclk;
|
||||||
|
// PORT_OUT_Type mosipinmask, clkpinmask, cspinmask, dcpinmask;
|
||||||
|
#elif defined (__arm__)
|
||||||
|
volatile RwReg *mosiport, *clkport, *dcport, *rsport, *csport;
|
||||||
|
int32_t _cs, _dc, _rst, _mosi, _miso, _sclk;
|
||||||
|
uint32_t mosipinmask, clkpinmask, cspinmask, dcpinmask;
|
||||||
|
#elif defined (ARDUINO_ARCH_ARC32)
|
||||||
|
int8_t _cs, _dc, _rst, _mosi, _miso, _sclk;
|
||||||
|
#elif defined (ESP8266)
|
||||||
|
int32_t _cs, _dc, _rst, _mosi, _miso, _sclk;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
330
Wire/Wire.cpp
Normal file
330
Wire/Wire.cpp
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
/*
|
||||||
|
TwoWire.cpp - TWI/I2C library for Wiring & Arduino
|
||||||
|
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include "utility/twi.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Wire.h"
|
||||||
|
|
||||||
|
// Initialize Class Variables //////////////////////////////////////////////////
|
||||||
|
|
||||||
|
uint8_t TwoWire::rxBuffer[BUFFER_LENGTH];
|
||||||
|
uint8_t TwoWire::rxBufferIndex = 0;
|
||||||
|
uint8_t TwoWire::rxBufferLength = 0;
|
||||||
|
|
||||||
|
uint8_t TwoWire::txAddress = 0;
|
||||||
|
uint8_t TwoWire::txBuffer[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);
|
||||||
|
|
||||||
|
// Constructors ////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TwoWire::TwoWire()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public Methods //////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void TwoWire::begin(void)
|
||||||
|
{
|
||||||
|
rxBufferIndex = 0;
|
||||||
|
rxBufferLength = 0;
|
||||||
|
|
||||||
|
txBufferIndex = 0;
|
||||||
|
txBufferLength = 0;
|
||||||
|
|
||||||
|
twi_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::begin(uint8_t address)
|
||||||
|
{
|
||||||
|
twi_setAddress(address);
|
||||||
|
twi_attachSlaveTxEvent(onRequestService);
|
||||||
|
twi_attachSlaveRxEvent(onReceiveService);
|
||||||
|
begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::begin(int address)
|
||||||
|
{
|
||||||
|
begin((uint8_t)address);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::end(void)
|
||||||
|
{
|
||||||
|
twi_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::setClock(uint32_t clock)
|
||||||
|
{
|
||||||
|
twi_setFrequency(clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddress, uint8_t isize, uint8_t sendStop)
|
||||||
|
{
|
||||||
|
if (isize > 0) {
|
||||||
|
// send internal address; this mode allows sending a repeated start to access
|
||||||
|
// some devices' internal registers. This function is executed by the hardware
|
||||||
|
// TWI module on other processors (for example Due's TWI_IADR and TWI_MMR registers)
|
||||||
|
|
||||||
|
beginTransmission(address);
|
||||||
|
|
||||||
|
// the maximum size of internal address is 3 bytes
|
||||||
|
if (isize > 3){
|
||||||
|
isize = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write internal register address - most significant byte first
|
||||||
|
while (isize-- > 0)
|
||||||
|
write((uint8_t)(iaddress >> (isize*8)));
|
||||||
|
endTransmission(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clamp to buffer length
|
||||||
|
if(quantity > BUFFER_LENGTH){
|
||||||
|
quantity = BUFFER_LENGTH;
|
||||||
|
}
|
||||||
|
// perform blocking read into buffer
|
||||||
|
uint8_t read = twi_readFrom(address, rxBuffer, quantity, sendStop);
|
||||||
|
// set rx buffer iterator vars
|
||||||
|
rxBufferIndex = 0;
|
||||||
|
rxBufferLength = read;
|
||||||
|
|
||||||
|
return read;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) {
|
||||||
|
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint32_t)0, (uint8_t)0, (uint8_t)sendStop);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity)
|
||||||
|
{
|
||||||
|
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)true);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t TwoWire::requestFrom(int address, int quantity)
|
||||||
|
{
|
||||||
|
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)true);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t TwoWire::requestFrom(int address, int quantity, int sendStop)
|
||||||
|
{
|
||||||
|
return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)sendStop);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::beginTransmission(uint8_t address)
|
||||||
|
{
|
||||||
|
// indicate that we are transmitting
|
||||||
|
transmitting = 1;
|
||||||
|
// set address of targeted slave
|
||||||
|
txAddress = address;
|
||||||
|
// reset tx buffer iterator vars
|
||||||
|
txBufferIndex = 0;
|
||||||
|
txBufferLength = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::beginTransmission(int address)
|
||||||
|
{
|
||||||
|
beginTransmission((uint8_t)address);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Originally, 'endTransmission' was an f(void) function.
|
||||||
|
// It has been modified to take one parameter indicating
|
||||||
|
// whether or not a STOP should be performed on the bus.
|
||||||
|
// Calling endTransmission(false) allows a sketch to
|
||||||
|
// perform a repeated start.
|
||||||
|
//
|
||||||
|
// WARNING: Nothing in the library keeps track of whether
|
||||||
|
// the bus tenure has been properly ended with a STOP. It
|
||||||
|
// is very possible to leave the bus in a hung state if
|
||||||
|
// no call to endTransmission(true) is made. Some I2C
|
||||||
|
// devices will behave oddly if they do not see a STOP.
|
||||||
|
//
|
||||||
|
uint8_t TwoWire::endTransmission(uint8_t sendStop)
|
||||||
|
{
|
||||||
|
// transmit buffer (blocking)
|
||||||
|
uint8_t ret = twi_writeTo(txAddress, txBuffer, txBufferLength, 1, sendStop);
|
||||||
|
// reset tx buffer iterator vars
|
||||||
|
txBufferIndex = 0;
|
||||||
|
txBufferLength = 0;
|
||||||
|
// indicate that we are done transmitting
|
||||||
|
transmitting = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This provides backwards compatibility with the original
|
||||||
|
// definition, and expected behaviour, of endTransmission
|
||||||
|
//
|
||||||
|
uint8_t TwoWire::endTransmission(void)
|
||||||
|
{
|
||||||
|
return endTransmission(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// must be called in:
|
||||||
|
// slave tx event callback
|
||||||
|
// or after beginTransmission(address)
|
||||||
|
size_t TwoWire::write(uint8_t data)
|
||||||
|
{
|
||||||
|
if(transmitting){
|
||||||
|
// in master transmitter mode
|
||||||
|
// don't bother if buffer is full
|
||||||
|
if(txBufferLength >= BUFFER_LENGTH){
|
||||||
|
setWriteError();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// must be called in:
|
||||||
|
// slave tx event callback
|
||||||
|
// or after beginTransmission(address)
|
||||||
|
size_t TwoWire::write(const uint8_t *data, size_t quantity)
|
||||||
|
{
|
||||||
|
if(transmitting){
|
||||||
|
// in master transmitter mode
|
||||||
|
for(size_t i = 0; i < quantity; ++i){
|
||||||
|
write(data[i]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// in slave send mode
|
||||||
|
// reply to master
|
||||||
|
twi_transmit(data, quantity);
|
||||||
|
}
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// must be called in:
|
||||||
|
// slave rx event callback
|
||||||
|
// or after requestFrom(address, numBytes)
|
||||||
|
int TwoWire::available(void)
|
||||||
|
{
|
||||||
|
return rxBufferLength - rxBufferIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
// must be called in:
|
||||||
|
// slave rx event callback
|
||||||
|
// or after requestFrom(address, numBytes)
|
||||||
|
int TwoWire::read(void)
|
||||||
|
{
|
||||||
|
int value = -1;
|
||||||
|
|
||||||
|
// get each successive byte on each call
|
||||||
|
if(rxBufferIndex < rxBufferLength){
|
||||||
|
value = rxBuffer[rxBufferIndex];
|
||||||
|
++rxBufferIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// must be called in:
|
||||||
|
// slave rx event callback
|
||||||
|
// or after requestFrom(address, numBytes)
|
||||||
|
int TwoWire::peek(void)
|
||||||
|
{
|
||||||
|
int value = -1;
|
||||||
|
|
||||||
|
if(rxBufferIndex < rxBufferLength){
|
||||||
|
value = rxBuffer[rxBufferIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWire::flush(void)
|
||||||
|
{
|
||||||
|
// XXX: to be implemented.
|
||||||
|
}
|
||||||
|
|
||||||
|
// behind the scenes function that is called when data is received
|
||||||
|
void TwoWire::onReceiveService(uint8_t* inBytes, int numBytes)
|
||||||
|
{
|
||||||
|
// don't bother if user hasn't registered a callback
|
||||||
|
if(!user_onReceive){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// don't bother if rx buffer is in use by a master requestFrom() op
|
||||||
|
// i know this drops data, but it allows for slight stupidity
|
||||||
|
// meaning, they may not have read all the master requestFrom() data yet
|
||||||
|
if(rxBufferIndex < rxBufferLength){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// copy twi rx buffer into local read buffer
|
||||||
|
// this enables new reads to happen in parallel
|
||||||
|
for(uint8_t i = 0; i < numBytes; ++i){
|
||||||
|
rxBuffer[i] = inBytes[i];
|
||||||
|
}
|
||||||
|
// set rx iterator vars
|
||||||
|
rxBufferIndex = 0;
|
||||||
|
rxBufferLength = numBytes;
|
||||||
|
// alert user program
|
||||||
|
user_onReceive(numBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// behind the scenes function that is called when data is requested
|
||||||
|
void TwoWire::onRequestService(void)
|
||||||
|
{
|
||||||
|
// don't bother if user hasn't registered a callback
|
||||||
|
if(!user_onRequest){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// reset tx buffer iterator vars
|
||||||
|
// !!! this will kill any pending pre-master sendTo() activity
|
||||||
|
txBufferIndex = 0;
|
||||||
|
txBufferLength = 0;
|
||||||
|
// alert user program
|
||||||
|
user_onRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
// sets function called on slave write
|
||||||
|
void TwoWire::onReceive( void (*function)(int) )
|
||||||
|
{
|
||||||
|
user_onReceive = function;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sets function called on slave read
|
||||||
|
void TwoWire::onRequest( void (*function)(void) )
|
||||||
|
{
|
||||||
|
user_onRequest = function;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preinstantiate Objects //////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TwoWire Wire = TwoWire();
|
||||||
|
|
85
Wire/Wire.h
Normal file
85
Wire/Wire.h
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
TwoWire.h - TWI/I2C library for Arduino & Wiring
|
||||||
|
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TwoWire_h
|
||||||
|
#define TwoWire_h
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include "Stream.h"
|
||||||
|
|
||||||
|
#define BUFFER_LENGTH 32
|
||||||
|
|
||||||
|
// WIRE_HAS_END means Wire has end()
|
||||||
|
#define WIRE_HAS_END 1
|
||||||
|
|
||||||
|
class TwoWire : public Stream
|
||||||
|
{
|
||||||
|
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 end();
|
||||||
|
void setClock(uint32_t);
|
||||||
|
void beginTransmission(uint8_t);
|
||||||
|
void beginTransmission(int);
|
||||||
|
uint8_t endTransmission(void);
|
||||||
|
uint8_t endTransmission(uint8_t);
|
||||||
|
uint8_t requestFrom(uint8_t, uint8_t);
|
||||||
|
uint8_t requestFrom(uint8_t, uint8_t, uint8_t);
|
||||||
|
uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t);
|
||||||
|
uint8_t requestFrom(int, int);
|
||||||
|
uint8_t requestFrom(int, int, int);
|
||||||
|
virtual size_t write(uint8_t);
|
||||||
|
virtual size_t write(const uint8_t *, size_t);
|
||||||
|
virtual int available(void);
|
||||||
|
virtual int read(void);
|
||||||
|
virtual int peek(void);
|
||||||
|
virtual void flush(void);
|
||||||
|
void onReceive( void (*)(int) );
|
||||||
|
void onRequest( void (*)(void) );
|
||||||
|
|
||||||
|
inline size_t write(unsigned long n) { return write((uint8_t)n); }
|
||||||
|
inline size_t write(long n) { return write((uint8_t)n); }
|
||||||
|
inline size_t write(unsigned int n) { return write((uint8_t)n); }
|
||||||
|
inline size_t write(int n) { return write((uint8_t)n); }
|
||||||
|
using Print::write;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern TwoWire Wire;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
561
Wire/utility/twi.c
Normal file
561
Wire/utility/twi.c
Normal file
@ -0,0 +1,561 @@
|
|||||||
|
/*
|
||||||
|
twi.c - TWI/I2C library for Wiring & Arduino
|
||||||
|
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <compat/twi.h>
|
||||||
|
#include "Arduino.h" // for digitalWrite
|
||||||
|
|
||||||
|
#ifndef cbi
|
||||||
|
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef sbi
|
||||||
|
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "pins_arduino.h"
|
||||||
|
#include "twi.h"
|
||||||
|
|
||||||
|
static volatile uint8_t twi_state;
|
||||||
|
static volatile uint8_t twi_slarw;
|
||||||
|
static volatile uint8_t twi_sendStop; // should the transaction end with a stop
|
||||||
|
static volatile uint8_t twi_inRepStart; // in the middle of a repeated start
|
||||||
|
|
||||||
|
static void (*twi_onSlaveTransmit)(void);
|
||||||
|
static void (*twi_onSlaveReceive)(uint8_t*, int);
|
||||||
|
|
||||||
|
static uint8_t twi_masterBuffer[TWI_BUFFER_LENGTH];
|
||||||
|
static volatile uint8_t twi_masterBufferIndex;
|
||||||
|
static volatile uint8_t twi_masterBufferLength;
|
||||||
|
|
||||||
|
static uint8_t twi_txBuffer[TWI_BUFFER_LENGTH];
|
||||||
|
static volatile uint8_t twi_txBufferIndex;
|
||||||
|
static volatile uint8_t twi_txBufferLength;
|
||||||
|
|
||||||
|
static uint8_t twi_rxBuffer[TWI_BUFFER_LENGTH];
|
||||||
|
static volatile uint8_t twi_rxBufferIndex;
|
||||||
|
|
||||||
|
static volatile uint8_t twi_error;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_init
|
||||||
|
* Desc readys twi pins and sets twi bitrate
|
||||||
|
* Input none
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_init(void)
|
||||||
|
{
|
||||||
|
// initialize state
|
||||||
|
twi_state = TWI_READY;
|
||||||
|
twi_sendStop = true; // default value
|
||||||
|
twi_inRepStart = false;
|
||||||
|
|
||||||
|
// activate internal pullups for twi.
|
||||||
|
digitalWrite(SDA, 1);
|
||||||
|
digitalWrite(SCL, 1);
|
||||||
|
|
||||||
|
// initialize twi prescaler and bit rate
|
||||||
|
cbi(TWSR, TWPS0);
|
||||||
|
cbi(TWSR, TWPS1);
|
||||||
|
TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
|
||||||
|
// enable twi module, acks, and twi interrupt
|
||||||
|
TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_disable
|
||||||
|
* Desc disables twi pins
|
||||||
|
* Input none
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_disable(void)
|
||||||
|
{
|
||||||
|
// disable twi module, acks, and twi interrupt
|
||||||
|
TWCR &= ~(_BV(TWEN) | _BV(TWIE) | _BV(TWEA));
|
||||||
|
|
||||||
|
// deactivate internal pullups for twi.
|
||||||
|
digitalWrite(SDA, 0);
|
||||||
|
digitalWrite(SCL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_slaveInit
|
||||||
|
* Desc sets slave address and enables interrupt
|
||||||
|
* Input none
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_setAddress(uint8_t address)
|
||||||
|
{
|
||||||
|
// set twi slave address (skip over TWGCE bit)
|
||||||
|
TWAR = address << 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_setClock
|
||||||
|
* Desc sets twi bit rate
|
||||||
|
* Input Clock Frequency
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_setFrequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
TWBR = ((F_CPU / frequency) - 16) / 2;
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_readFrom
|
||||||
|
* Desc attempts to become twi bus master and read a
|
||||||
|
* series of bytes from a device on the bus
|
||||||
|
* Input address: 7bit i2c device address
|
||||||
|
* data: pointer to byte array
|
||||||
|
* length: number of bytes to read into array
|
||||||
|
* sendStop: Boolean indicating whether to send a stop at the end
|
||||||
|
* Output number of bytes read
|
||||||
|
*/
|
||||||
|
uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sendStop)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
// ensure data will fit into buffer
|
||||||
|
if(TWI_BUFFER_LENGTH < length){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait until twi is ready, become master receiver
|
||||||
|
while(TWI_READY != twi_state){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
twi_state = TWI_MRX;
|
||||||
|
twi_sendStop = sendStop;
|
||||||
|
// reset error state (0xFF.. no error occured)
|
||||||
|
twi_error = 0xFF;
|
||||||
|
|
||||||
|
// initialize buffer iteration vars
|
||||||
|
twi_masterBufferIndex = 0;
|
||||||
|
twi_masterBufferLength = length-1; // This is not intuitive, read on...
|
||||||
|
// On receive, the previously configured ACK/NACK setting is transmitted in
|
||||||
|
// response to the received byte before the interrupt is signalled.
|
||||||
|
// Therefor we must actually set NACK when the _next_ to last byte is
|
||||||
|
// received, causing that NACK to be sent in response to receiving the last
|
||||||
|
// expected byte of data.
|
||||||
|
|
||||||
|
// build sla+w, slave device address + w bit
|
||||||
|
twi_slarw = TW_READ;
|
||||||
|
twi_slarw |= address << 1;
|
||||||
|
|
||||||
|
if (true == twi_inRepStart) {
|
||||||
|
// if we're in the repeated start state, then we've already sent the start,
|
||||||
|
// (@@@ we hope), and the TWI statemachine is just waiting for the address byte.
|
||||||
|
// We need to remove ourselves from the repeated start state before we enable interrupts,
|
||||||
|
// since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning
|
||||||
|
// up. Also, don't enable the START interrupt. There may be one pending from the
|
||||||
|
// repeated start that we sent ourselves, and that would really confuse things.
|
||||||
|
twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR
|
||||||
|
do {
|
||||||
|
TWDR = twi_slarw;
|
||||||
|
} while(TWCR & _BV(TWWC));
|
||||||
|
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// send start condition
|
||||||
|
TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA);
|
||||||
|
|
||||||
|
// wait for read operation to complete
|
||||||
|
while(TWI_MRX == twi_state){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (twi_masterBufferIndex < length)
|
||||||
|
length = twi_masterBufferIndex;
|
||||||
|
|
||||||
|
// copy twi buffer to data
|
||||||
|
for(i = 0; i < length; ++i){
|
||||||
|
data[i] = twi_masterBuffer[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_writeTo
|
||||||
|
* Desc attempts to become twi bus master and write a
|
||||||
|
* series of bytes to a device on the bus
|
||||||
|
* Input address: 7bit i2c device address
|
||||||
|
* data: pointer to byte array
|
||||||
|
* length: number of bytes in array
|
||||||
|
* wait: boolean indicating to wait for write or not
|
||||||
|
* sendStop: boolean indicating whether or not to send a stop at the end
|
||||||
|
* Output 0 .. success
|
||||||
|
* 1 .. length to long for buffer
|
||||||
|
* 2 .. address send, NACK received
|
||||||
|
* 3 .. data send, NACK received
|
||||||
|
* 4 .. other twi error (lost bus arbitration, bus error, ..)
|
||||||
|
*/
|
||||||
|
uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
// ensure data will fit into buffer
|
||||||
|
if(TWI_BUFFER_LENGTH < length){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait until twi is ready, become master transmitter
|
||||||
|
while(TWI_READY != twi_state){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
twi_state = TWI_MTX;
|
||||||
|
twi_sendStop = sendStop;
|
||||||
|
// reset error state (0xFF.. no error occured)
|
||||||
|
twi_error = 0xFF;
|
||||||
|
|
||||||
|
// initialize buffer iteration vars
|
||||||
|
twi_masterBufferIndex = 0;
|
||||||
|
twi_masterBufferLength = length;
|
||||||
|
|
||||||
|
// copy data to twi buffer
|
||||||
|
for(i = 0; i < length; ++i){
|
||||||
|
twi_masterBuffer[i] = data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// build sla+w, slave device address + w bit
|
||||||
|
twi_slarw = TW_WRITE;
|
||||||
|
twi_slarw |= address << 1;
|
||||||
|
|
||||||
|
// if we're in a repeated start, then we've already sent the START
|
||||||
|
// in the ISR. Don't do it again.
|
||||||
|
//
|
||||||
|
if (true == twi_inRepStart) {
|
||||||
|
// if we're in the repeated start state, then we've already sent the start,
|
||||||
|
// (@@@ we hope), and the TWI statemachine is just waiting for the address byte.
|
||||||
|
// We need to remove ourselves from the repeated start state before we enable interrupts,
|
||||||
|
// since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning
|
||||||
|
// up. Also, don't enable the START interrupt. There may be one pending from the
|
||||||
|
// repeated start that we sent outselves, and that would really confuse things.
|
||||||
|
twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR
|
||||||
|
do {
|
||||||
|
TWDR = twi_slarw;
|
||||||
|
} while(TWCR & _BV(TWWC));
|
||||||
|
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// send start condition
|
||||||
|
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE) | _BV(TWSTA); // enable INTs
|
||||||
|
|
||||||
|
// wait for write operation to complete
|
||||||
|
while(wait && (TWI_MTX == twi_state)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (twi_error == 0xFF)
|
||||||
|
return 0; // success
|
||||||
|
else if (twi_error == TW_MT_SLA_NACK)
|
||||||
|
return 2; // error: address send, nack received
|
||||||
|
else if (twi_error == TW_MT_DATA_NACK)
|
||||||
|
return 3; // error: data send, nack received
|
||||||
|
else
|
||||||
|
return 4; // other twi error
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_transmit
|
||||||
|
* Desc fills slave tx buffer with data
|
||||||
|
* must be called in slave tx event callback
|
||||||
|
* Input data: pointer to byte array
|
||||||
|
* length: number of bytes in array
|
||||||
|
* Output 1 length too long for buffer
|
||||||
|
* 2 not slave transmitter
|
||||||
|
* 0 ok
|
||||||
|
*/
|
||||||
|
uint8_t twi_transmit(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
// ensure data will fit into buffer
|
||||||
|
if(TWI_BUFFER_LENGTH < (twi_txBufferLength+length)){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure we are currently a slave transmitter
|
||||||
|
if(TWI_STX != twi_state){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set length and copy data into tx buffer
|
||||||
|
for(i = 0; i < length; ++i){
|
||||||
|
twi_txBuffer[twi_txBufferLength+i] = data[i];
|
||||||
|
}
|
||||||
|
twi_txBufferLength += length;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_attachSlaveRxEvent
|
||||||
|
* Desc sets function called before a slave read operation
|
||||||
|
* Input function: callback function to use
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_attachSlaveRxEvent( void (*function)(uint8_t*, int) )
|
||||||
|
{
|
||||||
|
twi_onSlaveReceive = function;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_attachSlaveTxEvent
|
||||||
|
* Desc sets function called before a slave write operation
|
||||||
|
* Input function: callback function to use
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_attachSlaveTxEvent( void (*function)(void) )
|
||||||
|
{
|
||||||
|
twi_onSlaveTransmit = function;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_reply
|
||||||
|
* Desc sends byte or readys receive line
|
||||||
|
* Input ack: byte indicating to ack or to nack
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_stop
|
||||||
|
* Desc relinquishes bus master status
|
||||||
|
* Input none
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function twi_releaseBus
|
||||||
|
* Desc releases bus control
|
||||||
|
* Input none
|
||||||
|
* Output none
|
||||||
|
*/
|
||||||
|
void twi_releaseBus(void)
|
||||||
|
{
|
||||||
|
// release bus
|
||||||
|
TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
|
||||||
|
|
||||||
|
// update twi state
|
||||||
|
twi_state = TWI_READY;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(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{
|
||||||
|
if (twi_sendStop)
|
||||||
|
twi_stop();
|
||||||
|
else {
|
||||||
|
twi_inRepStart = true; // we're gonna send the START
|
||||||
|
// don't enable the interrupt. We'll generate the start, but we
|
||||||
|
// avoid handling the interrupt until we're in the next transaction,
|
||||||
|
// at the point where we would normally issue the start.
|
||||||
|
TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
|
||||||
|
twi_state = TWI_READY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
if (twi_sendStop)
|
||||||
|
twi_stop();
|
||||||
|
else {
|
||||||
|
twi_inRepStart = true; // we're gonna send the START
|
||||||
|
// don't enable the interrupt. We'll generate the start, but we
|
||||||
|
// avoid handling the interrupt until we're in the next transaction,
|
||||||
|
// at the point where we would normally issue the start.
|
||||||
|
TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
|
||||||
|
twi_state = TWI_READY;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
// ack future responses and leave slave receiver state
|
||||||
|
twi_releaseBus();
|
||||||
|
// put a null char after data if there's room
|
||||||
|
if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
|
||||||
|
twi_rxBuffer[twi_rxBufferIndex] = '\0';
|
||||||
|
}
|
||||||
|
// 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;
|
||||||
|
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
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
55
Wire/utility/twi.h
Normal file
55
Wire/utility/twi.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
twi.h - TWI/I2C library for Wiring & Arduino
|
||||||
|
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef twi_h
|
||||||
|
#define twi_h
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
//#define ATMEGA8
|
||||||
|
|
||||||
|
#ifndef TWI_FREQ
|
||||||
|
#define TWI_FREQ 100000L
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TWI_BUFFER_LENGTH
|
||||||
|
#define TWI_BUFFER_LENGTH 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TWI_READY 0
|
||||||
|
#define TWI_MRX 1
|
||||||
|
#define TWI_MTX 2
|
||||||
|
#define TWI_SRX 3
|
||||||
|
#define TWI_STX 4
|
||||||
|
|
||||||
|
void twi_init(void);
|
||||||
|
void twi_disable(void);
|
||||||
|
void twi_setAddress(uint8_t);
|
||||||
|
void twi_setFrequency(uint32_t);
|
||||||
|
uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t);
|
||||||
|
uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t);
|
||||||
|
uint8_t twi_transmit(const uint8_t*, uint8_t);
|
||||||
|
void twi_attachSlaveRxEvent( void (*)(uint8_t*, int) );
|
||||||
|
void twi_attachSlaveTxEvent( void (*)(void) );
|
||||||
|
void twi_reply(uint8_t);
|
||||||
|
void twi_stop(void);
|
||||||
|
void twi_releaseBus(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user