This commit is contained in:
2024-04-24 10:34:57 +03:00
parent e752d0fb50
commit d46640b145
6 changed files with 105 additions and 90 deletions

View File

@ -1,8 +1,9 @@
#include "IR_DecoderRaw.h"
#include "IR_Encoder.h"
IR_DecoderRaw::IR_DecoderRaw(const uint8_t isrPin, uint16_t addr, IR_Encoder *encPair) : isrPin(isrPin), encoder(encPair)
IR_DecoderRaw::IR_DecoderRaw(const uint8_t pin, uint16_t addr, IR_Encoder *encPair) : encoder(encPair)
{
setPin(pin);
id = addr;
prevRise = prevFall = prevPrevFall = prevPrevRise = 0;
if (encPair != nullptr)
@ -46,6 +47,11 @@ volatile uint32_t time_;
void IR_DecoderRaw::isr()
{
if(isPairSending){
return;
}
noInterrupts();
// time_ = HAL_GetTick() * 1000 + ((SysTick->LOAD + 1 - SysTick->VAL) * 1000) / SysTick->LOAD + 1;
time_ = micros();
@ -68,7 +74,7 @@ void IR_DecoderRaw::isr()
oldTime = time_;
FrontStorage edge;
edge.dir = digitalRead(isrPin);
edge.dir = port->IDR & mask;
edge.time = time_;
subBuffer.push(edge);