mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/driver-w25qxxx.git
synced 2025-09-29 08:37:33 +00:00
Added mutex and more doxygen
This commit is contained in:
@@ -33,6 +33,12 @@ namespace sta
|
||||
// If the written data exceeds the remaining bytes in the page.
|
||||
if (ptr_ + length >= W25QXX_PAGE_SIZE)
|
||||
{
|
||||
// If the segment is full, stop writing data to it.
|
||||
if (address_ / W25QXX_SECTOR_SIZE == end_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::memcpy(buffer_ + ptr_, bytes, remaining);
|
||||
flash_->pageProgram(address_, buffer_, W25QXX_PAGE_SIZE);
|
||||
|
||||
@@ -43,15 +49,9 @@ namespace sta
|
||||
|
||||
address_ += W25QXX_PAGE_SIZE;
|
||||
|
||||
// If a new sector was started, erase the new sector.
|
||||
// If a new sector has to be started, erase the new sector.
|
||||
if (address_ % W25QXX_SECTOR_SIZE == 0)
|
||||
{
|
||||
// If the size of the logger segment was exceeded, restart at the first sector.
|
||||
if (address_ / W25QXX_SECTOR_SIZE == end_)
|
||||
{
|
||||
address_ = start_ * W25QXX_SECTOR_SIZE;
|
||||
}
|
||||
|
||||
flash_->sectorErase(address_);
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace sta
|
||||
template <typename T>
|
||||
size_t Logger<T>::remaining()
|
||||
{
|
||||
return (end_ * W25QXX_SECTOR_SIZE - address_) / sizeof(T);
|
||||
return (end_ * W25QXX_SECTOR_SIZE - address_) / sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Reference in New Issue
Block a user