USB Mass Storage Device demo with SD card

Dependencies:   USBDevice USBMSD_SD max32630fthr

Fork of FTHR_USBMSD_Demo by Greg Steiert

This example implements a micro SD card reader allowing access to a card inserted into the micro SD connector through the micro USB connector using the standard USB-MSD interface so that it appears just like a USB drive to your system.

Committer:
switches
Date:
Sun Nov 20 23:58:11 2016 +0000
Revision:
3:7264c8044625
Parent:
1:464c8b3634dc
Child:
4:b5764a3c5530
Updated to new MAX32630FTHR Class Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:60a522ae2e35 1 #include "mbed.h"
switches 1:464c8b3634dc 2 #include "max32630fthr.h"
switches 1:464c8b3634dc 3 #include "USBMSD_SD.h"
switches 0:60a522ae2e35 4
switches 3:7264c8044625 5 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
switches 3:7264c8044625 6
switches 1:464c8b3634dc 7 DigitalOut rLED(LED1);
switches 1:464c8b3634dc 8 DigitalOut gLED(LED2);
switches 0:60a522ae2e35 9
switches 0:60a522ae2e35 10 // main() runs in its own thread in the OS
switches 0:60a522ae2e35 11 // (note the calls to Thread::wait below for delays)
switches 0:60a522ae2e35 12 int main()
switches 0:60a522ae2e35 13 {
switches 1:464c8b3634dc 14 gLED = LED_OFF;
switches 1:464c8b3634dc 15 rLED = LED_ON;
switches 3:7264c8044625 16 pegasus.init();
switches 1:464c8b3634dc 17
switches 1:464c8b3634dc 18 gLED = LED_ON;
switches 1:464c8b3634dc 19 Thread::wait(100);
switches 1:464c8b3634dc 20
switches 1:464c8b3634dc 21 USBMSD_SD sd(P0_5, P0_6, P0_4, P0_7); // mosi, miso, sclk, cs
switches 1:464c8b3634dc 22 rLED = LED_OFF;
switches 0:60a522ae2e35 23
switches 0:60a522ae2e35 24 while (true) {
switches 1:464c8b3634dc 25 gLED = !gLED;
switches 0:60a522ae2e35 26 Thread::wait(500);
switches 0:60a522ae2e35 27 }
switches 0:60a522ae2e35 28 }
switches 0:60a522ae2e35 29