z ysaito
/
APro_B2DTst_0_Can_Class
2018.07.26
common.h@0:b3376afd10d8, 2018-07-26 (annotated)
- Committer:
- sayzyas
- Date:
- Thu Jul 26 00:20:04 2018 +0000
- Revision:
- 0:b3376afd10d8
2018.07.26
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sayzyas | 0:b3376afd10d8 | 1 | /* Information */ |
sayzyas | 0:b3376afd10d8 | 2 | #define LatestUpDate "2017.08.30" |
sayzyas | 0:b3376afd10d8 | 3 | #define ProgramRevision "Rev 2.30" |
sayzyas | 0:b3376afd10d8 | 4 | #define Author "Y.Saito(zinsor)" |
sayzyas | 0:b3376afd10d8 | 5 | #define Company "Revast Co.,Ltd" |
sayzyas | 0:b3376afd10d8 | 6 | |
sayzyas | 0:b3376afd10d8 | 7 | |
sayzyas | 0:b3376afd10d8 | 8 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 9 | /* Motor */ |
sayzyas | 0:b3376afd10d8 | 10 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 11 | enum{ |
sayzyas | 0:b3376afd10d8 | 12 | MOTOR_RFCRW, // RF crawler |
sayzyas | 0:b3376afd10d8 | 13 | MOTOR_LBCRW, // LB crawler |
sayzyas | 0:b3376afd10d8 | 14 | MOTOR_RFTFM, // RF Transform |
sayzyas | 0:b3376afd10d8 | 15 | MOTOR_LBTFM, // LB transform |
sayzyas | 0:b3376afd10d8 | 16 | MOTOR_WINCH, // Winch |
sayzyas | 0:b3376afd10d8 | 17 | MOTOR_CMPAN, // Pan |
sayzyas | 0:b3376afd10d8 | 18 | MOTOR_CTILT, // Tilt |
sayzyas | 0:b3376afd10d8 | 19 | MOTOR_CABLE // Cable transfar |
sayzyas | 0:b3376afd10d8 | 20 | }; |
sayzyas | 0:b3376afd10d8 | 21 | |
sayzyas | 0:b3376afd10d8 | 22 | enum{ |
sayzyas | 0:b3376afd10d8 | 23 | MOTOR_DIR_FWD, // Motor forwaed rotation |
sayzyas | 0:b3376afd10d8 | 24 | MOTOR_DIR_RVS, // Motor reverse rotation |
sayzyas | 0:b3376afd10d8 | 25 | MOTOR_DIR_STP // Motor stop |
sayzyas | 0:b3376afd10d8 | 26 | }; |
sayzyas | 0:b3376afd10d8 | 27 | |
sayzyas | 0:b3376afd10d8 | 28 | |
sayzyas | 0:b3376afd10d8 | 29 | enum{ |
sayzyas | 0:b3376afd10d8 | 30 | MOTOR_NO0, |
sayzyas | 0:b3376afd10d8 | 31 | MOTOR_NO1, |
sayzyas | 0:b3376afd10d8 | 32 | MOTOR_NO2, |
sayzyas | 0:b3376afd10d8 | 33 | MOTOR_NO3 |
sayzyas | 0:b3376afd10d8 | 34 | }; |
sayzyas | 0:b3376afd10d8 | 35 | |
sayzyas | 0:b3376afd10d8 | 36 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 37 | /* I2C */ |
sayzyas | 0:b3376afd10d8 | 38 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 39 | #define NumberOfI2CCommand 12 |
sayzyas | 0:b3376afd10d8 | 40 | enum{ |
sayzyas | 0:b3376afd10d8 | 41 | I2C_CP_COMMAND, // instruction command |
sayzyas | 0:b3376afd10d8 | 42 | I2C_CP_MOTORNO, // motor number |
sayzyas | 0:b3376afd10d8 | 43 | I2C_CP_M_DIR, // motor rotation direction |
sayzyas | 0:b3376afd10d8 | 44 | I2C_CP_M_CNTTH_U, // motor current limit detection threshold upper byte |
sayzyas | 0:b3376afd10d8 | 45 | I2C_CP_M_CNTTH_L, // motor current limit detection threshold lower byte |
sayzyas | 0:b3376afd10d8 | 46 | I2C_CP_WDRAM_DIA_X100_UPPER, // winch dram motor diameter upper |
sayzyas | 0:b3376afd10d8 | 47 | I2C_CP_WDRAM_DIA_X100_LOWER, // winch dram motor diameter lower |
sayzyas | 0:b3376afd10d8 | 48 | I2C_CP_ADJUST_VALUE_X10000_UPPER, // cable diameter upper byte |
sayzyas | 0:b3376afd10d8 | 49 | I2C_CP_ADJUST_VALUE_X10000_LOWER, // cable diameter lower byte |
sayzyas | 0:b3376afd10d8 | 50 | I2C_CP_RESOLVER_RESO, // resolver resolution (bit) |
sayzyas | 0:b3376afd10d8 | 51 | I2C_CP_PRESET_CPOS_UPPER, // preset position upper |
sayzyas | 0:b3376afd10d8 | 52 | I2C_CP_PRESET_CPOS_LOWER // preset position lower |
sayzyas | 0:b3376afd10d8 | 53 | }; |
sayzyas | 0:b3376afd10d8 | 54 | |
sayzyas | 0:b3376afd10d8 | 55 | #define I2C_ADDRESS_RESOLVER 0x02 |
sayzyas | 0:b3376afd10d8 | 56 | |
sayzyas | 0:b3376afd10d8 | 57 | |
sayzyas | 0:b3376afd10d8 | 58 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 59 | /* Parameters */ |
sayzyas | 0:b3376afd10d8 | 60 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 61 | #define MAX_DROP_AMOUNT 3495 /* Maxmun dropping distance : ex 3500 (mm) */ |
sayzyas | 0:b3376afd10d8 | 62 | |
sayzyas | 0:b3376afd10d8 | 63 | #define CALIBRATION_COUNT 300 /* Joystick calibration count */ |
sayzyas | 0:b3376afd10d8 | 64 | #define DEAD_BAND 5 /* Joystick dead band wide */ |
sayzyas | 0:b3376afd10d8 | 65 | |
sayzyas | 0:b3376afd10d8 | 66 | #define ROTATE_PER_RESOLUTION 24 /* For QEI */ |
sayzyas | 0:b3376afd10d8 | 67 | #define PAI 3.14159265359 |
sayzyas | 0:b3376afd10d8 | 68 | |
sayzyas | 0:b3376afd10d8 | 69 | #define LED_ON 0 |
sayzyas | 0:b3376afd10d8 | 70 | #define LED_OFF 1 |
sayzyas | 0:b3376afd10d8 | 71 | |
sayzyas | 0:b3376afd10d8 | 72 | #define __NETWORK_ACCESS__ |
sayzyas | 0:b3376afd10d8 | 73 | #define TCP_CMDSERVER_PORT 10000 |
sayzyas | 0:b3376afd10d8 | 74 | |
sayzyas | 0:b3376afd10d8 | 75 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 76 | /* Structure */ |
sayzyas | 0:b3376afd10d8 | 77 | /* ****************************************** */ |
sayzyas | 0:b3376afd10d8 | 78 | /* Winch setting value */ |
sayzyas | 0:b3376afd10d8 | 79 | typedef struct { |
sayzyas | 0:b3376afd10d8 | 80 | uint16_t cth_dram_mtr_f; // 2 Current threshold: winch dram Motor ( forward ) |
sayzyas | 0:b3376afd10d8 | 81 | uint16_t cth_dram_mtr_r; // 2 Current threshold: winch dram Motor ( reverse ) |
sayzyas | 0:b3376afd10d8 | 82 | uint16_t cth_cabl_mtr_f; // 2 Current threshold: winch cable Motor ( forward ) |
sayzyas | 0:b3376afd10d8 | 83 | uint16_t cth_cabl_mtr_r; // 2 Current threshold: winch cable Motor ( reverse ) |
sayzyas | 0:b3376afd10d8 | 84 | uint16_t dram_dmtr_x100; // 2 Winch dram diameter x 100 |
sayzyas | 0:b3376afd10d8 | 85 | uint16_t adj_val_x10000; // 2 Winch adjust value x 100 |
sayzyas | 0:b3376afd10d8 | 86 | uint8_t res_resolution; // 1 Winch resolver resolution (bit) |
sayzyas | 0:b3376afd10d8 | 87 | uint8_t reserved_1; // 1 reserved for future use |
sayzyas | 0:b3376afd10d8 | 88 | int16_t move_interval_cw; // 2 motor moving interval between m1 and m2 at CW rotation |
sayzyas | 0:b3376afd10d8 | 89 | int16_t move_interval_ccw; // 2 motor moving interval between m1 and m2 at CCW rotation |
sayzyas | 0:b3376afd10d8 | 90 | } wch_SetValue_t; |
sayzyas | 0:b3376afd10d8 | 91 | |
sayzyas | 0:b3376afd10d8 | 92 | typedef struct SetValue { |
sayzyas | 0:b3376afd10d8 | 93 | wch_SetValue_t wchCtrl; |
sayzyas | 0:b3376afd10d8 | 94 | } setValue_t; |
sayzyas | 0:b3376afd10d8 | 95 |