White Wizard SPI Chip Select test program. I changed chip select signal timing.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
halfpitch
Date:
Thu Sep 01 10:05:25 2011 +0000
Parent:
1:048ae028f72d
Commit message:
Rev.B

Changed in this revision

wwChipSelect.cpp Show annotated file Show diff for this revision Revisions of this file
wwChipSelect.h Show annotated file Show diff for this revision Revisions of this file
--- a/wwChipSelect.cpp	Mon Jul 25 10:01:36 2011 +0000
+++ b/wwChipSelect.cpp	Thu Sep 01 10:05:25 2011 +0000
@@ -1,19 +1,29 @@
 //Nest Egg Inc.
-//http://wizard.nestegg.jp/
+//http://nestegg.jp/
 //White Wizard Board SPI Chip Select Code
 //Auther : Yoshinari kou
 //2010/10/03
 
 #include "wwChipSelect.h"
+//#define NORMAL    //if you want to use normal chipselect, you should enable this code.
 
 wwChipSelect :: wwChipSelect(PinName cs):
  ChipSelect(cs){
  }
  
-void wwChipSelect :: wwCSwrite(int ch){   
+void wwChipSelect :: wwCSwrite(int ch){
+
+#ifdef NORMAL
+    if(ch == 0){//reset code
+        ChipSelect.write(1);
+    }else{
+        ChipSelect.write(0);
+    }
+    
+#else
     //start
     ChipSelect.write(1);   
-    wait_us(20); 
+    wait_us(30); 
     
     ChipSelect.write(0);
         
@@ -36,7 +46,9 @@
     wait_us(20);//106
     
     ChipSelect.write(1);
-
+    
+    wait_us(30);
+    
+#endif
 }
 
-
--- a/wwChipSelect.h	Mon Jul 25 10:01:36 2011 +0000
+++ b/wwChipSelect.h	Thu Sep 01 10:05:25 2011 +0000
@@ -1,16 +1,16 @@
-//Nest Egg Inc.
-//http://nestegg.jp/
-//White Wizard Board SPI Chip Select Code
-//Auther : Yoshinari kou
-//2010/10/03
-
-#include "mbed.h"
-
-class wwChipSelect
-{
-    private:
-        DigitalOut  ChipSelect;
-    public:
-        wwChipSelect(PinName);  //constructor
-        void wwCSwrite(int);
+//Nest Egg Inc.
+//http://nestegg.jp/
+//White Wizard Board SPI Chip Select Code
+//Auther : Yoshinari kou
+//2010/10/03
+
+#include "mbed.h"
+
+class wwChipSelect
+{
+    private:
+        DigitalOut  ChipSelect;
+    public:
+        wwChipSelect(PinName);  //constructor
+        void wwCSwrite(int);
 };
\ No newline at end of file