z ysaito / Mbed 2 deprecated CPro_DemoB1B2_4_ResAnaCtrl

Dependencies:   QEI mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers common.h Source File

common.h

00001 /*
00002  * mbed LPC824-Max header
00003  *
00004  */
00005 
00006 // If you use moving type winch , then should comment out followings !!
00007 // #define FFWinchPhaseSetting  // Valid if Fix falling winch system is using.
00008 
00009 #define __DEBUG__
00010 #ifdef __DEBUG__
00011 #define DEBUG_PRINT(...)  pc.printf(__VA_ARGS__)
00012 #else
00013 #define DEBUG_PRINT(...)  ;
00014 //#define DEBUG_PRINT(...)  1 ? (void)0 : pc.printf(__VA_ARGS__)
00015 #endif
00016 /* Information */
00017 #define LatestUpDate "2016.09.27"
00018 #define ProgramRevision "Rev 2.30" 
00019 #define Author "Y.Saito(zinsor)"
00020 #define Company "Revast Co.,Ltd"
00021 
00022 
00023 /* Debug macro */
00024 #define __DEBUG_L0__
00025 #define __DEBUG_L1__
00026 //#define __DEBUG_L2__
00027 //#define __DEBUG_L3__
00028 //#define __DEBUG_L4__
00029 
00030 #ifdef __DEBUG_L0__
00031     #define DEBUG_PRINT_L0(...)  pc.printf(__VA_ARGS__)
00032 #else
00033     #define DEBUG_PRINT_L0(...) 
00034 #endif
00035 #ifdef __DEBUG_L1__
00036     #define DEBUG_PRINT_L1(...)  pc.printf(__VA_ARGS__)
00037 #else
00038     #define DEBUG_PRINT_L1(...) 
00039 #endif
00040 #ifdef __DEBUG_L2__
00041     #define DEBUG_PRINT_L2(...)  pc.printf(__VA_ARGS__)
00042 #else
00043     #define DEBUG_PRINT_L2(...) 
00044 #endif
00045 #ifdef __DEBUG_L3__
00046     #define DEBUG_PRINT_L3(...)  pc.printf(__VA_ARGS__)
00047 #else
00048     #define DEBUG_PRINT_L3(...) 
00049 #endif
00050 #ifdef __DEBUG_L4__
00051     #define DEBUG_PRINT_L4(...)  pc.printf(__VA_ARGS__)
00052 #else
00053     #define DEBUG_PRINT_L4(...) 
00054 #endif
00055 
00056 enum{
00057     MOTOR_RFCRW,        // RF crawler
00058     MOTOR_LBCRW,        // LB crawler
00059     MOTOR_RFTFM,        // RF Transform
00060     MOTOR_LBTFM,        // LB transform
00061     MOTOR_WINCH,        // Winch
00062     MOTOR_CMPAN,        // Pan/Tilt
00063     MOTOR_CTILT
00064 };
00065 
00066 enum{
00067     MOTOR_DIR_FWD,      // Motor forwaed rotation
00068     MOTOR_DIR_RVS,      // Motor reverse rotation
00069     MOTOR_DIR_STP      // Motor stop
00070 };
00071 
00072 #define NumberOfI2CCommand 12
00073 enum{
00074     I2C_CP_COMMAND,             // instruction command
00075     I2C_CP_MOTORNO,             // motor number
00076     I2C_CP_M_DIR,               // motor rotation direction   
00077     I2C_CP_M_CNTTH_U,       // motor current limit detection threshold upper byte 
00078     I2C_CP_M_CNTTH_L,       // motor current limit detection threshold lower byte 
00079     I2C_CP_WDRAM_DIA_UPPER,     // winch dram motor diameter upper   
00080     I2C_CP_WDRAM_DIA_LOWER,     // winch dram motor diameter lower    
00081     I2C_CP_CCABLE_DIA_UPPER,    // cable diameter upper byte 
00082     I2C_CP_CCABLE_DIA_LOWER,    // cable diameter lower byte 
00083     I2C_CP_RESOLVER_RESO,       // resolver resolution (bit)
00084     I2C_CP_PRESET_CPOS_UPPER,   // preset position upper
00085     I2C_CP_PRESET_CPOS_LOWER,   // preset position lower 
00086 };
00087 
00088 
00089 #define ROTATE_PER_RESOLUTION       24
00090 #define REAL_THREAD_DIAMETER        63          // 60+3
00091 //#define ROTATION_DISTANCE           197.82f     // (60+3)*3.14
00092 #define ROTATION_PULSE_PER_1ROUND   16384       // 2^12(bit) * 4
00093 #define PAI                         3.14159265359
00094 
00095 /* ***************** */
00096 /* Target definition */
00097 /* ***************** */
00098 #define I2C_ADDRESS_RESOLVER    0x02
00099 
00100 /* Command Packet */
00101 #define CLEAR_RESOLVER_POSITION       'X'
00102 #define HELLO_PACKET        'A'
00103 
00104 #define LED_ON  0
00105 #define LED_OFF 1