3輪オムニホイール制御 GNCT, B team
Dependencies: nucleo_rotary_encoder
L3GD20_i2c/L3GD20_i2c.hpp@0:3bd8aecadafc, 2017-09-28 (annotated)
- Committer:
- sawai
- Date:
- Thu Sep 28 10:50:37 2017 +0000
- Revision:
- 0:3bd8aecadafc
?????????xy?????; ???????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sawai | 0:3bd8aecadafc | 1 | #ifndef __L3GD20_I2C__ |
sawai | 0:3bd8aecadafc | 2 | #define __L3GD20_I2C__ |
sawai | 0:3bd8aecadafc | 3 | |
sawai | 0:3bd8aecadafc | 4 | #include "mbed.h" |
sawai | 0:3bd8aecadafc | 5 | |
sawai | 0:3bd8aecadafc | 6 | class l3gd20 |
sawai | 0:3bd8aecadafc | 7 | { |
sawai | 0:3bd8aecadafc | 8 | I2C *i; |
sawai | 0:3bd8aecadafc | 9 | Timer t; |
sawai | 0:3bd8aecadafc | 10 | long pre_time_ms; |
sawai | 0:3bd8aecadafc | 11 | char addr; |
sawai | 0:3bd8aecadafc | 12 | const char ADDR_WHO_AM_I; |
sawai | 0:3bd8aecadafc | 13 | const char ADDR_CTRL_REG1; |
sawai | 0:3bd8aecadafc | 14 | const char ADDR_CTRL_REG2; |
sawai | 0:3bd8aecadafc | 15 | const char ADDR_CTRL_REG3; |
sawai | 0:3bd8aecadafc | 16 | const char ADDR_CTRL_REG4; |
sawai | 0:3bd8aecadafc | 17 | const char ADDR_CTRL_REG5; |
sawai | 0:3bd8aecadafc | 18 | const char ADDR_OUT_TEMP; |
sawai | 0:3bd8aecadafc | 19 | const char ADDR_STATUS_REG; |
sawai | 0:3bd8aecadafc | 20 | const char ADDR_OUT_X_L; |
sawai | 0:3bd8aecadafc | 21 | const char ADDR_OUT_X_H; |
sawai | 0:3bd8aecadafc | 22 | const char ADDR_OUT_Y_L; |
sawai | 0:3bd8aecadafc | 23 | const char ADDR_OUT_Y_H; |
sawai | 0:3bd8aecadafc | 24 | const char ADDR_OUT_Z_L; |
sawai | 0:3bd8aecadafc | 25 | const char ADDR_OUT_Z_H; |
sawai | 0:3bd8aecadafc | 26 | double decom; |
sawai | 0:3bd8aecadafc | 27 | double angleDeg[3]; |
sawai | 0:3bd8aecadafc | 28 | double omegaOffset[3]; |
sawai | 0:3bd8aecadafc | 29 | bool stpFlg; |
sawai | 0:3bd8aecadafc | 30 | public: |
sawai | 0:3bd8aecadafc | 31 | l3gd20(I2C *_i, bool SA0); |
sawai | 0:3bd8aecadafc | 32 | char read_reg(char reg); |
sawai | 0:3bd8aecadafc | 33 | void write_reg(char reg, char data); |
sawai | 0:3bd8aecadafc | 34 | bool who_am_i(); |
sawai | 0:3bd8aecadafc | 35 | void set_range(int dps); |
sawai | 0:3bd8aecadafc | 36 | int16_t get_raw_omega(char se); |
sawai | 0:3bd8aecadafc | 37 | void apply_offset(); |
sawai | 0:3bd8aecadafc | 38 | void start(); |
sawai | 0:3bd8aecadafc | 39 | void reset(); |
sawai | 0:3bd8aecadafc | 40 | void stop(); |
sawai | 0:3bd8aecadafc | 41 | double trapezoid_integr(double data, double ex_data, double period); |
sawai | 0:3bd8aecadafc | 42 | void renew_angle(); |
sawai | 0:3bd8aecadafc | 43 | void get_angle_deg(double *a); |
sawai | 0:3bd8aecadafc | 44 | void get_angle_rad(double *a); |
sawai | 0:3bd8aecadafc | 45 | }; |
sawai | 0:3bd8aecadafc | 46 | |
sawai | 0:3bd8aecadafc | 47 | #endif |