unfinished

Dependents:   WRS_mechanamu_test WRS2019_master mbed_2018 mbed_2019_rx3 ... more

Committer:
sgrsn
Date:
Sun Sep 18 05:42:49 2016 +0000
Revision:
0:6ff4cad60b67
Child:
1:6bcbd18a719a
unfinished

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgrsn 0:6ff4cad60b67 1 #ifndef MBED_JY901_H
sgrsn 0:6ff4cad60b67 2 #define MBED_JY901_H
sgrsn 0:6ff4cad60b67 3
sgrsn 0:6ff4cad60b67 4 #include "mbed.h"
sgrsn 0:6ff4cad60b67 5
sgrsn 0:6ff4cad60b67 6 #define IICADDR 0xa0 // IIC address
sgrsn 0:6ff4cad60b67 7 #define g 9.8 // Acceleration of gravity
sgrsn 0:6ff4cad60b67 8
sgrsn 0:6ff4cad60b67 9 #define SAVE 0x00 // Save
sgrsn 0:6ff4cad60b67 10 #define CALSW 0x01 // Calibration
sgrsn 0:6ff4cad60b67 11 #define RSW 0x02 // Return data content
sgrsn 0:6ff4cad60b67 12 #define RATE 0x03 // Return data Speed
sgrsn 0:6ff4cad60b67 13 #define BAUD 0x04 // Baud rate
sgrsn 0:6ff4cad60b67 14 #define AXOFFSET 0x05 // X axis Acceleration bias
sgrsn 0:6ff4cad60b67 15 #define AYOFFSET 0x06 // Y axis Acceleration bias
sgrsn 0:6ff4cad60b67 16 #define AZOFFSET 0x07 // Z axis Acceleration bias
sgrsn 0:6ff4cad60b67 17 #define GXOFFSET 0x08 // X axis angular velocity bias
sgrsn 0:6ff4cad60b67 18 #define GYOFFSET 0x09 // Y axis angular velocity bias
sgrsn 0:6ff4cad60b67 19 #define GZOFFSET 0x0a // Z axis angular velocity bias
sgrsn 0:6ff4cad60b67 20 #define HXOFFSET 0x0b // X axis Magnetic bias
sgrsn 0:6ff4cad60b67 21 #define HYOFFSET 0x0c // Y axis Magnetic bias
sgrsn 0:6ff4cad60b67 22 #define HZOFFSET 0x0d // Z axis Magnetic bias
sgrsn 0:6ff4cad60b67 23 #define D0MODE 0x0e // D0 mode
sgrsn 0:6ff4cad60b67 24 #define D1MODE 0x0f // D1 mode
sgrsn 0:6ff4cad60b67 25 #define D2MODE 0x10 // D2 mode
sgrsn 0:6ff4cad60b67 26 #define D3MODE 0x11 // D3 mode
sgrsn 0:6ff4cad60b67 27 #define D0PWMH 0x12 // D0PWM High-level width
sgrsn 0:6ff4cad60b67 28 #define D1PWMH 0x13 // D1PWM High-level width
sgrsn 0:6ff4cad60b67 29 #define D2PWMH 0x14 // D2PWM High-level width
sgrsn 0:6ff4cad60b67 30 #define D3PWMH 0x15 // D3PWM High-level width
sgrsn 0:6ff4cad60b67 31 #define D0PWMT 0x16 // D0PWM Period
sgrsn 0:6ff4cad60b67 32 #define D1PWMT 0x17 // D1PWM Period
sgrsn 0:6ff4cad60b67 33 #define D2PWMT 0x18 // D2PWM Period
sgrsn 0:6ff4cad60b67 34 #define D3PWMT 0x19 // D3PWM Period
sgrsn 0:6ff4cad60b67 35 #define LEDOFF 0x1b // Turn off LED
sgrsn 0:6ff4cad60b67 36 #define GPSBAUD 0x1c // GPS baud rate
sgrsn 0:6ff4cad60b67 37
sgrsn 0:6ff4cad60b67 38 #define YYMM 0x30 // Year、Month
sgrsn 0:6ff4cad60b67 39 #define DDHH 0x31 // Day、Hour
sgrsn 0:6ff4cad60b67 40 #define MMSS 0x32 // Minute、Second
sgrsn 0:6ff4cad60b67 41 #define MS 0x33 // Millisecond
sgrsn 0:6ff4cad60b67 42 #define AX 0x34 // X axis Acceleration
sgrsn 0:6ff4cad60b67 43 #define AY 0x35 // Y axis Acceleration
sgrsn 0:6ff4cad60b67 44 #define AZ 0x36 // Z axis Acceleration
sgrsn 0:6ff4cad60b67 45 #define GX 0x37 // X axis angular velocity
sgrsn 0:6ff4cad60b67 46 #define GY 0x38 // Y axis angular velocity
sgrsn 0:6ff4cad60b67 47 #define GZ 0x39 // Z axis angular velocity
sgrsn 0:6ff4cad60b67 48 #define HX 0x3a // X axis Magnetic
sgrsn 0:6ff4cad60b67 49 #define HY 0x3b // Y axis Magnetic
sgrsn 0:6ff4cad60b67 50 #define HZ 0x3c // Z axis Magnetic
sgrsn 0:6ff4cad60b67 51 #define Roll 0x3d // X axis Angle
sgrsn 0:6ff4cad60b67 52 #define Pitch 0x3e // Y axis Angle
sgrsn 0:6ff4cad60b67 53 #define Yaw 0x3f // Z axis Angle
sgrsn 0:6ff4cad60b67 54 #define TEMP 0x40 // Temperature
sgrsn 0:6ff4cad60b67 55 #define D0Status 0x41 // D0Status
sgrsn 0:6ff4cad60b67 56 #define D1Status 0x42 // D1Status
sgrsn 0:6ff4cad60b67 57 #define D2Status 0x43 // D2Status
sgrsn 0:6ff4cad60b67 58 #define D3Status 0x44 // D3Status
sgrsn 0:6ff4cad60b67 59 #define PressureL 0x45 // Pressure Low Byte
sgrsn 0:6ff4cad60b67 60 #define PressureH 0x46 // Pressure High Byte
sgrsn 0:6ff4cad60b67 61 #define HeightL 0x47 // Height Low Byte
sgrsn 0:6ff4cad60b67 62 #define HeightH 0x48 // Height High Byte
sgrsn 0:6ff4cad60b67 63 #define LonL 0x49 // Longitude Low Byte
sgrsn 0:6ff4cad60b67 64 #define LonH 0x4a // Longitude High Byte
sgrsn 0:6ff4cad60b67 65 #define LatL 0x4b // Latitude Low Byte
sgrsn 0:6ff4cad60b67 66 #define LatH 0x4c // Latitude High Byte
sgrsn 0:6ff4cad60b67 67 #define GPSHeight 0x4d // GPS Height
sgrsn 0:6ff4cad60b67 68 #define GPSYaw 0x4e // GPS Yaw
sgrsn 0:6ff4cad60b67 69 #define GPSVL 0x4f // GPS speed Low byte
sgrsn 0:6ff4cad60b67 70 #define GPSVH 0x50 // GPS speed High byte
sgrsn 0:6ff4cad60b67 71 #define Q0 0x51 // Quaternion Q0
sgrsn 0:6ff4cad60b67 72 #define Q1 0x52 // Quaternion Q1
sgrsn 0:6ff4cad60b67 73 #define Q2 0x53 // Quaternion Q2
sgrsn 0:6ff4cad60b67 74 #define Q3 0x54 // Quaternion Q3
sgrsn 0:6ff4cad60b67 75
sgrsn 0:6ff4cad60b67 76 class JY901 : public I2C
sgrsn 0:6ff4cad60b67 77 {
sgrsn 0:6ff4cad60b67 78 public:
sgrsn 0:6ff4cad60b67 79 JY901(PinName sda, PinName scl);
sgrsn 0:6ff4cad60b67 80
sgrsn 0:6ff4cad60b67 81 void Calibrate_Gyro_Accel();
sgrsn 0:6ff4cad60b67 82 void CalibrateMagnetic();
sgrsn 0:6ff4cad60b67 83 void CalibrateHeight();
sgrsn 0:6ff4cad60b67 84 void EndCalibrate();
sgrsn 0:6ff4cad60b67 85 void CalibrateAll(int time);
sgrsn 0:6ff4cad60b67 86 int getYear();
sgrsn 0:6ff4cad60b67 87 int getMonth();
sgrsn 0:6ff4cad60b67 88 int getDay();
sgrsn 0:6ff4cad60b67 89 int getHour();
sgrsn 0:6ff4cad60b67 90 int getMinute();
sgrsn 0:6ff4cad60b67 91 int getSecond();
sgrsn 0:6ff4cad60b67 92 int getMillisecond();
sgrsn 0:6ff4cad60b67 93 float getXaxisAcceleration();
sgrsn 0:6ff4cad60b67 94 float getYaxisAcceleration();
sgrsn 0:6ff4cad60b67 95 float getZaxisAcceleration();
sgrsn 0:6ff4cad60b67 96 float getXaxisAngularVelocity();
sgrsn 0:6ff4cad60b67 97 float getYaxisAngularVelocity();
sgrsn 0:6ff4cad60b67 98 float getZaxisAngularVelocity();
sgrsn 0:6ff4cad60b67 99 float getXaxisMagnetic();
sgrsn 0:6ff4cad60b67 100 float getYaxisMagnetic();
sgrsn 0:6ff4cad60b67 101 float getZaxisMagnetic();
sgrsn 0:6ff4cad60b67 102 float getXaxisAngle();
sgrsn 0:6ff4cad60b67 103 float getYaxisAngle();
sgrsn 0:6ff4cad60b67 104 float getZaxisAngle();
sgrsn 0:6ff4cad60b67 105 float getTemperature();
sgrsn 0:6ff4cad60b67 106 float getD0Status();
sgrsn 0:6ff4cad60b67 107 float getD1Status();
sgrsn 0:6ff4cad60b67 108 float getD2Status();
sgrsn 0:6ff4cad60b67 109 float getD3Status();
sgrsn 0:6ff4cad60b67 110 int getmode(float (JY901::*getFunc)(), const int kaisu);
sgrsn 0:6ff4cad60b67 111
sgrsn 0:6ff4cad60b67 112 /*dnt use I correct someday*********/
sgrsn 0:6ff4cad60b67 113 float getPressure();
sgrsn 0:6ff4cad60b67 114 float getHeight();
sgrsn 0:6ff4cad60b67 115 float getLongitude();
sgrsn 0:6ff4cad60b67 116 float getLatitude();
sgrsn 0:6ff4cad60b67 117 float getGPSHeight();
sgrsn 0:6ff4cad60b67 118 float getGPSYaw();
sgrsn 0:6ff4cad60b67 119 float getGPSspeed();
sgrsn 0:6ff4cad60b67 120 /*************************************/
sgrsn 0:6ff4cad60b67 121
sgrsn 0:6ff4cad60b67 122 private:
sgrsn 0:6ff4cad60b67 123 char *getdata(char registar);
sgrsn 0:6ff4cad60b67 124 };
sgrsn 0:6ff4cad60b67 125
sgrsn 0:6ff4cad60b67 126 #endif