SD card interface

main.cpp

Committer:
lharoon
Date:
2012-10-08
Revision:
0:22612ae617a0

File content as of revision 0:22612ae617a0:

#include "mbed.h"
#include "USBMSD_SD.h"
#include "watchdog.h"

Serial pc(USBTX, USBRX);
USBMSD_SD sd(p5, p6, p7, p8, p9, LED1, p14);
DigitalOut myled(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);

int main() {
    WDTInit();
    while (1) {
        if (!sd.disk_present()) {
            myled2 = 0;
            sd.disconnect();
            NVIC_SystemReset();
            while (!sd.disk_present()) {};
            wait(.5);
        } else {
            myled2 = 1;
        }
        if ((LPC_WWDT->MOD >> 2) & 1) {
            myled3 = 1;
        }
        feed();
    }
}