Jump to main content

##

# 2.108.11 SEFCx_PageBufferWrite Function

## C

    bool SEFCx_PageBufferWrite( uint32_t *data, const uint32_t address) // x - Instance of the SEFC peripheral

## Summary

Writes data to the internal buffer of SEFCx known as the latch buffer

## Description

Writes data to the internal buffer of SEFCx known as the latch buffer. Use this API if multiple updates are required to the same Flash page and to avoid erasing the page multiple times. When all the updates to the page are done, commit the data to the flash by calling the SEFCx_PageBufferCommit() API.

## Precondition

The SEFCx_Initialize() function should have been called once.

## Parameters

Param | Description
--- | ---
data | pointer to data buffer.
address | Data Flash address to be modified.

## Returns

true if the operation was successful, else returns false.

## Example

    uint32_t* data; //data - pointer to the buffer to be written to flash memory
    uint32_t flashAddr; //flashAddr - variable containing flash address

    //populate data and flashAddr

    SEFC0_PageBufferWrite((uint32_t*)data, (uint32_t)flashAddr);

    //update data here

    SEFC0_PageBufferWrite((uint32_t*)data, (uint32_t)flashAddr);

    //Commit the final data in the SEFC internal page buffer to the flash memory
    SEFC0_PageBufferCommit((uint32_t)flashAddr);

    //Wait until the SEFC controller is busy
    while (SEFC0_IsBusy());

## Remarks

None