ESPHome 2025.5.0
Loading...
Searching...
No Matches
rc5_protocol.h
Go to the documentation of this file.
1#pragma once
2
4#include "remote_base.h"
5
6namespace esphome {
7namespace remote_base {
8
9struct 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
16class RC5Protocol : public RemoteProtocol<RC5Data> {
17 public:
18 void encode(RemoteTransmitData *dst, const RC5Data &data) override;
20 void dump(const RC5Data &data) override;
21};
22
23DECLARE_REMOTE_PROTOCOL(RC5)
24
25template<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
uint8_t address
Definition bl0906.h:4
optional< RC5Data > decode(RemoteReceiveData src) override
void dump(const RC5Data &data) override
void encode(RemoteTransmitData *dst, const RC5Data &data) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const RC5Data &rhs) const
uint16_t x
Definition tt21100.cpp:5