White Wizard micro SD Card module test program.You can use White Wizard SPI system easily! Details : http://wizard.nestegg.jp/sd.html

Dependencies:   mbed

Revision:
0:b8ab9a03a28d
Child:
1:731d34c1b57d
diff -r 000000000000 -r b8ab9a03a28d wwChipSelect.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wwChipSelect.cpp	Wed Jul 06 16:22:44 2011 +0000
@@ -0,0 +1,41 @@
+//Nest Egg Inc.
+//http://nestegg.jp/
+//White Wizard Board SPI Chip Select Code
+//Auther : Yoshinari kou
+//2010/10/03
+
+#include "wwChipSelect.h"
+
+wwChipSelect :: wwChipSelect(PinName cs):
+ ChipSelect(cs){
+ }
+ 
+void wwChipSelect :: wwCSwrite(int ch){   
+    //start
+    ChipSelect.write(1);   
+    wait_us(20); 
+    
+    ChipSelect.write(0);
+        
+    wait_us(26);//26
+    
+//A1
+    ChipSelect.write(0x01 & ch);    
+    wait_us(20);//46  
+    
+//A2    
+    ChipSelect.write((0x02 & ch)>>1);
+    wait_us(20);//66  
+    
+//A3    
+    ChipSelect.write((0x04 & ch)>>2);
+    wait_us(20);//86 
+    
+//A4    
+    ChipSelect.write((0x08 & ch)>>3);
+    wait_us(20);//106
+    
+    ChipSelect.write(1);
+
+}
+