Ir esp8266 lib update and code impacts (#235)

* integrate new IRremoteESP8266 lib 2.4.2 and add new protocols

IR_RC6
IR_MITSUBISHI
IR_GICABLE
IR_MITSUBISHI2
IR_LASERTAG
IR_CARRIER_AC
IR_MIDEA
IR_NIKAI
IR_SHERWOOD
IR_DENON
IR_AIWA_RC_T501
IR_JVC
This commit is contained in:
Florian authored and GitHub committed 2018-07-22 16:44:10 +02:00
1 parent 9b258723a8
commit b12ee19979
130 files changed
+16548 -1693

No files matched your search

+92 -7
View File
@@ -21,24 +21,52 @@
// Constants
// Offset (in microseconds) to use in Period time calculations to account for
// code excution time in producing the software PWM signal.
// Value determined in https://github.com/markszabo/IRremoteESP8266/issues/62
#define PERIOD_OFFSET -3
// Value was calculated on Wemos D1 mini using v2.4.1 with v2.4.0 ESP core
#define PERIOD_OFFSET -5
#define DUTY_DEFAULT 50
#define DUTY_MAX 100 // Percentage
// delayMicroseconds() is only accurate to 16383us.
// Ref: https://www.arduino.cc/en/Reference/delayMicroseconds
#define MAX_ACCURATE_USEC_DELAY 16383U
// Classes
class IRsend {
public:
explicit IRsend(uint16_t IRsendPin, bool inverted = false);
explicit IRsend(uint16_t IRsendPin, bool inverted = false,
bool use_modulation = true);
void begin();
void enableIROut(uint32_t freq, uint8_t duty = DUTY_DEFAULT);
VIRTUAL void _delayMicroseconds(uint32_t usec);
VIRTUAL uint16_t mark(uint16_t usec);
VIRTUAL void space(uint32_t usec);
void calibrate(uint16_t hz = 38000U);
int8_t calibrate(uint16_t hz = 38000U);
void sendRaw(uint16_t buf[], uint16_t len, uint16_t hz);
void sendData(uint16_t onemark, uint32_t onespace, uint16_t zeromark,
uint32_t zerospace, uint64_t data, uint16_t nbits,
bool MSBfirst = true);
void send(uint16_t type, uint64_t data, uint16_t nbits);
void sendGeneric(const uint16_t headermark, const uint32_t headerspace,
const uint16_t onemark, const uint32_t onespace,
const uint16_t zeromark, const uint32_t zerospace,
const uint16_t footermark, const uint32_t gap,
const uint64_t data, const uint16_t nbits,
const uint16_t frequency, const bool MSBfirst,
const uint16_t repeat, const uint8_t dutycycle);
void sendGeneric(const uint16_t headermark, const uint32_t headerspace,
const uint16_t onemark, const uint32_t onespace,
const uint16_t zeromark, const uint32_t zerospace,
const uint16_t footermark, const uint32_t gap,
const uint32_t mesgtime,
const uint64_t data, const uint16_t nbits,
const uint16_t frequency, const bool MSBfirst,
const uint16_t repeat, const uint8_t dutycycle);
void sendGeneric(const uint16_t headermark, const uint32_t headerspace,
const uint16_t onemark, const uint32_t onespace,
const uint16_t zeromark, const uint32_t zerospace,
const uint16_t footermark, const uint32_t gap,
const uint8_t *dataptr, const uint16_t nbytes,
const uint16_t frequency, const bool MSBfirst,
const uint16_t repeat, const uint8_t dutycycle);
void send(uint16_t type, uint64_t data, uint16_t nbits);
#if (SEND_NEC || SEND_SHERWOOD || SEND_AIWA_RC_T501 || SEND_SANYO)
void sendNEC(uint64_t data, uint16_t nbits = NEC_BITS, uint16_t repeat = 0);
uint32_t encodeNEC(uint16_t address, uint16_t command);
@@ -135,6 +163,10 @@ class IRsend {
void sendMitsubishi(uint64_t data, uint16_t nbits = MITSUBISHI_BITS,
uint16_t repeat = MITSUBISHI_MIN_REPEAT);
#endif
#if SEND_MITSUBISHI2
void sendMitsubishi2(uint64_t data, uint16_t nbits = MITSUBISHI_BITS,
uint16_t repeat = MITSUBISHI_MIN_REPEAT);
#endif
#if SEND_MITSUBISHI_AC
void sendMitsubishiAC(unsigned char data[],
uint16_t nbytes = MITSUBISHI_AC_STATE_LENGTH,
@@ -157,6 +189,7 @@ class IRsend {
void sendDaikin(unsigned char data[],
uint16_t nbytes = DAIKIN_COMMAND_LENGTH,
uint16_t repeat = 0);
void sendDaikinGapHeader();
#endif
#if SEND_AIWA_RC_T501
void sendAiwaRCT501(uint64_t data, uint16_t nbits = AIWA_RC_T501_BITS,
@@ -175,12 +208,61 @@ class IRsend {
uint16_t nbytes = ARGO_COMMAND_LENGTH,
uint16_t repeat = 0);
#endif
#if SEND_TROTEC
void sendTrotec(unsigned char data[],
uint16_t nbytes = TROTEC_COMMAND_LENGTH,
uint16_t repeat = 0);
#endif
#if SEND_NIKAI
void sendNikai(uint64_t data, uint16_t nbits = NIKAI_BITS,
uint16_t repeat = 0);
#endif
#if SEND_TOSHIBA_AC
void sendToshibaAC(unsigned char data[],
uint16_t nbytes = TOSHIBA_AC_STATE_LENGTH,
uint16_t repeat = TOSHIBA_AC_MIN_REPEAT);
#endif
#if SEND_MIDEA
void sendMidea(uint64_t data, uint16_t nbits = MIDEA_BITS,
uint16_t repeat = MIDEA_MIN_REPEAT);
#endif
#if SEND_MAGIQUEST
void sendMagiQuest(uint64_t data, uint16_t nbits = MAGIQUEST_BITS,
uint16_t repeat = 0);
uint64_t encodeMagiQuest(uint32_t wand_id, uint16_t magnitude);
#endif
#if SEND_LASERTAG
void sendLasertag(uint64_t data, uint16_t nbits = LASERTAG_BITS,
uint16_t repeat = LASERTAG_MIN_REPEAT);
#endif
#if SEND_CARRIER_AC
void sendCarrierAC(uint64_t data, uint16_t nbits = CARRIER_AC_BITS,
uint16_t repeat = CARRIER_AC_MIN_REPEAT);
#endif
#if SEND_HAIER_AC
void sendHaierAC(unsigned char data[],
uint16_t nbytes = HAIER_AC_STATE_LENGTH,
uint16_t repeat = 0);
#endif
#if SEND_HITACHI_AC
void sendHitachiAC(unsigned char data[],
uint16_t nbytes = HITACHI_AC_STATE_LENGTH,
uint16_t repeat = 0);
#endif
#if SEND_HITACHI_AC1
void sendHitachiAC1(unsigned char data[],
uint16_t nbytes = HITACHI_AC1_STATE_LENGTH,
uint16_t repeat = 0);
#endif
#if SEND_HITACHI_AC2
void sendHitachiAC2(unsigned char data[],
uint16_t nbytes = HITACHI_AC2_STATE_LENGTH,
uint16_t repeat = 0);
#endif
#if SEND_GICABLE
void sendGICable(uint64_t data, uint16_t nbits = GICABLE_BITS,
uint16_t repeat = GICABLE_MIN_REPEAT);
#endif
protected:
#ifdef UNIT_TEST
@@ -193,13 +275,16 @@ class IRsend {
#endif // UNIT_TEST
uint8_t outputOn;
uint8_t outputOff;
VIRTUAL void ledOff();
VIRTUAL void ledOn();
private:
uint16_t onTimePeriod;
uint16_t offTimePeriod;
uint16_t IRpin;
int8_t periodOffset;
void ledOff();
uint8_t _dutycycle;
bool modulation;
uint32_t calcUSecPeriod(uint32_t hz, bool use_offset = true);
};