forked from ToniA/arduino-heatpumpir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IRSender.h
57 lines (46 loc) · 1.12 KB
/
IRSender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Class to send IR signals using the Arduino PWM
*/
#ifndef IRSender_h
#define IRSender_h
#include <Arduino.h>
class IRSender
{
protected:
IRSender(uint8_t pin); // Cannot create generic IRSender instances
public:
virtual void setFrequency(int frequency);
void sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength);
uint8_t bitReverse(uint8_t x);
virtual void space(int spaceLength);
virtual void mark(int markLength);
protected:
uint8_t _pin;
};
class IRSenderPWM : public IRSender
{
public:
IRSenderPWM(uint8_t pin);
void setFrequency(int frequency);
void space(int spaceLength);
void mark(int markLength);
};
class IRSenderBlaster : public IRSender
{
public:
IRSenderBlaster(uint8_t pin);
void setFrequency(int frequency);
void space(int spaceLength);
void mark(int markLength);
};
class IRSenderBitBang : public IRSender
{
public:
IRSenderBitBang(uint8_t pin);
void setFrequency(int frequency);
void space(int spaceLength);
void mark(int markLength);
protected:
int _halfPeriodicTime;
};
#endif