ESPHome 2025.5.0
Loading...
Searching...
No Matches
rc6_protocol.h
Go to the documentation of this file.
1#pragma once
2
3#include "remote_base.h"
4
5namespace esphome {
6namespace remote_base {
7
8struct RC6Data {
9 uint8_t mode : 3;
10 uint8_t toggle : 1;
11 uint8_t address;
12 uint8_t command;
13
14 bool operator==(const RC6Data &rhs) const { return address == rhs.address && command == rhs.command; }
15};
16
17class RC6Protocol : public RemoteProtocol<RC6Data> {
18 public:
19 void encode(RemoteTransmitData *dst, const RC6Data &data) override;
21 void dump(const RC6Data &data) override;
22};
23
24DECLARE_REMOTE_PROTOCOL(RC6)
25
26template<typename... Ts> class RC6Action : public RemoteTransmitterActionBase<Ts...> {
27 public:
28 TEMPLATABLE_VALUE(uint8_t, address)
29 TEMPLATABLE_VALUE(uint8_t, command)
30
31 void encode(RemoteTransmitData *dst, Ts... x) {
32 RC6Data data{};
33 data.mode = 0;
34 data.toggle = this->toggle_;
35 data.address = this->address_.value(x...);
36 data.command = this->command_.value(x...);
37 RC6Protocol().encode(dst, data);
38 this->toggle_ = !this->toggle_;
39 }
40
41 protected:
42 uint8_t toggle_{0};
43};
44
45} // namespace remote_base
46} // namespace esphome
uint8_t address
Definition bl0906.h:4
void encode(RemoteTransmitData *dst, const RC6Data &data) override
void dump(const RC6Data &data) override
optional< RC6Data > decode(RemoteReceiveData src) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const RC6Data &rhs) const
uint16_t x
Definition tt21100.cpp:5