irda_common_protocol_defs.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. .min_split_time = IRDA_SAMSUNG_MIN_SPLIT_TIME,
  37. },
  38. .databit_len[0] = 32,
  39. .no_stop_bit = false,
  40. .decode = irda_common_decode_pdwm,
  41. .encode = irda_common_encode_pdwm,
  42. .interpret = irda_decoder_samsung32_interpret,
  43. .decode_repeat = irda_decoder_samsung32_decode_repeat,
  44. .encode_repeat = irda_encoder_samsung32_encode_repeat,
  45. };
  46. const IrdaCommonProtocolSpec protocol_rc6 = {
  47. .timings = {
  48. .preamble_mark = IRDA_RC6_PREAMBLE_MARK,
  49. .preamble_space = IRDA_RC6_PREAMBLE_SPACE,
  50. .bit1_mark = IRDA_RC6_BIT,
  51. .preamble_tolerance = IRDA_RC6_PREAMBLE_TOLERANCE,
  52. .bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
  53. .silence_time = IRDA_RC6_SILENCE,
  54. .min_split_time = IRDA_RC6_MIN_SPLIT_TIME,
  55. },
  56. .databit_len[0] = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
  57. .manchester_start_from_space = false,
  58. .decode = irda_decoder_rc6_decode_manchester,
  59. .encode = irda_encoder_rc6_encode_manchester,
  60. .interpret = irda_decoder_rc6_interpret,
  61. .decode_repeat = NULL,
  62. .encode_repeat = NULL,
  63. };
  64. const IrdaCommonProtocolSpec protocol_rc5 = {
  65. .timings = {
  66. .preamble_mark = 0,
  67. .preamble_space = 0,
  68. .bit1_mark = IRDA_RC5_BIT,
  69. .preamble_tolerance = 0,
  70. .bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
  71. .silence_time = IRDA_RC5_SILENCE,
  72. .min_split_time = IRDA_RC5_MIN_SPLIT_TIME,
  73. },
  74. .databit_len[0] = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
  75. .manchester_start_from_space = true,
  76. .decode = irda_common_decode_manchester,
  77. .encode = irda_common_encode_manchester,
  78. .interpret = irda_decoder_rc5_interpret,
  79. .decode_repeat = NULL,
  80. .encode_repeat = NULL,
  81. };
  82. const IrdaCommonProtocolSpec protocol_sirc = {
  83. .timings = {
  84. .preamble_mark = IRDA_SIRC_PREAMBLE_MARK,
  85. .preamble_space = IRDA_SIRC_PREAMBLE_SPACE,
  86. .bit1_mark = IRDA_SIRC_BIT1_MARK,
  87. .bit1_space = IRDA_SIRC_BIT1_SPACE,
  88. .bit0_mark = IRDA_SIRC_BIT0_MARK,
  89. .bit0_space = IRDA_SIRC_BIT0_SPACE,
  90. .preamble_tolerance = IRDA_SIRC_PREAMBLE_TOLERANCE,
  91. .bit_tolerance = IRDA_SIRC_BIT_TOLERANCE,
  92. .silence_time = IRDA_SIRC_SILENCE,
  93. .min_split_time = IRDA_SIRC_MIN_SPLIT_TIME,
  94. },
  95. .databit_len[0] = 20,
  96. .databit_len[1] = 15,
  97. .databit_len[2] = 12,
  98. .no_stop_bit = true,
  99. .decode = irda_common_decode_pdwm,
  100. .encode = irda_common_encode_pdwm,
  101. .interpret = irda_decoder_sirc_interpret,
  102. .decode_repeat = NULL,
  103. .encode_repeat = irda_encoder_sirc_encode_repeat,
  104. };