9/10

Committer:
yuki0108
Date:
Wed Apr 14 12:15:08 2021 +0000
Revision:
3:d7d9b1d7d01e
Parent:
2:e0164b9fe93a
Child:
4:1ee3f6183111
4.14

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yuki0108 0:f3d3f744dbd9 1 #ifndef _INCLUDED_AMT212_H_
yuki0108 0:f3d3f744dbd9 2 #define _INCLUDED_AMT212_H_
yuki0108 0:f3d3f744dbd9 3 #include "mbed.h"
yuki0108 0:f3d3f744dbd9 4
yuki0108 0:f3d3f744dbd9 5 #define SEND 1
yuki0108 0:f3d3f744dbd9 6 #define RECEIVE 0
yuki0108 0:f3d3f744dbd9 7 #define RECEIVE_COUNT 0
yuki0108 0:f3d3f744dbd9 8 #define RECEIVE_TURN 2
yuki0108 0:f3d3f744dbd9 9 #define GET_COUNT 84
yuki0108 0:f3d3f744dbd9 10 #define GET_TURN 85
yuki0108 0:f3d3f744dbd9 11 #define RESOLUTION_AMT21 16384
yuki0108 0:f3d3f744dbd9 12 #define DETECT_FLOW 5
yuki0108 0:f3d3f744dbd9 13 #define RESET 86
yuki0108 3:d7d9b1d7d01e 14 #define COUNT_OFFSET 6890
yuki0108 2:e0164b9fe93a 15 #define GEER_STEER 1
yuki0108 0:f3d3f744dbd9 16 #ifndef M_PI
yuki0108 0:f3d3f744dbd9 17 #define M_PI 3.14159265359f
yuki0108 0:f3d3f744dbd9 18 #endif
yuki0108 0:f3d3f744dbd9 19
yuki0108 0:f3d3f744dbd9 20
yuki0108 0:f3d3f744dbd9 21
yuki0108 0:f3d3f744dbd9 22 class Amt21
yuki0108 0:f3d3f744dbd9 23 {
yuki0108 0:f3d3f744dbd9 24 private:
yuki0108 2:e0164b9fe93a 25 //////////////////////////////////////////////
yuki0108 0:f3d3f744dbd9 26 int low_count,high_count;
yuki0108 0:f3d3f744dbd9 27 int low_turn,high_turn;
yuki0108 0:f3d3f744dbd9 28 int receive_mode;
yuki0108 0:f3d3f744dbd9 29 int instruction;
yuki0108 0:f3d3f744dbd9 30 void sendMessage();
yuki0108 0:f3d3f744dbd9 31 void receiveMessage();
yuki0108 2:e0164b9fe93a 32 /////////////////////////////////////////////
yuki0108 2:e0164b9fe93a 33 int count_;
yuki0108 0:f3d3f744dbd9 34 int receive_old;
yuki0108 0:f3d3f744dbd9 35 int flow_count;
yuki0108 0:f3d3f744dbd9 36 int th_min;
yuki0108 0:f3d3f744dbd9 37 int th_max;
yuki0108 0:f3d3f744dbd9 38 int pre_count;
yuki0108 0:f3d3f744dbd9 39 double omega_;
yuki0108 0:f3d3f744dbd9 40 double pre_time;
yuki0108 0:f3d3f744dbd9 41
yuki0108 0:f3d3f744dbd9 42 protected:
yuki0108 0:f3d3f744dbd9 43 Serial serial_;//RS485通信
yuki0108 0:f3d3f744dbd9 44 DigitalOut rs485_mode;//送受信の切り替え
yuki0108 0:f3d3f744dbd9 45 public:
yuki0108 0:f3d3f744dbd9 46 Amt21(PinName tx,PinName rx,PinName mode);//コンストラクタ
yuki0108 0:f3d3f744dbd9 47
yuki0108 0:f3d3f744dbd9 48 Timer timer_;
yuki0108 0:f3d3f744dbd9 49
yuki0108 0:f3d3f744dbd9 50 int getAbCount();//カウント数取得関数
yuki0108 0:f3d3f744dbd9 51 int getTurn();//回転回数取得関数
yuki0108 2:e0164b9fe93a 52 void rewriteCount();
yuki0108 0:f3d3f744dbd9 53 int getCount();//インクリメント型のカウントと同じように使えて、-のカウントや16383以上のカウントを返す。
yuki0108 1:3838b5e3966c 54 double getDeg();
yuki0108 1:3838b5e3966c 55 double getRad();
yuki0108 0:f3d3f744dbd9 56 void calOmega();
yuki0108 0:f3d3f744dbd9 57 double getOmega();
yuki0108 0:f3d3f744dbd9 58 void reset();//回転数のリセット関数。※0~360を示すカウント数はリセットされない。
yuki0108 0:f3d3f744dbd9 59
yuki0108 0:f3d3f744dbd9 60 };
yuki0108 0:f3d3f744dbd9 61 #endif