Added delay function to driver

This commit is contained in:
dario
2024-04-15 22:50:13 +02:00
parent b6122a2dd8
commit ad76f8e12f
2 changed files with 18 additions and 5 deletions

View File

@@ -40,13 +40,18 @@ namespace sta
class W25Qxx
{
public:
/**
* @brief Signature for delay msec function.
*/
using DelayUsFunc = void (*)(uint32_t);
/**
* @brief Construct a new W25Qxx object
*
* @param device
* @param addrMode
*/
W25Qxx(SPIDevice * device, AddressMode addrMode = AddressMode::_24BIT);
W25Qxx(SPIDevice * device, DelayUsFunc delay, AddressMode addrMode = AddressMode::_24BIT);
uint8_t init();
@@ -251,7 +256,7 @@ namespace sta
* @param arg_length
* @return uint8_t
*/
uint8_t busWrite(uint8_t instruction, const uint8_t * data = nullptr, size_t length = 0, uint8_t * arguments = nullptr, size_t arg_length = 0);
uint8_t busWrite(uint8_t instruction, const uint8_t * data = nullptr, size_t length = 0, uint8_t * arguments = nullptr, size_t arg_length = 0, uint32_t delayCsHigh = 0);
/**
* @brief
@@ -280,6 +285,7 @@ namespace sta
private:
SPIDevice * device_;
DelayUsFunc delay_;
ChipState state_;
AddressMode addrMode_;
};