z ysaito
/
Pro_B2_1ZNR_CrExpB2_MotorCtrl_LPC824MAX
2018.08.06
common.h@0:653609b2a5cf, 2016-03-28 (annotated)
- Committer:
- sayzyas
- Date:
- Mon Mar 28 00:08:58 2016 +0000
- Revision:
- 0:653609b2a5cf
- Child:
- 1:c3508bfe65b6
Rev20160325
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sayzyas | 0:653609b2a5cf | 1 | /* |
sayzyas | 0:653609b2a5cf | 2 | * mbed LPC824-Max header |
sayzyas | 0:653609b2a5cf | 3 | * |
sayzyas | 0:653609b2a5cf | 4 | */ |
sayzyas | 0:653609b2a5cf | 5 | |
sayzyas | 0:653609b2a5cf | 6 | #define __IIC_COMAMND_SEND__ |
sayzyas | 0:653609b2a5cf | 7 | |
sayzyas | 0:653609b2a5cf | 8 | /* Information */ |
sayzyas | 0:653609b2a5cf | 9 | #define LatestUpDate "2016.03.16" |
sayzyas | 0:653609b2a5cf | 10 | #define ProgramRevision "---" |
sayzyas | 0:653609b2a5cf | 11 | #define Author "zinsor" |
sayzyas | 0:653609b2a5cf | 12 | #define Company "NRst" |
sayzyas | 0:653609b2a5cf | 13 | #define ProgramCode "RVM-X0F0A" |
sayzyas | 0:653609b2a5cf | 14 | |
sayzyas | 0:653609b2a5cf | 15 | #define __DEBUG_L0__ |
sayzyas | 0:653609b2a5cf | 16 | #define __DEBUG_L1__ |
sayzyas | 0:653609b2a5cf | 17 | #define __DEBUG_L2__ |
sayzyas | 0:653609b2a5cf | 18 | #define __DEBUG_L3__ |
sayzyas | 0:653609b2a5cf | 19 | //#define __DEBUG_L4__ |
sayzyas | 0:653609b2a5cf | 20 | |
sayzyas | 0:653609b2a5cf | 21 | #ifdef __DEBUG_L0__ |
sayzyas | 0:653609b2a5cf | 22 | #define DEBUG_PRINT_L0(...) pc.printf(__VA_ARGS__) |
sayzyas | 0:653609b2a5cf | 23 | #else |
sayzyas | 0:653609b2a5cf | 24 | #define DEBUG_PRINT_L0(...) |
sayzyas | 0:653609b2a5cf | 25 | #endif |
sayzyas | 0:653609b2a5cf | 26 | #ifdef __DEBUG_L1__ |
sayzyas | 0:653609b2a5cf | 27 | #define DEBUG_PRINT_L1(...) pc.printf(__VA_ARGS__) |
sayzyas | 0:653609b2a5cf | 28 | #else |
sayzyas | 0:653609b2a5cf | 29 | #define DEBUG_PRINT_L1(...) |
sayzyas | 0:653609b2a5cf | 30 | #endif |
sayzyas | 0:653609b2a5cf | 31 | #ifdef __DEBUG_L2__ |
sayzyas | 0:653609b2a5cf | 32 | #define DEBUG_PRINT_L2(...) pc.printf(__VA_ARGS__) |
sayzyas | 0:653609b2a5cf | 33 | #else |
sayzyas | 0:653609b2a5cf | 34 | #define DEBUG_PRINT_L2(...) |
sayzyas | 0:653609b2a5cf | 35 | #endif |
sayzyas | 0:653609b2a5cf | 36 | #ifdef __DEBUG_L3__ |
sayzyas | 0:653609b2a5cf | 37 | #define DEBUG_PRINT_L3(...) pc.printf(__VA_ARGS__) |
sayzyas | 0:653609b2a5cf | 38 | #else |
sayzyas | 0:653609b2a5cf | 39 | #define DEBUG_PRINT_L3(...) |
sayzyas | 0:653609b2a5cf | 40 | #endif |
sayzyas | 0:653609b2a5cf | 41 | #ifdef __DEBUG_L4__ |
sayzyas | 0:653609b2a5cf | 42 | #define DEBUG_PRINT_L4(...) pc.printf(__VA_ARGS__) |
sayzyas | 0:653609b2a5cf | 43 | #else |
sayzyas | 0:653609b2a5cf | 44 | #define DEBUG_PRINT_L4(...) |
sayzyas | 0:653609b2a5cf | 45 | #endif |
sayzyas | 0:653609b2a5cf | 46 | |
sayzyas | 0:653609b2a5cf | 47 | |
sayzyas | 0:653609b2a5cf | 48 | /* Motor Controller I2C address definition */ |
sayzyas | 0:653609b2a5cf | 49 | #define I2C_ADDRESS_HANDY 0x20 |
sayzyas | 0:653609b2a5cf | 50 | #define I2C_ADDRESS_WINCH 0x10 |
sayzyas | 0:653609b2a5cf | 51 | #define I2C_ADDRESS_TRANSFORM 0x08 |
sayzyas | 0:653609b2a5cf | 52 | #define I2C_ADDRESS_CRAWLER 0x04 |
sayzyas | 0:653609b2a5cf | 53 | #define I2C_ADDRESS_RESOLVER 0x02 |
sayzyas | 0:653609b2a5cf | 54 | |
sayzyas | 0:653609b2a5cf | 55 | |
sayzyas | 0:653609b2a5cf | 56 | /* Command definition */ |
sayzyas | 0:653609b2a5cf | 57 | //#define I2C_TFM_RF_K '6' |
sayzyas | 0:653609b2a5cf | 58 | //#define I2C_TFM_RF_I '8' |
sayzyas | 0:653609b2a5cf | 59 | //#define I2C_TFM_LB_K '7' |
sayzyas | 0:653609b2a5cf | 60 | //#define I2C_TFM_LB_I '5' |
sayzyas | 0:653609b2a5cf | 61 | //#define I2C_TFM_PAN_CW '2' |
sayzyas | 0:653609b2a5cf | 62 | //#define I2C_TFM_PAN_CCW '4' |
sayzyas | 0:653609b2a5cf | 63 | //#define I2C_TFM_TILT_UP '1' |
sayzyas | 0:653609b2a5cf | 64 | //#define I2C_TFM_TILT_DWN '3' |
sayzyas | 0:653609b2a5cf | 65 | |
sayzyas | 0:653609b2a5cf | 66 | /* Command definition */ |
sayzyas | 0:653609b2a5cf | 67 | #define MOTOR_1 '1' |
sayzyas | 0:653609b2a5cf | 68 | #define MOTOR_2 '2' |
sayzyas | 0:653609b2a5cf | 69 | |
sayzyas | 0:653609b2a5cf | 70 | #define MOTOR_FWD 'F' /* Forward Rotation */ |
sayzyas | 0:653609b2a5cf | 71 | #define MOTOR_RVS 'R' /* Reverse Rotation */ |
sayzyas | 0:653609b2a5cf | 72 | #define MOTOR_STP 'S' /* Stop */ |
sayzyas | 0:653609b2a5cf | 73 | |
sayzyas | 0:653609b2a5cf | 74 | #define HELLO_PACKET 'A' |
sayzyas | 0:653609b2a5cf | 75 | #define READ_MCURRENT_PACKET 'C' |
sayzyas | 0:653609b2a5cf | 76 | |
sayzyas | 0:653609b2a5cf | 77 | |
sayzyas | 0:653609b2a5cf | 78 | #define MOTOR_ON '0' |
sayzyas | 0:653609b2a5cf | 79 | #define MOTOR_OFF '1' |
sayzyas | 0:653609b2a5cf | 80 | |
sayzyas | 0:653609b2a5cf | 81 | #define LED_ON 0 |
sayzyas | 0:653609b2a5cf | 82 | #define LED_OFF 1 |
sayzyas | 0:653609b2a5cf | 83 | |
sayzyas | 0:653609b2a5cf | 84 | #define FLG_MOTOR1 1 |
sayzyas | 0:653609b2a5cf | 85 | #define FLG_MOTOR2 2 |
sayzyas | 0:653609b2a5cf | 86 | #define FLG_MOTOR_ON 1 |
sayzyas | 0:653609b2a5cf | 87 | #define FLG_MOTOR_OFF 0 |
sayzyas | 0:653609b2a5cf | 88 | |
sayzyas | 0:653609b2a5cf | 89 | enum { |
sayzyas | 0:653609b2a5cf | 90 | FLG_MOTOR_DIR_FWD, |
sayzyas | 0:653609b2a5cf | 91 | FLG_MOTOR_DIR_RVS, |
sayzyas | 0:653609b2a5cf | 92 | FLG_MOTOR_DIR_NONE |
sayzyas | 0:653609b2a5cf | 93 | }; |
sayzyas | 0:653609b2a5cf | 94 | |
sayzyas | 0:653609b2a5cf | 95 | |
sayzyas | 0:653609b2a5cf | 96 | |
sayzyas | 0:653609b2a5cf | 97 | #define MC_UPPER_LIMIT 95.0f |
sayzyas | 0:653609b2a5cf | 98 | #define MC_LOWER_LIMIT 5.0f |
sayzyas | 0:653609b2a5cf | 99 | #define MC_LOCK_COUNT 5 |
sayzyas | 0:653609b2a5cf | 100 | |
sayzyas | 0:653609b2a5cf | 101 | #define NumberOfPcCommand 11 |
sayzyas | 0:653609b2a5cf | 102 | #define NumberOfI2CCommand 10 |
sayzyas | 0:653609b2a5cf | 103 | |
sayzyas | 0:653609b2a5cf | 104 | #define ROTATE_PER_RESOLUTION 24 |