5 namespace remote_base {
7 static const char *
const TAG =
"remote.rc5";
9 static const uint32_t BIT_TIME_US = 889;
10 static const uint8_t NBITS = 14;
13 static bool toggle =
false;
16 uint64_t out_data = 0;
19 out_data |= 0b10 << 12;
20 command = command - 64;
22 out_data |= 0
b11 << 12;
24 out_data |= toggle << 11;
28 for (uint64_t mask = 1UL << (NBITS - 1); mask != 0; mask >>= 1) {
29 if (out_data & mask) {
30 dst->
space(BIT_TIME_US);
31 dst->
mark(BIT_TIME_US);
33 dst->
mark(BIT_TIME_US);
34 dst->
space(BIT_TIME_US);
63 uint32_t out_data = 0;
64 for (
int bit = NBITS - 4; bit >= 1; bit--) {
81 out.command = (uint8_t) (out_data & 0x3F) + (1 - field_bit) * 64u;
82 out.address = (out_data >> 6) & 0x1F;
86 ESP_LOGI(TAG,
"Received RC5: address=0x%02X, command=0x%02X", data.
address, data.
command);
void encode(RemoteTransmitData *dst, const RC5Data &data) override
void set_carrier_frequency(uint32_t carrier_frequency)
bool peek_space(uint32_t length, uint32_t offset=0) const
optional< RC5Data > decode(RemoteReceiveData src) override
bool expect_space(uint32_t length)
bool expect_mark(uint32_t length)
bool peek_mark(uint32_t length, uint32_t offset=0) const
void mark(uint32_t length)
void dump(const RC5Data &data) override
void space(uint32_t length)
Implementation of SPI Controller mode.