irda_common_protocol_defs.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #include "irda_common_i.h"
  2. #include "irda_protocol_defs_i.h"
  3. const IrdaCommonProtocolSpec protocol_nec = {
  4. .timings = {
  5. .preamble_mark = IRDA_NEC_PREAMBLE_MARK,
  6. .preamble_space = IRDA_NEC_PREAMBLE_SPACE,
  7. .bit1_mark = IRDA_NEC_BIT1_MARK,
  8. .bit1_space = IRDA_NEC_BIT1_SPACE,
  9. .bit0_mark = IRDA_NEC_BIT0_MARK,
  10. .bit0_space = IRDA_NEC_BIT0_SPACE,
  11. .preamble_tolerance = IRDA_NEC_PREAMBLE_TOLERANCE,
  12. .bit_tolerance = IRDA_NEC_BIT_TOLERANCE,
  13. .silence_time = IRDA_NEC_SILENCE,
  14. .min_split_time = IRDA_NEC_MIN_SPLIT_TIME,
  15. },
  16. .databit_len[0] = 42,
  17. .databit_len[1] = 32,
  18. .no_stop_bit = false,
  19. .decode = irda_common_decode_pdwm,
  20. .encode = irda_common_encode_pdwm,
  21. .interpret = irda_decoder_nec_interpret,
  22. .decode_repeat = irda_decoder_nec_decode_repeat,
  23. .encode_repeat = irda_encoder_nec_encode_repeat,
  24. };
  25. const IrdaCommonProtocolSpec protocol_samsung32 = {
  26. .timings = {
  27. .preamble_mark = IRDA_SAMSUNG_PREAMBLE_MARK,
  28. .preamble_space = IRDA_SAMSUNG_PREAMBLE_SPACE,
  29. .bit1_mark = IRDA_SAMSUNG_BIT1_MARK,
  30. .bit1_space = IRDA_SAMSUNG_BIT1_SPACE,
  31. .bit0_mark = IRDA_SAMSUNG_BIT0_MARK,
  32. .bit0_space = IRDA_SAMSUNG_BIT0_SPACE,
  33. .preamble_tolerance = IRDA_SAMSUNG_PREAMBLE_TOLERANCE,
  34. .bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
  35. .silence_time = IRDA_SAMSUNG_SILENCE,
  36. },
  37. .databit_len[0] = 32,
  38. .no_stop_bit = false,
  39. .decode = irda_common_decode_pdwm,
  40. .encode = irda_common_encode_pdwm,
  41. .interpret = irda_decoder_samsung32_interpret,
  42. .decode_repeat = irda_decoder_samsung32_decode_repeat,
  43. .encode_repeat = irda_encoder_samsung32_encode_repeat,
  44. };
  45. const IrdaCommonProtocolSpec protocol_rc6 = {
  46. .timings = {
  47. .preamble_mark = IRDA_RC6_PREAMBLE_MARK,
  48. .preamble_space = IRDA_RC6_PREAMBLE_SPACE,
  49. .bit1_mark = IRDA_RC6_BIT,
  50. .preamble_tolerance = IRDA_RC6_PREAMBLE_TOLERANCE,
  51. .bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
  52. .silence_time = IRDA_RC6_SILENCE,
  53. },
  54. .databit_len[0] = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
  55. .manchester_start_from_space = false,
  56. .decode = irda_decoder_rc6_decode_manchester,
  57. .encode = irda_encoder_rc6_encode_manchester,
  58. .interpret = irda_decoder_rc6_interpret,
  59. .decode_repeat = NULL,
  60. .encode_repeat = NULL,
  61. };
  62. const IrdaCommonProtocolSpec protocol_rc5 = {
  63. .timings = {
  64. .preamble_mark = 0,
  65. .preamble_space = 0,
  66. .bit1_mark = IRDA_RC5_BIT,
  67. .preamble_tolerance = 0,
  68. .bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
  69. .silence_time = IRDA_RC5_SILENCE,
  70. },
  71. .databit_len[0] = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
  72. .manchester_start_from_space = true,
  73. .decode = irda_common_decode_manchester,
  74. .encode = irda_common_encode_manchester,
  75. .interpret = irda_decoder_rc5_interpret,
  76. .decode_repeat = NULL,
  77. .encode_repeat = NULL,
  78. };
  79. const IrdaCommonProtocolSpec protocol_sirc = {
  80. .timings = {
  81. .preamble_mark = IRDA_SIRC_PREAMBLE_MARK,
  82. .preamble_space = IRDA_SIRC_PREAMBLE_SPACE,
  83. .bit1_mark = IRDA_SIRC_BIT1_MARK,
  84. .bit1_space = IRDA_SIRC_BIT1_SPACE,
  85. .bit0_mark = IRDA_SIRC_BIT0_MARK,
  86. .bit0_space = IRDA_SIRC_BIT0_SPACE,
  87. .preamble_tolerance = IRDA_SIRC_PREAMBLE_TOLERANCE,
  88. .bit_tolerance = IRDA_SIRC_BIT_TOLERANCE,
  89. .silence_time = IRDA_SIRC_SILENCE,
  90. .min_split_time = IRDA_SIRC_MIN_SPLIT_TIME,
  91. },
  92. .databit_len[0] = 20,
  93. .databit_len[1] = 15,
  94. .databit_len[2] = 12,
  95. .no_stop_bit = true,
  96. .decode = irda_common_decode_pdwm,
  97. .encode = irda_common_encode_pdwm,
  98. .interpret = irda_decoder_sirc_interpret,
  99. .decode_repeat = NULL,
  100. .encode_repeat = irda_encoder_sirc_encode_repeat,
  101. };