![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Mini Project 10: Displaying stuff from day 7
Dependencies: DmTouch_UniGraphic UniGraphic mbed
acceler_sensor.cpp
- Committer:
- ezimmerman17
- Date:
- 2017-01-17
- Revision:
- 7:ee7f2c33d45d
- Parent:
- 6:b196b0a8f337
- Child:
- 8:bbe3e332fe94
File content as of revision 7:ee7f2c33d45d:
#include "acceler_sensor.h" DigitalOut led3(LED3); void configure_acceleration(void){ const int address = 0x53 << 1; // set 'address' to i2c_port.start(); i2c_port.write(address); i2c_port.write(0x1D); //to set the Tap Threshold i2c_port.write(0x50 << 2); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); i2c_port.write(0x21);//set Tap Duration i2c_port.write(0x0A); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); int temp[2] = {0x22, 0x05}; i2c_port.write(temp[0]);//set Tap Gap i2c_port.write(temp[1]); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); i2c_port.write(0x23);//set Tap Window i2c_port.write(0xFF); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); i2c_port.write(0x2A);//set Tap Axis i2c_port.write(0x07); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); i2c_port.write(0x2E);//set interupt Enable i2c_port.write(0x20|0x40); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); i2c_port.write(0x2F);//set interupt map i2c_port.write(0x20|0x40); i2c_port.stop(); wait(0.01); i2c_port.start(); i2c_port.write(address); i2c_port.write(0x2D);//power control register i2c_port.write(0x08);//measure mode i2c_port.stop(); wait(0.01); }