mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-06-28 05:09:40 +00:00
isr optimizations
This commit is contained in:
26
IR_Decoder.h
26
IR_Decoder.h
@ -21,6 +21,8 @@
|
||||
#define aroundRise(t) (riseTimeMin < t && t < riseTimeMax)
|
||||
#define IR_timeout ((riseTimeMax * 8) + syncBits +1) // us // таймаут в 8 data + 3 sync + 1
|
||||
|
||||
#define subBuffer 5 //Буфер для складирования фронтов, пока их не обработают
|
||||
|
||||
class IR_Encoder;
|
||||
class IR_Decoder : private IR_FOX {
|
||||
friend IR_Encoder;
|
||||
@ -33,6 +35,8 @@ public:
|
||||
// @brief Для прерывания
|
||||
void isr();
|
||||
|
||||
void tick();
|
||||
|
||||
|
||||
// @return Буффер переполнился
|
||||
bool isOverflow() { return isBufferOverflow; };
|
||||
@ -111,7 +115,6 @@ public:
|
||||
};
|
||||
|
||||
// class RawData : public Data {
|
||||
|
||||
// };
|
||||
|
||||
class Accept : public InputData {
|
||||
@ -175,7 +178,6 @@ private:
|
||||
bool isWaitingAccept = false;
|
||||
uint16_t addrWaitingFrom = 0;
|
||||
|
||||
|
||||
uint16_t addrFrom = 0;
|
||||
|
||||
uint16_t riseSyncTime = bitTime;
|
||||
@ -196,6 +198,26 @@ private:
|
||||
(bufferBitSizeMax / 8) + 1 :
|
||||
(bufferBitSizeMax / 8));
|
||||
const uint8_t bufferDataSize = dataByteSizeMax; // + crc
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
void noFunc();
|
||||
volatile uint8_t currentFrontBufferWriteIndex;
|
||||
struct FrontStorage {
|
||||
volatile uint32_t time;
|
||||
volatile bool dir;
|
||||
volatile FrontStorage* next;
|
||||
|
||||
FrontStorage& operator= (FrontStorage& val) {
|
||||
this->next = val.next;
|
||||
this->time = val.time;
|
||||
this->dir = val.dir;
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
volatile FrontStorage* lastFront = nullptr;
|
||||
volatile FrontStorage* firstUnHandledFront = nullptr;
|
||||
volatile FrontStorage frontBuffer[subBuffer];
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
uint8_t* rawBuffer = nullptr;
|
||||
uint8_t* dataBuffer = nullptr;
|
||||
|
||||
|
Reference in New Issue
Block a user