infrared_nec_spec.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "../infrared_i.h"
  2. #include "infrared_protocol_defs_i.h"
  3. static const InfraredProtocolSpecification infrared_nec_protocol_specification = {
  4. .name = "NEC",
  5. .address_length = 8,
  6. .command_length = 8,
  7. .frequency = INFRARED_COMMON_CARRIER_FREQUENCY,
  8. .duty_cycle = INFRARED_COMMON_DUTY_CYCLE,
  9. };
  10. static const InfraredProtocolSpecification infrared_necext_protocol_specification = {
  11. .name = "NECext",
  12. .address_length = 16,
  13. .command_length = 16,
  14. .frequency = INFRARED_COMMON_CARRIER_FREQUENCY,
  15. .duty_cycle = INFRARED_COMMON_DUTY_CYCLE,
  16. };
  17. static const InfraredProtocolSpecification infrared_nec42_protocol_specification = {
  18. .name = "NEC42",
  19. .address_length = 13,
  20. .command_length = 8,
  21. .frequency = INFRARED_COMMON_CARRIER_FREQUENCY,
  22. .duty_cycle = INFRARED_COMMON_DUTY_CYCLE,
  23. };
  24. static const InfraredProtocolSpecification infrared_nec42ext_protocol_specification = {
  25. .name = "NEC42ext",
  26. .address_length = 26,
  27. .command_length = 16,
  28. .frequency = INFRARED_COMMON_CARRIER_FREQUENCY,
  29. .duty_cycle = INFRARED_COMMON_DUTY_CYCLE,
  30. };
  31. const InfraredProtocolSpecification* infrared_nec_get_spec(InfraredProtocol protocol) {
  32. if(protocol == InfraredProtocolNEC)
  33. return &infrared_nec_protocol_specification;
  34. else if(protocol == InfraredProtocolNECext)
  35. return &infrared_necext_protocol_specification;
  36. else if(protocol == InfraredProtocolNEC42)
  37. return &infrared_nec42_protocol_specification;
  38. else if(protocol == InfraredProtocolNEC42ext)
  39. return &infrared_nec42ext_protocol_specification;
  40. else
  41. return NULL;
  42. }