Added heatpumpir support (#1343)

Co-authored-by: Otto winter <otto@otto-winter.com>
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
Rob Deutsch
2021-10-13 05:38:19 +11:00
committed by GitHub
parent d13134135b
commit a3eb2a7ee0
9 changed files with 481 additions and 0 deletions
@@ -0,0 +1,32 @@
#include "ir_sender_esphome.h"
#ifdef USE_ARDUINO
namespace esphome {
namespace heatpumpir {
void IRSenderESPHome::setFrequency(int frequency) { // NOLINT(readability-identifier-naming)
auto data = transmit_.get_data();
data->set_carrier_frequency(1000 * frequency);
}
// Send an IR 'mark' symbol, i.e. transmitter ON
void IRSenderESPHome::mark(int mark_length) {
auto data = transmit_.get_data();
data->mark(mark_length);
}
// Send an IR 'space' symbol, i.e. transmitter OFF
void IRSenderESPHome::space(int space_length) {
if (space_length) {
auto data = transmit_.get_data();
data->space(space_length);
} else {
transmit_.perform();
}
}
} // namespace heatpumpir
} // namespace esphome
#endif