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
| Parameters | 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.
