arduino-dataflash
arduino-dataflash copied to clipboard
BufferToPage should block at beginning, not end
The BufferToPage method currently initiates the ram -> flash transfer and blocks until completion. this should be reversed. the reason the device has two ram buffers is so that you could continuously write data to it without having the consumer wait for the flush operation.
it should be
function BufferToPage(number) while (busy) wait;
initiateTransfer(number) return
and the operations that read flash directly should wait as well. this way, if i'm writing a chunk of data that's larget than the ram buffer, i can initiate the flush, pop out, switch ram buffers and keep writing. the time necessary to flush a buffer to flash is less than the time necessary to fill a ram buffer.
because of this change, you need to introduce checks into any function that touches the flash, including ReadMainMemoryPage and ContinuousRead. The reason is that before you couldn't have a situation where you were trying to read the flash while it was busy, but now you can.
I'm thinking about making DataFlash::enable call waitUntilReady before setting CS pin low.