mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
fix syncBit
This commit is contained in:
parent
b272b6031c
commit
9cd391bda7
@ -24,6 +24,13 @@ IR_Encoder::~IR_Encoder() {
|
||||
delete [] sendBuffer;
|
||||
};
|
||||
|
||||
void IR_Encoder::sendData(uint16_t addrTo, uint8_t* data, uint8_t len, bool needAccept = false) {
|
||||
uint8_t packSize = msgBytes + addrBytes + addrBytes + len + crcBytes;
|
||||
uint8_t msgType =
|
||||
((needAccept ? IR_MSG_DATA_ACCEPT : IR_MSG_DATA_NOACCEPT) << 5) | ((packSize - crcBytes) & IR_MASK_MSG_INFO);
|
||||
_sendData(addrTo, data, len, msgType);
|
||||
}
|
||||
|
||||
void IR_Encoder::sendACK(uint16_t addrTo, uint8_t addInfo, bool forAll = false) {
|
||||
uint8_t* ptr = new uint8_t[msgBytes + addrBytes + crcBytes] { 0 };
|
||||
|
||||
@ -184,7 +191,7 @@ void IR_Encoder::isr() {
|
||||
toggleCounter = currentBitSequence[!state];
|
||||
dataSequenceCounter--;
|
||||
} else { // Конец data, переход на следующий signal
|
||||
syncLastBit = !((sendBuffer[dataByteCounter]) & 1U);
|
||||
syncLastBit = ((sendBuffer[dataByteCounter]) & 1U);
|
||||
dataByteCounter++;
|
||||
dataBitCounter = bitPerByte - 1;
|
||||
dataSequenceCounter = bitPerByte * 2;
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
|
||||
template<typename T>
|
||||
void sendData(uint16_t addrTo, T& data, bool needAccept = false);
|
||||
void sendData(uint16_t addrTo, uint8_t* data, uint8_t len, bool needAccept = false);
|
||||
void sendACK(uint16_t addrTo, uint8_t addInfo = 0, bool forAll = false);
|
||||
void sendRequest(uint16_t addrTo, uint8_t addInfo = 0);
|
||||
void rawSend(uint8_t* ptr, uint8_t len);
|
||||
@ -87,7 +88,6 @@ private:
|
||||
volatile SignalPart signal;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -102,3 +102,4 @@ void IR_Encoder::sendData(uint16_t addrTo, T& data, bool needAccept = false) { /
|
||||
|
||||
_sendData(addrTo, data, len, msgType);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user