CPS-Lab* / Mbed 2 deprecated Lab6

Dependencies:   ADXL362 mbed

Files at this revision

API Documentation at this revision

Comitter:
jackclar
Date:
Thu Feb 22 15:49:12 2018 +0000
Child:
1:737fa48a7c0c
Child:
2:3299365b3e3c
Commit message:
Version .1

Changed in this revision

ADXL362.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADXL362.lib	Thu Feb 22 15:49:12 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/teams/AnalogDevices/code/ADXL362/#ae171c032dc0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Feb 22 15:49:12 2018 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "ADXL362.h"
+ 
+// Interface pulled from ADXL362.cpp
+// ADXL362::ADXL362(PinName CS, PinName MOSI, PinName MISO, PinName SCK) :
+ADXL362 adxl362(PA_0,PA_7,PA_6,PA_1);
+Serial pc(USBTX, USBRX);
+
+int adxl362_reg_print(int start, int length);
+
+int main()
+{
+    adxl362.reset();
+    wait_ms(600); // we need to wait at least 500ms after ADXL362 reset
+    adxl362.set_mode(ADXL362::MEASUREMENT);
+    
+    adxl362_reg_print(0, 3);
+    return(0);
+}
+
+
+
+int adxl362_reg_print(int start, int length)
+{
+    int i;
+    if(start >= 0x00 && start <= 0x2E && length >= 0x00 /*&& (adxl362.read_reg(adxl362.DEVID_AD) == 0xAD)*/)
+    {
+        for(i = start; i <= start + length; i++)
+        {
+            pc.printf("\n\r0x%x: Test=%d\n\r", i, adxl362.read_reg());   
+        }
+    }
+    else
+    {
+        pc.printf("Error");
+        return(-1);  
+    }    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Feb 22 15:49:12 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file