mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
Compare commits
No commits in common. "70a22463ef0a969b48deae43ee943638582718e2" and "98a21f5e56ffd6825bd84535bbc91806e43479ac" have entirely different histories.
70a22463ef
...
98a21f5e56
@ -23,14 +23,12 @@ void IR_Decoder::enable()
|
||||
{
|
||||
dec_list.push_back(this);
|
||||
}
|
||||
pinMode(pin, INPUT_PULLUP);
|
||||
attachInterrupt(pin, (*this)(), CHANGE);
|
||||
}
|
||||
|
||||
void IR_Decoder::disable()
|
||||
{
|
||||
detachInterrupt(pin);
|
||||
pinMode(pin, INPUT);
|
||||
auto &dec_list = get_dec_list();
|
||||
auto it = std::find(dec_list.begin(), dec_list.end(), this);
|
||||
if (it != dec_list.end())
|
||||
|
@ -29,6 +29,7 @@ IR_Encoder::IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair, bool
|
||||
{
|
||||
decPair->encoder = this;
|
||||
}
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
if (autoHandle)
|
||||
{
|
||||
@ -36,19 +37,6 @@ IR_Encoder::IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair, bool
|
||||
}
|
||||
};
|
||||
|
||||
HardwareTimer IR_Encoder::IR_Timer;
|
||||
|
||||
inline HardwareTimer* IR_Encoder::get_IR_Timer(){return &IR_Encoder::IR_Timer;}
|
||||
|
||||
void IR_Encoder::begin(HardwareTimer timer, uint8_t channel, IRQn_Type IRQn){
|
||||
IR_Timer = timer;
|
||||
IR_Timer.setOverflow(carrierFrec * 2, HERTZ_FORMAT);
|
||||
IR_Timer.attachInterrupt(channel, IR_Encoder::isr);
|
||||
NVIC_SetPriority(IRQn, 0);
|
||||
IR_Timer.resume();
|
||||
}
|
||||
|
||||
|
||||
void IR_Encoder::enable()
|
||||
{
|
||||
auto &enc_list = get_enc_list();
|
||||
@ -56,8 +44,6 @@ void IR_Encoder::enable()
|
||||
{
|
||||
enc_list.push_back(this);
|
||||
}
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
void IR_Encoder::disable()
|
||||
@ -68,7 +54,6 @@ void IR_Encoder::disable()
|
||||
{
|
||||
enc_list.erase(it);
|
||||
}
|
||||
pinMode(pin, INPUT);
|
||||
}
|
||||
|
||||
void IR_Encoder::setBlindDecoders(IR_DecoderRaw *decoders[], uint8_t count)
|
||||
|
@ -9,7 +9,6 @@ class IR_Encoder : public IR_FOX
|
||||
friend IR_DecoderRaw;
|
||||
|
||||
public:
|
||||
static HardwareTimer IR_Timer;
|
||||
private:
|
||||
// uint16_t id; /// @brief Адрес передатчика
|
||||
public:
|
||||
@ -19,8 +18,6 @@ public:
|
||||
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
|
||||
IR_Encoder(uint8_t pin, uint16_t addr = 0, IR_DecoderRaw *decPair = nullptr, bool autoHandle = true);
|
||||
static void isr();
|
||||
static void begin(HardwareTimer IR_Timer, uint8_t channel, IRQn_Type IRQn);
|
||||
static HardwareTimer* get_IR_Timer();
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
|
@ -4,6 +4,7 @@ void IR_FOX::setPin(uint8_t pin){
|
||||
this->pin = pin;
|
||||
port = digitalPinToPort(pin);
|
||||
mask = digitalPinToBitMask(pin);
|
||||
pinMode(pin, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
void IR_FOX::checkAddressRuleApply(uint16_t address, uint16_t id, bool &flag)
|
||||
|
Loading…
x
Reference in New Issue
Block a user