1 /* SET_OUTPUT_STATE */ 2 typedef enum 3 { 4 NXT_MODE_MOTORON = 0x01, 5 NXT_MODE_BRAKE = 0x02, 6 NXT_MODE_REGULATED = 0x04 7 } nxt_output_mode_t; 8 9 typedef enum 10 { 11 NXT_REGULATION_MODE_IDLE = 0x00, 12 NXT_REGULATION_MODE_MOTOR_SPEED = 0x01, 13 NXT_REGULATION_MODE_MOTOR_SYNC = 0X02 14 } nxt_output_regulation_mode_t; 15 16 typedef enum 17 { 18 NXT_RUN_STATE_IDLE = 0x00, 19 NXT_RUN_STATE_RAMPUP = 0x10, 20 NXT_RUN_STATE_RUNNING = 0x20, 21 NXT_RUN_STATEE_RAMPDOWN = 0x40 22 } nxt_output_runstate_t; 23 24 typedef struct 25 { 26 nxt_output_mode_t mode; 27 nxt_output_regulation_mode_t regulation_mode; 28 nxt_output_runstate_t run_state; 29 int power; 30 int turn_ratio; 31 unsigned long tacho_limit; 32 } nxt_output_state_t; 33 34 #define NXT_OUTPUT_INIT { NXT_MODE_BRAKE, NXT_REGULATION_MODE_IDLE, \ 35 NXT_RUN_STATE_IDLE, 0, 0, 0 } 36 37