Jump to main content

##

# DRV_SST26_Initialize Function

## C

    SYS_MODULE_OBJ DRV_SST26_Initialize
    (
    const SYS_MODULE_INDEX drvIndex,
    const SYS_MODULE_INIT *const init
    );

## Summary

Initializes the SST26 Driver

## Description

This routine initializes the SST26 driver making it ready for client to use.

## Precondition

None.

## Parameters

Param | Description
--- | ---
drvIndex | Identifier for the instance to be initialized
init | Pointer to a data structure containing any data necessary to initialize the driver.

## Returns

If successful, returns a valid driver instance object. Otherwise it returns SYS_MODULE_OBJ_INVALID.

## Example

    // This code snippet shows an example of initializing the SST26 Driver
    // with SST26 QSPI flash device attached.

    SYS_MODULE_OBJ objectHandle;

    const DRV_SST26_PLIB_INTERFACE drvSST26PlibAPI = {
        .CommandWrite = QSPI_CommandWrite,
        .RegisterRead = QSPI_RegisterRead,
        .RegisterWrite = QSPI_RegisterWrite,
        .MemoryRead = QSPI_MemoryRead,
        .MemoryWrite = QSPI_MemoryWrite
    };

    const DRV_SST26_INIT drvSST26InitData =
    {
        .sst26Plib = &drvSST26PlibAPI,
    };

    objectHandle = DRV_SST26_Initialize((SYS_MODULE_INDEX)DRV_SST26_INDEX, (SYS_MODULE_INIT *)&drvSST26InitData);

    if (SYS_MODULE_OBJ_INVALID == objectHandle)
    {
        // Handle error
    }

## Remarks

This routine must be called before any other SST26 driver routine is called. This routine should only be called once during system initialization.