Main Program

Dependencies:   mbed AQM1602 HMC6352 PID

Revision:
2:97a4070c34d7
Parent:
1:f2633c150301
Child:
3:f7c906e52339
--- a/def.h	Tue Sep 15 01:40:28 2015 +0000
+++ b/def.h	Tue Sep 15 06:04:31 2015 +0000
@@ -1,6 +1,24 @@
 #ifndef _DEF_H_
 #define _DEF_H_
 
+/*PID処理*/
+#define RATE    0.052//52
+#define PID_BIAS    0.2
+#define REFERENCE   180.0
+#define MINIMUM     0.0
+#define MAXIMUM     359.0
+#define P_GAIN  1.4//1.4    //0.78   
+#define I_GAIN  0.0     //0.0
+#define D_GAIN  0.05  //0.009
+#define OUT_LIMIT   40.0
+#define MAX_POW     100
+#define MIN_POW     -100
+#define PID_CYCLE   0.05   //s
+
+/*Serial Mbed間*/
+#define ADDRESS 0xAA
+
+
 //BT(BlueTooth)
 #define DATA_NUM 8+2//2byte→KEYCODE(拝啓)とCHECKCODE(敬具) 8byte→やりとりするデータ
 #define TX_KEYCODE 0xAA//あちらのKEYCODE
@@ -9,23 +27,30 @@
 #define CHECK DATA_NUM-1//CHECKCODEは配列の最後
 
 //ロータリースイッチ 入力値
-#define NONE    0x0
-#define START   0x1
-#define DEBUG0  0x2
-#define DEBUG1  0x3
-#define DEBUG2  0x4
-#define TEST0   0x5
-#define TEST1   0x6
-#define TEST2   0x7
-#define CALIBRATION0    0x8
-#define CALIBRATION1    0x9
-#define CALIBRATION2    0xA
-#define SAVE            0xB
-#define STORE           0xC
-#define DEFENCE0        0xD
-#define ATTACK0        0xE
-
-#define BUFSIZE 10
+typedef enum{
+    NONE = 0x0,
+    START,
+    DEBUG0,
+    DEBUG1,
+    DEBUG2,
+    TEST0,
+    TEST1,
+    TEST2,
+    CALIBRATION0,
+    CALIBRATION1,
+    CALIBRATION2,
+    SAVE,
+    STORE,
+    DEFENCE0,
+    ATTACK0,
+    STOP
+} SwState;
+//スイッチ 入力値
+#define FRONT   0x1
+#define BACK    0x2
+#define EXIT    0x3
+//Lcd出力文字サイズ
+#define BUFSIZE 7
 
 typedef struct {
     uint8_t ping[4];