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: libmDot-dev-mbed5-deprecated ISL29011
Fork of mdot-examples by
Diff: peer_to_peer_example.cpp
- Revision:
- 8:efab0e415826
- Parent:
- 7:5f2b3d1a9b0b
- Child:
- 9:df0c4e8a3097
--- a/peer_to_peer_example.cpp Fri Dec 01 21:08:13 2017 +0000
+++ b/peer_to_peer_example.cpp Tue Dec 05 23:33:16 2017 +0000
@@ -98,7 +98,7 @@
"6: Reset Accelerometer\n\r"
"7: Send Temperature data\n\r"
"8: SPI Read values from Accelerometer ADXL372\n\r"
- "9: SPI Write to a register for ADXL372\n\r");
+ "9: SPI reset for ADXL372\n\r");
}
@@ -373,26 +373,14 @@
wait(0.2);
}
break;
- case 57: // 9
+ case 57: // 9 Reset Accelerometer with SPI
int intRegister;
char input[4];
char passRegister[1];
int intData;
char passData[1];
- pc.printf("What register do you want(2 digit hex form)? \n\r"
- "Ex: Register 0x01 enter 01\n\r");
- pc.scanf("%s\n\r", input);
- intRegister = atoi(input);
- itoa(intRegister, passRegister, 16); // Convert number(input), into hexadecimal(16), and save in char buffer(passVariable)
- passRegister[0] = atoi(passRegister);
- pc.printf("0x%x register\n\r", passRegister[0]);
-
- pc.printf("What is the hex representation of your data?\n\r");
- pc.scanf("%s\n\r", input);
- intData = atoi(input); // Convert input to integer
- itoa(intRegister, passData, 16); //Convert number(input), into hexadecimal(16), and save in char buffer(passVariable)
- passData[0] = atoi(passData);
- pc.printf("0x%x is your data\n\r", passData[0]);
+ BitBangSPIWrite(0x41, 0x52);
+ pc.printf("Done \n\r");
break;
default:
printMenu();
