From c43d221a7bc95dc4f0adee0b6a6ec937c012580e Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Thu, 17 Aug 2017 18:04:06 -0600 Subject: [PATCH] Added sending for RECS80 Has not yet been tested --- src/ir_RECS80.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/ir_RECS80.cpp diff --git a/src/ir_RECS80.cpp b/src/ir_RECS80.cpp new file mode 100644 index 0000000..6dc68f5 --- /dev/null +++ b/src/ir_RECS80.cpp @@ -0,0 +1,49 @@ +#include "IRremote.h" +#include "IRremoteInt.h" + +// RECS80 +// Documentation : http://www.sbprojects.com/knowledge/ir/recs80.php + +#define RECS80_MARK 158 +#define RECS80_ONE_SPACE 7426 +#define RECS80_ZERO_SPACE 4898 +#if SEND_RECS80 + +void IRsend::sendRECS80 (uint8_t address, uint8_t address_nbit, uint8_t command, uint8_t command_nbit) { + // address: 1 - 3 bits + // command: 1 - 7 bits + + // Set IR carrier frequency + enableIROut(38); + + // Header + mark(RECS80_MARK); + space(RECS80_ONE_SPACE); + + // Address + for (uint8_t mask = 1 << (address_nbit - 1); mask; mask >>=1) { + mark(RECS80_MARK); + + if (address & mask) { + space(RECS80_ONE_SPACE); + } else { + space(RECS80_ONE_ZERO); + } + + } + + // Command + for (uint8_t mask = 1 << (command_nbit - 1); mask; mask >>=1) { + mark(RECS80_MARK); + + if (command & mask) { + space(RECS80_ONE_SPACE); + } else { + space(RECS80_ONE_ZERO); + } + + } +} + + +#endif // SEND_RECS80