irda_common_protocol_defs.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. },
  15. .databit_len = 32,
  16. .no_stop_bit = false,
  17. .decode = irda_common_decode_pdm,
  18. .encode = irda_common_encode_pdwm,
  19. .interpret = irda_decoder_nec_interpret,
  20. .decode_repeat = irda_decoder_nec_decode_repeat,
  21. .encode_repeat = irda_encoder_nec_encode_repeat,
  22. };
  23. const IrdaCommonProtocolSpec protocol_samsung32 = {
  24. .timings = {
  25. .preamble_mark = IRDA_SAMSUNG_PREAMBLE_MARK,
  26. .preamble_space = IRDA_SAMSUNG_PREAMBLE_SPACE,
  27. .bit1_mark = IRDA_SAMSUNG_BIT1_MARK,
  28. .bit1_space = IRDA_SAMSUNG_BIT1_SPACE,
  29. .bit0_mark = IRDA_SAMSUNG_BIT0_MARK,
  30. .bit0_space = IRDA_SAMSUNG_BIT0_SPACE,
  31. .preamble_tolerance = IRDA_SAMSUNG_PREAMBLE_TOLERANCE,
  32. .bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
  33. .silence_time = IRDA_SAMSUNG_SILENCE,
  34. },
  35. .databit_len = 32,
  36. .no_stop_bit = false,
  37. .decode = irda_common_decode_pdm,
  38. .encode = irda_common_encode_pdwm,
  39. .interpret = irda_decoder_samsung32_interpret,
  40. .decode_repeat = irda_decoder_samsung32_decode_repeat,
  41. .encode_repeat = irda_encoder_samsung32_encode_repeat,
  42. };
  43. const IrdaCommonProtocolSpec protocol_rc6 = {
  44. .timings = {
  45. .preamble_mark = IRDA_RC6_PREAMBLE_MARK,
  46. .preamble_space = IRDA_RC6_PREAMBLE_SPACE,
  47. .bit1_mark = IRDA_RC6_BIT,
  48. .preamble_tolerance = IRDA_RC6_PREAMBLE_TOLERANCE,
  49. .bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
  50. .silence_time = IRDA_RC6_SILENCE,
  51. },
  52. .databit_len = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
  53. .manchester_start_from_space = false,
  54. .decode = irda_decoder_rc6_decode_manchester,
  55. .encode = irda_encoder_rc6_encode_manchester,
  56. .interpret = irda_decoder_rc6_interpret,
  57. .decode_repeat = NULL,
  58. .encode_repeat = NULL,
  59. };
  60. const IrdaCommonProtocolSpec protocol_rc5 = {
  61. .timings = {
  62. .preamble_mark = 0,
  63. .preamble_space = 0,
  64. .bit1_mark = IRDA_RC5_BIT,
  65. .preamble_tolerance = 0,
  66. .bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
  67. .silence_time = IRDA_RC5_SILENCE,
  68. },
  69. .databit_len = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
  70. .manchester_start_from_space = true,
  71. .decode = irda_common_decode_manchester,
  72. .encode = irda_common_encode_manchester,
  73. .interpret = irda_decoder_rc5_interpret,
  74. .decode_repeat = NULL,
  75. .encode_repeat = NULL,
  76. };
  77. const IrdaCommonProtocolSpec protocol_sirc = {
  78. .timings = {
  79. .preamble_mark = IRDA_SIRC_PREAMBLE_MARK,
  80. .preamble_space = IRDA_SIRC_PREAMBLE_SPACE,
  81. .bit1_mark = IRDA_SIRC_BIT1_MARK,
  82. .bit1_space = IRDA_SIRC_BIT1_SPACE,
  83. .bit0_mark = IRDA_SIRC_BIT0_MARK,
  84. .bit0_space = IRDA_SIRC_BIT0_SPACE,
  85. .preamble_tolerance = IRDA_SIRC_PREAMBLE_TOLERANCE,
  86. .bit_tolerance = IRDA_SIRC_BIT_TOLERANCE,
  87. .silence_time = IRDA_SIRC_SILENCE,
  88. },
  89. .databit_len = 20, /* 12/15/20 */
  90. .no_stop_bit = true,
  91. .decode = irda_common_decode_pwm,
  92. .encode = irda_common_encode_pdwm,
  93. .interpret = irda_decoder_sirc_interpret,
  94. .decode_repeat = NULL,
  95. .encode_repeat = irda_encoder_sirc_encode_repeat,
  96. };