mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
add pin change
This commit is contained in:
parent
4f6482ec2a
commit
78f8a77f72
@ -6,7 +6,7 @@
|
||||
((uint16_t)((dataBuffer[h] << 8) | dataBuffer[l]) >= IR_Broadcast)\
|
||||
)
|
||||
|
||||
IR_Decoder::IR_Decoder(uint16_t addr, IR_Encoder* encPair = nullptr) : addrSelf(addr), encoder(encPair) {
|
||||
IR_Decoder::IR_Decoder(const uint8_t isrPin, uint16_t addr, IR_Encoder* encPair = nullptr) : isrPin(isrPin), addrSelf(addr), encoder(encPair) {
|
||||
rawBuffer = new uint8_t[bufferRawSize] { 0 };
|
||||
prevRise = prevFall = prevPrevFall = prevPrevRise = 0;
|
||||
start_RX();
|
||||
@ -191,7 +191,7 @@ void IR_Decoder::isr() { // в прерывании вызываем isr()
|
||||
}
|
||||
if (frontCounter > 0) { // в преамбуле
|
||||
uint32_t risePeriod = micros() - prevRise;
|
||||
if ((PIND >> 2) & 1 && risePeriod < IR_timeout) { // __/``` ↑ и мы в внутри пакета
|
||||
if ((PIND >> isrPin) & 1 && risePeriod < IR_timeout) { // __/``` ↑ и мы в внутри пакета
|
||||
|
||||
if (risePeriod < riseTimeMin << 1) { // fix рваной единицы
|
||||
frontCounter += 2;
|
||||
@ -210,7 +210,7 @@ void IR_Decoder::isr() { // в прерывании вызываем isr()
|
||||
}
|
||||
|
||||
// определить направление фронта
|
||||
if ((PIND >> 2) & 1) { // Если __/``` ↑
|
||||
if ((PIND >> isrPin) & 1) { // Если __/``` ↑
|
||||
|
||||
uint16_t risePeriod = micros() - prevRise;
|
||||
uint16_t highTime = micros() - prevFall;
|
||||
|
@ -27,7 +27,7 @@ class IR_Decoder : private IR_FOX {
|
||||
public:
|
||||
uint16_t addrSelf;
|
||||
|
||||
IR_Decoder(uint16_t addr, IR_Encoder* encPair = nullptr);
|
||||
IR_Decoder(const uint8_t isrPin, uint16_t addr, IR_Encoder* encPair = nullptr);
|
||||
~IR_Decoder();
|
||||
|
||||
// @brief Для прерывания
|
||||
@ -163,6 +163,8 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
const uint8_t isrPin;
|
||||
|
||||
IR_Encoder* encoder;
|
||||
bool isPairSending = false;
|
||||
bool IsPairSendLOW = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user