forked from Arduino-IRremote/Arduino-IRremote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ir_Lego_PF.cpp
46 lines (39 loc) · 1.34 KB
/
ir_Lego_PF.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "IRremote.h"
#include "IRremoteInt.h"
#include "ir_Lego_PF_BitStreamEncoder.h"
//==============================================================================
// L EEEEEE EEEE OOOO
// L E E O O
// L EEEE E EEE O O
// L E E E O O LEGO Power Functions
// LLLLLL EEEEEE EEEE OOOO Copyright (c) 2016 Philipp Henkel
//==============================================================================
// Supported Devices
// LEGO® Power Functions IR Receiver 8884
//+=============================================================================
//
#if SEND_LEGO_PF
#if DEBUG
namespace {
void logFunctionParameters(uint16_t data, bool repeat) {
DBG_PRINT("sendLegoPowerFunctions(data=");
DBG_PRINT(data);
DBG_PRINT(", repeat=");
DBG_PRINTLN(repeat?"true)" : "false)");
}
} // anonymous namespace
#endif // DEBUG
void IRsend::sendLegoPowerFunctions(uint16_t data, bool repeat)
{
#if DEBUG
::logFunctionParameters(data, repeat);
#endif // DEBUG
enableIROut(38);
static LegoPfBitStreamEncoder bitStreamEncoder;
bitStreamEncoder.reset(data, repeat);
do {
mark(bitStreamEncoder.getMarkDuration());
space(bitStreamEncoder.getPauseDuration());
} while (bitStreamEncoder.next());
}
#endif // SEND_LEGO_PF