z ysaito
/
Pro_B2_1ZNR_CrExpB2_MotorCtrl_LPC824MAX
2018.08.06
Diff: common.h
- Revision:
- 0:653609b2a5cf
- Child:
- 1:c3508bfe65b6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common.h Mon Mar 28 00:08:58 2016 +0000 @@ -0,0 +1,104 @@ +/* + * mbed LPC824-Max header + * + */ + +#define __IIC_COMAMND_SEND__ + +/* Information */ +#define LatestUpDate "2016.03.16" +#define ProgramRevision "---" +#define Author "zinsor" +#define Company "NRst" +#define ProgramCode "RVM-X0F0A" + +#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 + + +/* Motor Controller I2C address definition */ +#define I2C_ADDRESS_HANDY 0x20 +#define I2C_ADDRESS_WINCH 0x10 +#define I2C_ADDRESS_TRANSFORM 0x08 +#define I2C_ADDRESS_CRAWLER 0x04 +#define I2C_ADDRESS_RESOLVER 0x02 + + +/* Command definition */ +//#define I2C_TFM_RF_K '6' +//#define I2C_TFM_RF_I '8' +//#define I2C_TFM_LB_K '7' +//#define I2C_TFM_LB_I '5' +//#define I2C_TFM_PAN_CW '2' +//#define I2C_TFM_PAN_CCW '4' +//#define I2C_TFM_TILT_UP '1' +//#define I2C_TFM_TILT_DWN '3' + +/* Command definition */ +#define MOTOR_1 '1' +#define MOTOR_2 '2' + +#define MOTOR_FWD 'F' /* Forward Rotation */ +#define MOTOR_RVS 'R' /* Reverse Rotation */ +#define MOTOR_STP 'S' /* Stop */ + +#define HELLO_PACKET 'A' +#define READ_MCURRENT_PACKET 'C' + + +#define MOTOR_ON '0' +#define MOTOR_OFF '1' + +#define LED_ON 0 +#define LED_OFF 1 + +#define FLG_MOTOR1 1 +#define FLG_MOTOR2 2 +#define FLG_MOTOR_ON 1 +#define FLG_MOTOR_OFF 0 + +enum { + FLG_MOTOR_DIR_FWD, + FLG_MOTOR_DIR_RVS, + FLG_MOTOR_DIR_NONE +}; + + + +#define MC_UPPER_LIMIT 95.0f +#define MC_LOWER_LIMIT 5.0f +#define MC_LOCK_COUNT 5 + +#define NumberOfPcCommand 11 +#define NumberOfI2CCommand 10 + +#define ROTATE_PER_RESOLUTION 24