Basic test for SPI of MS5611

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
smigielski
Date:
Wed Feb 04 07:36:04 2015 +0000
Parent:
0:6d8234cd8b2d
Commit message:
add more registers to test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6d8234cd8b2d -r da4082c0bc4d main.cpp
--- a/main.cpp	Sat Jan 31 20:29:07 2015 +0000
+++ b/main.cpp	Wed Feb 04 07:36:04 2015 +0000
@@ -10,8 +10,8 @@
 
 
 //Test that spi is working with fram MS5611 memory
-//mosi: || 0x1E || 0xA0 0x00 0x00 ||
-//miso: || 0x00 || 0x00 0x?? 0x?? ||
+//mosi: || 0x1E || 0xA0 0x00 0x00 || 0xA2 0x00 0x00 || ... || 0xAE 0x00 0x00 ||
+//miso: || 0x00 || 0x00 0x?? 0x?? || 0x00 0x?? 0x?? || ... || 0x00 0x?? 0x?? ||
 
 void reset(){
     cs=0;
@@ -20,9 +20,9 @@
     cs=1;
 }
 
-void readProm(){
+void readProm(int rec){
     cs=0;
-        spi.write(MS5611_PROM);
+        spi.write(MS5611_PROM+rec);
         uint8_t factory_data = spi.write(0x00);
         uint8_t setup = spi.write(0x00);
         cs=1;
@@ -32,8 +32,11 @@
     cs=1;
     while(1) {
         reset();
-        readProm();
-        wait(0.5); 
+        for(int i=0;i<16;i+=2){
+        readProm(i);
+        wait(0.2); 
+        }
+        wait(0.5);
     }
 }