irda_nec_spec.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "../irda_i.h"
  2. #include "irda_protocol_defs_i.h"
  3. static const IrdaProtocolSpecification irda_nec_protocol_specification = {
  4. .name = "NEC",
  5. .address_length = 8,
  6. .command_length = 8,
  7. .frequency = IRDA_COMMON_CARRIER_FREQUENCY,
  8. .duty_cycle = IRDA_COMMON_DUTY_CYCLE,
  9. };
  10. static const IrdaProtocolSpecification irda_necext_protocol_specification = {
  11. .name = "NECext",
  12. .address_length = 16,
  13. .command_length = 16,
  14. .frequency = IRDA_COMMON_CARRIER_FREQUENCY,
  15. .duty_cycle = IRDA_COMMON_DUTY_CYCLE,
  16. };
  17. static const IrdaProtocolSpecification irda_nec42_protocol_specification = {
  18. .name = "NEC42",
  19. .address_length = 13,
  20. .command_length = 8,
  21. .frequency = IRDA_COMMON_CARRIER_FREQUENCY,
  22. .duty_cycle = IRDA_COMMON_DUTY_CYCLE,
  23. };
  24. static const IrdaProtocolSpecification irda_nec42ext_protocol_specification = {
  25. .name = "NEC42ext",
  26. .address_length = 26,
  27. .command_length = 16,
  28. .frequency = IRDA_COMMON_CARRIER_FREQUENCY,
  29. .duty_cycle = IRDA_COMMON_DUTY_CYCLE,
  30. };
  31. const IrdaProtocolSpecification* irda_nec_get_spec(IrdaProtocol protocol) {
  32. if (protocol == IrdaProtocolNEC)
  33. return &irda_nec_protocol_specification;
  34. else if (protocol == IrdaProtocolNECext)
  35. return &irda_necext_protocol_specification;
  36. else if (protocol == IrdaProtocolNEC42)
  37. return &irda_nec42_protocol_specification;
  38. else if (protocol == IrdaProtocolNEC42ext)
  39. return &irda_nec42ext_protocol_specification;
  40. else
  41. return NULL;
  42. }