1
0
forked from fsfw/fsfw

Adding Code for freeRTOS

This commit is contained in:
2018-07-13 15:56:37 +02:00
parent d1bc3a71a1
commit db1f93a155
37 changed files with 1332 additions and 73 deletions

View File

@ -30,7 +30,7 @@ void FixedSlotSequence::executeAndAdvance() {
}
}
uint32_t FixedSlotSequence::getIntervalMs() {
uint32_t FixedSlotSequence::getIntervalToNextSlotMs() {
uint32_t oldTime;
std::list<FixedSequenceSlot*>::iterator it;
it = current;
@ -53,6 +53,23 @@ uint32_t FixedSlotSequence::getIntervalMs() {
return lengthMs - oldTime + (*it)->pollingTimeMs;
}
uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() {
uint32_t currentTime;
std::list<FixedSequenceSlot*>::iterator it;
it = current;
// Get the pollingTimeMs of the current slot object.
currentTime = (*it)->pollingTimeMs;
//if it is the first slot, calculate difference to last slot
if (it == slotList.begin()){
return lengthMs - (*(--slotList.end()))->pollingTimeMs + currentTime;
}
// get previous slot
it--;
return currentTime - (*it)->pollingTimeMs;
}
bool FixedSlotSequence::slotFollowsImmediately() {
uint32_t currentTime = (*current)->pollingTimeMs;
std::list<FixedSequenceSlot*>::iterator it;

View File

@ -59,10 +59,20 @@ public:
*
* \details This method is vitally important for the operation of the PST. By fetching the polling time
* of the current slot and that of the next one (or the first one, if the list end is reached)
* it calculates and returns the interval in clock ticks within which the handler execution
* shall take place.
* it calculates and returns the interval in milliseconds within which the handler execution
* shall take place. If the next slot has the same time as the current one, it is ignored until
* a slot with different time or the end of the PST is found.
*/
uint32_t getIntervalMs();
uint32_t getIntervalToNextSlotMs();
/**
* \brief This method returns the time difference between the current slot and the previous slot
*
* \details This method is vitally important for the operation of the PST. By fetching the polling time
* of the current slot and that of the prevous one (or the last one, if the slot is the first one)
* it calculates and returns the interval in milliseconds that the handler execution shall be delayed.
*/
uint32_t getIntervalToPreviousSlotMs();
/**
* \brief This method returns the length of this FixedSlotSequence instance.