irda_common_protocol_defs.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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_PREAMBULE_MARK,
  6. .preamble_space = IRDA_NEC_PREAMBULE_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. .decode = irda_common_decode_pdwm,
  17. .encode = irda_common_encode_pdwm,
  18. .interpret = irda_decoder_nec_interpret,
  19. .decode_repeat = irda_decoder_nec_decode_repeat,
  20. .encode_repeat = irda_encoder_nec_encode_repeat,
  21. };
  22. const IrdaCommonProtocolSpec protocol_necext = {
  23. .timings = {
  24. .preamble_mark = IRDA_NEC_PREAMBULE_MARK,
  25. .preamble_space = IRDA_NEC_PREAMBULE_SPACE,
  26. .bit1_mark = IRDA_NEC_BIT1_MARK,
  27. .bit1_space = IRDA_NEC_BIT1_SPACE,
  28. .bit0_mark = IRDA_NEC_BIT0_MARK,
  29. .bit0_space = IRDA_NEC_BIT0_SPACE,
  30. .preamble_tolerance = IRDA_NEC_PREAMBLE_TOLERANCE,
  31. .bit_tolerance = IRDA_NEC_BIT_TOLERANCE,
  32. .silence_time = IRDA_NEC_SILENCE,
  33. },
  34. .databit_len = 32,
  35. .decode = irda_common_decode_pdwm,
  36. .encode = irda_common_encode_pdwm,
  37. .interpret = irda_decoder_necext_interpret,
  38. .decode_repeat = irda_decoder_nec_decode_repeat,
  39. .encode_repeat = irda_encoder_nec_encode_repeat,
  40. };
  41. const IrdaCommonProtocolSpec protocol_samsung32 = {
  42. .timings = {
  43. .preamble_mark = IRDA_SAMSUNG_PREAMBULE_MARK,
  44. .preamble_space = IRDA_SAMSUNG_PREAMBULE_SPACE,
  45. .bit1_mark = IRDA_SAMSUNG_BIT1_MARK,
  46. .bit1_space = IRDA_SAMSUNG_BIT1_SPACE,
  47. .bit0_mark = IRDA_SAMSUNG_BIT0_MARK,
  48. .bit0_space = IRDA_SAMSUNG_BIT0_SPACE,
  49. .preamble_tolerance = IRDA_SAMSUNG_PREAMBLE_TOLERANCE,
  50. .bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
  51. .silence_time = IRDA_SAMSUNG_SILENCE,
  52. },
  53. .databit_len = 32,
  54. .decode = irda_common_decode_pdwm,
  55. .encode = irda_common_encode_pdwm,
  56. .interpret = irda_decoder_samsung32_interpret,
  57. .decode_repeat = irda_decoder_samsung32_decode_repeat,
  58. .encode_repeat = irda_encoder_samsung32_encode_repeat,
  59. };
  60. const IrdaCommonProtocolSpec protocol_rc6 = {
  61. .timings = {
  62. .preamble_mark = IRDA_RC6_PREAMBULE_MARK,
  63. .preamble_space = IRDA_RC6_PREAMBULE_SPACE,
  64. .bit1_mark = IRDA_RC6_BIT,
  65. .preamble_tolerance = IRDA_RC6_PREAMBLE_TOLERANCE,
  66. .bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
  67. .silence_time = IRDA_RC6_SILENCE,
  68. },
  69. .databit_len = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
  70. .manchester_inverse_level = false,
  71. .decode = irda_decoder_rc6_decode_manchester,
  72. .encode = irda_encoder_rc6_encode_manchester,
  73. .interpret = irda_decoder_rc6_interpret,
  74. .decode_repeat = NULL,
  75. .encode_repeat = NULL,
  76. };