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.
Revision 0:d5c236ffbd5e, committed 2018-02-20
- Comitter:
- csinders
- Date:
- Tue Feb 20 15:54:29 2018 +0000
- Child:
- 1:fedb70ea0eaa
- Commit message:
- Minor alterations to program. Switched with board is being used.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADXL362.lib Tue Feb 20 15:54:29 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:54:29 2018 +0000
@@ -0,0 +1,61 @@
+#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 main() {
+ pc.printf("Starting program\n\r");
+ 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;
+
+ while(1) {
+ x=adxl362.scanx_u8();
+ y=adxl362.scany_u8();
+ z=adxl362.scanz_u8();
+ pc.printf("x = %d y = %d z = %d\r\n",x,y,z);
+ wait_ms(100);
+ }
+}
+
+int adxl362_reg_print(int start, int length) {
+ // Check if start is within registry
+ if (start < 0 || start > 0x2E) {
+ pc.printf("Error: start value passed to adxl362_reg_print outside of range of registry\n\r");
+ return -1;
+ }
+ // check if length is negative
+ if (length < 0) {
+ pc.printf("Error: length passed to adxl362_reg_print is negative\n\r");
+ return -1;
+ }
+
+ // check if valid communication with device going
+ if (adxl362.read_reg(adxl362.DEVID_AD) != 0xAD) {
+ pc.printf("Error: Unable to read from DEVID_AD register\n\r");
+ }
+
+
+ // String array with all of the names of the different registers in order
+ char regNames [0x2E][20] = {
+ "DEVID_AD", "DEVID_MST", "PARTID",
+ "REVID", "XDATA", "YDATA",
+ "ZDATA", "STATUS", "FIFO_ENTRIES_L",
+ "FIFO_ENTRIES_H", "XDATA_L", "XDATA_H",
+ "YDATA_L", "YDATA_H", "ZDATA_L",
+ "ZDATA_H", "TEMP_L", "TEMP_H",
+ "RESERVED", "RESERVED", "SOFT_RESET",
+ "THRESH_ACT_L", "THRESH_ACT_H", "TIME_INACT_L",
+ "TIME_ACT", "THRESH_INACT_L", "THRESH_INACT_H",
+ "TIME_INACT_L", "TIME_INACT_H", "ACT_INACT_CTL",
+ "FIFO_CONTROL", "FIFO_SAMPLES", "INTMAP1",
+ "INTMATP2", "FILTER_CTL", "POWER_CTL",
+ "SELF_TEST"};
+
+// below is github with data for ADXL362 methods
+ //https://github.com/analogdevicesinc/mbed-adi/blob/master/libraries/ADXL362/ADXL362.cpp
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 20 15:54:29 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file