mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
moved id to parrent class
This commit is contained in:
parent
b7d0179092
commit
f6bbd96a4c
@ -2,7 +2,8 @@
|
|||||||
#include "IR_Encoder.h"
|
#include "IR_Encoder.h"
|
||||||
|
|
||||||
|
|
||||||
IR_DecoderRaw::IR_DecoderRaw(const uint8_t isrPin, uint16_t addr, IR_Encoder* encPair = nullptr) : isrPin(isrPin), id(addr), encoder(encPair) {
|
IR_DecoderRaw::IR_DecoderRaw(const uint8_t isrPin, uint16_t addr, IR_Encoder* encPair = nullptr) : isrPin(isrPin), encoder(encPair) {
|
||||||
|
id = addr;
|
||||||
prevRise = prevFall = prevPrevFall = prevPrevRise = 0;
|
prevRise = prevFall = prevPrevFall = prevPrevRise = 0;
|
||||||
if (encPair != nullptr) {
|
if (encPair != nullptr) {
|
||||||
encPair->decPair = this;
|
encPair->decPair = this;
|
||||||
|
@ -27,7 +27,6 @@ class IR_DecoderRaw : virtual public IR_FOX {
|
|||||||
friend IR_Encoder;
|
friend IR_Encoder;
|
||||||
protected:
|
protected:
|
||||||
PackInfo packInfo;
|
PackInfo packInfo;
|
||||||
uint16_t id;
|
|
||||||
IR_Encoder* encoder; // Указатель на парный передатчик
|
IR_Encoder* encoder; // Указатель на парный передатчик
|
||||||
public:
|
public:
|
||||||
const uint8_t isrPin; // Пин прерывания
|
const uint8_t isrPin; // Пин прерывания
|
||||||
@ -44,8 +43,6 @@ public:
|
|||||||
bool available() { if (isAvailable) { isAvailable = false; return true; } else { return false; } };
|
bool available() { if (isAvailable) { isAvailable = false; return true; } else { return false; } };
|
||||||
bool isOverflow() { return isBufferOverflow; }; // Буффер переполнился
|
bool isOverflow() { return isBufferOverflow; }; // Буффер переполнился
|
||||||
bool isReciving() { return isBufferOverflow; }; // Возвращает true, если происходит приём пакета
|
bool isReciving() { return isBufferOverflow; }; // Возвращает true, если происходит приём пакета
|
||||||
uint16_t getId() {return id;}
|
|
||||||
void setId(uint16_t id) {this->id = id;}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
private:
|
private:
|
||||||
|
@ -7,9 +7,9 @@ class IR_DecoderRaw;
|
|||||||
class IR_Encoder : IR_FOX {
|
class IR_Encoder : IR_FOX {
|
||||||
friend IR_DecoderRaw;
|
friend IR_DecoderRaw;
|
||||||
public:
|
public:
|
||||||
uint16_t id; /// @brief Адрес передатчика
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
uint16_t id; /// @brief Адрес передатчика
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ public:
|
|||||||
void sendBack(uint8_t* data = nullptr, uint8_t len = 0);
|
void sendBack(uint8_t* data = nullptr, uint8_t len = 0);
|
||||||
void sendBackTo(uint16_t addrTo, uint8_t* data = nullptr, uint8_t len = 0);
|
void sendBackTo(uint16_t addrTo, uint8_t* data = nullptr, uint8_t len = 0);
|
||||||
void isr();
|
void isr();
|
||||||
|
|
||||||
|
|
||||||
~IR_Encoder();
|
~IR_Encoder();
|
||||||
volatile bool ir_out_virtual;
|
volatile bool ir_out_virtual;
|
||||||
|
@ -176,8 +176,12 @@ public:
|
|||||||
flag |= address >= IR_Broadcast;
|
flag |= address >= IR_Broadcast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t getId() { return id; }
|
||||||
|
void setId(uint16_t id) { this->id = id; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ErrorsStruct errors;
|
ErrorsStruct errors;
|
||||||
|
uint16_t id;
|
||||||
uint8_t crc8(uint8_t* data, uint8_t start, uint8_t end, uint8_t poly) { //TODO: сделать возможность межбайтовой проверки
|
uint8_t crc8(uint8_t* data, uint8_t start, uint8_t end, uint8_t poly) { //TODO: сделать возможность межбайтовой проверки
|
||||||
uint8_t crc = 0xff;
|
uint8_t crc = 0xff;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user