/* Checks whether the specified SPI flag is set or not.  */
uint8_t SPI_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag)
/* Checks whether the specified SPI flag is set or not.  */
uint8_t SPI_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag)
{
    uint16_t status;
    status = (uint16_t)(spi->STS & flag);
    if (status == flag)
    {
        return SET;
    }
    return RESET;
}