infrared_common_protocol_defs.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #include "infrared_common_i.h"
  2. #include "infrared_protocol_defs_i.h"
  3. const InfraredCommonProtocolSpec protocol_nec = {
  4. .timings =
  5. {
  6. .preamble_mark = INFRARED_NEC_PREAMBLE_MARK,
  7. .preamble_space = INFRARED_NEC_PREAMBLE_SPACE,
  8. .bit1_mark = INFRARED_NEC_BIT1_MARK,
  9. .bit1_space = INFRARED_NEC_BIT1_SPACE,
  10. .bit0_mark = INFRARED_NEC_BIT0_MARK,
  11. .bit0_space = INFRARED_NEC_BIT0_SPACE,
  12. .preamble_tolerance = INFRARED_NEC_PREAMBLE_TOLERANCE,
  13. .bit_tolerance = INFRARED_NEC_BIT_TOLERANCE,
  14. .silence_time = INFRARED_NEC_SILENCE,
  15. .min_split_time = INFRARED_NEC_MIN_SPLIT_TIME,
  16. },
  17. .databit_len[0] = 42,
  18. .databit_len[1] = 32,
  19. .no_stop_bit = false,
  20. .decode = infrared_common_decode_pdwm,
  21. .encode = infrared_common_encode_pdwm,
  22. .interpret = infrared_decoder_nec_interpret,
  23. .decode_repeat = infrared_decoder_nec_decode_repeat,
  24. .encode_repeat = infrared_encoder_nec_encode_repeat,
  25. };
  26. const InfraredCommonProtocolSpec protocol_samsung32 = {
  27. .timings =
  28. {
  29. .preamble_mark = INFRARED_SAMSUNG_PREAMBLE_MARK,
  30. .preamble_space = INFRARED_SAMSUNG_PREAMBLE_SPACE,
  31. .bit1_mark = INFRARED_SAMSUNG_BIT1_MARK,
  32. .bit1_space = INFRARED_SAMSUNG_BIT1_SPACE,
  33. .bit0_mark = INFRARED_SAMSUNG_BIT0_MARK,
  34. .bit0_space = INFRARED_SAMSUNG_BIT0_SPACE,
  35. .preamble_tolerance = INFRARED_SAMSUNG_PREAMBLE_TOLERANCE,
  36. .bit_tolerance = INFRARED_SAMSUNG_BIT_TOLERANCE,
  37. .silence_time = INFRARED_SAMSUNG_SILENCE,
  38. .min_split_time = INFRARED_SAMSUNG_MIN_SPLIT_TIME,
  39. },
  40. .databit_len[0] = 32,
  41. .no_stop_bit = false,
  42. .decode = infrared_common_decode_pdwm,
  43. .encode = infrared_common_encode_pdwm,
  44. .interpret = infrared_decoder_samsung32_interpret,
  45. .decode_repeat = infrared_decoder_samsung32_decode_repeat,
  46. .encode_repeat = infrared_encoder_samsung32_encode_repeat,
  47. };
  48. const InfraredCommonProtocolSpec protocol_rc6 = {
  49. .timings =
  50. {
  51. .preamble_mark = INFRARED_RC6_PREAMBLE_MARK,
  52. .preamble_space = INFRARED_RC6_PREAMBLE_SPACE,
  53. .bit1_mark = INFRARED_RC6_BIT,
  54. .preamble_tolerance = INFRARED_RC6_PREAMBLE_TOLERANCE,
  55. .bit_tolerance = INFRARED_RC6_BIT_TOLERANCE,
  56. .silence_time = INFRARED_RC6_SILENCE,
  57. .min_split_time = INFRARED_RC6_MIN_SPLIT_TIME,
  58. },
  59. .databit_len[0] =
  60. 1 + 3 + 1 + 8 +
  61. 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
  62. .manchester_start_from_space = false,
  63. .decode = infrared_decoder_rc6_decode_manchester,
  64. .encode = infrared_encoder_rc6_encode_manchester,
  65. .interpret = infrared_decoder_rc6_interpret,
  66. .decode_repeat = NULL,
  67. .encode_repeat = NULL,
  68. };
  69. const InfraredCommonProtocolSpec protocol_rc5 = {
  70. .timings =
  71. {
  72. .preamble_mark = 0,
  73. .preamble_space = 0,
  74. .bit1_mark = INFRARED_RC5_BIT,
  75. .preamble_tolerance = 0,
  76. .bit_tolerance = INFRARED_RC5_BIT_TOLERANCE,
  77. .silence_time = INFRARED_RC5_SILENCE,
  78. .min_split_time = INFRARED_RC5_MIN_SPLIT_TIME,
  79. },
  80. .databit_len[0] = 1 + 1 + 1 + 5 +
  81. 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
  82. .manchester_start_from_space = true,
  83. .decode = infrared_common_decode_manchester,
  84. .encode = infrared_common_encode_manchester,
  85. .interpret = infrared_decoder_rc5_interpret,
  86. .decode_repeat = NULL,
  87. .encode_repeat = NULL,
  88. };
  89. const InfraredCommonProtocolSpec protocol_sirc = {
  90. .timings =
  91. {
  92. .preamble_mark = INFRARED_SIRC_PREAMBLE_MARK,
  93. .preamble_space = INFRARED_SIRC_PREAMBLE_SPACE,
  94. .bit1_mark = INFRARED_SIRC_BIT1_MARK,
  95. .bit1_space = INFRARED_SIRC_BIT1_SPACE,
  96. .bit0_mark = INFRARED_SIRC_BIT0_MARK,
  97. .bit0_space = INFRARED_SIRC_BIT0_SPACE,
  98. .preamble_tolerance = INFRARED_SIRC_PREAMBLE_TOLERANCE,
  99. .bit_tolerance = INFRARED_SIRC_BIT_TOLERANCE,
  100. .silence_time = INFRARED_SIRC_SILENCE,
  101. .min_split_time = INFRARED_SIRC_MIN_SPLIT_TIME,
  102. },
  103. .databit_len[0] = 20,
  104. .databit_len[1] = 15,
  105. .databit_len[2] = 12,
  106. .no_stop_bit = true,
  107. .decode = infrared_common_decode_pdwm,
  108. .encode = infrared_common_encode_pdwm,
  109. .interpret = infrared_decoder_sirc_interpret,
  110. .decode_repeat = NULL,
  111. .encode_repeat = infrared_encoder_sirc_encode_repeat,
  112. };