Jump to main content

##

# 1.1.7.4.11 DRV_SDSPI_IsWriteProtected Function

## C

    bool DRV_SDSPI_IsWriteProtected
    (
        const DRV_HANDLE handle
    )

## Summary

Returns the write protect status of the SD Card.

## Description

This function returns true if the SD Card is write protected otherwise it returns false.

## Precondition

The DRV_SDSPI_Initialize routine must have been called for the specified SDSPI driver instance.

The DRV_SDSPI_Open routine must have been called to obtain a valid opened device handle.

## Parameters

Param | Description
--- | ---
handle | A valid open-instance handle, returned from the driver's open function

## Returns

true - If the attached SD Card is write protected. If the configured write protect GPIO pin is read High by the driver then the card is write protected. The status of the write protect GPIO pin is read by the driver during the media (SD Card) initialization.

false - If the handle is not valid, or if the SD Card is not write protected.

## Example

    bool isWriteProtected;
    // mySDSPIHandle is the handle returned by the DRV_SDSPI_Open function.
    isWriteProtected = DRV_SDSPI_IsWriteProtected(mySDSPIHandle);

    if (isWriteProtected == true)
    {
        //SD Card is write protected.
    }

## Remarks

None.