diff --git a/.gitignore b/.gitignore index c5d99cb..e24b84c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.un~ +*.sublime-project +*.sublime-workspace \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 43666bd..f4b1ba0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ env: - PLATFORMIO_CI_SRC=examples/IRtest PLATFORMIO_BUILD_FLAGS="-DSEND_NEC -DSEND_SONY -DSEND_RC5 -DSEND_RC6" - PLATFORMIO_CI_SRC=examples/IRtest2 PLATFORMIO_BUILD_FLAGS="-DSEND_NEC -DSEND_SONY -DSEND_RC5 -DSEND_RC6" - PLATFORMIO_CI_SRC=examples/JVCPanasonicSendDemo PLATFORMIO_BUILD_FLAGS="-DSEND_JVC -DSEND_PANASONIC" + - PLATFORMIO_CI_SRC=examples/IRremoteInfo install: - python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" diff --git a/Contributing.md b/Contributing.md new file mode 100644 index 0000000..56409a9 --- /dev/null +++ b/Contributing.md @@ -0,0 +1,11 @@ +# Contribution Guidlines + +This library is the culmination of the expertise of many members of the open source community who have dedicated their time and hard work. The best way to ask for help or propose a new idea is to [create a new issue](https://github.com/z3t0/Arduino-IRremote/issues/new) while creating a Pull Request with your code changes allows you to share your own innovations with the rest of the community. + +The following are some guidelines to observe when creating issues or PRs: +- Be friendly; it is important that we can all enjoy a safe space as we are all working on the same project and it is okay for people to have different ideas +- [Use code blocks](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code); it helps us help you when we can read your code! On that note also refrain from pasting more than 30 lines of code in a post, instead [create a gist](https://gist.github.com/) if you need to share large snippets +- Use reasonable titles; refrain from using overly long or capitalized titles as they are usually annoying and do little to encourage others to help :smile: +- Be detailed; refrain from mentioning code problems without sharing your source code and always give information regarding your board and version of the library + +If there is any need to contact me then you can find my email on the README, I do not mind responding to emails but it would be in your own interests to create issues if you need help with the library as responses would be from a larger community with greater knowledge! \ No newline at end of file diff --git a/Contributors.md b/Contributors.md index e56b29c..6988f52 100644 --- a/Contributors.md +++ b/Contributors.md @@ -12,6 +12,9 @@ These are the active contributors of this project that you may contact if there - [Neco777](https://github.com/neco777) : Active contributor - [Lauszus](https://github.com/lauszus) : Active contributor - [csBlueChip](https://github.com/csbluechip) : Active contributor, who contributed major and vital changes to the code base. +- [Sebazzz](https://github.com/sebazz): Contributor +- [lumbric](https://github.com/lumbric): Contributor +- [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Active Contributor Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. diff --git a/IRremote.cpp b/IRremote.cpp index 466a4fb..c9907eb 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -41,14 +41,19 @@ // int MATCH (int measured, int desired) { - DBG_PRINT("Testing: "); + DBG_PRINT(F("Testing: ")); DBG_PRINT(TICKS_LOW(desired), DEC); - DBG_PRINT(" <= "); + DBG_PRINT(F(" <= ")); DBG_PRINT(measured, DEC); - DBG_PRINT(" <= "); - DBG_PRINTLN(TICKS_HIGH(desired), DEC); + DBG_PRINT(F(" <= ")); + DBG_PRINT(TICKS_HIGH(desired), DEC); - return ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired))); + bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired))); + if (passed) + DBG_PRINTLN(F("?; passed")); + else + DBG_PRINTLN(F("?; FAILED")); + return passed; } //+======================================================== @@ -56,19 +61,25 @@ int MATCH (int measured, int desired) // int MATCH_MARK (int measured_ticks, int desired_us) { - DBG_PRINT("Testing mark "); + DBG_PRINT(F("Testing mark (actual vs desired): ")); DBG_PRINT(measured_ticks * USECPERTICK, DEC); - DBG_PRINT(" vs "); + DBG_PRINT(F("us vs ")); DBG_PRINT(desired_us, DEC); + DBG_PRINT("us"); DBG_PRINT(": "); - DBG_PRINT(TICKS_LOW(desired_us + MARK_EXCESS), DEC); - DBG_PRINT(" <= "); - DBG_PRINT(measured_ticks, DEC); - DBG_PRINT(" <= "); - DBG_PRINTLN(TICKS_HIGH(desired_us + MARK_EXCESS), DEC); + DBG_PRINT(TICKS_LOW(desired_us + MARK_EXCESS) * USECPERTICK, DEC); + DBG_PRINT(F(" <= ")); + DBG_PRINT(measured_ticks * USECPERTICK, DEC); + DBG_PRINT(F(" <= ")); + DBG_PRINT(TICKS_HIGH(desired_us + MARK_EXCESS) * USECPERTICK, DEC); - return ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS)) - && (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS))); + bool passed = ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS)) + && (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS))); + if (passed) + DBG_PRINTLN(F("?; passed")); + else + DBG_PRINTLN(F("?; FAILED")); + return passed; } //+======================================================== @@ -76,19 +87,25 @@ int MATCH_MARK (int measured_ticks, int desired_us) // int MATCH_SPACE (int measured_ticks, int desired_us) { - DBG_PRINT("Testing space "); + DBG_PRINT(F("Testing space (actual vs desired): ")); DBG_PRINT(measured_ticks * USECPERTICK, DEC); - DBG_PRINT(" vs "); + DBG_PRINT(F("us vs ")); DBG_PRINT(desired_us, DEC); + DBG_PRINT("us"); DBG_PRINT(": "); - DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS), DEC); - DBG_PRINT(" <= "); - DBG_PRINT(measured_ticks, DEC); - DBG_PRINT(" <= "); - DBG_PRINTLN(TICKS_HIGH(desired_us - MARK_EXCESS), DEC); + DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS) * USECPERTICK, DEC); + DBG_PRINT(F(" <= ")); + DBG_PRINT(measured_ticks * USECPERTICK, DEC); + DBG_PRINT(F(" <= ")); + DBG_PRINT(TICKS_HIGH(desired_us - MARK_EXCESS) * USECPERTICK, DEC); - return ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS)) - && (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS))); + bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS)) + && (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS))); + if (passed) + DBG_PRINTLN(F("?; passed")); + else + DBG_PRINTLN(F("?; FAILED")); + return passed; } //+============================================================================= diff --git a/IRremote.h b/IRremote.h index 86815b4..96d82ca 100644 --- a/IRremote.h +++ b/IRremote.h @@ -257,7 +257,7 @@ class IRsend void enableIROut (int khz) ; void mark (unsigned int usec) ; void space (unsigned int usec) ; - void sendRaw (unsigned int buf[], unsigned int len, unsigned int hz) ; + void sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz) ; //...................................................................... # if SEND_RC5 diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..bb9232e --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,21 @@ +**Board:** ARDUINO UNO +**Library Version:** 2.1.0 +**Protocol:** Sony (if any) + +**Code Block:** +```c + +#include + +..... + +``` + +Use [a gist](gist.github.com) if the code exceeds 30 lines + +**checklist:** +- [] The latest [release](https://github.com/z3t0/Arduino-IRremote/releases/latest) is used +- [] Any code referenced is provided +- [] The title of the issue is helpful and relevant + +The above is a short template allowing you to make detailed issues! \ No newline at end of file diff --git a/README.md b/README.md index fe7fa25..33c1d11 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This library enables you to send and receive using infra-red signals on an Ardui Check [here](http://z3t0.github.io/Arduino-IRremote/) for tutorials and more information. -## Version - 2.01 +## Version - 2.1.0 ## Installation 1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page. @@ -17,6 +17,33 @@ Check [here](http://z3t0.github.io/Arduino-IRremote/) for tutorials and more inf 4. Move the "IRremote" folder that has been extracted to your libraries directory. 5. Make sure to delete Arduino_Root/libraries/RobotIRremote. Where Arduino_Root refers to the install directory of Arduino. The library RobotIRremote has similar definitions to IRremote and causes errors. +## Supported Boards +- Arduino Uno / Mega / Leonardo / Duemilanove / Diecimila / LilyPad / Mini / Fio / Nano etc. +- Teensy 1.0 / 1.0++ / 2.0 / 2++ / 3.0 / 3.1 / Teensy-LC; Credits: @PaulStoffregen (Teensy Team) +- Sanguino +- Atmega8 +- ATtiny 84 / 85 + +We are open to suggestions for adding support to new boards, however we highly recommend you contact your supplier first and ask them to provide support from their side. + +### Hardware specifications + +| Board/CPU | Send Pin | Timers | +|------------------------------------------|---------------------|-------------------| +| Arduino Mega / ATmega 1280 / ATmega 2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 | +| Teensy 1.0 | **17** | **1** | +| Teensy 2.0 | 9, **10**, 14 | 1, 3, **4_HS** | +| Teensy++ 1.0 / 2.0 | **1**, 16, 25 | 1, **2**, 3 | +| Teensy 3.0 / 3.1 | **5** | **CMT** | +| Teensy-LC | **16** | **TPM1** | +| Sanguino | 13, **14** | 1, **2** | +| Atmega8 | **9** | **1** | +| ATtiny84 | **6** | **1** | +| ATtiny85 | **1** | **TINY0** | +| Arduino Duemilanove, UNO etc. | **3**, 9 | 1, **2** | + +The table above lists the currently supported timers and corresponding send pins, many of these can have additional pins opened up and we are open to requests if a need arises for other pins. + ## Usage - TODO (Check examples for now) @@ -27,7 +54,8 @@ If you want to contribute to this project: - Create issues and pull requests - Tell other people about this library - Contribute new protocols -- + +Check [here](Contributing.md) for some guidelines. ## Contact The only way to contact me at the moment is by email: zetoslab@gmail.com diff --git a/arduino-irremote.sublime-workspace b/arduino-irremote.sublime-workspace new file mode 100644 index 0000000..f536803 --- /dev/null +++ b/arduino-irremote.sublime-workspace @@ -0,0 +1,240 @@ +{ + "auto_complete": + { + "selected_items": + [ + [ + "vb", + "vboMatrix" + ] + ] + }, + "buffers": + [ + ], + "build_system": "", + "build_system_choices": + [ + ], + "build_varint": "", + "command_palette": + { + "height": 275.0, + "last_filter": "blame", + "selected_items": + [ + [ + "blame", + "Git: Blame" + ], + [ + "install", + "Package Control: Install Package" + ], + [ + "diff", + "Git: Diff Current File" + ], + [ + "js", + "Set Syntax: JavaScript" + ], + [ + "i", + "Package Control: Install Package" + ], + [ + "instal", + "Package Control: Install Package" + ] + ], + "width": 510.0 + }, + "console": + { + "height": 126.0, + "history": + [ + "import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)" + ] + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "expanded_folders": + [ + "/C/Users/Rafi Khan/Documents/Arduino/libraries/Arduino-IRremote" + ], + "file_history": + [ + "/C/Users/Rafi Khan/Documents/Arduino/libraries/Arduino-IRremote/changelog.md", + "/C/Users/Rafi Khan/Documents/Development/Arduino-IRremote/arduino-irremote.sublime-project", + "/C/Users/Rafi Khan/Documents/Development/Arduino-IRremote/.gitignore", + "/C/Users/Rafi Khan/Documents/Development/magic/README.md", + "/C/Users/Rafi Khan/Documents/Development/magic/shader.frag", + "/C/Users/Rafi Khan/Documents/Development/magic/package.json", + "/C/Users/Rafi Khan/Documents/Development/magic/block.js", + "/C/Users/Rafi Khan/Documents/Development/magic/chunker.js", + "/C/Users/Rafi Khan/Documents/Development/magic/index.js", + "/C/Users/Rafi Khan/Documents/Development/magic/blocks", + "/C/Users/Rafi Khan/AppData/Roaming/Sublime Text 3/Packages/User/Preferences.sublime-settings", + "/C/Users/Rafi Khan/Documents/Development/magic/shader.vert", + "/C/Users/Rafi Khan/Documents/Development/magic/magic.sublime-project", + "/C/Users/Rafi Khan/Documents/Development/magic/node_modules/browserify/node_modules/syntax-error/node_modules/acorn/.tern-project", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/supermarket.py", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/takingavacation.py", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/TipCalculator.py", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/battleship.py", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/exam.py", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/pyglatin.py", + "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/student.py" + ], + "find": + { + "height": 28.0 + }, + "find_in_files": + { + "height": 0.0, + "where_history": + [ + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + "i", + "Direction", + ";", + ";\n", + "north", + "cubeMatrix", + ")\n", + "vec3.set", + "f", + ";", + "();\n", + "render", + "this", + "y" + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "sheets": + [ + ] + } + ], + "incremental_find": + { + "height": 28.0 + }, + "input": + { + "height": 66.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "output.find_results": + { + "height": 0.0 + }, + "pinned_build_system": "", + "project": "arduino-irremote.sublime-project", + "replace": + { + "height": 52.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + [ + "json", + "package.json" + ], + [ + "inde", + "index.js" + ] + ], + "width": 0.0 + }, + "select_project": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "select_symbol": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "selected_group": 0, + "settings": + { + }, + "show_minimap": true, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": true, + "side_bar_width": 150.0, + "status_bar_visible": true, + "template_settings": + { + } +} diff --git a/changelog.md b/changelog.md index 81e95d8..2901dd1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,17 @@ +## 2.1.0 - 2016/02/20 +- Improved Debugging [PR #258](https://github.com/z3t0/Arduino-IRremote/pull/258) +- Display TIME instead of TICKS [PR #258](https://github.com/z3t0/Arduino-IRremote/pull/258) + +## 2.0.4 - 2016/02/20 +- Add Panasonic and JVC to IRrecord example [PR](https://github.com/z3t0/Arduino-IRremote/pull/54) + +## 2.0.3 - 2016/02/20 +- Change IRSend Raw parameter to const [PR](https://github.com/z3t0/Arduino-IRremote/pull/227) + +## 2.0.2 - 2015/12/02 +- Added IRremoteInfo Sketch - [PR](https://github.com/z3t0/Arduino-IRremote/pull/241) +- Enforcing changelog.md + ## 2.0.1 - 2015/07/26 - [Release](https://github.com/shirriff/Arduino-IRremote/releases/tag/BETA) ### Changes - Updated README diff --git a/examples/IRrecord/IRrecord.ino b/examples/IRrecord/IRrecord.ino index caf86de..bf290fa 100644 --- a/examples/IRrecord/IRrecord.ino +++ b/examples/IRrecord/IRrecord.ino @@ -80,6 +80,12 @@ void storeCode(decode_results *results) { else if (codeType == SONY) { Serial.print("Received SONY: "); } + else if (codeType == PANASONIC) { + Serial.print("Received PANASONIC: "); + } + else if (codeType == JVC) { + Serial.print("Received JVC: "); + } else if (codeType == RC5) { Serial.print("Received RC5: "); } @@ -114,6 +120,16 @@ void sendCode(int repeat) { Serial.print("Sent Sony "); Serial.println(codeValue, HEX); } + else if (codeType == PANASONIC) { + irsend.sendPanasonic(codeValue, codeLen); + Serial.print("Sent Panasonic"); + Serial.println(codeValue, HEX); + } + else if (codeType == JVC) { + irsend.sendPanasonic(codeValue, codeLen); + Serial.print("Sent JVC"); + Serial.println(codeValue, HEX); + } else if (codeType == RC5 || codeType == RC6) { if (!repeat) { // Flip the toggle bit for a new button press diff --git a/irSend.cpp b/irSend.cpp index 1340e63..253c941 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -2,7 +2,7 @@ #include "IRremoteInt.h" //+============================================================================= -void IRsend::sendRaw (unsigned int buf[], unsigned int len, unsigned int hz) +void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz) { // Set IR carrier frequency enableIROut(hz); diff --git a/library.json b/library.json index 3a29ecd..b08559f 100644 --- a/library.json +++ b/library.json @@ -8,5 +8,16 @@ "url": "https://github.com/shirriff/Arduino-IRremote.git" }, "frameworks": "arduino", - "platforms": "atmelavr" + "platforms": "atmelavr", + "authors" : + [ + { + "name":"Rafi Khan", + "email":"zetoslab@gmail.com" + }, + { + "name":"Ken Shirriff", + "email":"ken.shirriff@gmail.com" + } +] }