For Hepta-Sat Lite

Revision:
3:d5eed0bb962e
Parent:
2:306058b9d04e
Child:
4:01941772f493
diff -r 306058b9d04e -r d5eed0bb962e Hepta9axis.cpp
--- a/Hepta9axis.cpp	Wed Aug 23 06:18:26 2017 +0000
+++ b/Hepta9axis.cpp	Mon Sep 04 11:45:42 2017 +0000
@@ -1,91 +1,91 @@
 #include"Hepta9axis.h"
 #include"mbed.h"
 
-Hepta9axis::Hepta9axis(PinName sda, PinName scl, int aaddr, int agaddr) : _9axis(sda,scl),addr_accel_gyro(aaddr),addr_compus(agaddr)
+Hepta9axis::Hepta9axis(PinName sda, PinName scl, int aaddr, int agaddr) : n_axis(sda,scl),addr_accel_gyro(aaddr),addr_compus(agaddr)
 {
-    _9axis.frequency(100000);
+    n_axis.frequency(100000);
     cmd[0]=0x6B;
     cmd[1]=0x00;
-    _9axis.write(addr_accel_gyro,cmd,2);
+    n_axis.write(addr_accel_gyro,cmd,2);
     cmd[0] = 0x37;
     cmd[1] = 0x02;
-    _9axis.write(addr_accel_gyro,cmd,2);
-    _9axis.stop();
+    n_axis.write(addr_accel_gyro,cmd,2);
+    n_axis.stop();
 }
 
 void Hepta9axis::setup()
 {
 
-    _9axis.frequency(100000);
+    n_axis.frequency(100000);
     cmd[0]=0x6B;
     cmd[1]=0x00;
-    _9axis.write(addr_accel_gyro,cmd,2);
+    n_axis.write(addr_accel_gyro,cmd,2);
     cmd[0] = 0x37;
     cmd[1] = 0x02;
-    _9axis.write(addr_accel_gyro,cmd,2);
-    _9axis.stop();
+    n_axis.write(addr_accel_gyro,cmd,2);
+    n_axis.stop();
 }
 
 void Hepta9axis::sen_acc(float *ax,float *ay,float *az)
 {
 //x軸加速度
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3B);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    xh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3B);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    xh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3C);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    xl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3C);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    xl = n_axis.read(0);
+    n_axis.stop();
 
     double  acc_ax = short((xh<<8) | (xl));
     *ax = (acc_ax)*2/32764*9.81;
 
 
 //Y軸加速度
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3D);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    yh = _9axis.read(0);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3D);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    yh = n_axis.read(0);
 
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3E);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    yl = _9axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3E);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    yl = n_axis.read(0);
 
-    _9axis.stop();
+    n_axis.stop();
     double  acc_ay = short((yh<<8) | (yl));
     *ay = (acc_ay)*2/32764*9.81;
 
 
 //z軸加速度
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3F);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    zh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3F);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    zh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x40);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    zl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x40);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    zl = n_axis.read(0);
+    n_axis.stop();
 
     double  acc_az = short((zh<<8) | (zl));
     *az = (acc_az)*2/32764*9.81-0.1;
@@ -95,61 +95,61 @@
 void Hepta9axis::sen_gyro(float *gx,float *gy,float *gz)
 {
 //x軸GYRO
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x43);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gxh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x43);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gxh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x44);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gxl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x44);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gxl = n_axis.read(0);
+    n_axis.stop();
 
     double  gyro_ax = short((gxh<<8) | (gxl));
     *gx = (gyro_ax)*0.00763-1.6;
 
 //y軸GYRO
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x45);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gyh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x45);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gyh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x46);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gyl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x46);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gyl = n_axis.read(0);
+    n_axis.stop();
 
     double  gyro_ay = short((gyh<<8) | (gyl));
     *gy = (gyro_ay)*0.00763;
 
 //z軸GYRO
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x47);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gzh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x47);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gzh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x48);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gzl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x48);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gzl = n_axis.read(0);
+    n_axis.stop();
 
     double  gyro_az = short((gzh<<8) | (gzl));
     *gz = (gyro_az)*0.00763;
@@ -159,168 +159,168 @@
 void Hepta9axis::sen_mag(float *mx,float *my,float *mz)
 {
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x0A);
-    _9axis.write(0x12);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x0A);
+    n_axis.write(0x12);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x03);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mxl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x04);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mxh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x03);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mxl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x04);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mxh = n_axis.read(0);
+    n_axis.stop();
     /*
-     _9axis.start();
-     _9axis.write(addr_compus);
-    _9axis.write(0x09);
-    _9axis.write(addr_compus|0x01);
-    _9axis.stop();
+     n_axis.start();
+     n_axis.write(addr_compus);
+    n_axis.write(0x09);
+    n_axis.write(addr_compus|0x01);
+    n_axis.stop();
     */
     double  mg_x = short((mxh<<8) | (mxl));
     *mx = ( mg_x)*0.15;
     //pc.printf("MGX = %f\t",mx);
 
-    _9axis.start();
+    n_axis.start();
 
-    _9axis.write(addr_compus);
-    _9axis.write(0x05);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    myl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x06);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    myh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.write(addr_compus);
+    n_axis.write(0x05);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    myl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x06);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    myh = n_axis.read(0);
+    n_axis.stop();
     /*
-         _9axis.start();
-         _9axis.write(addr_compus);
-        _9axis.write(0x09);
-        _9axis.write(addr_compus|0x01);
-        _9axis.stop();
+         n_axis.start();
+         n_axis.write(addr_compus);
+        n_axis.write(0x09);
+        n_axis.write(addr_compus|0x01);
+        n_axis.stop();
         */
     double  mg_y = short((myh<<8) | (myl));
     *my = ( mg_y)*0.15;
     // pc.printf("MAGY = %f\t",my);
 
-    _9axis.start();
+    n_axis.start();
 
-    _9axis.write(addr_compus);
-    _9axis.write(0x07);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mzl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x08);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mzh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.write(addr_compus);
+    n_axis.write(0x07);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mzl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x08);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mzh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x09);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x09);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    n_axis.stop();
     double  mg_z= short((mzh<<8) | (mzl));
     *mz = ( mg_z)*0.15;
     /*
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x0a);
-    _9axis.write(0x12);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x0a);
+    n_axis.write(0x12);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x03);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mxl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x04);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mxh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x03);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mxl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x04);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mxh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x09);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x09);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    n_axis.stop();
 
 
     double  mg_x = short((mxh<<8) | (mxl));
     *mx = ( mg_x)*0.15;
 
 
-    _9axis.start();
+    n_axis.start();
 
-    _9axis.write(addr_compus);
-    _9axis.write(0x05);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    myl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x06);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    myh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.write(addr_compus);
+    n_axis.write(0x05);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    myl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x06);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    myh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x09);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x09);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    n_axis.stop();
     double  mg_y = short((myh<<8) | (myl));
     *my = ( mg_y)*0.15;
 
-    _9axis.start();
+    n_axis.start();
 
-    _9axis.write(addr_compus);
-    _9axis.write(0x07);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mzl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x08);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mzh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.write(addr_compus);
+    n_axis.write(0x07);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mzl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x08);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mzh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x09);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x09);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    n_axis.stop();
 
     double  mg_z= short((mzh<<8) | (mzl));
     *mz = ( mg_z)*0.15;*/
@@ -331,21 +331,21 @@
 void Hepta9axis::sen_gyro_u16(char* gx_u16,char* gy_u16,char* gz_u16, int *dsize)
 {
     //x軸GYRO
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x43);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gxh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x43);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gxh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x44);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gxl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x44);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gxl = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( g1, "%02X", ((gxh)) & 0xFF);
     sprintf( g2, "%02X", ((gxl)) & 0xFF);
@@ -355,21 +355,21 @@
     gx_u16[3]=g2[1];
 
 //y軸GYRO
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x45);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gyh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x45);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gyh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x46);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gyl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x46);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gyl = n_axis.read(0);
+    n_axis.stop();
     sprintf( g1, "%02X", (gyh) & 0xFF);
     sprintf( g2, "%02X", (gyl) & 0xFF);
     gy_u16[0]=g1[0];
@@ -378,21 +378,21 @@
     gy_u16[3]=g2[1];
 
 //z軸GYRO
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x47);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gzh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x47);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gzh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x48);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    gzl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x48);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    gzl = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( g1, "%02X", ((gzh)) & 0xFF);
     sprintf( g2, "%02X", ((gzl)) & 0xFF);
@@ -406,21 +406,21 @@
 void Hepta9axis::sen_acc_u16(char* ax_u16,char* ay_u16,char* az_u16, int *dsize)
 {
     //x軸加速度
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3B);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    xh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3B);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    xh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3C);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    xl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3C);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    xl = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( a1, "%02X", ((xh)) & 0xFF);
     sprintf( a2, "%02X", ((xl)) & 0xFF);
@@ -430,21 +430,21 @@
     ax_u16[3]=a2[1];
 
 //Y軸加速度
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3D);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    yh = _9axis.read(0);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3D);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    yh = n_axis.read(0);
 
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3E);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    yl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3E);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    yl = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( a1, "%02X", ((yh)) & 0xFF);
     sprintf( a2, "%02X", ((yl)) & 0xFF);
@@ -453,21 +453,21 @@
     ay_u16[2]=a2[0];
     ay_u16[3]=a2[1];
 //z軸加速度
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x3F);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    zh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x3F);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    zh = n_axis.read(0);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_accel_gyro);
-    _9axis.write(0x40);
-    _9axis.start();
-    _9axis.write(addr_accel_gyro|0x01);
-    zl = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_accel_gyro);
+    n_axis.write(0x40);
+    n_axis.start();
+    n_axis.write(addr_accel_gyro|0x01);
+    zl = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( a1, "%02X", ((zh)) & 0xFF);
     sprintf( a2, "%02X", ((zl)) & 0xFF);
@@ -480,26 +480,26 @@
 
 void Hepta9axis::sen_mag_u16(char* mx_u16,char* my_u16,char* mz_u16, int *dsize)
 {
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x0a);
-    _9axis.write(0x12);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x0a);
+    n_axis.write(0x12);
+    n_axis.stop();
 
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x03);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mxl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x04);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mxh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x03);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mxl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x04);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mxh = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( m1, "%02X", ((mxh)) & 0xFF);
     sprintf( m2, "%02X", ((mxl)) & 0xFF);
@@ -510,21 +510,21 @@
 
     //pc.printf("MGX = %f\t",mx);
 
-    _9axis.start();
+    n_axis.start();
 
-    _9axis.write(addr_compus);
-    _9axis.write(0x05);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    myl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x06);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    myh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.write(addr_compus);
+    n_axis.write(0x05);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    myl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x06);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    myh = n_axis.read(0);
+    n_axis.stop();
 
     sprintf( m1, "%02X", ((myh)) & 0xFF);
     sprintf( m2, "%02X", ((myl)) & 0xFF);
@@ -534,28 +534,28 @@
     my_u16[3]=m2[1];
     // pc.printf("MAGY = %f\t",my);
 
-    _9axis.start();
+    n_axis.start();
 
-    _9axis.write(addr_compus);
-    _9axis.write(0x07);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mzl = _9axis.read(0);
-    _9axis.stop();
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x08);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    mzh = _9axis.read(0);
-    _9axis.stop();
+    n_axis.write(addr_compus);
+    n_axis.write(0x07);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mzl = n_axis.read(0);
+    n_axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x08);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    mzh = n_axis.read(0);
+    n_axis.stop();
     
-    _9axis.start();
-    _9axis.write(addr_compus);
-    _9axis.write(0x09);
-    _9axis.start();
-    _9axis.write(addr_compus|0x01);
-    _9axis.stop();
+    n_axis.start();
+    n_axis.write(addr_compus);
+    n_axis.write(0x09);
+    n_axis.start();
+    n_axis.write(addr_compus|0x01);
+    n_axis.stop();
 
     sprintf( m1, "%02X", ((mzh)) & 0xFF);
     sprintf( m2, "%02X", ((mzl)) & 0xFF);