mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-06-27 20:59:37 +00:00
refactor
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user