SD card interface

Committer:
lharoon
Date:
Mon Oct 08 11:14:07 2012 +0000
Revision:
0:22612ae617a0
1st edition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lharoon 0:22612ae617a0 1 #include "mbed.h"
lharoon 0:22612ae617a0 2 #include "USBMSD_SD.h"
lharoon 0:22612ae617a0 3 #include "watchdog.h"
lharoon 0:22612ae617a0 4
lharoon 0:22612ae617a0 5 Serial pc(USBTX, USBRX);
lharoon 0:22612ae617a0 6 USBMSD_SD sd(p5, p6, p7, p8, p9, LED1, p14);
lharoon 0:22612ae617a0 7 DigitalOut myled(LED1);
lharoon 0:22612ae617a0 8 DigitalOut myled2(LED2);
lharoon 0:22612ae617a0 9 DigitalOut myled3(LED3);
lharoon 0:22612ae617a0 10
lharoon 0:22612ae617a0 11 int main() {
lharoon 0:22612ae617a0 12 WDTInit();
lharoon 0:22612ae617a0 13 while (1) {
lharoon 0:22612ae617a0 14 if (!sd.disk_present()) {
lharoon 0:22612ae617a0 15 myled2 = 0;
lharoon 0:22612ae617a0 16 sd.disconnect();
lharoon 0:22612ae617a0 17 NVIC_SystemReset();
lharoon 0:22612ae617a0 18 while (!sd.disk_present()) {};
lharoon 0:22612ae617a0 19 wait(.5);
lharoon 0:22612ae617a0 20 } else {
lharoon 0:22612ae617a0 21 myled2 = 1;
lharoon 0:22612ae617a0 22 }
lharoon 0:22612ae617a0 23 if ((LPC_WWDT->MOD >> 2) & 1) {
lharoon 0:22612ae617a0 24 myled3 = 1;
lharoon 0:22612ae617a0 25 }
lharoon 0:22612ae617a0 26 feed();
lharoon 0:22612ae617a0 27 }
lharoon 0:22612ae617a0 28 }