BrickUp API Service for Docker version.

ir_Sharp.cpp 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "IRremote.h"
  2. #include "IRremoteInt.h"
  3. //==============================================================================
  4. // SSSS H H AAA RRRR PPPP
  5. // S H H A A R R P P
  6. // SSS HHHHH AAAAA RRRR PPPP
  7. // S H H A A R R P
  8. // SSSS H H A A R R P
  9. //==============================================================================
  10. // Sharp and DISH support by Todd Treece: http://unionbridge.org/design/ircommand
  11. //
  12. // The send function has the necessary repeat built in because of the need to
  13. // invert the signal.
  14. //
  15. // Sharp protocol documentation:
  16. // http://www.sbprojects.com/knowledge/ir/sharp.htm
  17. //
  18. // Here is the LIRC file I found that seems to match the remote codes from the
  19. // oscilloscope:
  20. // Sharp LCD TV:
  21. // http://lirc.sourceforge.net/remotes/sharp/GA538WJSA
  22. #define SHARP_BITS 15
  23. #define SHARP_BIT_MARK 245
  24. #define SHARP_ONE_SPACE 1805
  25. #define SHARP_ZERO_SPACE 795
  26. #define SHARP_GAP 600000
  27. #define SHARP_RPT_SPACE 3000
  28. #define SHARP_TOGGLE_MASK 0x3FF
  29. //+=============================================================================
  30. #if SEND_SHARP
  31. void IRsend::sendSharpRaw (unsigned long data, int nbits)
  32. {
  33. enableIROut(38);
  34. // Sending codes in bursts of 3 (normal, inverted, normal) makes transmission
  35. // much more reliable. That's the exact behaviour of CD-S6470 remote control.
  36. for (int n = 0; n < 3; n++) {
  37. for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
  38. if (data & mask) {
  39. mark(SHARP_BIT_MARK);
  40. space(SHARP_ONE_SPACE);
  41. } else {
  42. mark(SHARP_BIT_MARK);
  43. space(SHARP_ZERO_SPACE);
  44. }
  45. }
  46. mark(SHARP_BIT_MARK);
  47. space(SHARP_ZERO_SPACE);
  48. delay(40);
  49. data = data ^ SHARP_TOGGLE_MASK;
  50. }
  51. }
  52. #endif
  53. //+=============================================================================
  54. // Sharp send compatible with data obtained through decodeSharp()
  55. // ^^^^^^^^^^^^^ FUNCTION MISSING!
  56. //
  57. #if SEND_SHARP
  58. void IRsend::sendSharp (unsigned int address, unsigned int command)
  59. {
  60. sendSharpRaw((address << 10) | (command << 2) | 2, SHARP_BITS);
  61. }
  62. #endif