Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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.
Revision 1:464c8b3634dc, committed 2016-11-16
- Comitter:
- switches
- Date:
- Wed Nov 16 18:25:25 2016 +0000
- Parent:
- 0:60a522ae2e35
- Child:
- 2:8b0920fd81bc
- Commit message:
- USB Mass Storage Device demo with SD card
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBMSD_SD.lib Wed Nov 16 18:25:25 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/samux/code/USBMSD_SD/#cce1e689c548
--- a/main.cpp Fri Nov 11 21:08:36 2016 +0000
+++ b/main.cpp Wed Nov 16 18:25:25 2016 +0000
@@ -1,28 +1,31 @@
#include "mbed.h"
-
-#define MAX14690_I2C_ADDR 0x50
+#include "max32630fthr.h"
+#include "USBMSD_SD.h"
-DigitalOut led1(LED1);
-I2C i2cm2(P5_7, P6_0);
-
+DigitalOut rLED(LED1);
+DigitalOut gLED(LED2);
// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
int main()
{
- char data[5];
- data[0] = 0x14; // I2C address for first register (LDO2 CFG)
- data[1] = 0x00; // Dissable LDO2
- data[2] = 0x19; // Set voltage to 3.3V
- data[3] = 0x00; // Dissable LDO3
- data[4] = 0x19; // Set voltage to 3.3V
- i2cm2.write(MAX14690_I2C_ADDR, data, 5);
- data[1] = 0x02; // Enable LDO2
- data[3] = 0x02; // Enable LDO3
- i2cm2.write(MAX14690_I2C_ADDR, data, 5);
+ gLED = LED_OFF;
+ rLED = LED_ON;
+ max32630fthrInit();
+ Thread::wait(100);
+
+ vddioh(P0_4, TRUE);
+ vddioh(P0_5, TRUE);
+ vddioh(P0_6, TRUE);
+ vddioh(P0_7, TRUE);
+ gLED = LED_ON;
+ Thread::wait(100);
+
+ USBMSD_SD sd(P0_5, P0_6, P0_4, P0_7); // mosi, miso, sclk, cs
+ rLED = LED_OFF;
while (true) {
- led1 = !led1;
+ gLED = !gLED;
Thread::wait(500);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/max32630fthr.lib Wed Nov 16 18:25:25 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/switches/code/max32630fthr/#8926602da648
