mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/driver-w25qxxx.git
synced 2025-06-10 18:45:59 +00:00
Removed reading from buffer
This commit is contained in:
parent
137d6d053b
commit
3b1629d34a
@ -188,17 +188,10 @@ namespace sta
|
|||||||
uint32_t address = start_ * W25QXX_SECTOR_SIZE + i * sizeof(T);
|
uint32_t address = start_ * W25QXX_SECTOR_SIZE + i * sizeof(T);
|
||||||
|
|
||||||
// If the requested element is in the cache, read it from there.
|
// If the requested element is in the cache, read it from there.
|
||||||
if (address / W25QXX_PAGE_SIZE == address_ / W25QXX_PAGE_SIZE)
|
|
||||||
{
|
uint8_t buffer[sizeof(T)];
|
||||||
uint8_t * ptr = buffer_ + address % W25QXX_PAGE_SIZE;
|
flash_->readData(address, buffer, sizeof(T));
|
||||||
return *reinterpret_cast<T*>(ptr);
|
return *reinterpret_cast<T*>(buffer);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint8_t buffer[sizeof(T)];
|
|
||||||
flash_->readData(address, buffer, sizeof(T));
|
|
||||||
return *reinterpret_cast<T*>(buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user