예제 #1
0
파일: DiskIO.cs 프로젝트: valoni/FatFsFez
        /*-----------------------------------------------------------------------*/
        /* Select the card and wait for ready                                    */
        /*-----------------------------------------------------------------------*/

        static int select()     /* 1:OK, 0:Timeout */
        {
            /* Set CS# low */
            chipSelectPin.Write(GpioPinValue.Low);
            Spi.RcvSpi();                   /* Dummy clock (force DO enabled) */
            if (wait_ready() > 0)
            {
                return(1);                  /* Wait for card ready */
            }
            deselect();
            return(0);                               /* Failed */
        }
예제 #2
0
파일: DiskIO.cs 프로젝트: valoni/FatFsFez
        /*-----------------------------------------------------------------------*/
        /* Receive bytes from the card                                           */
        /*-----------------------------------------------------------------------*/

        static void rcvr_mmc(
            ref byte[] buff,    /* Pointer to read buffer */
            uint bc             /* Number of bytes to receive */
            )
        {
            int rxIndex = 0;

            do
            {
                buff[rxIndex++] = Spi.RcvSpi();     /* Store a received byte */
            }while (--bc > 0);
        }
예제 #3
0
파일: DiskIO.cs 프로젝트: valoni/FatFsFez
        /*-----------------------------------------------------------------------*/
        /* Deselect the card and release SPI bus                                 */
        /*-----------------------------------------------------------------------*/

        static void deselect()
        {
            chipSelectPin.Write(GpioPinValue.High);
            Spi.RcvSpi();       /* Dummy clock (force DO hi-z for multiple slave SPI) */
        }