-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Implement some requested changes for ringbuffer
- Loading branch information
Showing
6 changed files
with
84 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
|
||
#include <Sts1CobcSw/Periphery/FramRingBuffer.hpp> | ||
|
||
|
||
namespace sts1cobcsw::fram | ||
{ | ||
template<typename T, std::size_t size, Address startAddress> | ||
void RingBuffer<T, size, startAddress>::Push(T const& newData) | ||
{ | ||
currentWriteIndex_ = writeIndex_; | ||
auto const address = startAddress + writeIndex_ * serialSize<T>; | ||
fram::WriteTo(address, Span(Serialize(newData)), 0); | ||
writeIndex_++; | ||
|
||
if (writeIndex_ >= size) { | ||
writeIndex_ = 0; | ||
} | ||
if (occupiedCount_ < size) { | ||
occupiedCount_++; | ||
} | ||
writeCount_++; | ||
// TODO: iwyu | ||
currentWriteIndex_ = UINT32_MAX; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters