latest version 9/26

Dependencies:   mbed

Committer:
Yamanobe
Date:
Sun Oct 10 04:47:14 2021 +0000
Revision:
0:0d02a451e79d
slave program (at 9/26)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Yamanobe 0:0d02a451e79d 1 #ifndef ENCODER_H
Yamanobe 0:0d02a451e79d 2 #define ENCODER_H
Yamanobe 0:0d02a451e79d 3
Yamanobe 0:0d02a451e79d 4 #include "mbed.h"
Yamanobe 0:0d02a451e79d 5
Yamanobe 0:0d02a451e79d 6 /****定数****/
Yamanobe 0:0d02a451e79d 7 #define PI 3.1415f
Yamanobe 0:0d02a451e79d 8 #define RADIAN 360
Yamanobe 0:0d02a451e79d 9 #define MINUTE 60
Yamanobe 0:0d02a451e79d 10 #define CALCULATE_PERIOD 0.01f
Yamanobe 0:0d02a451e79d 11
Yamanobe 0:0d02a451e79d 12 enum DATA_CATEGORY{
Yamanobe 0:0d02a451e79d 13 COUNT,
Yamanobe 0:0d02a451e79d 14 };
Yamanobe 0:0d02a451e79d 15
Yamanobe 0:0d02a451e79d 16
Yamanobe 0:0d02a451e79d 17 class Encoder {
Yamanobe 0:0d02a451e79d 18 public:
Yamanobe 0:0d02a451e79d 19 Encoder(PinName Apulse,PinName Bpulse);
Yamanobe 0:0d02a451e79d 20 float getData(short ch);
Yamanobe 0:0d02a451e79d 21 bool reset(int preset = 0);
Yamanobe 0:0d02a451e79d 22
Yamanobe 0:0d02a451e79d 23 private:
Yamanobe 0:0d02a451e79d 24 InterruptIn Apulse;
Yamanobe 0:0d02a451e79d 25 InterruptIn Bpulse;
Yamanobe 0:0d02a451e79d 26
Yamanobe 0:0d02a451e79d 27 void Apulse_Down();
Yamanobe 0:0d02a451e79d 28
Yamanobe 0:0d02a451e79d 29 int preset;
Yamanobe 0:0d02a451e79d 30 float count;
Yamanobe 0:0d02a451e79d 31 };
Yamanobe 0:0d02a451e79d 32
Yamanobe 0:0d02a451e79d 33 #endif