diff --git a/include/sta/drivers/w25qxx.hpp b/include/sta/drivers/w25qxx.hpp index 4682f02..3e8e962 100644 --- a/include/sta/drivers/w25qxx.hpp +++ b/include/sta/drivers/w25qxx.hpp @@ -2,6 +2,7 @@ #define STA_SENSORS_W25Q128_HPP #include +//#include #include #include @@ -333,4 +334,4 @@ namespace sta } // namespace sta -#endif // STA_SENSORS_W25Q128_HPP \ No newline at end of file +#endif // STA_SENSORS_W25Q128_HPP diff --git a/include/sta/utils/logger.tpp b/include/sta/utils/logger.tpp index 5eebdd3..4c1501c 100644 --- a/include/sta/utils/logger.tpp +++ b/include/sta/utils/logger.tpp @@ -16,7 +16,7 @@ namespace sta ptr_ {0} { STA_ASSERT(flash != nullptr); - STA_ASSERT(endAddr > startAddr); + STA_ASSERT(endSec > startSec); // Jump to the last written page. findLast(); diff --git a/src/w25qxx.cpp b/src/w25qxx.cpp index 1518bae..737b940 100644 --- a/src/w25qxx.cpp +++ b/src/w25qxx.cpp @@ -22,7 +22,7 @@ namespace sta uint8_t W25Qxx::init() { - lock_guard(*mutex_); + lock_guardlock(*mutex_); powerDown(); delay_(5); @@ -76,7 +76,7 @@ namespace sta { STA_ASSERT(startAddr <= endAddr); - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint32_t bytes = getChunkBytes(size); uint32_t left = startAddr / bytes; @@ -115,7 +115,7 @@ namespace sta uint8_t W25Qxx::setAddressMode(AddressMode addrMode) { - lock_guard(*mutex_); + lock_guardlock(*mutex_); busWrite(W25QXX_4_BYTE_ADDR_ENABLE); while (isBusy()) {} @@ -125,7 +125,7 @@ namespace sta AddressMode W25Qxx::getAddressMode() { - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint8_t status; readStatusRegister(3, &status); @@ -135,7 +135,7 @@ namespace sta uint8_t W25Qxx::getChipID() { - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint8_t buffer[4]; busRead(W25QXX_RELEASE_POWER_DOWN, buffer, 3); @@ -145,7 +145,7 @@ namespace sta uint8_t W25Qxx::getManufacturerID() { - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint8_t dummy[3] = {0, 0, 0}; uint8_t id[2] = {0, 0}; @@ -157,7 +157,7 @@ namespace sta uint64_t W25Qxx::getUniqueID() { - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint8_t dummy[4]; uint8_t id[8]; @@ -176,7 +176,7 @@ namespace sta bool W25Qxx::isBusy() { - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint8_t status = 0; readStatusRegister(1, &status); @@ -186,7 +186,7 @@ namespace sta uint8_t W25Qxx::readData(uint32_t address, uint8_t * buffer, size_t length, bool fast /* = true */) { - lock_guard(*mutex_); + lock_guardlock(*mutex_); uint8_t instruction = fast ? W25QXX_FAST_READ : W25QXX_READ; @@ -238,7 +238,7 @@ namespace sta uint8_t W25Qxx::pageProgram(uint32_t address, uint8_t * buffer, size_t length) { - lock_guard(*mutex_); + lock_guardlock(*mutex_); STA_ASSERT(length <= W25QXX_PAGE_SIZE); while (isBusy()) {} @@ -275,7 +275,7 @@ namespace sta uint8_t W25Qxx::sectorProgram(uint32_t address, uint8_t * buffer, size_t length) { - lock_guard(*mutex_); + lock_guardlock(*mutex_); STA_ASSERT(length <= W25QXX_SECTOR_SIZE);