PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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