infrared_protocol_rc5.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "../infrared_i.h"
  3. /***************************************************************************************************
  4. * RC5 protocol description
  5. * https://www.mikrocontroller.net/articles/IRMP_-_english#RC5_.2B_RC5X
  6. ****************************************************************************************************
  7. * Manchester/biphase
  8. * Modulation
  9. *
  10. * 888/1776 - bit (x2 for toggle bit)
  11. *
  12. * __ ____ __ __ __ __ __ __ __ __
  13. * __ __ ____ __ __ __ __ __ __ __ _
  14. * | 1 | 1 | 0 | ... | ... |
  15. * s si T address (MSB) command (MSB)
  16. *
  17. * Note: manchester starts from space timing, so it have to be handled properly
  18. * s - start bit (always 1)
  19. * si - RC5: start bit (always 1), RC5X - 7-th bit of address (in our case always 0)
  20. * T - toggle bit, change it's value every button press
  21. * address - 5 bit
  22. * command - 6/7 bit
  23. ***************************************************************************************************/
  24. void* infrared_decoder_rc5_alloc(void);
  25. void infrared_decoder_rc5_reset(void* decoder);
  26. void infrared_decoder_rc5_free(void* decoder);
  27. InfraredMessage* infrared_decoder_rc5_check_ready(void* ctx);
  28. InfraredMessage* infrared_decoder_rc5_decode(void* decoder, bool level, uint32_t duration);
  29. void* infrared_encoder_rc5_alloc(void);
  30. void infrared_encoder_rc5_reset(void* encoder_ptr, const InfraredMessage* message);
  31. void infrared_encoder_rc5_free(void* decoder);
  32. InfraredStatus infrared_encoder_rc5_encode(void* encoder_ptr, uint32_t* duration, bool* polarity);
  33. const InfraredProtocolVariant* infrared_protocol_rc5_get_variant(InfraredProtocol protocol);