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:
Wed Nov 16 18:25:25 2016 +0000
Revision:
1:464c8b3634dc
Parent:
0:60a522ae2e35
Child:
3:7264c8044625
USB Mass Storage Device demo with SD card

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 1:464c8b3634dc 5 DigitalOut rLED(LED1);
switches 1:464c8b3634dc 6 DigitalOut gLED(LED2);
switches 0:60a522ae2e35 7
switches 0:60a522ae2e35 8 // main() runs in its own thread in the OS
switches 0:60a522ae2e35 9 // (note the calls to Thread::wait below for delays)
switches 0:60a522ae2e35 10 int main()
switches 0:60a522ae2e35 11 {
switches 1:464c8b3634dc 12 gLED = LED_OFF;
switches 1:464c8b3634dc 13 rLED = LED_ON;
switches 1:464c8b3634dc 14 max32630fthrInit();
switches 1:464c8b3634dc 15 Thread::wait(100);
switches 1:464c8b3634dc 16
switches 1:464c8b3634dc 17 vddioh(P0_4, TRUE);
switches 1:464c8b3634dc 18 vddioh(P0_5, TRUE);
switches 1:464c8b3634dc 19 vddioh(P0_6, TRUE);
switches 1:464c8b3634dc 20 vddioh(P0_7, TRUE);
switches 1:464c8b3634dc 21 gLED = LED_ON;
switches 1:464c8b3634dc 22 Thread::wait(100);
switches 1:464c8b3634dc 23
switches 1:464c8b3634dc 24 USBMSD_SD sd(P0_5, P0_6, P0_4, P0_7); // mosi, miso, sclk, cs
switches 1:464c8b3634dc 25 rLED = LED_OFF;
switches 0:60a522ae2e35 26
switches 0:60a522ae2e35 27 while (true) {
switches 1:464c8b3634dc 28 gLED = !gLED;
switches 0:60a522ae2e35 29 Thread::wait(500);
switches 0:60a522ae2e35 30 }
switches 0:60a522ae2e35 31 }
switches 0:60a522ae2e35 32