mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/driver-w25qxxx.git
synced 2025-09-29 00:37:33 +00:00
Updated binary search and addressing
This commit is contained in:
@@ -39,6 +39,18 @@ namespace sta
|
||||
_32BIT
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
enum class ChunkSize
|
||||
{
|
||||
PAGE,
|
||||
SECTOR,
|
||||
BLOCK_32KB,
|
||||
BLOCK_64KB
|
||||
};
|
||||
|
||||
class W25Qxx
|
||||
{
|
||||
public:
|
||||
@@ -62,13 +74,18 @@ namespace sta
|
||||
*/
|
||||
uint8_t init();
|
||||
|
||||
uint32_t getChunkBytes(ChunkSize size);
|
||||
|
||||
/**
|
||||
* @brief Find the last page satisfying the given criterion. Uses a binary search to find this page.
|
||||
* @brief Find the first memory section not satisfying a given criterion using a binary search.
|
||||
*
|
||||
* @note This function assume that there is a page n such that every page before n satisfies the criterion, while every page after that doesn't
|
||||
*
|
||||
* @param criterion A function evaluating the criterion on a page.
|
||||
* @param size The size of the memory section. Has to be one of the predefined sizes.
|
||||
* @return uint32_t The last address such that the criterion is satisfied.
|
||||
*/
|
||||
uint32_t findLastPage(std::function<bool(uint8_t*)> criterion);
|
||||
uint32_t findLast(std::function<bool(uint8_t*)> criterion, ChunkSize size);
|
||||
|
||||
/**
|
||||
* @brief Set the Address Mode object
|
||||
@@ -188,6 +205,8 @@ namespace sta
|
||||
* @return uint8_t
|
||||
*/
|
||||
uint8_t pageProgram(uint32_t address, uint8_t * buffer, size_t length);
|
||||
|
||||
uint8_t sectorProgram(uint32_t address, uint8_t * buffer, size_t length);
|
||||
public:
|
||||
/*
|
||||
* Erase operations
|
||||
|
Reference in New Issue
Block a user