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.
Dependents: BLE_Acceleration_Statejudging
Fork of AE_KXSD9 by
Diff: KXSD9_2050.h
- Revision:
- 0:809f34a09f98
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KXSD9_2050.h Fri May 16 14:10:09 2014 +0000 @@ -0,0 +1,38 @@ +#ifndef KXSD9_2050_H +#define KXSD9_2050_H + +#include "mbed.h" + +class KXSD9_2050 +{ + public: + KXSD9_2050(PinName sda, PinName scl, int addr1, int addr2);//constructor + //~KXSD9_2050();//destructor(unimplemented) + void init();//initialization(required) + void read_xyz(double *x, double *y, double *z);//read each axial acceleration(unit:g) + double read_x();//read the acceleration in x-axis(unit:g) + double read_y();//read the acceleration in y-axis(unit:g) + double read_z();//read the acceleration in z-axis(unit:g) + //char read_reg(char addr);//read from KXSD9_2050 register(unimplemented) + //void write_reg(char addr, char data); //write register(unimplemented) + enum{ + XOUT_H=0x00, //the highest 8 bits of the acceleration in x-axis + XOUT_L=0x01, //the lowest 4 bits of the acceleration in x-axis + YOUT_H=0x02, //the highest 8 bits of the acceleration in y-axis + YOUT_L=0x03, //the lowest 4 bits of the acceleration in y-axis + ZOUT_H=0x04, //the highest 8 bits of the acceleration in z-axis + ZOUT_L=0x05, //the lowest 4 bits of the acceleration in z-axis + AUXOUT_H=0x06, + AUXOUT_L=0x07, + RESET_WRITE=0x0A, + CTRL_REGC=0x0C, + CTRL_REGB=0x0D, + CTRL_REGA=0x0E, + SENSITIVITY=819 + }; + private: + I2C i2c_k; + int addr_w, addr_r; +}; + +#endif \ No newline at end of file