add support for sending single bits. Needed for Nibe heatpump which sends 90 bits

This commit is contained in:
Fabian Kunkel 2024-01-05 16:07:54 +01:00
parent 7e9134ee8e
commit b8ce01554a
2 changed files with 3 additions and 3 deletions

View File

@ -10,9 +10,9 @@ IRSender::IRSender(uint8_t pin)
// Send a uint8_t (8 bits) over IR // Send a uint8_t (8 bits) over IR
void IRSender::sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength) void IRSender::sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength, uint8_t bitCount)
{ {
for (int i=0; i<8 ; i++) for (int i=0; i<bitCount ; i++)
{ {
if (sendByte & 0x01) if (sendByte & 0x01)
{ {

View File

@ -27,7 +27,7 @@ class IRSender
public: public:
virtual ~IRSender() = default; virtual ~IRSender() = default;
virtual void setFrequency(int frequency); virtual void setFrequency(int frequency);
void sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength); void sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength, uint8_t bitCount = 8);
uint8_t bitReverse(uint8_t x); uint8_t bitReverse(uint8_t x);
virtual void invert(bool inverted); virtual void invert(bool inverted);
virtual void space(int spaceLength); virtual void space(int spaceLength);