AT45D_Write
Default mainpageat91libmemoriesspi-flashAT45D_Write
Description Source Call Graph
Start Line: 152
void AT45D_Write(At45 *pAt45, unsigned char *pBuffer, unsigned int size, unsigned int address)
{
    unsigned char error;

    SANITY_CHECK(pAt45);
    SANITY_CHECK(pBuffer);
    SANITY_CHECK(size <= pAt45->pDesc->pageSize);

    // Issue a page write through buffer 1 command
    error = AT45_SendCommand(pAt45, AT45_PAGE_WRITE_BUF1, 4, pBuffer, size, address, 0, 0);
    ASSERT(!error, "-F- AT45_Write: Could not issue command.\n\r");

    // Wait until the command is sent
    while (AT45_IsBusy(pAt45)) {
    
        AT45D_Wait(pAt45);
    }

    // Wait until the At45 becomes ready again
    AT45D_WaitReady(pAt45);
}