USB Mass Storage Device demo with SD card
Dependencies: USBDevice USBMSD_SD max32630fthr
Fork of FTHR_USBMSD_Demo by
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.
main.cpp@6:1f64f4cf7cc7, 2017-02-06 (annotated)
- Committer:
- switches
- Date:
- Mon Feb 06 23:58:28 2017 +0000
- Revision:
- 6:1f64f4cf7cc7
- Parent:
- 4:b5764a3c5530
- Child:
- 8:8c31b3ba5371
Publishing to Maxim Integrated Team
Who changed what in which revision?
User | Revision | Line number | New 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 | 6:1f64f4cf7cc7 | 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 | 6:1f64f4cf7cc7 | 14 | gLED = LED_ON; |
switches | 1:464c8b3634dc | 15 | rLED = LED_ON; |
switches | 1:464c8b3634dc | 16 | |
switches | 1:464c8b3634dc | 17 | Thread::wait(100); |
switches | 1:464c8b3634dc | 18 | |
switches | 1:464c8b3634dc | 19 | USBMSD_SD sd(P0_5, P0_6, P0_4, P0_7); // mosi, miso, sclk, cs |
switches | 1:464c8b3634dc | 20 | rLED = LED_OFF; |
switches | 0:60a522ae2e35 | 21 | |
switches | 0:60a522ae2e35 | 22 | while (true) { |
switches | 1:464c8b3634dc | 23 | gLED = !gLED; |
switches | 0:60a522ae2e35 | 24 | Thread::wait(500); |
switches | 0:60a522ae2e35 | 25 | } |
switches | 0:60a522ae2e35 | 26 | } |
switches | 0:60a522ae2e35 | 27 |