irda_common_protocol_defs.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_samsung32 = {
  23. .timings = {
  24. .preamble_mark = IRDA_SAMSUNG_PREAMBULE_MARK,
  25. .preamble_space = IRDA_SAMSUNG_PREAMBULE_SPACE,
  26. .bit1_mark = IRDA_SAMSUNG_BIT1_MARK,
  27. .bit1_space = IRDA_SAMSUNG_BIT1_SPACE,
  28. .bit0_mark = IRDA_SAMSUNG_BIT0_MARK,
  29. .bit0_space = IRDA_SAMSUNG_BIT0_SPACE,
  30. .preamble_tolerance = IRDA_SAMSUNG_PREAMBLE_TOLERANCE,
  31. .bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
  32. .silence_time = IRDA_SAMSUNG_SILENCE,
  33. },
  34. .databit_len = 32,
  35. .decode = irda_common_decode_pdwm,
  36. .encode = irda_common_encode_pdwm,
  37. .interpret = irda_decoder_samsung32_interpret,
  38. .decode_repeat = irda_decoder_samsung32_decode_repeat,
  39. .encode_repeat = irda_encoder_samsung32_encode_repeat,
  40. };
  41. const IrdaCommonProtocolSpec protocol_rc6 = {
  42. .timings = {
  43. .preamble_mark = IRDA_RC6_PREAMBULE_MARK,
  44. .preamble_space = IRDA_RC6_PREAMBULE_SPACE,
  45. .bit1_mark = IRDA_RC6_BIT,
  46. .preamble_tolerance = IRDA_RC6_PREAMBLE_TOLERANCE,
  47. .bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
  48. .silence_time = IRDA_RC6_SILENCE,
  49. },
  50. .databit_len = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
  51. .manchester_start_from_space = false,
  52. .decode = irda_decoder_rc6_decode_manchester,
  53. .encode = irda_encoder_rc6_encode_manchester,
  54. .interpret = irda_decoder_rc6_interpret,
  55. .decode_repeat = NULL,
  56. .encode_repeat = NULL,
  57. };
  58. const IrdaCommonProtocolSpec protocol_rc5 = {
  59. .timings = {
  60. .preamble_mark = 0,
  61. .preamble_space = 0,
  62. .bit1_mark = IRDA_RC5_BIT,
  63. .preamble_tolerance = 0,
  64. .bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
  65. .silence_time = IRDA_RC5_SILENCE,
  66. },
  67. .databit_len = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
  68. .manchester_start_from_space = true,
  69. .decode = irda_common_decode_manchester,
  70. .encode = irda_common_encode_manchester,
  71. .interpret = irda_decoder_rc5_interpret,
  72. .decode_repeat = NULL,
  73. .encode_repeat = NULL,
  74. };