https://os.mbed.com/users/sayzyas

Dependencies:   QEI TextLCD mbed

Committer:
sayzyas
Date:
Thu Jul 26 00:20:15 2018 +0000
Revision:
0:73dd48be5ca6
2018.07.26

Who changed what in which revision?

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