/* Selects the data transfer direction in bi-directional mode for the specified SPI.  */
void SPI_BiDirectionalLineConfig(SPI_TypeDef *spi, SPI_Direction_TypeDef direction)
/* Selects the data transfer direction in bi-directional mode for the specified SPI.  */
void SPI_BiDirectionalLineConfig(SPI_TypeDef *spi, SPI_Direction_TypeDef direction)
{
    switch (direction) {
        case SPI_Direction_Rx:
            SET_BIT(spi->GCR, SPI_GCR_RXEN);
            break;
        case SPI_Direction_Tx:
            SET_BIT(spi->GCR, SPI_GCR_TXEN);
            break;
        case SPI_Disable_Rx:
            CLEAR_BIT(spi->GCR, SPI_GCR_RXEN);
            break;
        case SPI_Disable_Tx:
            CLEAR_BIT(spi->GCR, SPI_GCR_TXEN);
            break;
        default:
            break;
    }
}