DRV_AT25_PageWrite Function

C

bool DRV_AT25_PageWrite(const DRV_HANDLE handle, void *txData, uint32_t address)

Summary

Writes one page of data starting at the specified address.

Description

This function schedules a non-blocking write operation for writing one page of data starting from the given address of the EEPROM.

The requesting client should call DRV_AT25_TransferStatusGet API to know the current status of the request OR the requesting client can register a callback function with the driver to get notified of the status.

Preconditions

DRV_AT25_Open must have been called to obtain a valid opened device handle.

"address" provided must be page boundary aligned in order to avoid overwriting the data in the beginning of the page.

Parameters

ParamDescription
handleA valid open-instance handle, returned from the driver's open routine
txDataThe source buffer containing data to be written to the AT25 EEPROM
addressWrite memory start address from where the data should be written. It must be page boundary aligned in order to avoid overwriting the data in the beginning of the page.

Returns

true

  • if the write request is accepted.

false

  • if handle is invalid

  • if the pointer to the transmit data is NULL

  • if the driver is busy handling another transfer request

Example

#define PAGE_SIZE 256
#define MEM_ADDRESS 0x0

uint8_t CACHE_ALIGN writeBuffer[PAGE_SIZE];

// myHandle is the handle returned from DRV_AT25_Open API.
// In the below example, the transfer status is polled. However, application can
// register a callback and get notified when the transfer is complete.

if (DRV_AT25_PageWrite(myHandle, writeBuffer, MEM_ADDRESS) != true)
{
    // Error handling here
}
else
{
    // Wait for write to be completed
    while(DRV_AT25_TransferStatusGet(myHandle) == DRV_AT25_TRANSFER_STATUS_BUSY);
}

Remarks

None.