BrickUp API Service for Docker version.

IRSendRev.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * IRremote
  3. * Version 0.1 July, 2009
  4. * Copyright 2009 Ken Shirriff
  5. * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.htm http://arcfn.com
  6. * Edited by Mitra to add new controller SANYO
  7. *
  8. * Interrupt code based on NECIRrcv by Joe Knapp
  9. * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
  10. * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
  11. *
  12. * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
  13. */
  14. #ifndef _IRSENDREV_H_
  15. #define _IRSENDREV_H_
  16. // len, start_H, start_L, nshort, nlong, data_len, data[data_len]....
  17. #define D_LEN 0
  18. #define D_STARTH 1
  19. #define D_STARTL 2
  20. #define D_SHORT 3
  21. #define D_LONG 4
  22. #define D_DATALEN 5
  23. #define D_DATA 6
  24. #define USECPERTICK 50 // microseconds per clock interrupt tick
  25. #define RAWBUF 300 // Length of raw duration buffer
  26. // Marks tend to be 100us too long, and spaces 100us too short
  27. // when received due to sensor lag.
  28. #define MARK_EXCESS 100
  29. #define __DEBUG 0
  30. // Results returned from the decoder
  31. class decode_results {
  32. public:
  33. volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
  34. int rawlen; // Number of records in rawbuf.
  35. };
  36. // main class for receiving IR
  37. class IRSendRev
  38. {
  39. private:
  40. decode_results results;
  41. //**************************rev**********************************
  42. private:
  43. int decode(decode_results *results);
  44. void enableIRIn();
  45. public:
  46. void Init(int revPin); // init
  47. void Init();
  48. unsigned char Recv(unsigned char *revData); //
  49. unsigned char IsDta(); // if IR get data
  50. void Clear(); // clear IR data
  51. //**************************send*********************************
  52. private:
  53. void sendRaw(unsigned int buf[], int len, int hz);
  54. // private:
  55. void mark(int usec);
  56. void space(int usec);
  57. void enableIROut(int khz);
  58. public:
  59. void Send(unsigned char *idata, unsigned char ifreq);
  60. };
  61. extern IRSendRev IR;
  62. #endif