PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

77 Zeilen
2.6KB

  1. #include "IRremote.h"
  2. #include "IRremoteInt.h"
  3. //==============================================================================
  4. // SSSS AAA N N Y Y OOO
  5. // S A A NN N Y Y O O
  6. // SSS AAAAA N N N Y O O
  7. // S A A N NN Y O O
  8. // SSSS A A N N Y OOO
  9. //==============================================================================
  10. // I think this is a Sanyo decoder: Serial = SA 8650B
  11. // Looks like Sony except for timings, 48 chars of data and time/space different
  12. #define SANYO_BITS 12
  13. #define SANYO_HDR_MARK 3500 // seen range 3500
  14. #define SANYO_HDR_SPACE 950 // seen 950
  15. #define SANYO_ONE_MARK 2400 // seen 2400
  16. #define SANYO_ZERO_MARK 700 // seen 700
  17. #define SANYO_DOUBLE_SPACE_USECS 800 // usually ssee 713 - not using ticks as get number wrapround
  18. #define SANYO_RPT_LENGTH 45000
  19. //+=============================================================================
  20. #if DECODE_SANYO
  21. bool IRrecv::decodeSanyo (decode_results *results)
  22. {
  23. long data = 0;
  24. int offset = 0; // Skip first space <-- CHECK THIS!
  25. if (irparams.rawlen < (2 * SANYO_BITS) + 2) return false ;
  26. #if 0
  27. // Put this back in for debugging - note can't use #DEBUG as if Debug on we don't see the repeat cos of the delay
  28. Serial.print("IR Gap: ");
  29. Serial.println( results->rawbuf[offset]);
  30. Serial.println( "test against:");
  31. Serial.println(results->rawbuf[offset]);
  32. #endif
  33. // Initial space
  34. if (results->rawbuf[offset] < SANYO_DOUBLE_SPACE_USECS) {
  35. //Serial.print("IR Gap found: ");
  36. results->bits = 0;
  37. results->value = REPEAT;
  38. results->decode_type = SANYO;
  39. return true;
  40. }
  41. offset++;
  42. // Initial mark
  43. if (!MATCH_MARK(results->rawbuf[offset++], SANYO_HDR_MARK)) return false ;
  44. // Skip Second Mark
  45. if (!MATCH_MARK(results->rawbuf[offset++], SANYO_HDR_MARK)) return false ;
  46. while (offset + 1 < irparams.rawlen) {
  47. if (!MATCH_SPACE(results->rawbuf[offset++], SANYO_HDR_SPACE)) break ;
  48. if (MATCH_MARK(results->rawbuf[offset], SANYO_ONE_MARK)) data = (data << 1) | 1 ;
  49. else if (MATCH_MARK(results->rawbuf[offset], SANYO_ZERO_MARK)) data = (data << 1) | 0 ;
  50. else return false ;
  51. offset++;
  52. }
  53. // Success
  54. results->bits = (offset - 1) / 2;
  55. if (results->bits < 12) {
  56. results->bits = 0;
  57. return false;
  58. }
  59. results->value = data;
  60. results->decode_type = SANYO;
  61. return true;
  62. }
  63. #endif