M-G354PDH0 library.
Dependents: M-G354PDH0_serial_Lib INS_GNSS_logger_1 UBX_GPS_muliti_SPI_4_logger_ver
MG354PDH0.h@0:9e92f863fde5, 2021-04-28 (annotated)
- Committer:
- Joeatsumi
- Date:
- Wed Apr 28 07:39:09 2021 +0000
- Revision:
- 0:9e92f863fde5
M-G354PDH0 program that utilizes library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Joeatsumi | 0:9e92f863fde5 | 1 | |
Joeatsumi | 0:9e92f863fde5 | 2 | class MG354PDH0 { |
Joeatsumi | 0:9e92f863fde5 | 3 | |
Joeatsumi | 0:9e92f863fde5 | 4 | public: |
Joeatsumi | 0:9e92f863fde5 | 5 | MG354PDH0(Serial* ps); |
Joeatsumi | 0:9e92f863fde5 | 6 | |
Joeatsumi | 0:9e92f863fde5 | 7 | void call_window1(); |
Joeatsumi | 0:9e92f863fde5 | 8 | void call_window0(); |
Joeatsumi | 0:9e92f863fde5 | 9 | void GLOB_CMD_read(); |
Joeatsumi | 0:9e92f863fde5 | 10 | void DIAG_STAT_read(); |
Joeatsumi | 0:9e92f863fde5 | 11 | void UART_CTRL_write(); |
Joeatsumi | 0:9e92f863fde5 | 12 | /*サンプリングモードへの移行*/ |
Joeatsumi | 0:9e92f863fde5 | 13 | void move_to_sampling_mode(); |
Joeatsumi | 0:9e92f863fde5 | 14 | /*IMUが動作可能かどうかの確認*/ |
Joeatsumi | 0:9e92f863fde5 | 15 | void power_on_sequence1(); |
Joeatsumi | 0:9e92f863fde5 | 16 | /*IMUが動作可能かどうかの確認*/ |
Joeatsumi | 0:9e92f863fde5 | 17 | void power_on_sequence2(); |
Joeatsumi | 0:9e92f863fde5 | 18 | |
Joeatsumi | 0:9e92f863fde5 | 19 | /*X軸周りの角速度を算出*/ |
Joeatsumi | 0:9e92f863fde5 | 20 | float read_angular_rate_x(); |
Joeatsumi | 0:9e92f863fde5 | 21 | /*Y軸周りの角速度を算出*/ |
Joeatsumi | 0:9e92f863fde5 | 22 | float read_angular_rate_y(); |
Joeatsumi | 0:9e92f863fde5 | 23 | /*Z軸周りの角速度を算出*/ |
Joeatsumi | 0:9e92f863fde5 | 24 | float read_angular_rate_z(); |
Joeatsumi | 0:9e92f863fde5 | 25 | |
Joeatsumi | 0:9e92f863fde5 | 26 | /*X軸の加速度を算出*/ |
Joeatsumi | 0:9e92f863fde5 | 27 | float read_acceleration_x(); |
Joeatsumi | 0:9e92f863fde5 | 28 | /*Y軸の加速度を算出*/ |
Joeatsumi | 0:9e92f863fde5 | 29 | float read_acceleration_y(); |
Joeatsumi | 0:9e92f863fde5 | 30 | /*Z軸の加速度を算出*/ |
Joeatsumi | 0:9e92f863fde5 | 31 | float read_acceleration_z(); |
Joeatsumi | 0:9e92f863fde5 | 32 | |
Joeatsumi | 0:9e92f863fde5 | 33 | float gyro_val[3];//角速度の値 |
Joeatsumi | 0:9e92f863fde5 | 34 | float acc_val[3];//加速度の値 |
Joeatsumi | 0:9e92f863fde5 | 35 | |
Joeatsumi | 0:9e92f863fde5 | 36 | |
Joeatsumi | 0:9e92f863fde5 | 37 | private: |
Joeatsumi | 0:9e92f863fde5 | 38 | Serial* p_port; |
Joeatsumi | 0:9e92f863fde5 | 39 | |
Joeatsumi | 0:9e92f863fde5 | 40 | #define SCALE_FACTOR_GYRO 0.016 |
Joeatsumi | 0:9e92f863fde5 | 41 | #define SCALE_FACTOR_ACC 0.20 |
Joeatsumi | 0:9e92f863fde5 | 42 | #define GRAVITIONAL_ACCELERATION 9.80665 |
Joeatsumi | 0:9e92f863fde5 | 43 | |
Joeatsumi | 0:9e92f863fde5 | 44 | char val_GLOB_CMD_read[2]; |
Joeatsumi | 0:9e92f863fde5 | 45 | short i_GLOB_CMD_read; |
Joeatsumi | 0:9e92f863fde5 | 46 | |
Joeatsumi | 0:9e92f863fde5 | 47 | char val_DIAG_STAT_read[2]; |
Joeatsumi | 0:9e92f863fde5 | 48 | short i_DIAG_STAT_read; |
Joeatsumi | 0:9e92f863fde5 | 49 | |
Joeatsumi | 0:9e92f863fde5 | 50 | char val_rate_x[4]; |
Joeatsumi | 0:9e92f863fde5 | 51 | char val_rate_y[4]; |
Joeatsumi | 0:9e92f863fde5 | 52 | char val_rate_z[4]; |
Joeatsumi | 0:9e92f863fde5 | 53 | |
Joeatsumi | 0:9e92f863fde5 | 54 | char val_acc_x[4]; |
Joeatsumi | 0:9e92f863fde5 | 55 | char val_acc_y[4]; |
Joeatsumi | 0:9e92f863fde5 | 56 | char val_acc_z[4]; |
Joeatsumi | 0:9e92f863fde5 | 57 | |
Joeatsumi | 0:9e92f863fde5 | 58 | float gyro_x,gyro_y,gyro_z; |
Joeatsumi | 0:9e92f863fde5 | 59 | float acceleration_x,acceleration_y,acceleration_z; |
Joeatsumi | 0:9e92f863fde5 | 60 | |
Joeatsumi | 0:9e92f863fde5 | 61 | }; |