z ysaito / Mbed 2 deprecated CPro_DemoB1B2_4_ResAnaCtrl

Dependencies:   QEI mbed

common.h

Committer:
sayzyas
Date:
2018-07-26
Revision:
0:f8373bf202a6

File content as of revision 0:f8373bf202a6:

/*
 * mbed LPC824-Max header
 *
 */

// If you use moving type winch , then should comment out followings !!
// #define FFWinchPhaseSetting  // Valid if Fix falling winch system is using.

#define __DEBUG__
#ifdef __DEBUG__
#define DEBUG_PRINT(...)  pc.printf(__VA_ARGS__)
#else
#define DEBUG_PRINT(...)  ;
//#define DEBUG_PRINT(...)  1 ? (void)0 : pc.printf(__VA_ARGS__)
#endif
/* Information */
#define LatestUpDate "2016.09.27"
#define ProgramRevision "Rev 2.30" 
#define Author "Y.Saito(zinsor)"
#define Company "Revast Co.,Ltd"


/* Debug macro */
#define __DEBUG_L0__
#define __DEBUG_L1__
//#define __DEBUG_L2__
//#define __DEBUG_L3__
//#define __DEBUG_L4__

#ifdef __DEBUG_L0__
    #define DEBUG_PRINT_L0(...)  pc.printf(__VA_ARGS__)
#else
    #define DEBUG_PRINT_L0(...) 
#endif
#ifdef __DEBUG_L1__
    #define DEBUG_PRINT_L1(...)  pc.printf(__VA_ARGS__)
#else
    #define DEBUG_PRINT_L1(...) 
#endif
#ifdef __DEBUG_L2__
    #define DEBUG_PRINT_L2(...)  pc.printf(__VA_ARGS__)
#else
    #define DEBUG_PRINT_L2(...) 
#endif
#ifdef __DEBUG_L3__
    #define DEBUG_PRINT_L3(...)  pc.printf(__VA_ARGS__)
#else
    #define DEBUG_PRINT_L3(...) 
#endif
#ifdef __DEBUG_L4__
    #define DEBUG_PRINT_L4(...)  pc.printf(__VA_ARGS__)
#else
    #define DEBUG_PRINT_L4(...) 
#endif

enum{
    MOTOR_RFCRW,        // RF crawler
    MOTOR_LBCRW,        // LB crawler
    MOTOR_RFTFM,        // RF Transform
    MOTOR_LBTFM,        // LB transform
    MOTOR_WINCH,        // Winch
    MOTOR_CMPAN,        // Pan/Tilt
    MOTOR_CTILT
};

enum{
    MOTOR_DIR_FWD,      // Motor forwaed rotation
    MOTOR_DIR_RVS,      // Motor reverse rotation
    MOTOR_DIR_STP      // Motor stop
};

#define NumberOfI2CCommand 12
enum{
    I2C_CP_COMMAND,             // instruction command
    I2C_CP_MOTORNO,             // motor number
    I2C_CP_M_DIR,               // motor rotation direction   
    I2C_CP_M_CNTTH_U,       // motor current limit detection threshold upper byte 
    I2C_CP_M_CNTTH_L,       // motor current limit detection threshold lower byte 
    I2C_CP_WDRAM_DIA_UPPER,     // winch dram motor diameter upper   
    I2C_CP_WDRAM_DIA_LOWER,     // winch dram motor diameter lower    
    I2C_CP_CCABLE_DIA_UPPER,    // cable diameter upper byte 
    I2C_CP_CCABLE_DIA_LOWER,    // cable diameter lower byte 
    I2C_CP_RESOLVER_RESO,       // resolver resolution (bit)
    I2C_CP_PRESET_CPOS_UPPER,   // preset position upper
    I2C_CP_PRESET_CPOS_LOWER,   // preset position lower 
};


#define ROTATE_PER_RESOLUTION       24
#define REAL_THREAD_DIAMETER        63          // 60+3
//#define ROTATION_DISTANCE           197.82f     // (60+3)*3.14
#define ROTATION_PULSE_PER_1ROUND   16384       // 2^12(bit) * 4
#define PAI                         3.14159265359

/* ***************** */
/* Target definition */
/* ***************** */
#define I2C_ADDRESS_RESOLVER    0x02

/* Command Packet */
#define CLEAR_RESOLVER_POSITION       'X'
#define HELLO_PACKET        'A'

#define LED_ON  0
#define LED_OFF 1