Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ADXL362 mbed MPL3115A2
Revision 0:0f663d16e8a2, committed 2018-02-20
- Comitter:
- rmneubau
- Date:
- Tue Feb 20 15:24:50 2018 +0000
- Child:
- 1:b8716571ecac
- Commit message:
- lab 6
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADXL362.lib Tue Feb 20 15:24:50 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 Tue Feb 20 15:24:50 2018 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#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);
+
+int main() {
+ adxl362.reset();
+ wait_ms(600); // we need to wait at least 500ms after ADXL362 reset
+ adxl362.set_mode(ADXL362::MEASUREMENT);
+ int8_t x,y,z;
+ adxl362_reg_print(start, length);
+
+ while(1) {
+ x=adxl362.scanx_u8();
+ y=adxl362.scany_u8();
+ z=adxl362.scanz_u8();
+ printf("x = %d y = %d z = %d\r\n",x,y,z);
+ wait_ms(100);
+ }
+}
+
+int adxl362_reg_print(int s, int l){
+ //check s is 0x00 and 0x2E
+ if(s > 0x2E || s < 0x00){
+ printf("adx: requires start between 0x00 and 0x2E; given %d\n", s);
+ return 1;
+ }else if(l < 0){
+ printf("adx: requires length > 0, given %d\n", l);
+ return 1;
+ }else{
+ // start sending stuff
+ //first check DEVID_AD == 0xAD
+ if(DEVID_AD != 0xAD){
+ printf("error: DEVID_AD is not 0xAD\n");
+ return 1;
+ }else{
+ //now do stuff
+ }
+ }
+
+ //check length >0
+ //if length == 0, send everything from s to end of registers
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 20 15:24:50 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file