Exemplo n.º 1
0
Arquivo: spi.c Projeto: JMR-b/RIOT
void spi_poweroff(spi_t dev)
{
    switch (dev) {
#if SPI_0_EN
        case SPI_0:
            SPI_0_DEV->CR1 &= ~(SPI_CR1_SPE);   /* turn SPI peripheral off */
            SPI_0_CLKDIS();
            break;
#endif

#if SPI_1_EN
        case SPI_1:
            SPI_1_DEV->CR1 &= ~(SPI_CR1_SPE);   /* turn SPI peripheral off */
            SPI_1_CLKDIS();
            break;
#endif

#if SPI_2_EN
        case SPI_2:
            SPI_2_DEV->CR1 &= ~(SPI_CR1_SPE);   /* turn SPI peripheral off */
            SPI_2_CLKDIS();
            break;
#endif
    }
}
Exemplo n.º 2
0
Arquivo: spi.c Projeto: AnonMall/RIOT
void spi_poweroff(spi_t dev)
{
    switch (dev) {
#if SPI_0_EN
        case SPI_0:
            while (SPI_0_DEV->SR & SPI_SR_BSY);
            SPI_0_CLKDIS();
            break;
#endif
#if SPI_1_EN
        case SPI_1:
            while (SPI_1_DEV->SR & SPI_SR_BSY);
            SPI_1_CLKDIS();
            break;
#endif
    }
}
Exemplo n.º 3
0
void spi_poweroff(spi_t dev)
{
    /* Wait until the last byte has been transmitted before turning off
     * the clock. */
    switch (dev) {
#if SPI_0_EN

        case SPI_0:
            while ((SPI_0_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_0_CLKDIS();
            break;
#endif
#if SPI_1_EN

        case SPI_1:
            while ((SPI_1_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_1_CLKDIS();
            break;
#endif
#if SPI_2_EN

        case SPI_2:
            while ((SPI_2_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_2_CLKDIS();
            break;
#endif
#if SPI_3_EN

        case SPI_3:
            while ((SPI_3_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_3_CLKDIS();
            break;
#endif
#if SPI_4_EN

        case SPI_4:
            while ((SPI_4_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_4_CLKDIS();
            break;
#endif
#if SPI_5_EN

        case SPI_5:
            while ((SPI_5_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_5_CLKDIS();
            break;
#endif
#if SPI_6_EN

        case SPI_6:
            while ((SPI_6_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_6_CLKDIS();
            break;
#endif
#if SPI_7_EN

        case SPI_7:
            while ((SPI_7_DEV->SR & SPI_SR_TXCTR_MASK) != 0);

            SPI_7_CLKDIS();
            break;
#endif
    }
}