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