update source sequence counter code

This commit is contained in:
Robin Müller 2022-08-15 17:24:48 +02:00
parent 007f958a0b
commit 4d82d0e4c1
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -10,14 +10,14 @@ class SourceSequenceCounter {
public: public:
SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {} SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {}
void increment() { void increment() {
sequenceCount = (sequenceCount + 1) % (SpacePacketBase::LIMIT_SEQUENCE_COUNT); sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT);
} }
void decrement() { void decrement() {
sequenceCount = (sequenceCount - 1) % (SpacePacketBase::LIMIT_SEQUENCE_COUNT); sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT);
} }
uint16_t get() { return this->sequenceCount; } uint16_t get() { return this->sequenceCount; }
void reset(uint16_t toValue = 0) { void reset(uint16_t toValue = 0) {
sequenceCount = toValue % (SpacePacketBase::LIMIT_SEQUENCE_COUNT); sequenceCount = toValue % (ccsds::LIMIT_SEQUENCE_COUNT);
} }
SourceSequenceCounter& operator++(int) { SourceSequenceCounter& operator++(int) {
this->increment(); this->increment();