IRremote
ir_Lego_PF.cpp
Go to the documentation of this file.
1 #include "IRremote.h"
3 
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 
12 // Supported Devices
13 // LEGO® Power Functions IR Receiver 8884
14 
15 //+=============================================================================
16 //
17 #if SEND_LEGO_PF
18 
19 #if DEBUG
20 namespace {
21 void logFunctionParameters(uint16_t data, bool repeat) {
22  DBG_PRINT("sendLegoPowerFunctions(data=");
23  DBG_PRINT(data);
24  DBG_PRINT(", repeat=");
25  DBG_PRINTLN(repeat?"true)" : "false)");
26 }
27 } // anonymous namespace
28 #endif // DEBUG
29 
30 void IRsend::sendLegoPowerFunctions(uint16_t data, bool repeat) {
31 #if DEBUG
32  ::logFunctionParameters(data, repeat);
33 #endif // DEBUG
34 
35  enableIROut(38);
36  static LegoPfBitStreamEncoder bitStreamEncoder;
37  bitStreamEncoder.reset(data, repeat);
38  do {
39  mark(bitStreamEncoder.getMarkDuration());
40  space(bitStreamEncoder.getPauseDuration());
41  } while (bitStreamEncoder.next());
42 }
43 
44 #endif // SEND_LEGO_PF
LegoPfBitStreamEncoder::reset
void reset(uint16_t data, bool repeatMessage)
Definition: ir_Lego_PF_BitStreamEncoder.h:35
LegoPfBitStreamEncoder::getMarkDuration
uint8_t getMarkDuration() const
Definition: ir_Lego_PF_BitStreamEncoder.h:79
DBG_PRINTLN
#define DBG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
Definition: IRremote.h:155
ir_Lego_PF_BitStreamEncoder.h
IRsend::mark
void mark(unsigned int usec)
Definition: irSend.cpp:69
IRsend::enableIROut
void enableIROut(int khz)
Definition: irSend.cpp:127
DBG_PRINT
#define DBG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
Definition: IRremote.h:151
IRsend::sendLegoPowerFunctions
void sendLegoPowerFunctions(uint16_t data, bool repeat=true)
Definition: ir_Lego_PF.cpp:30
LegoPfBitStreamEncoder::getPauseDuration
uint32_t getPauseDuration() const
Definition: ir_Lego_PF_BitStreamEncoder.h:83
LegoPfBitStreamEncoder
Definition: ir_Lego_PF_BitStreamEncoder.h:12
IRremote.h
Public API to the library.
IRsend::space
void space(unsigned int usec)
Definition: irSend.cpp:103
LegoPfBitStreamEncoder::next
boolean next()
Definition: ir_Lego_PF_BitStreamEncoder.h:64