mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 15:20:16 +00:00
default constructor and operator() for test
This commit is contained in:
parent
c66d47e464
commit
784365181e
@ -6,12 +6,15 @@ std::list<IR_Decoder*>& IR_Decoder::get_dec_list() // определение ф
|
|||||||
return dec_list; // возвращается ссылка на переменную
|
return dec_list; // возвращается ссылка на переменную
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IR_Decoder::IR_Decoder(){};
|
||||||
IR_Decoder::IR_Decoder(const uint8_t pin, uint16_t addr, IR_Encoder *encPair)
|
IR_Decoder::IR_Decoder(const uint8_t pin, uint16_t addr, IR_Encoder *encPair)
|
||||||
: IR_DecoderRaw(pin, addr, encPair)
|
: IR_DecoderRaw(pin, addr, encPair)
|
||||||
{
|
{
|
||||||
get_dec_list().push_back(this);
|
get_dec_list().push_back(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void IR_Decoder::operator()() { isr(); }
|
||||||
|
|
||||||
IR_Decoder::~IR_Decoder()
|
IR_Decoder::~IR_Decoder()
|
||||||
{
|
{
|
||||||
IR_Decoder::get_dec_list().remove(this);
|
IR_Decoder::get_dec_list().remove(this);
|
||||||
|
@ -24,7 +24,11 @@ public:
|
|||||||
PacketTypes::Request gotRequest;
|
PacketTypes::Request gotRequest;
|
||||||
PacketTypes::BasePack gotRaw;
|
PacketTypes::BasePack gotRaw;
|
||||||
|
|
||||||
|
IR_Decoder();
|
||||||
IR_Decoder(const uint8_t pin, uint16_t addr, IR_Encoder *encPair = nullptr);
|
IR_Decoder(const uint8_t pin, uint16_t addr, IR_Encoder *encPair = nullptr);
|
||||||
|
|
||||||
|
void operator()() ;
|
||||||
|
|
||||||
~IR_Decoder();
|
~IR_Decoder();
|
||||||
|
|
||||||
static void tick();
|
static void tick();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "IR_DecoderRaw.h"
|
#include "IR_DecoderRaw.h"
|
||||||
#include "IR_Encoder.h"
|
#include "IR_Encoder.h"
|
||||||
|
|
||||||
|
IR_DecoderRaw::IR_DecoderRaw(){};
|
||||||
IR_DecoderRaw::IR_DecoderRaw(const uint8_t pin, uint16_t addr, IR_Encoder *encPair) : encoder(encPair)
|
IR_DecoderRaw::IR_DecoderRaw(const uint8_t pin, uint16_t addr, IR_Encoder *encPair) : encoder(encPair)
|
||||||
{
|
{
|
||||||
setPin(pin);
|
setPin(pin);
|
||||||
|
@ -36,6 +36,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
IR_DecoderRaw();
|
||||||
/// @brief Конструктор
|
/// @brief Конструктор
|
||||||
/// @param pin Номер вывода прерывания/данных от приёмника (2 или 3 для atmega 328p)
|
/// @param pin Номер вывода прерывания/данных от приёмника (2 или 3 для atmega 328p)
|
||||||
/// @param addr Адрес приёмника
|
/// @param addr Адрес приёмника
|
||||||
|
@ -11,6 +11,8 @@ std::list<IR_Encoder*>& IR_Encoder::get_enc_list() // определение ф
|
|||||||
return dec_list; // возвращается ссылка на переменную
|
return dec_list; // возвращается ссылка на переменную
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IR_Encoder::IR_Encoder(){};
|
||||||
|
|
||||||
IR_Encoder::IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair)
|
IR_Encoder::IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair)
|
||||||
{
|
{
|
||||||
setPin(pin);
|
setPin(pin);
|
||||||
@ -46,8 +48,6 @@ void IR_Encoder::setBlindDecoders(IR_DecoderRaw *decoders[], uint8_t count)
|
|||||||
|
|
||||||
IR_Encoder::~IR_Encoder()
|
IR_Encoder::~IR_Encoder()
|
||||||
{
|
{
|
||||||
delete[] bitLow;
|
|
||||||
delete[] bitHigh;
|
|
||||||
get_enc_list().remove(this);
|
get_enc_list().remove(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -392,10 +392,10 @@ void IR_Encoder::addSync(bool *prev, bool *next)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* IR_Encoder::bitHigh = new uint8_t[2]{
|
uint8_t IR_Encoder::bitHigh[2] = {
|
||||||
(bitPauseTakts) * 2 - 1,
|
(bitPauseTakts) * 2 - 1,
|
||||||
(bitActiveTakts) * 2 - 1};
|
(bitActiveTakts) * 2 - 1};
|
||||||
uint8_t* IR_Encoder::bitLow = new uint8_t[2]{
|
uint8_t IR_Encoder::bitLow[2] = {
|
||||||
(bitPauseTakts/2 + bitActiveTakts) * 2 - 1,
|
(bitPauseTakts/2 + bitActiveTakts) * 2 - 1,
|
||||||
(bitPauseTakts) - 1};
|
(bitPauseTakts) - 1};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
uint16_t id; /// @brief Адрес передатчика
|
uint16_t id; /// @brief Адрес передатчика
|
||||||
public:
|
public:
|
||||||
|
IR_Encoder();
|
||||||
/// @brief Класс передатчика
|
/// @brief Класс передатчика
|
||||||
/// @param addr Адрес передатчика
|
/// @param addr Адрес передатчика
|
||||||
/// @param pin Вывод передатчика
|
/// @param pin Вывод передатчика
|
||||||
@ -82,8 +82,8 @@ private:
|
|||||||
uint8_t low;
|
uint8_t low;
|
||||||
uint8_t high;
|
uint8_t high;
|
||||||
};
|
};
|
||||||
static uint8_t *bitHigh;
|
static uint8_t bitHigh[2];
|
||||||
static uint8_t *bitLow;
|
static uint8_t bitLow[2];
|
||||||
uint8_t *currentBitSequence = bitLow;
|
uint8_t *currentBitSequence = bitLow;
|
||||||
volatile SignalPart signal;
|
volatile SignalPart signal;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user