Sungwoo Kim
/
HydraulicControlBoard_Rainbow_v1_2_copy1
2011
Diff: CAN/function_CAN.h
- Revision:
- 2:a1c0a37df760
- Child:
- 4:58c8081de776
diff -r e04e563be5ce -r a1c0a37df760 CAN/function_CAN.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CAN/function_CAN.h Tue Aug 20 07:38:55 2019 +0000 @@ -0,0 +1,104 @@ +#ifndef _FUNCTION_CAN_H_ +#define _FUNCTION_CAN_H_ + +#include "mbed.h" + +// CID_RX_CMD - RX CMD type +#define CRX_ASK_INFO 0 +#define CRX_ASK_BNO 1 +#define CRX_SET_BNO 101 +#define CRX_ASK_OPERATING_MODE 2 +#define CRX_SET_OPERATING_MODE 102 +#define CRX_SET_ENC_ZERO 103 +#define CRX_SET_FET_ON 104 +#define CRX_SET_REF_UPDATE_ENABLE 105 +#define CRX_ASK_CAN_FREQ 6 +#define CRX_SET_CAN_FREQ 106 +#define CRX_ASK_CONTROL_MODE 7 +#define CRX_SET_CONTROL_MODE 107 +#define CRX_SET_DATA_REQUEST 108 +#define CRX_ASK_JOINT_ENC_DIR 9 +#define CRX_SET_JOINT_ENC_DIR 109 +#define CRX_ASK_VALVE_DIR 10 +#define CRX_SET_VALVE_DIR 110 +#define CRX_ASK_VALVE_ENC_DIR 11 +#define CRX_SET_VALVE_ENC_DIR 111 +#define CRX_ASK_VOLTAGE_SUPPLY 12 +#define CRX_SET_VOLTAGE_SUPPLY 112 +#define CRX_ASK_VOLTAGE_VALVE 13 +#define CRX_SET_VOLTAGE_VALVE 113 +#define CRX_SET_HOMEPOS 114 +#define CRX_ASK_PID_GAIN 20 +#define CRX_SET_PID_GAIN 120 +#define CRX_ASK_VALVE_DEADZONE 21 +#define CRX_SET_VALVE_DEADZONE 121 +#define CRX_ASK_VELOCITY_COMP_GAIN 22 +#define CRX_SET_VELOCITY_COMP_GAIN 122 +#define CRX_ASK_COMPLIANCE_GAIN 23 +#define CRX_SET_COMPLIANCE_GAIN 123 +#define CRX_ASK_VALVE_FF 25 +#define CRX_SET_VALVE_FF 125 +#define CRX_ASK_BULK_MODULUS 26 +#define CRX_SET_BULK_MODULUS 126 +#define CRX_ASK_CHAMBER_VOLUME 27 +#define CRX_SET_CHAMBER_VOLUME 127 +#define CRX_ASK_PISTON_AREA 28 +#define CRX_SET_PISTON_AREA 128 +#define CRX_ASK_PRES 29 +#define CRX_SET_PRES 129 +#define CRX_ASK_ENC_LIMIT 30 +#define CRX_SET_ENC_LIMIT 130 +#define CRX_ASK_STROKE 31 +#define CRX_SET_STROKE 131 +#define CRX_ASK_VALVE_LIMIT 32 +#define CRX_SET_VALVE_LIMIT 132 +#define CRX_ASK_ENC_PULSE_PER_POSITION 33 +#define CRX_SET_ENC_PULSE_PER_POSITION 133 +#define CRX_ASK_TORQUE_SENSOR_PULSE_PER_TORQUE 34 +#define CRX_SET_TORQUE_SENSOR_PULSE_PER_TORQUE 134 +#define CRX_ASK_PRES_SENSOR_PULSE_PER_PRES 35 +#define CRX_SET_PRES_SENSOR_PULSE_PER_PRES 135 +#define CRX_ASK_FRICTION 36 +#define CRX_SET_FRICTION 136 +#define CRX_ASK_VALVE_GAIN_PLUS 37 +#define CRX_SET_VALVE_GAIN_PLUS 137 +#define CRX_ASK_VALVE_GAIN_MINUS 38 +#define CRX_SET_VALVE_GAIN_MINUS 138 +#define CRX_LOW_REF 139 +#define CRX_ASK_HOMEPOS_OFFSET 40 +#define CRX_SET_HOMEPOS_OFFSET 140 +#define CRX_ASK_HOMEPOS_VALVE_OPENING 41 +#define CRX_SET_HOMEPOS_VALVE_OPENING 141 +#define CRX_SET_ERR_CLEAR 150 +#define CRX_JUMP_STATUS 255 + +// 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); + +// CAN Receive Functions +void ReadCMD(); +void CAN_RX_HANDLER(); + +#endif