IR-PC-HID-Remote.ino 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. //------------------------------------------------------------------------------
  2. // Include the IRremote library header
  3. //
  4. #include <IRremote.h>
  5. #include <HID-Project.h> // HID-Project 2.8.2
  6. // switch on/off debug mode at once
  7. bool isDebugBuild = false;
  8. // enable HID Keyboard output
  9. bool sendHID = true;
  10. // ATTENTION - set ALL debug and useSerial to false in normal usage
  11. // as sending over Serial blocks the Arduino Leonardo unless a terminal application is connected!
  12. bool debug = false;
  13. bool debug2 = false;
  14. bool useSerial = false;
  15. // global conf vars
  16. unsigned int holdButton_releaseTimeout = 120; // global default, will be overwritten depending on RC code used
  17. #define BTN_UNKNOWN 0
  18. #define BTN_1 1
  19. #define BTN_2 2
  20. #define BTN_3 3
  21. #define BTN_4 4
  22. #define BTN_5 5
  23. #define BTN_6 6
  24. #define BTN_7 7
  25. #define BTN_8 8
  26. #define BTN_9 9
  27. #define BTN_0 10
  28. #define BTN_PLAY 11
  29. #define BTN_PAUSE 12
  30. #define BTN_STOP 13
  31. #define BTN_REC 14
  32. #define BTN_REWD 15
  33. #define BTN_FFWD 16
  34. #define BTN_PREV 17
  35. #define BTN_NEXT 18
  36. #define BTN_LEFT 20
  37. #define BTN_RIGHT 21
  38. #define BTN_UP 22
  39. #define BTN_DOWN 23
  40. #define BTN_OK_ENTER 24
  41. #define BTN_BACK 25
  42. #define BTN_MENU 26
  43. #define BTN_HOME 27
  44. #define BTN_RED 30
  45. #define BTN_GREEN 31
  46. #define BTN_YELLOW 32
  47. #define BTN_BLUE 33
  48. #define BTN_STATUS 34
  49. #define BTN_RETURN 35
  50. #define BTN_SETUP 36
  51. #define BTN_GUIDE 37
  52. #define BTN_RADIO 38
  53. #define BTN_PREVCH 39
  54. #define BTN_CH_DOWN 40
  55. #define BTN_CH_UP 41
  56. #define BTN_VOL_DOWN 42
  57. #define BTN_VOL_UP 43
  58. #define BTN_MUTE 44
  59. #define BTN_TV 46
  60. #define BTN_VIDEOS 47
  61. #define BTN_MUSIC 48
  62. #define BTN_PICTURES 49
  63. #define BTN_STAR 50
  64. #define BTN_HASH 51
  65. #define BTN_PAGE_UP 60
  66. #define BTN_PAGE_DOWN 61
  67. #define BTN_CONTEXT 62
  68. #define BTN_INFO 63
  69. #define BTN_POWER 100
  70. #define BTN_TASKSWITCH 101
  71. #define BTN_SLEEP 102
  72. #define BTN_REPETITION 255
  73. // Button Modes
  74. #define BUTTONMODE_LAST 0
  75. #define BUTTONMODE_ONCE 1
  76. #define BUTTONMODE_HOLD 2
  77. #define BUTTONMODE_REPEAT 3
  78. #define BUTTONMODE_EXTENDED_REPEAT 4
  79. // Remote Types
  80. #define REMOTETYPE_RC5 0
  81. #define REMOTETYPE_RC6 1
  82. // global vars
  83. unsigned long lastNECcode;
  84. unsigned long lastReceivedMillis;
  85. unsigned long holdButton_lastTriggeredMillis = 0;
  86. //------------------------------------------------------------------------------
  87. // Tell IRremote which Arduino pin is connected to the IR Receiver (TSOP4838)
  88. //
  89. int recvPin = 2;
  90. IRrecv irrecv(recvPin);
  91. //+=============================================================================
  92. // Configure the Arduino
  93. //
  94. void setup ( )
  95. {
  96. if (isDebugBuild) {
  97. useSerial = true;
  98. debug = true;
  99. debug2 = true;
  100. }
  101. if (useSerial || debug || debug2) Serial.begin(115200);
  102. BootKeyboard.begin();
  103. Consumer.begin();
  104. System.begin();
  105. irrecv.enableIRIn(); // Start the receiver
  106. }
  107. //+=============================================================================
  108. // Dump out the decode_results structure.
  109. //
  110. void dumpInfo (decode_results *results)
  111. {
  112. // Check if the buffer overflowed
  113. // if (results->overflow) {
  114. // Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWLEN");
  115. // return;
  116. // }
  117. if (debug) {
  118. if ((results->decode_type != UNKNOWN && results->bits > 0) && debug2) {
  119. if (useSerial) {
  120. Serial.println();
  121. Serial.println();
  122. Serial.print(F("RECEIVED: "));
  123. encoding(results);
  124. Serial.print(";0x");
  125. ircode(results);
  126. Serial.print(";");
  127. Serial.print(results->bits, DEC);
  128. Serial.println();
  129. }
  130. }
  131. }
  132. // RC5 CODES
  133. if (results->decode_type == RC5 && results->bits == 12) {
  134. // RC5 code
  135. // 3 bytes, start byte for this device is 0xF or 0x7 depending on toggle bit
  136. uint8_t _currRC5Code = results->value ^ 0xF00;
  137. uint8_t _currRC5Pref = ( _currRC5Code ^ results->value ) >> 8;
  138. if (debug) {
  139. Serial.print(F(" _currRC5Code=0x"));
  140. Serial.print(_currRC5Code, HEX);
  141. Serial.print(F(" _currRC5Pref=0x"));
  142. Serial.println(_currRC5Pref, HEX);
  143. }
  144. // Hauppauge Remote
  145. if (_currRC5Code == 0xBD) { // POWER (upper right key)
  146. //handleButton_RCx(BTN_POWER, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  147. //handlePowerButton();
  148. handleButton_RCx(BTN_POWER, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  149. }
  150. else if (_currRC5Code == 0xBB) { // HOME/GO (upper left key)
  151. //handleButton_RCx(BTN_HOME, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  152. //handleTaskSwitchButton();
  153. handleButton_RCx(BTN_TASKSWITCH, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  154. }
  155. // media player controls
  156. else if (_currRC5Code == 0xB7) { // REC
  157. handleButton_RCx(BTN_REC, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  158. }
  159. else if (_currRC5Code == 0xB6) { // STOP
  160. handleButton_RCx(BTN_STOP, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  161. }
  162. else if (_currRC5Code == 0xB5) { // PLAY
  163. handleButton_RCx(BTN_PLAY, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  164. }
  165. else if (_currRC5Code == 0xB0) { // PAUSE
  166. handleButton_RCx(BTN_PAUSE, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  167. }
  168. else if (_currRC5Code == 0xA4) { // PREV
  169. handleButton_RCx(BTN_PREV, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  170. }
  171. else if (_currRC5Code == 0x9E) { // NEXT
  172. handleButton_RCx(BTN_NEXT, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  173. }
  174. else if (_currRC5Code == 0xB2) { // REWIND
  175. //handleButton_RCx(BTN_REWD, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  176. //handleButton_RCx(BTN_REWD, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  177. handleButton_RCx(BTN_REWD, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  178. }
  179. else if (_currRC5Code == 0xB4) { // FAST_FORWARD
  180. //handleButton_RCx(BTN_FFWD, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  181. //handleButton_RCx(BTN_FFWD, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  182. handleButton_RCx(BTN_FFWD, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  183. }
  184. // above control pad
  185. else if (_currRC5Code == 0x9B) { // GUIDE -> left above control pad
  186. //handleButton_RCx(BTN_GUIDE, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  187. handleButton_RCx(BTN_TASKSWITCH, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  188. }
  189. else if (_currRC5Code == 0x8C) { // RADIO -> right above control pad
  190. //handleButton_RCx(BTN_RADIO, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  191. handleButton_RCx(BTN_CONTEXT, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  192. }
  193. // control pad
  194. else if (_currRC5Code == 0xA5) { // OK
  195. //handleButton_RCx(BTN_OK_ENTER, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  196. handleButton_RCx(BTN_OK_ENTER, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  197. }
  198. else if (_currRC5Code == 0x94) { // ARROW UP
  199. //handleButton_RCx(BTN_UP, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  200. //handleButton_RCx(BTN_UP, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  201. handleButton_RCx(BTN_UP, BUTTONMODE_EXTENDED_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  202. }
  203. else if (_currRC5Code == 0x95) { // ARROW DOWN
  204. //handleButton_RCx(BTN_DOWN, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  205. //handleButton_RCx(BTN_DOWN, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  206. handleButton_RCx(BTN_DOWN, BUTTONMODE_EXTENDED_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  207. }
  208. else if (_currRC5Code == 0x96) { // ARROW LEFT
  209. //handleButton_RCx(BTN_LEFT, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  210. //handleButton_RCx(BTN_LEFT, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  211. handleButton_RCx(BTN_LEFT, BUTTONMODE_EXTENDED_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  212. }
  213. else if (_currRC5Code == 0x97) { // ARROW RIGHT
  214. //handleButton_RCx(BTN_RIGHT, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  215. //handleButton_RCx(BTN_RIGHT, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  216. handleButton_RCx(BTN_RIGHT, BUTTONMODE_EXTENDED_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  217. }
  218. else if (_currRC5Code == 0xA5) { // OK
  219. //handleButton_RCx(BTN_OK_ENTER, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  220. handleButton_RCx(BTN_OK_ENTER, BUTTONMODE_EXTENDED_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  221. }
  222. // below control pad
  223. else if (_currRC5Code == 0x9F) { // BACK/EXIT -> -> swapped and used as on the other remotes as MENU
  224. handleButton_RCx(BTN_MENU, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  225. }
  226. else if (_currRC5Code == 0x8D) { // i/MENU -> swapped and used as on the other remotes as BACK/EXIT
  227. handleButton_RCx(BTN_BACK, BUTTONMODE_HOLD, _currRC5Pref, REMOTETYPE_RC5);
  228. }
  229. // volume controls
  230. else if (_currRC5Code == 0x90) { // VOL+
  231. handleButton_RCx(BTN_VOL_UP, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  232. }
  233. else if (_currRC5Code == 0x91) { // VOL-
  234. handleButton_RCx(BTN_VOL_DOWN, BUTTONMODE_REPEAT, _currRC5Pref, REMOTETYPE_RC5);
  235. }
  236. else if (_currRC5Code == 0x8F) { // MUTE
  237. handleButton_RCx(BTN_MUTE, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  238. }
  239. // channel controls
  240. else if (_currRC5Code == 0xA1) { // CH- used as page down
  241. handleButton_RCx(BTN_CH_DOWN, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  242. }
  243. else if (_currRC5Code == 0xA0) { // CH+ used as page up
  244. handleButton_RCx(BTN_CH_UP, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  245. }
  246. else if (_currRC5Code == 0x92) { // PREV.CH
  247. handleButton_RCx(BTN_CONTEXT, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  248. }
  249. // sources
  250. else if (_currRC5Code == 0x9C) { // TV
  251. handleButton_RCx(BTN_TV, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  252. }
  253. else if (_currRC5Code == 0x98) { // VIDEOS
  254. handleButton_RCx(BTN_VIDEOS, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  255. }
  256. else if (_currRC5Code == 0x99) { // MUSIC
  257. handleButton_RCx(BTN_MUSIC, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  258. }
  259. else if (_currRC5Code == 0x9A) { // PICTURES
  260. handleButton_RCx(BTN_PICTURES, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  261. }
  262. // number keys
  263. else if (_currRC5Code == 0x81) { // 1
  264. handleButton_RCx(BTN_1, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  265. }
  266. else if (_currRC5Code == 0x82) { // 2
  267. handleButton_RCx(BTN_2, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  268. }
  269. else if (_currRC5Code == 0x83) { // 3
  270. handleButton_RCx(BTN_3, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  271. }
  272. else if (_currRC5Code == 0x84) { // 4
  273. handleButton_RCx(BTN_4, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  274. }
  275. else if (_currRC5Code == 0x85) { // 5
  276. handleButton_RCx(BTN_5, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  277. }
  278. else if (_currRC5Code == 0x86) { // 6
  279. handleButton_RCx(BTN_6, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  280. }
  281. else if (_currRC5Code == 0x87) { // 7
  282. handleButton_RCx(BTN_7, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  283. }
  284. else if (_currRC5Code == 0x88) { // 8
  285. handleButton_RCx(BTN_8, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  286. }
  287. else if (_currRC5Code == 0x89) { // 9
  288. handleButton_RCx(BTN_9, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  289. }
  290. else if (_currRC5Code == 0x80) { // 0
  291. handleButton_RCx(BTN_0, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  292. }
  293. else if (_currRC5Code == 0x8A) { // *
  294. handleButton_RCx(BTN_STAR, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  295. }
  296. else if (_currRC5Code == 0x8E) { // #
  297. handleButton_RCx(BTN_HASH, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  298. }
  299. // color keys
  300. else if (_currRC5Code == 0x8B) { // RED
  301. handleButton_RCx(BTN_RED, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  302. }
  303. else if (_currRC5Code == 0xAE) { // GREEN
  304. handleButton_RCx(BTN_GREEN, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  305. }
  306. else if (_currRC5Code == 0xB8) { // YELLOW
  307. handleButton_RCx(BTN_YELLOW, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  308. }
  309. else if (_currRC5Code == 0xA9) { // BLUE
  310. handleButton_RCx(BTN_BLUE, BUTTONMODE_ONCE, _currRC5Pref, REMOTETYPE_RC5);
  311. }
  312. } // END RC5 CODES
  313. // SONY CODES
  314. else if (results->decode_type == SONY && results->bits == 12) {
  315. // DENON RC-1014 REMOTE, Mode AUDIO/CD, MEDIA KEYS (set to SONY CD Player)
  316. if (results->value == 0x9D1) { // PAUSE
  317. handleButton(BTN_PAUSE, false);
  318. }
  319. else if (results->value == 0xCD1) { // REWD
  320. handleButton(BTN_REWD, true);
  321. }
  322. else if (results->value == 0x2D1) { // FFWD
  323. handleButton(BTN_FFWD, true);
  324. }
  325. else if (results->value == 0xD1) { // PREV
  326. handleButton(BTN_PREV, false);
  327. }
  328. else if (results->value == 0x8D1) { // NEXT
  329. handleButton(BTN_NEXT, false);
  330. }
  331. else if (results->value == 0x4D1) { // PLAY
  332. handleButton(BTN_PLAY, false);
  333. }
  334. else if (results->value == 0x1D1) { // STOP
  335. handleButton(BTN_STOP, false);
  336. }
  337. } // END SONY CODES
  338. // RC6 CODES
  339. else if (results->decode_type == RC6 && results->bits == 20) {
  340. unsigned int _currRC6Code = results->value ^ 0xF0000;
  341. uint8_t _currRC6Pref = ( _currRC6Code ^ results->value ) >> 16;
  342. if (debug) {
  343. Serial.print(F(" _currRC6Code=0x"));
  344. Serial.print(_currRC6Code, HEX);
  345. Serial.print(F(" _currRC6Pref=0x"));
  346. Serial.println(_currRC6Pref, HEX);
  347. }
  348. // Pioneer Remote in BD mode, configured code preset to Sat-PVR/Philips 6139 (RC6 code)
  349. // with the most important buttons available.
  350. // Missing buttons configured using learning function, which does not work well with RCx format due to the toggle bit,
  351. // so i used an old unused IR remote with NEC code for these, which will be OK for non-repeating buttons.
  352. // power
  353. if (_currRC6Code == 0x270C) { // POWER (of SOURCE)
  354. //handleButton_RCx(BTN_POWER, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  355. //handlePowerButton();
  356. handleButton_RCx(BTN_POWER, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  357. }
  358. // above control pad
  359. else if (_currRC6Code == 0x2743) { // X - AUDIO PARAMETER - left above control pad
  360. //handleButton_RCx(BTN_HOME, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  361. //handleTaskSwitchButton();
  362. handleButton_RCx(BTN_TASKSWITCH, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  363. }
  364. else if (_currRC6Code == 0x2754) { // VIDEO PARAMETER - right above control pad
  365. //handleButton_RCx(BTN_MENU, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  366. handleButton_RCx(BTN_CONTEXT, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  367. }
  368. // control pad
  369. else if (_currRC6Code == 0x275C) { // OK/ENTER
  370. //handleButton_RCx(BTN_OK_ENTER, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  371. handleButton_RCx(BTN_OK_ENTER, BUTTONMODE_HOLD, _currRC6Pref, REMOTETYPE_RC6);
  372. }
  373. else if (_currRC6Code == 0x275A) { // LEFT
  374. //handleButton_RCx(BTN_LEFT, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  375. //handleButton_RCx(BTN_LEFT, BUTTONMODE_HOLD, _currRC6Pref, REMOTETYPE_RC6);
  376. handleButton_RCx(BTN_LEFT, BUTTONMODE_EXTENDED_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  377. }
  378. else if (_currRC6Code == 0x275B) { // RIGHT
  379. //handleButton_RCx(BTN_RIGHT, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  380. //handleButton_RCx(BTN_RIGHT, BUTTONMODE_HOLD, _currRC6Pref, REMOTETYPE_RC6);
  381. handleButton_RCx(BTN_RIGHT, BUTTONMODE_EXTENDED_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  382. }
  383. else if (_currRC6Code == 0x2758) { // UP
  384. //handleButton_RCx(BTN_UP, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  385. //handleButton_RCx(BTN_UP, BUTTONMODE_HOLD, _currRC6Pref, REMOTETYPE_RC6);
  386. handleButton_RCx(BTN_UP, BUTTONMODE_EXTENDED_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  387. }
  388. else if (_currRC6Code == 0x2759) { // DOWN
  389. //handleButton_RCx(BTN_DOWN, BUTTONMODE_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  390. //handleButton_RCx(BTN_DOWN, BUTTONMODE_HOLD, _currRC6Pref, REMOTETYPE_RC6);
  391. handleButton_RCx(BTN_DOWN, BUTTONMODE_EXTENDED_REPEAT, _currRC6Pref, REMOTETYPE_RC6);
  392. }
  393. // below control pad
  394. else if (_currRC6Code == 0x27CC) { // HOME MENU - left below control pad
  395. handleButton_RCx(BTN_MENU, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  396. }
  397. else if (_currRC6Code == 0x2783) { // RETURN/BACK - right below control pad
  398. //handleButton_RCx(BTN_BACK, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  399. handleButton_RCx(BTN_BACK, BUTTONMODE_HOLD, _currRC6Pref, REMOTETYPE_RC6);
  400. }
  401. // media player controls
  402. else if (_currRC6Code == 0x2771) { // PLAY
  403. handleButton_RCx(BTN_PLAY, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  404. }
  405. else if (_currRC6Code == 0x276F) { // PAUSE
  406. handleButton_RCx(BTN_PAUSE, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  407. }
  408. else if (_currRC6Code == 0x276E) { // STOP
  409. handleButton_RCx(BTN_STOP, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  410. }
  411. else if (_currRC6Code == 0x276D) { // PREVIOUS
  412. handleButton_RCx(BTN_PREV, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  413. }
  414. else if (_currRC6Code == 0x2770) { // NEXT
  415. handleButton_RCx(BTN_NEXT, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  416. }
  417. // number keys
  418. else if (_currRC6Code == 0x2701) { // 1
  419. handleButton_RCx(BTN_1, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  420. }
  421. else if (_currRC6Code == 0x2702) { // 2
  422. handleButton_RCx(BTN_2, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  423. }
  424. else if (_currRC6Code == 0x2703) { // 3
  425. handleButton_RCx(BTN_3, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  426. }
  427. else if (_currRC6Code == 0x2704) { // 4
  428. handleButton_RCx(BTN_4, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  429. }
  430. else if (_currRC6Code == 0x2705) { // 5
  431. handleButton_RCx(BTN_5, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  432. }
  433. else if (_currRC6Code == 0x2706) { // 6
  434. handleButton_RCx(BTN_6, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  435. }
  436. else if (_currRC6Code == 0x2707) { // 7
  437. handleButton_RCx(BTN_7, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  438. }
  439. else if (_currRC6Code == 0x2708) { // 8
  440. handleButton_RCx(BTN_8, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  441. }
  442. else if (_currRC6Code == 0x2709) { // 9
  443. handleButton_RCx(BTN_9, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  444. }
  445. else if (_currRC6Code == 0x2700) { // 0
  446. handleButton_RCx(BTN_0, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  447. }
  448. // channel up/down
  449. else if (_currRC6Code == 0x2720) { // CH+
  450. handleButton_RCx(BTN_CH_UP, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  451. }
  452. else if (_currRC6Code == 0x2721) { // CH-
  453. handleButton_RCx(BTN_CH_DOWN, BUTTONMODE_ONCE, _currRC6Pref, REMOTETYPE_RC6);
  454. }
  455. // Buttons in NEC CODE due to limitations of this RC:
  456. // RED
  457. // GREEN
  458. // YELLOW
  459. // BLUE
  460. // REWIND
  461. // FAST FORWARD
  462. // ./CLR
  463. // CLASS/ENTER
  464. // AUDIO
  465. // INFO/DISP
  466. } // END RC6 CODES
  467. // NEC CODES - used also for Pioneer remote codes here (Pioneer code consists of 2 NEC codes and is not directly supported by Arduino IRRemote.h)
  468. else if (results->decode_type == NEC && results->bits == 32) {
  469. // Pioneer Remote in BD mode, configured code preset to Sat-PVR/Philips 6139 (RC6 code)
  470. // -> missing/unused buttons "learned" with codes in NEC format
  471. if (results->value == 0x4FF18E7) { // RED
  472. handleButton_NEC(BTN_RED, BUTTONMODE_ONCE);
  473. }
  474. else if (results->value == 0x4FF02FD) { // GREEN
  475. handleButton_NEC(BTN_GREEN, BUTTONMODE_ONCE);
  476. }
  477. else if (results->value == 0x4FF827D) { // YELLOW
  478. handleButton_NEC(BTN_YELLOW, BUTTONMODE_ONCE);
  479. }
  480. else if (results->value == 0x4FF38C7) { // BLUE
  481. handleButton_NEC(BTN_BLUE, BUTTONMODE_ONCE);
  482. }
  483. else if (results->value == 0x4FFB847) { // REWIND
  484. handleButton_NEC(BTN_REWD, BUTTONMODE_ONCE);
  485. }
  486. else if (results->value == 0x4FF08F7) { // FAST FORWARD
  487. handleButton_NEC(BTN_FFWD, BUTTONMODE_ONCE);
  488. }
  489. else if (results->value == 0x4FF6897) { // ./CLR
  490. //handleButton_NEC(BTN_, BUTTONMODE_ONCE);
  491. }
  492. else if (results->value == 0x4FF9867) { // CLASS/ENTER
  493. handleButton_NEC(BTN_OK_ENTER, BUTTONMODE_ONCE);
  494. }
  495. else if (results->value == 0x4FFF807) { // AUDIO
  496. //handleButton_NEC(BTN_, BUTTONMODE_ONCE);
  497. }
  498. else if (results->value == 0x4FF7887) { // DISPLAY/INFO
  499. handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  500. }
  501. // TOSHIBA SE-R0319
  502. // NEC 32bit codes
  503. else if (results->value == 0x2FD48B7) { // POWER
  504. handleButton_NEC(BTN_POWER, BUTTONMODE_REPEAT);
  505. }
  506. else if (results->value == 0x2FDA857) { // SLEEP
  507. handleButton_NEC(BTN_SLEEP, BUTTONMODE_ONCE);
  508. }
  509. // above control pad
  510. else if (results->value == 0x2FDCA35) { // left above control pad -> TASKSWITCH
  511. handleButton_NEC(BTN_TASKSWITCH, BUTTONMODE_REPEAT);
  512. }
  513. else if (results->value == 0xA25D9E61) { // right above control pad -> CONTEXT
  514. handleButton_NEC(BTN_CONTEXT, BUTTONMODE_ONCE);
  515. }
  516. // control pad
  517. else if (results->value == 0x2FDBC43) { // ENTER
  518. handleButton_NEC(BTN_OK_ENTER, BUTTONMODE_HOLD);
  519. }
  520. else if (results->value == 0x22DD8A75) { // LEFT
  521. //handleButton_NEC(BTN_LEFT, BUTTONMODE_HOLD);
  522. handleButton_NEC(BTN_LEFT, BUTTONMODE_EXTENDED_REPEAT);
  523. }
  524. else if (results->value == 0x22DDB24D) { // RIGHT
  525. //handleButton_NEC(BTN_RIGHT, BUTTONMODE_HOLD);
  526. handleButton_NEC(BTN_RIGHT, BUTTONMODE_EXTENDED_REPEAT);
  527. }
  528. else if (results->value == 0x2FD7C83) { // UP
  529. //handleButton_NEC(BTN_UP, BUTTONMODE_HOLD);
  530. handleButton_NEC(BTN_UP, BUTTONMODE_EXTENDED_REPEAT);
  531. }
  532. else if (results->value == 0x2FDFC03) { // DOWN
  533. //handleButton_NEC(BTN_DOWN, BUTTONMODE_HOLD);
  534. handleButton_NEC(BTN_DOWN, BUTTONMODE_EXTENDED_REPEAT);
  535. }
  536. // below control pad
  537. else if (results->value == 0x2FD708F) { // left below control pad -> MENU
  538. handleButton_NEC(BTN_MENU, BUTTONMODE_ONCE);
  539. }
  540. else if (results->value == 0x22DDF708) { // left below control pad -> BACK
  541. handleButton_NEC(BTN_BACK, BUTTONMODE_ONCE);
  542. }
  543. // volume control
  544. else if (results->value == 0x2FD58A7) { // VOL+
  545. handleButton_NEC(BTN_VOL_UP, BUTTONMODE_REPEAT);
  546. }
  547. else if (results->value == 0x2FD7887) { // VOL-
  548. handleButton_NEC(BTN_VOL_DOWN, BUTTONMODE_REPEAT);
  549. }
  550. else if (results->value == 0x2FD08F7) { // MUTE
  551. handleButton_NEC(BTN_MUTE, BUTTONMODE_ONCE);
  552. }
  553. // media player controls
  554. else if (results->value == 0x22DDA857) { // PLAY
  555. handleButton_NEC(BTN_PLAY, BUTTONMODE_ONCE);
  556. }
  557. // else if (results->value == 0xA25DA857) { // PAUSE - combined with GREEN - unused as PLAY/PAUSE is 1 key anyway
  558. // handleButton_NEC(BTN_PAUSE, BUTTONMODE_ONCE);
  559. // }
  560. else if (results->value == 0x22DD28D7) { // STOP
  561. handleButton_NEC(BTN_STOP, BUTTONMODE_ONCE);
  562. }
  563. else if (results->value == 0xA25DC43B) { // PREV
  564. handleButton_NEC(BTN_PREV, BUTTONMODE_ONCE);
  565. }
  566. else if (results->value == 0xA25D24DB) { // NEXT
  567. handleButton_NEC(BTN_NEXT, BUTTONMODE_ONCE);
  568. }
  569. else if (results->value == 0xA25D9867) { // REWD
  570. handleButton_NEC(BTN_REWD, BUTTONMODE_ONCE);
  571. }
  572. else if (results->value == 0xA25DC837) { // FFWD
  573. handleButton_NEC(BTN_FFWD, BUTTONMODE_ONCE);
  574. }
  575. // number keys
  576. else if (results->value == 0x2FD807F) { // 1
  577. handleButton_NEC(BTN_1, BUTTONMODE_ONCE);
  578. }
  579. else if (results->value == 0x2FD40BF) { // 2
  580. handleButton_NEC(BTN_2, BUTTONMODE_ONCE);
  581. }
  582. else if (results->value == 0x2FDC03F) { // 3
  583. handleButton_NEC(BTN_3, BUTTONMODE_ONCE);
  584. }
  585. else if (results->value == 0x2FD20DF) { // 4
  586. handleButton_NEC(BTN_4, BUTTONMODE_ONCE);
  587. }
  588. else if (results->value == 0x2FDA05F) { // 5
  589. handleButton_NEC(BTN_5, BUTTONMODE_ONCE);
  590. }
  591. else if (results->value == 0x2FD609F) { // 6
  592. handleButton_NEC(BTN_6, BUTTONMODE_ONCE);
  593. }
  594. else if (results->value == 0x2FDE01F) { // 7
  595. handleButton_NEC(BTN_7, BUTTONMODE_ONCE);
  596. }
  597. else if (results->value == 0x2FD10EF) { // 8
  598. handleButton_NEC(BTN_8, BUTTONMODE_ONCE);
  599. }
  600. else if (results->value == 0x2FD906F) { // 9
  601. handleButton_NEC(BTN_9, BUTTONMODE_ONCE);
  602. }
  603. else if (results->value == 0x2FD00FF) { // 0
  604. handleButton_NEC(BTN_0, BUTTONMODE_ONCE);
  605. }
  606. // color keys
  607. else if (results->value == 0xA25D708F) { // RED (also SLOW REWD)
  608. handleButton_NEC(BTN_RED, BUTTONMODE_ONCE);
  609. }
  610. else if (results->value == 0xA25DA857) { // GREEN (also PAUSE)
  611. handleButton_NEC(BTN_GREEN, BUTTONMODE_ONCE);
  612. }
  613. else if (results->value == 0xA25D07F8) { // YELLOW (also PLAY MODE)
  614. handleButton_NEC(BTN_YELLOW, BUTTONMODE_ONCE);
  615. }
  616. else if (results->value == 0xA25DB04F) { // BLUE (also SLOW FWD)
  617. handleButton_NEC(BTN_BLUE, BUTTONMODE_ONCE);
  618. }
  619. // other
  620. else if (results->value == 0x2FD38C7) { // DISPLAY
  621. handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  622. }
  623. // else if (results->value == 0xA23DCD32) { // TV/DVD
  624. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  625. // }
  626. // else if (results->value == 0xA25DAF50) { // EJECT
  627. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  628. // }
  629. // else if (results->value == 0x22DDE11E) { // SUBTITLE
  630. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  631. // }
  632. // else if (results->value == 0x2FDF00F) { // INPUT
  633. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  634. // }
  635. // else if (results->value == 0x2FD9867) { // MENU/DVD
  636. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  637. // }
  638. // else if (results->value == 0x22DDFB04) { // MENU/TOP
  639. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  640. // }
  641. // else if (results->value == 0x22DDCA35) { // AUDIO SELECT
  642. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  643. // }
  644. // else if (results->value == 0xA25D02FD) { // CH.RTN/ZOOM
  645. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  646. // }
  647. // else if (results->value == 0x22DDBA45) { // RETURN (next to PLAY)
  648. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  649. // }
  650. // else if (results->value == 0xA25D37C8) { // MARKER
  651. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  652. // }
  653. // else if (results->value == 0x22DD6996) { // ANGLE
  654. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  655. // }
  656. // else if (results->value == 0x22DD3AC5) { // REPEAT A+B
  657. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  658. // }
  659. // else if (results->value == 0x22DDD926) { // JUMP
  660. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  661. // }
  662. // else if (results->value == 0x2FD9A65) { // PIC SIZE
  663. // handleButton_NEC(BTN_INFO, BUTTONMODE_ONCE);
  664. // }
  665. // Pioneer Codes - here we have to take 2 received codes into account, so we check against the last received that we stored in a global variable then ;-)
  666. // // Pioneer 2238 code for BD ---- NOT UNUSED ANY MORE
  667. // if (lastNECcode == 0xD52A34CB && results->value == 0xF50AC639) { // LEFT
  668. // handleButton(BTN_LEFT, true);
  669. // }
  670. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A26D9) { // RIGHT
  671. // handleButton(BTN_RIGHT, true);
  672. // }
  673. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A4FB0) { // UP
  674. // handleButton(BTN_UP, true);
  675. // }
  676. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50ACF30) { // DOWN
  677. // handleButton(BTN_DOWN, true);
  678. // }
  679. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50AF708) { // ENTER + CLASS ENTER
  680. // handleButton(BTN_OK_ENTER, false);
  681. // }
  682. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A3DC2) { // POWER
  683. // //handleButton(BTN_POWER, false);
  684. // handlePowerButton();
  685. // }
  686. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A2DD2) { // AUDIO PARAMETER - top left at control pad
  687. // //handleButton(BTN_, false);
  688. // }
  689. // else if (lastNECcode == 0xD52A54AB && results->value == 0xF50A3CC3) { // VIDEO PARAMETER - top right at control pad
  690. // //handleButton(BTN_, false);
  691. // }
  692. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A0DF2) { // HOME MENU - bottom left at control pad
  693. // handleButton(BTN_MENU, false);
  694. // }
  695. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A2FD0) { // RETURN - bottom right at control pad
  696. // handleButton(BTN_BACK, false);
  697. // }
  698. // else if (lastNECcode == 0xD52A54AB && results->value == 0xF50A26D9) { // RED
  699. // handleButton(BTN_RED, false);
  700. // }
  701. // else if (lastNECcode == 0xD52A54AB && results->value == 0xF50AA659) { // GREEN
  702. // handleButton(BTN_GREEN, false);
  703. // }
  704. // else if (lastNECcode == 0xD52A54AB && results->value == 0xF50A1FE0) { // YELLOW
  705. // handleButton(BTN_YELLOW, false);
  706. // }
  707. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A9D62) { // BLUE
  708. // handleButton(BTN_BLUE, false);
  709. // }
  710. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A57A8) { // REWIND
  711. // handleButton(BTN_REWD, true);
  712. // }
  713. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A9768) { // FFWD
  714. // handleButton(BTN_FFWD, true);
  715. // }
  716. // else if (lastNECcode == 0xD52A44BB && results->value == 0xD52A44BB) { // PLAY
  717. // handleButton(BTN_PLAY, false);
  718. // }
  719. // else if (lastNECcode == 0xD52AE41B && results->value == 0xD52AE41B) { // PREVIOUS
  720. // handleButton(BTN_PREV, false);
  721. // }
  722. // else if (lastNECcode == 0xD52AC43B && results->value == 0xD52AC43B) { // PAUSE
  723. // handleButton(BTN_PAUSE, false);
  724. // }
  725. // else if (lastNECcode == 0xD52A04FB && results->value == 0xD52A04FB) { // STOP
  726. // handleButton(BTN_STOP, false);
  727. // }
  728. // else if (lastNECcode == 0xD52A649B && results->value == 0xD52A649B) { // NEXT TRACK
  729. // handleButton(BTN_NEXT, false);
  730. // }
  731. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A05FA) { // 0
  732. // handleButton(BTN_0, false);
  733. // }
  734. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A857A) { // 1
  735. // handleButton(BTN_1, false);
  736. // }
  737. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A45BA) { // 2
  738. // handleButton(BTN_2, false);
  739. // }
  740. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50AC53A) { // 3
  741. // handleButton(BTN_3, false);
  742. // }
  743. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A25DA) { // 4
  744. // handleButton(BTN_4, false);
  745. // }
  746. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50AA55A) { // 5
  747. // handleButton(BTN_5, false);
  748. // }
  749. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A659A) { // 6
  750. // handleButton(BTN_6, false);
  751. // }
  752. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50AE51A) { // 7
  753. // handleButton(BTN_7, false);
  754. // }
  755. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A15EA) { // 8
  756. // handleButton(BTN_8, false);
  757. // }
  758. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A956A) { // 9
  759. // handleButton(BTN_9, false);
  760. // }
  761. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50A7D82) { // AUDIO
  762. // //handleButton(BTN_POWER, false);
  763. // }
  764. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50AC738) { // DISP/INFO
  765. // //handleButton(BTN_POWER, false);
  766. // }
  767. // else if (lastNECcode == 0xD52A54AB && results->value == 0xF50A7689) { // CH_UP
  768. // handleButton(BTN_CH_UP, false);
  769. // }
  770. // else if (lastNECcode == 0xD52A54AB && results->value == 0xF50AF609) { // CH_DOWN
  771. // handleButton(BTN_CH_DOWN, false);
  772. // }
  773. // else if (lastNECcode == 0xD52A34CB && results->value == 0xF50AA758) { // ./CLR/D.ACCESS
  774. // //handleButton(BTN_POWER, false);
  775. // }
  776. // remember last NEC code - for PIONEER remotes sending 2 NEC codes as one PIONEER code
  777. //lastNECcode = results->value;
  778. else {
  779. // unknown / not implemented NEC code -> must reset last key or a repeat of this unknown key will trigger the last one
  780. handleButton_NEC(BTN_UNKNOWN, BUTTONMODE_REPEAT);
  781. }
  782. } // END NEC CODES
  783. // NEC repetitions (0 bits)
  784. // RC using NEC code send a 0 bit NEC code as repetition after the actual key press
  785. else if (results->decode_type == NEC && results->bits == 0) {
  786. if (debug) Serial.println(F("NEC REPETITION"));
  787. handleButton_NEC(BTN_REPETITION, BUTTONMODE_LAST);
  788. }
  789. }
  790. //+=============================================================================
  791. // The repeating section of the code
  792. //
  793. void loop ( )
  794. {
  795. decode_results results; // Somewhere to store the results
  796. if (irrecv.decode(&results)) { // Grab an IR code
  797. dumpInfo(&results); // Output the results (if not in ignore time window)
  798. irrecv.resume(); // Prepare for the next value
  799. }
  800. handlePowerButton_loop();
  801. handleTaskSwitchButton_loop();
  802. handleHoldButtons_loop(); // release all keys after timeout
  803. }