ESPHome  2024.10.3
rc5_protocol.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "remote_base.h"
5 
6 namespace esphome {
7 namespace remote_base {
8 
9 struct RC5Data {
10  uint8_t address;
11  uint8_t command;
12 
13  bool operator==(const RC5Data &rhs) const { return address == rhs.address && command == rhs.command; }
14 };
15 
16 class RC5Protocol : public RemoteProtocol<RC5Data> {
17  public:
18  void encode(RemoteTransmitData *dst, const RC5Data &data) override;
19  optional<RC5Data> decode(RemoteReceiveData src) override;
20  void dump(const RC5Data &data) override;
21 };
22 
24 
25 template<typename... Ts> class RC5Action : public RemoteTransmitterActionBase<Ts...> {
26  public:
27  TEMPLATABLE_VALUE(uint8_t, address)
28  TEMPLATABLE_VALUE(uint8_t, command)
29 
30  void encode(RemoteTransmitData *dst, Ts... x) override {
31  RC5Data data{};
32  data.address = this->address_.value(x...);
33  data.command = this->command_.value(x...);
34  RC5Protocol().encode(dst, data);
35  }
36 };
37 
38 } // namespace remote_base
39 } // namespace esphome
void encode(RemoteTransmitData *dst, const RC5Data &data) override
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:27
uint16_t x
Definition: tt21100.cpp:17
bool operator==(const RC5Data &rhs) const
Definition: rc5_protocol.h:13
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7