drivers/src/microsd.c
void MICROSD_Init(void)
{
  USART_InitSync_TypeDef init = USART_INITSYNC_DEFAULT;

  /* Enabling clock to USART 0 */
  CMU_ClockEnable(MICROSD_CMUCLOCK, true);
  CMU_ClockEnable(cmuClock_GPIO, true);

  /* Initialize USART in SPI master mode. */
  xfersPrMsec   = MICROSD_LO_SPI_FREQ / 8000;
  init.baudrate = MICROSD_LO_SPI_FREQ;
  init.msbf     = true;
  USART_InitSync(MICROSD_USART, &init);

  /* Enabling pins and setting location, SPI CS not enable */
  MICROSD_USART->ROUTE = USART_ROUTE_TXPEN | USART_ROUTE_RXPEN
                         | USART_ROUTE_CLKPEN | MICROSD_LOC;

#if defined(USART_CTRL_SMSDELAY)
  /* This will allow us to use higher baudrate. */
  MICROSD_USART->CTRL |= USART_CTRL_SMSDELAY;
#endif

  /* IO configuration */
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_MOSIPIN, gpioModePushPull, 0);  /* MOSI */
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_MISOPIN, gpioModeInputPull, 1); /* MISO */
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_CSPIN, gpioModePushPull, 1);    /* CS */
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_CLKPIN, gpioModePushPull, 0);   /* CLK */
}
/**************************************************************************/
/**
 * @brief
 *  Initialize the SPI peripheral for microSD card usage.
 *  SPI pins and speed etc. is defined in microsdconfig.h.
 *****************************************************************************/
@brief
Initialize the SPI peripheral for microSD card usage.
SPI pins and speed etc.
@brief Initialize the SPI peripheral for microSD card usage . SPI pins and speed etc .
void MICROSD_Init(void)
{
  USART_InitSync_TypeDef init = USART_INITSYNC_DEFAULT;
  CMU_ClockEnable(MICROSD_CMUCLOCK, true);
  CMU_ClockEnable(cmuClock_GPIO, true);
  xfersPrMsec   = MICROSD_LO_SPI_FREQ / 8000;
  init.baudrate = MICROSD_LO_SPI_FREQ;
  init.msbf     = true;
  USART_InitSync(MICROSD_USART, &init);
  MICROSD_USART->ROUTE = USART_ROUTE_TXPEN | USART_ROUTE_RXPEN
                         | USART_ROUTE_CLKPEN | MICROSD_LOC;
#if defined(USART_CTRL_SMSDELAY)
  MICROSD_USART->CTRL |= USART_CTRL_SMSDELAY;
#endif
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_MOSIPIN, gpioModePushPull, 0);  
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_MISOPIN, gpioModeInputPull, 1); 
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_CSPIN, gpioModePushPull, 1);    
  GPIO_PinModeSet(MICROSD_GPIOPORT, MICROSD_CLKPIN, gpioModePushPull, 0);   
}
void MICROSD_Init ( void ) { USART_InitSync_TypeDef init = USART_INITSYNC_DEFAULT ; CMU_ClockEnable ( MICROSD_CMUCLOCK , true ) ; CMU_ClockEnable ( cmuClock_GPIO , true ) ; xfersPrMsec = MICROSD_LO_SPI_FREQ / 8000 ; init . baudrate = MICROSD_LO_SPI_FREQ ; init . msbf = true ; USART_InitSync ( MICROSD_USART , & init ) ; MICROSD_USART -> ROUTE = USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_CLKPEN | MICROSD_LOC ; #if defined ( USART_CTRL_SMSDELAY ) MICROSD_USART -> CTRL |= USART_CTRL_SMSDELAY ; #endif GPIO_PinModeSet ( MICROSD_GPIOPORT , MICROSD_MOSIPIN , gpioModePushPull , 0 ) ; GPIO_PinModeSet ( MICROSD_GPIOPORT , MICROSD_MISOPIN , gpioModeInputPull , 1 ) ; GPIO_PinModeSet ( MICROSD_GPIOPORT , MICROSD_CSPIN , gpioModePushPull , 1 ) ; GPIO_PinModeSet ( MICROSD_GPIOPORT , MICROSD_CLKPIN , gpioModePushPull , 0 ) ; }
@brief
  Initialize the SPI peripheral for microSD card usage.
@brief Initialize the SPI peripheral for microSD card usage .
/* Enabling clock to USART 0 */ /* Initialize USART in SPI master mode. */ /* Enabling pins and setting location, SPI CS not enable */ /* This will allow us to use higher baudrate. */ /* IO configuration */ /* MOSI */ /* MISO */ /* CS */ /* CLK */