![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
for learning
CAN/function_CAN.h@2:a1c0a37df760, 2019-08-20 (annotated)
- Committer:
- jobuuu
- Date:
- Tue Aug 20 07:38:55 2019 +0000
- Revision:
- 2:a1c0a37df760
- Child:
- 4:58c8081de776
HydraulicControlBoard_190820
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jobuuu | 2:a1c0a37df760 | 1 | #ifndef _FUNCTION_CAN_H_ |
jobuuu | 2:a1c0a37df760 | 2 | #define _FUNCTION_CAN_H_ |
jobuuu | 2:a1c0a37df760 | 3 | |
jobuuu | 2:a1c0a37df760 | 4 | #include "mbed.h" |
jobuuu | 2:a1c0a37df760 | 5 | |
jobuuu | 2:a1c0a37df760 | 6 | // CID_RX_CMD - RX CMD type |
jobuuu | 2:a1c0a37df760 | 7 | #define CRX_ASK_INFO 0 |
jobuuu | 2:a1c0a37df760 | 8 | #define CRX_ASK_BNO 1 |
jobuuu | 2:a1c0a37df760 | 9 | #define CRX_SET_BNO 101 |
jobuuu | 2:a1c0a37df760 | 10 | #define CRX_ASK_OPERATING_MODE 2 |
jobuuu | 2:a1c0a37df760 | 11 | #define CRX_SET_OPERATING_MODE 102 |
jobuuu | 2:a1c0a37df760 | 12 | #define CRX_SET_ENC_ZERO 103 |
jobuuu | 2:a1c0a37df760 | 13 | #define CRX_SET_FET_ON 104 |
jobuuu | 2:a1c0a37df760 | 14 | #define CRX_SET_REF_UPDATE_ENABLE 105 |
jobuuu | 2:a1c0a37df760 | 15 | #define CRX_ASK_CAN_FREQ 6 |
jobuuu | 2:a1c0a37df760 | 16 | #define CRX_SET_CAN_FREQ 106 |
jobuuu | 2:a1c0a37df760 | 17 | #define CRX_ASK_CONTROL_MODE 7 |
jobuuu | 2:a1c0a37df760 | 18 | #define CRX_SET_CONTROL_MODE 107 |
jobuuu | 2:a1c0a37df760 | 19 | #define CRX_SET_DATA_REQUEST 108 |
jobuuu | 2:a1c0a37df760 | 20 | #define CRX_ASK_JOINT_ENC_DIR 9 |
jobuuu | 2:a1c0a37df760 | 21 | #define CRX_SET_JOINT_ENC_DIR 109 |
jobuuu | 2:a1c0a37df760 | 22 | #define CRX_ASK_VALVE_DIR 10 |
jobuuu | 2:a1c0a37df760 | 23 | #define CRX_SET_VALVE_DIR 110 |
jobuuu | 2:a1c0a37df760 | 24 | #define CRX_ASK_VALVE_ENC_DIR 11 |
jobuuu | 2:a1c0a37df760 | 25 | #define CRX_SET_VALVE_ENC_DIR 111 |
jobuuu | 2:a1c0a37df760 | 26 | #define CRX_ASK_VOLTAGE_SUPPLY 12 |
jobuuu | 2:a1c0a37df760 | 27 | #define CRX_SET_VOLTAGE_SUPPLY 112 |
jobuuu | 2:a1c0a37df760 | 28 | #define CRX_ASK_VOLTAGE_VALVE 13 |
jobuuu | 2:a1c0a37df760 | 29 | #define CRX_SET_VOLTAGE_VALVE 113 |
jobuuu | 2:a1c0a37df760 | 30 | #define CRX_SET_HOMEPOS 114 |
jobuuu | 2:a1c0a37df760 | 31 | #define CRX_ASK_PID_GAIN 20 |
jobuuu | 2:a1c0a37df760 | 32 | #define CRX_SET_PID_GAIN 120 |
jobuuu | 2:a1c0a37df760 | 33 | #define CRX_ASK_VALVE_DEADZONE 21 |
jobuuu | 2:a1c0a37df760 | 34 | #define CRX_SET_VALVE_DEADZONE 121 |
jobuuu | 2:a1c0a37df760 | 35 | #define CRX_ASK_VELOCITY_COMP_GAIN 22 |
jobuuu | 2:a1c0a37df760 | 36 | #define CRX_SET_VELOCITY_COMP_GAIN 122 |
jobuuu | 2:a1c0a37df760 | 37 | #define CRX_ASK_COMPLIANCE_GAIN 23 |
jobuuu | 2:a1c0a37df760 | 38 | #define CRX_SET_COMPLIANCE_GAIN 123 |
jobuuu | 2:a1c0a37df760 | 39 | #define CRX_ASK_VALVE_FF 25 |
jobuuu | 2:a1c0a37df760 | 40 | #define CRX_SET_VALVE_FF 125 |
jobuuu | 2:a1c0a37df760 | 41 | #define CRX_ASK_BULK_MODULUS 26 |
jobuuu | 2:a1c0a37df760 | 42 | #define CRX_SET_BULK_MODULUS 126 |
jobuuu | 2:a1c0a37df760 | 43 | #define CRX_ASK_CHAMBER_VOLUME 27 |
jobuuu | 2:a1c0a37df760 | 44 | #define CRX_SET_CHAMBER_VOLUME 127 |
jobuuu | 2:a1c0a37df760 | 45 | #define CRX_ASK_PISTON_AREA 28 |
jobuuu | 2:a1c0a37df760 | 46 | #define CRX_SET_PISTON_AREA 128 |
jobuuu | 2:a1c0a37df760 | 47 | #define CRX_ASK_PRES 29 |
jobuuu | 2:a1c0a37df760 | 48 | #define CRX_SET_PRES 129 |
jobuuu | 2:a1c0a37df760 | 49 | #define CRX_ASK_ENC_LIMIT 30 |
jobuuu | 2:a1c0a37df760 | 50 | #define CRX_SET_ENC_LIMIT 130 |
jobuuu | 2:a1c0a37df760 | 51 | #define CRX_ASK_STROKE 31 |
jobuuu | 2:a1c0a37df760 | 52 | #define CRX_SET_STROKE 131 |
jobuuu | 2:a1c0a37df760 | 53 | #define CRX_ASK_VALVE_LIMIT 32 |
jobuuu | 2:a1c0a37df760 | 54 | #define CRX_SET_VALVE_LIMIT 132 |
jobuuu | 2:a1c0a37df760 | 55 | #define CRX_ASK_ENC_PULSE_PER_POSITION 33 |
jobuuu | 2:a1c0a37df760 | 56 | #define CRX_SET_ENC_PULSE_PER_POSITION 133 |
jobuuu | 2:a1c0a37df760 | 57 | #define CRX_ASK_TORQUE_SENSOR_PULSE_PER_TORQUE 34 |
jobuuu | 2:a1c0a37df760 | 58 | #define CRX_SET_TORQUE_SENSOR_PULSE_PER_TORQUE 134 |
jobuuu | 2:a1c0a37df760 | 59 | #define CRX_ASK_PRES_SENSOR_PULSE_PER_PRES 35 |
jobuuu | 2:a1c0a37df760 | 60 | #define CRX_SET_PRES_SENSOR_PULSE_PER_PRES 135 |
jobuuu | 2:a1c0a37df760 | 61 | #define CRX_ASK_FRICTION 36 |
jobuuu | 2:a1c0a37df760 | 62 | #define CRX_SET_FRICTION 136 |
jobuuu | 2:a1c0a37df760 | 63 | #define CRX_ASK_VALVE_GAIN_PLUS 37 |
jobuuu | 2:a1c0a37df760 | 64 | #define CRX_SET_VALVE_GAIN_PLUS 137 |
jobuuu | 2:a1c0a37df760 | 65 | #define CRX_ASK_VALVE_GAIN_MINUS 38 |
jobuuu | 2:a1c0a37df760 | 66 | #define CRX_SET_VALVE_GAIN_MINUS 138 |
jobuuu | 2:a1c0a37df760 | 67 | #define CRX_LOW_REF 139 |
jobuuu | 2:a1c0a37df760 | 68 | #define CRX_ASK_HOMEPOS_OFFSET 40 |
jobuuu | 2:a1c0a37df760 | 69 | #define CRX_SET_HOMEPOS_OFFSET 140 |
jobuuu | 2:a1c0a37df760 | 70 | #define CRX_ASK_HOMEPOS_VALVE_OPENING 41 |
jobuuu | 2:a1c0a37df760 | 71 | #define CRX_SET_HOMEPOS_VALVE_OPENING 141 |
jobuuu | 2:a1c0a37df760 | 72 | #define CRX_SET_ERR_CLEAR 150 |
jobuuu | 2:a1c0a37df760 | 73 | #define CRX_JUMP_STATUS 255 |
jobuuu | 2:a1c0a37df760 | 74 | |
jobuuu | 2:a1c0a37df760 | 75 | // Information Transmission |
jobuuu | 2:a1c0a37df760 | 76 | inline void CAN_TX_INFO(void); |
jobuuu | 2:a1c0a37df760 | 77 | inline void CAN_TX_BNO(void); |
jobuuu | 2:a1c0a37df760 | 78 | inline void CAN_TX_OPERATING_MODE(void); |
jobuuu | 2:a1c0a37df760 | 79 | inline void CAN_TX_CAN_FREQ(void); |
jobuuu | 2:a1c0a37df760 | 80 | inline void CAN_TX_CONTROL_MODE(void); |
jobuuu | 2:a1c0a37df760 | 81 | inline void CAN_TX_JOINT_ENC_DIR(void); |
jobuuu | 2:a1c0a37df760 | 82 | inline void CAN_TX_VALVE_DIR(void); |
jobuuu | 2:a1c0a37df760 | 83 | inline void CAN_TX_VALVE_ENC_DIR(void); |
jobuuu | 2:a1c0a37df760 | 84 | inline void CAN_TX_VOLTAGE_SUPPLY(void); |
jobuuu | 2:a1c0a37df760 | 85 | inline void CAN_TX_VOLTAGE_VALVE(void); |
jobuuu | 2:a1c0a37df760 | 86 | inline void CAN_TX_PID_GAIN(int t_type); |
jobuuu | 2:a1c0a37df760 | 87 | inline void CAN_TX_VALVE_DEADZONE(void); |
jobuuu | 2:a1c0a37df760 | 88 | inline void CAN_TX_ENC_PULSE_PER_POSITION(void); |
jobuuu | 2:a1c0a37df760 | 89 | inline void CAN_TX_TORQUE_SENSOR_PULSE_PER_TORQUE(void); |
jobuuu | 2:a1c0a37df760 | 90 | inline void CAN_TX_PRES_SENSOR_PULSE_PER_PRES(void); |
jobuuu | 2:a1c0a37df760 | 91 | inline void CAN_TX_HOMEPOS_OFFSET(void); |
jobuuu | 2:a1c0a37df760 | 92 | |
jobuuu | 2:a1c0a37df760 | 93 | // Sensor & State Transmission |
jobuuu | 2:a1c0a37df760 | 94 | inline void CAN_TX_POSITION(long t_pos, long t_vel); |
jobuuu | 2:a1c0a37df760 | 95 | inline void CAN_TX_TORQUE(int16_t t_torque); |
jobuuu | 2:a1c0a37df760 | 96 | inline void CAN_TX_PRES(int16_t t_pres_a, int16_t t_pres_b); |
jobuuu | 2:a1c0a37df760 | 97 | inline void CAN_TX_PWM(int16_t t_pwm); |
jobuuu | 2:a1c0a37df760 | 98 | inline void CAN_TX_VALVE_POSITION(int16_t t_valve_pos); |
jobuuu | 2:a1c0a37df760 | 99 | |
jobuuu | 2:a1c0a37df760 | 100 | // CAN Receive Functions |
jobuuu | 2:a1c0a37df760 | 101 | void ReadCMD(); |
jobuuu | 2:a1c0a37df760 | 102 | void CAN_RX_HANDLER(); |
jobuuu | 2:a1c0a37df760 | 103 | |
jobuuu | 2:a1c0a37df760 | 104 | #endif |