Library for AE-KXSD9(3 axis accelerometer Module KXSD9-2050)

Dependents:   BLE_Acceleration_Statejudging

Fork of AE_KXSD9 by 尚人 永井

Revision:
2:fd07558fbebb
Parent:
1:4dc1a0ac0cf1
--- a/AE_KXSD9.h	Fri May 16 14:17:37 2014 +0000
+++ b/AE_KXSD9.h	Thu May 22 13:53:53 2014 +0000
@@ -8,13 +8,13 @@
     public:
         AE_KXSD9(PinName sda, PinName scl, int addr1, int addr2);//constructor
         //~AE_KXSD9();//destructor(unimplemented)
-        void init();//initialization(required)
+        void init();//initialization(set to default settings)
         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 AE_KXSD9 register(unimplemented)
-        //void write_reg(char addr, char data); //write register(unimplemented)
+        char read_reg(char addr);//read register
+        void write_reg(char addr, char data); //write register
         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
@@ -28,7 +28,8 @@
             CTRL_REGC=0x0C,    
             CTRL_REGB=0x0D,    
             CTRL_REGA=0x0E,  
-            SENSITIVITY=819
+            SENSITIVITY=273, //tune it yourself(default:273(+-6g))
+            OFFSET=2048//tune it yourself(default:2048)
         };
     private:
       I2C i2c_k;