Working logger implementation and some fixes for driver code

This commit is contained in:
dario
2024-06-15 12:42:11 +02:00
parent 789fa4cd3e
commit 231f2ea06d
4 changed files with 123 additions and 115 deletions

View File

@@ -21,6 +21,10 @@ namespace sta
*/
Logger(W25Qxx * flash, uint32_t startSector, uint32_t endSector);
void findLast();
bool write(T* data);
/**
* @brief Write a new data point to the flash chip.
* @note If the total capacity of this logger was exceeded, it restarts at the first sector, overwriting its data.
@@ -73,7 +77,7 @@ namespace sta
*/
T operator[](std::size_t i);
private:
void findLast();
bool searchCriterion(uint8_t * buffer);
W25Qxx * flash_;
uint32_t start_;
@@ -81,6 +85,7 @@ namespace sta
uint32_t address_;
uint8_t buffer_[W25QXX_PAGE_SIZE];
bool flushed_;
uint32_t ptr_;
};
} // namespace sta