sdcard

Dependencies:   SDFileSystem mbed

Fork of rtcfinalcodeyuppie by Pradeep Kotipalli

Revision:
1:d360ad53f8fd
Parent:
0:d5e352a3ea98
Child:
2:d67cd8569921
--- a/main.cpp	Mon Dec 22 06:10:52 2014 +0000
+++ b/main.cpp	Mon Dec 22 07:04:43 2014 +0000
@@ -2,6 +2,8 @@
 SPI spi(PTD6, PTD7, PTD5); // mosi, miso, sclk
 DigitalOut cs(PTD2);
 
+void spiwrite(int);
+
 
 int main() 
 {
@@ -14,14 +16,16 @@
     spi.frequency(1000000);
 
     // Send the commands to write to test the seconds register
-    cs = 0;
+    /*cs = 0;
     spi.write(0x80);  // set write register to seconds
-    spi.write(0x00);  // send value of one
+    spi.write(0x00);  // send value of one*/
+    spiwrite(0x80);
     
     cs=1;
     cs=0;
      spi.write(0x81);  //write reg to minutes
     spi.write(0x00);
+    spiwrite(0x81);
     
     cs=1;
     cs=0;
@@ -110,4 +114,12 @@
     
     
     
+    }
+    
+    void spiwrite(int a)
+    {
+        cs=1;
+        cs=0;
+        spi.write(a);
+        spi.write(0x01);
     }
\ No newline at end of file