For LIGHT

Dependencies:   mbed FastPWM

Revision:
11:82d8768d7351
Parent:
7:e9086c72bb22
Child:
12:6f2531038ea4
diff -r 83a6baa77a2e -r 82d8768d7351 CAN/function_CAN.h
--- a/CAN/function_CAN.h	Fri Aug 23 01:02:32 2019 +0000
+++ b/CAN/function_CAN.h	Fri Aug 23 12:28:08 2019 +0000
@@ -6,6 +6,22 @@
 extern CAN can;
 extern CANMessage msg;
 
+// INIT_CID
+#define INIT_CID_RX_CMD                   100
+#define INIT_CID_RX_REF_POSITION          200
+#define INIT_CID_RX_REF_TORQUE            300
+#define INIT_CID_RX_REF_PRES_DIFF         400
+#define INIT_CID_RX_REF_VOUT              500
+#define INIT_CID_RX_REF_VALVE_POSITION    600
+
+#define INIT_CID_TX_INFO              1100
+#define INIT_CID_TX_POSITION          1200
+#define INIT_CID_TX_TORQUE            1300
+#define INIT_CID_TX_PRES              1400
+#define INIT_CID_TX_VOUT              1500
+#define INIT_CID_TX_VALVE_POSITION    1600
+
+
 // CID_RX_CMD - RX CMD type
 #define             CRX_ASK_INFO                    0
 #define             CRX_ASK_BNO                     1
@@ -72,6 +88,11 @@
 #define             CRX_SET_HOMEPOS_OFFSET          140
 #define             CRX_ASK_HOMEPOS_VALVE_OPENING   41
 #define             CRX_SET_HOMEPOS_VALVE_OPENING   141
+#define             CRX_ASK_DDV_VALVE_DEADZONE     42
+#define             CRX_SET_DDV_VALVE_DEADZONE     142
+#define             CRX_ASK_VALVE_PWM_VS_VALVE_POS  43
+#define             CRX_ASK_VALVE_POS_VS_FLOWRATE   44
+#define             CRX_ASK_VALVE_POS_NUM           45
 #define             CRX_SET_ERR_CLEAR               150
 #define             CRX_JUMP_STATUS                 255
 
@@ -109,41 +130,54 @@
 #define             CTX_SEND_REFENCE_MODE                       39
 #define             CTX_SEND_HOMEPOS_OFFSET                     40
 #define             CTX_SEND_HOMEPOS_VALVE_OPENING              41
+#define             CTX_SEND_DDV_VALVE_DEADZONE                 42
+#define             CTX_VALVE_PWM_VS_VALVE_POS                  43
+#define             CTX_VALVE_POS_VS_FLOWRATE                   44
+#define             CTX_VALVE_POS_NUM                           45
+
+// Sensor & State Transmission
+void CAN_TX_POSITION(long t_pos, long t_vel);
+void CAN_TX_TORQUE(int16_t t_torque);
+void CAN_TX_PRES(int16_t t_pres_a, int16_t t_pres_b);
+void CAN_TX_PWM(int16_t t_pwm);
+void CAN_TX_VALVE_POSITION(int16_t t_valve_pos);
 
 // Information Transmission
-//inline void CAN_TX_INFO(void);
-//inline void CAN_TX_BNO(void);
-//inline void CAN_TX_OPERATING_MODE(void);
-//inline void CAN_TX_CAN_FREQ(void);
-//inline void CAN_TX_CONTROL_MODE(void);
-//inline void CAN_TX_JOINT_ENC_DIR(void);
-//inline void CAN_TX_VALVE_DIR(void);
-//inline void CAN_TX_VALVE_ENC_DIR(void);
-//inline void CAN_TX_VOLTAGE_SUPPLY(void);
-//inline void CAN_TX_VOLTAGE_VALVE(void);
-//inline void CAN_TX_PID_GAIN(int t_type);
-//inline void CAN_TX_VALVE_DEADZONE(void);
-//inline void CAN_TX_ENC_PULSE_PER_POSITION(void);
-//inline void CAN_TX_TORQUE_SENSOR_PULSE_PER_TORQUE(void);
-//inline void CAN_TX_PRES_SENSOR_PULSE_PER_PRES(void);
-//inline void CAN_TX_HOMEPOS_OFFSET(void);
-
-// Sensor & State Transmission
-inline void CAN_TX_POSITION(long t_pos, long t_vel);
-inline void CAN_TX_TORQUE(int16_t t_torque);
-inline void CAN_TX_PRES(int16_t t_pres_a, int16_t t_pres_b);
-inline void CAN_TX_PWM(int16_t t_pwm);
-inline void CAN_TX_VALVE_POSITION(int16_t t_valve_pos);
-
-// Board Information Variables
-extern int BNO;
-extern int CONTROL_MODE;
-extern double P_GAIN_JOINT_POSITION;
-extern double I_GAIN_JOINT_POSITION;
-extern double D_GAIN_JOINT_POSITION;
-extern double P_GAIN_JOINT_TORQUE;
-extern double I_GAIN_JOINT_TORQUE;
-extern double D_GAIN_JOINT_TORQUE;
+void CAN_TX_INFO(void);
+void CAN_TX_BNO(void);
+void CAN_TX_OPERATING_MODE(void);
+void CAN_TX_CAN_FREQ(void);
+void CAN_TX_CONTROL_MODE(void);
+void CAN_TX_JOINT_ENC_DIR(void);
+void CAN_TX_VALVE_DIR(void);
+void CAN_TX_VALVE_ENC_DIR(void);
+void CAN_TX_VOLTAGE_SUPPLY(void);
+void CAN_TX_VOLTAGE_VALVE(void);
+void CAN_TX_PID_GAIN(int t_type);
+void CAN_TX_VALVE_DEADZONE(void);
+void CAN_TX_VELOCITY_COMP_GAIN(void);
+void CAN_TX_COMPLIANCE_GAIN(void);
+void CAN_TX_VALVE_FF(void);
+void CAN_TX_BULK_MODULUS(void);
+void CAN_TX_CHAMBER_VOLUME(void);
+void CAN_TX_PISTON_AREA(void);
+void CAN_TX_PRES_A_AND_B(void);
+void CAN_TX_ENC_LIMIT(void);
+void CAN_TX_STROKE(void);
+void CAN_TX_VALVE_LIMIT(void);
+void CAN_TX_ENC_PULSE_PER_POSITION(void);
+void CAN_TX_TORQUE_SENSOR_PULSE_PER_TORQUE(void);
+void CAN_TX_PRES_SENSOR_PULSE_PER_PRES(void);
+void CAN_TX_FRICTION(void);
+void CAN_TX_VALVE_GAIN_PLUS(void);
+void CAN_TX_VALVE_GAIN_MINUS(void);
+void CAN_TX_REFENCE_MODE(void);
+void CAN_TX_HOMEPOS_OFFSET(void);
+void CAN_TX_HOMPOS_VALVE_OPENING(void);
+void CAN_TX_VALVE_PWM_VS_VALVE_POS(char canindex);
+void CAN_TX_DDV_VALVE_DEADZONE(void);
+void CAN_TX_VALVE_POS_VS_FLOWRATE(char canindex);
+void CAN_TX_VALVE_POS_NUM(void);
 
 class State 
 {
@@ -180,5 +214,8 @@
 // CAN Receive Functions
 void ReadCMD();
 void CAN_RX_HANDLER();
+void CAN_ID_INIT(void);
+
+extern int ID_index_array[100];
 
 #endif