Alexandre Lemay
/
APP1_s5_A17
PARTYYYY
Diff: Accelerometre.cpp
- Revision:
- 11:09317efe9bb5
- Parent:
- 10:2836530d9a5e
--- a/Accelerometre.cpp Wed Sep 06 01:29:41 2017 +0000 +++ b/Accelerometre.cpp Wed Sep 06 03:46:20 2017 +0000 @@ -1,6 +1,11 @@ #include "Accelerometre.h" - +namespace +{ + const double PI = 3.14159265359; + const int WRITE_DATA = 0x38; + const int READ_DATA = 0x39; +} Accelerometre::Accelerometre():i2c(p28,p27),pc(USBTX, USBRX),acc(p28, p27, 40000){ acc.setBitDepth(MMA8452::BIT_DEPTH_12); @@ -32,22 +37,6 @@ return (angle*180/ PI); } - -//int Accelerometre::readSingleByte(int regis){ -// int c; -// pc.printf("Reading single byte\n"); -// i2c.start(); -// int a=i2c.write(WRITE_DATA); // A write to device -// i2c.write(regis); // Register to read from (acceleration in X) -// i2c.start(); // Need to send start condition here -// i2c.write(READ_DATA); // tell devide you want to read -// c=i2c.read(0); -// i2c.stop(); -// pc.printf("value is %d\n", c); -// pc.printf("end\n"); -// return c; -// } - void Accelerometre::writeByte(int regis,int data){ pc.printf("Reading single byte\n");