toshiba_ir.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef __TOSHIBA_IR__
  2. #define __TOSHIBA_IR__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. void Toshiba_ir_ResetDecoder ();
  6. int64_t nextPulseToshiba_ir(uint32_t width);
  7. #define kToshibaACStateLengthLong 10
  8. union ToshibaProtocol{
  9. uint8_t raw[kToshibaACStateLengthLong]; ///< The state in code form.
  10. struct {
  11. // Byte[0] - 0xF2
  12. uint8_t :8;
  13. // Byte[1] - 0x0D (inverted previous byte's value)
  14. uint8_t :8;
  15. // Byte[2] - The expected payload length (in bytes) past the Byte[4].
  16. ///< Known lengths are:
  17. ///< 1 (56 bit message)
  18. ///< 3 (72 bit message)
  19. ///< 4 (80 bit message)
  20. uint8_t Length :8;
  21. // Byte[3] - The bit-inverted value of the "length" byte.
  22. uint8_t :8;
  23. // Byte[4]
  24. uint8_t :3;
  25. uint8_t LongMsg :1;
  26. uint8_t :1;
  27. uint8_t ShortMsg :1;
  28. uint8_t :2;
  29. // Byte[5]
  30. uint8_t Swing :3;
  31. uint8_t :1;
  32. uint8_t Temp :4;
  33. // Byte[6]
  34. uint8_t Mode :3;
  35. uint8_t :2;
  36. uint8_t Fan :3;
  37. // Byte[7]
  38. uint8_t :4;
  39. uint8_t Filter :1;
  40. uint8_t :3;
  41. // Byte[8]
  42. // (Checksum for 72 bit messages, Eco/Turbo for long 80 bit messages)
  43. uint8_t EcoTurbo :8;
  44. };
  45. };
  46. #endif