これは MMA7361 3軸アナログ加速度センサ の Nucleo F401RE 用のライブラリです。詳しい説明はLibrary中のReadMe.hに記載しています。文字化けや開けない場合はダウンロードしてみてください。Google Chrome では見れるはずです。
Dependents: Nucleo_L3GD20_MMA7361_Kalman
Diff: mma7361.h
- Revision:
- 5:83a3021f51f8
- Parent:
- 4:c3d863eb7f91
- Child:
- 6:ca882e5e2686
--- a/mma7361.h Wed Sep 28 11:12:01 2016 +0000 +++ b/mma7361.h Fri Sep 30 04:44:48 2016 +0000 @@ -20,6 +20,9 @@ #define PI 3.1415926535 #define THHO 0.0000000001 +/** This progrum is to be easy to control MMA7361 analog sensor\n + * site http://akizukidenshi.com/catalog/g/gM-06725/ + */ class mma7361{ private: AnalogIn dx; @@ -29,13 +32,39 @@ DigitalOut GS; Serial pcdev; int range; //0 : 1.5G 1 : 6.0G + + /** matrix + * + * the matrix which use to calcurate the gravity + */ int mat[4][3]; public: - mma7361(); - mma7361(PinName accelx,PinName accely,PinName accelz); - mma7361(PinName accelx,PinName accely,PinName accelz,PinName set); - mma7361(PinName accelx,PinName accely,PinName accelz,PinName set,PinName set_range); + + /** constracta + * + * set all pin number + * @param accelx analog pin which conect to x-axis (default = PA_0) + * @param accely analog pin which conect to y-axis (default = PA_1) + * @param accelz analog pin which conect to z-axis (default = PA_4) + * @param set digital pin which conect to ST (default = PH_0) + * @param set_range digital pin which conect to GS (default = PH_1) + */ + mma7361(PinName accelx = PA_0,PinName accely = PA_1,PinName accelz = PA_4,PinName set = PH_0,PinName set_range = PH_1); + + /** function + * + * do the calibration, you need to conect terminal (ex.TeraTerm) by USB\n + * the serial port is set in this class, but it's private\n + * please follow the sentence on the terminal\n + * this function set the matrix\n + * if you don't want to do this or know the data, you can use set_each_num() or set_num() to set matrix + */ void calibration(); + + /** function + * + * + */ void set_each_num(int ax_0_0,int ay_0_0,int az_0_0,int ax_1_0,int ay_1_0,int az_1_0,int gx_0_0,int gy_0_0,int gz_0_0,int gx_1_0,int gy_1_0,int gz_1_0,int new_range); void set_num(int (*new_mat)[3],int new_range); void set_range(int new_range);