/**
 * @brief Deactivates the SPI peripheral.
 * @note  Deactivating the peripheral also enforces a release of the slave
 *        select line.
 *
 * @param[in] spip      pointer to the @p SPIDriver object
 *
 * @api
 */
void spiStop(SPIDriver *spip) {

  chDbgCheck(spip != NULL, "spiStop");

  chSysLock();
  chDbgAssert((spip->state == SPI_STOP) || (spip->state == SPI_READY),
              "spiStop(), #1", "invalid state");
  spi_lld_unselect(spip);
  spi_lld_stop(spip);
  spip->state = SPI_STOP;
  chSysUnlock();
}
Exemplo n.º 2
0
/**
 * @brief   Deactivates the SPI peripheral.
 * @note    Deactivating the peripheral also enforces a release of the slave
 *          select line.
 *
 * @param[in] spip      pointer to the @p SPIDriver object
 *
 * @api
 */
void spiStop(SPIDriver *spip) {

  osalDbgCheck(spip != NULL);

  osalSysLock();

  osalDbgAssert((spip->state == SPI_STOP) || (spip->state == SPI_READY),
                "invalid state");

  spi_lld_stop(spip);
  spip->config = NULL;
  spip->state  = SPI_STOP;

  osalSysUnlock();
}