2 #include "stubborn_receiver.h"
4 StubbornReceiver::StubbornReceiver(uint8_t maxPackageIndex
)
6 this->maxPackageIndex
= maxPackageIndex
;
10 void StubbornReceiver::ResetState()
17 telemetryConfirm
= false;
20 bool StubbornReceiver::GetCurrentConfirm()
22 return telemetryConfirm
;
25 void StubbornReceiver::SetDataToReceive(uint8_t maxLength
, uint8_t* dataToReceive
, uint8_t bytesPerCall
)
32 this->bytesPerCall
= bytesPerCall
;
35 void StubbornReceiver::ReceiveData(uint8_t packageIndex
, volatile uint8_t* receiveData
)
37 if (packageIndex
== 0 && currentPackage
> 1)
40 telemetryConfirm
= !telemetryConfirm
;
44 if (packageIndex
== maxPackageIndex
)
46 telemetryConfirm
= !telemetryConfirm
;
58 if (packageIndex
== currentPackage
)
60 for (uint8_t i
= 0; i
< bytesPerCall
; i
++)
62 data
[currentOffset
++] = *(receiveData
+ i
);
66 telemetryConfirm
= !telemetryConfirm
;
73 bool StubbornReceiver::HasFinishedData()
78 void StubbornReceiver::Unlock()