PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ir_Lego_PF.cpp 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "IRremote.h"
  2. #include "IRremoteInt.h"
  3. #include "ir_Lego_PF_BitStreamEncoder.h"
  4. //==============================================================================
  5. // L EEEEEE EEEE OOOO
  6. // L E E O O
  7. // L EEEE E EEE O O
  8. // L E E E O O LEGO Power Functions
  9. // LLLLLL EEEEEE EEEE OOOO Copyright (c) 2016 Philipp Henkel
  10. //==============================================================================
  11. // Supported Devices
  12. // LEGO® Power Functions IR Receiver 8884
  13. //+=============================================================================
  14. //
  15. #if SEND_LEGO_PF
  16. #if DEBUG
  17. namespace {
  18. void logFunctionParameters(uint16_t data, bool repeat) {
  19. DBG_PRINT("sendLegoPowerFunctions(data=");
  20. DBG_PRINT(data);
  21. DBG_PRINT(", repeat=");
  22. DBG_PRINTLN(repeat?"true)" : "false)");
  23. }
  24. } // anonymous namespace
  25. #endif // DEBUG
  26. void IRsend::sendLegoPowerFunctions(uint16_t data, bool repeat)
  27. {
  28. #if DEBUG
  29. ::logFunctionParameters(data, repeat);
  30. #endif // DEBUG
  31. enableIROut(38);
  32. static LegoPfBitStreamEncoder bitStreamEncoder;
  33. bitStreamEncoder.reset(data, repeat);
  34. do {
  35. mark(bitStreamEncoder.getMarkDuration());
  36. space(bitStreamEncoder.getPauseDuration());
  37. } while (bitStreamEncoder.next());
  38. }
  39. #endif // SEND_LEGO_PF