change code by hasegawa
jy901.h@3:ba9da7dbbd9a, 2020-09-29 (annotated)
- Committer:
- LVRhase01
- Date:
- Tue Sep 29 13:25:52 2020 +0000
- Revision:
- 3:ba9da7dbbd9a
- Parent:
- 2:a93909601341
Add 0-point setting for Yaw axis and 6-axis mode code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
number_key | 0:f80d034ed481 | 1 | #ifndef MBED_JY901_H |
number_key | 0:f80d034ed481 | 2 | #define MBED_JY901_H |
number_key | 0:f80d034ed481 | 3 | |
number_key | 0:f80d034ed481 | 4 | #include "mbed.h" |
number_key | 0:f80d034ed481 | 5 | #include "jy901_def.h" |
number_key | 0:f80d034ed481 | 6 | |
number_key | 2:a93909601341 | 7 | /** jy901 class. |
number_key | 2:a93909601341 | 8 | * Can measure acceleration, angular Velocity, magnetic and Angle. |
number_key | 2:a93909601341 | 9 | * |
number_key | 2:a93909601341 | 10 | */ |
number_key | 2:a93909601341 | 11 | |
number_key | 0:f80d034ed481 | 12 | |
number_key | 0:f80d034ed481 | 13 | class JY901 : public I2C |
number_key | 0:f80d034ed481 | 14 | { |
number_key | 1:60d4e2eb6952 | 15 | public: |
number_key | 1:60d4e2eb6952 | 16 | |
number_key | 1:60d4e2eb6952 | 17 | /** |
number_key | 1:60d4e2eb6952 | 18 | * @param sda |
number_key | 1:60d4e2eb6952 | 19 | * @param scl |
number_key | 1:60d4e2eb6952 | 20 | */ |
number_key | 0:f80d034ed481 | 21 | JY901(PinName sda, PinName scl); |
number_key | 0:f80d034ed481 | 22 | |
number_key | 1:60d4e2eb6952 | 23 | /** calibrate Gyroscope and Accelerometer |
number_key | 1:60d4e2eb6952 | 24 | */ |
number_key | 0:f80d034ed481 | 25 | void calibrateGyroAccel(); |
number_key | 1:60d4e2eb6952 | 26 | |
number_key | 1:60d4e2eb6952 | 27 | /** calibrate Magnetic |
number_key | 1:60d4e2eb6952 | 28 | */ |
number_key | 0:f80d034ed481 | 29 | void calibrateMagnetic(); |
number_key | 1:60d4e2eb6952 | 30 | |
number_key | 1:60d4e2eb6952 | 31 | /** set height to 0 |
number_key | 1:60d4e2eb6952 | 32 | */ |
number_key | 0:f80d034ed481 | 33 | void calibrateHeight(); |
number_key | 1:60d4e2eb6952 | 34 | |
number_key | 1:60d4e2eb6952 | 35 | /** end calibration mode |
number_key | 1:60d4e2eb6952 | 36 | */ |
number_key | 0:f80d034ed481 | 37 | void endCalibrate(); |
number_key | 1:60d4e2eb6952 | 38 | |
number_key | 1:60d4e2eb6952 | 39 | /** calibrate Gyroscope, Accelerometer and Magnetic |
number_key | 1:60d4e2eb6952 | 40 | * set height to 0 |
number_key | 1:60d4e2eb6952 | 41 | */ |
LVRhase01 | 3:ba9da7dbbd9a | 42 | void yawcalibrate(); |
LVRhase01 | 3:ba9da7dbbd9a | 43 | // reset yawaxis |
LVRhase01 | 3:ba9da7dbbd9a | 44 | |
LVRhase01 | 3:ba9da7dbbd9a | 45 | void algorithmtrasition(); |
LVRhase01 | 3:ba9da7dbbd9a | 46 | //change 6 axis |
LVRhase01 | 3:ba9da7dbbd9a | 47 | |
number_key | 0:f80d034ed481 | 48 | void calibrateAll(int time); |
number_key | 1:60d4e2eb6952 | 49 | |
number_key | 1:60d4e2eb6952 | 50 | /** return XaxisAcceleration |
number_key | 1:60d4e2eb6952 | 51 | */ |
number_key | 0:f80d034ed481 | 52 | float getXaxisAcceleration(); |
number_key | 2:a93909601341 | 53 | |
number_key | 1:60d4e2eb6952 | 54 | /** return YaxisAcceleration |
number_key | 1:60d4e2eb6952 | 55 | */ |
number_key | 0:f80d034ed481 | 56 | float getYaxisAcceleration(); |
number_key | 2:a93909601341 | 57 | |
number_key | 1:60d4e2eb6952 | 58 | /** return ZaxisAcceleration |
number_key | 1:60d4e2eb6952 | 59 | */ |
number_key | 0:f80d034ed481 | 60 | float getZaxisAcceleration(); |
number_key | 2:a93909601341 | 61 | |
number_key | 1:60d4e2eb6952 | 62 | /** return XaxisAngularVelocity |
number_key | 1:60d4e2eb6952 | 63 | */ |
number_key | 0:f80d034ed481 | 64 | float getXaxisAngularVelocity(); |
number_key | 2:a93909601341 | 65 | |
number_key | 1:60d4e2eb6952 | 66 | /** return YaxisAngularVelocity |
number_key | 1:60d4e2eb6952 | 67 | */ |
number_key | 0:f80d034ed481 | 68 | float getYaxisAngularVelocity(); |
number_key | 2:a93909601341 | 69 | |
number_key | 1:60d4e2eb6952 | 70 | /** return ZaxisAngularVelocity |
number_key | 1:60d4e2eb6952 | 71 | */ |
number_key | 0:f80d034ed481 | 72 | float getZaxisAngularVelocity(); |
number_key | 2:a93909601341 | 73 | |
number_key | 1:60d4e2eb6952 | 74 | /** return XaxisMagnetic |
number_key | 1:60d4e2eb6952 | 75 | */ |
number_key | 0:f80d034ed481 | 76 | float getXaxisMagnetic(); |
number_key | 2:a93909601341 | 77 | |
number_key | 1:60d4e2eb6952 | 78 | /** return YaxisMagnetic |
number_key | 1:60d4e2eb6952 | 79 | */ |
number_key | 0:f80d034ed481 | 80 | float getYaxisMagnetic(); |
number_key | 2:a93909601341 | 81 | |
number_key | 1:60d4e2eb6952 | 82 | /** return ZaxisMagnetic |
number_key | 1:60d4e2eb6952 | 83 | */ |
number_key | 0:f80d034ed481 | 84 | float getZaxisMagnetic(); |
number_key | 2:a93909601341 | 85 | |
number_key | 1:60d4e2eb6952 | 86 | /** return XaxisAngle |
number_key | 1:60d4e2eb6952 | 87 | */ |
number_key | 0:f80d034ed481 | 88 | float getXaxisAngle(); |
number_key | 2:a93909601341 | 89 | |
number_key | 1:60d4e2eb6952 | 90 | /** return YaxisAngle |
number_key | 1:60d4e2eb6952 | 91 | */ |
number_key | 0:f80d034ed481 | 92 | float getYaxisAngle(); |
number_key | 2:a93909601341 | 93 | |
number_key | 1:60d4e2eb6952 | 94 | /** return ZaxisAngle |
number_key | 1:60d4e2eb6952 | 95 | */ |
number_key | 0:f80d034ed481 | 96 | float getZaxisAngle(); |
number_key | 1:60d4e2eb6952 | 97 | |
number_key | 2:a93909601341 | 98 | private: |
number_key | 0:f80d034ed481 | 99 | char *getdata(char registar); |
number_key | 2:a93909601341 | 100 | }; |
number_key | 0:f80d034ed481 | 101 | |
number_key | 2:a93909601341 | 102 | #endif |