Removed reading from buffer

This commit is contained in:
dario 2024-10-10 14:09:34 +02:00
parent 137d6d053b
commit 3b1629d34a

View File

@ -188,17 +188,10 @@ namespace sta
uint32_t address = start_ * W25QXX_SECTOR_SIZE + i * sizeof(T);
// If the requested element is in the cache, read it from there.
if (address / W25QXX_PAGE_SIZE == address_ / W25QXX_PAGE_SIZE)
{
uint8_t * ptr = buffer_ + address % W25QXX_PAGE_SIZE;
return *reinterpret_cast<T*>(ptr);
}
else
{
uint8_t buffer[sizeof(T)];
flash_->readData(address, buffer, sizeof(T));
return *reinterpret_cast<T*>(buffer);
}
uint8_t buffer[sizeof(T)];
flash_->readData(address, buffer, sizeof(T));
return *reinterpret_cast<T*>(buffer);
}
} // namespace sta