diff -r -c ../legOS-0.1.7/direct-motor.c ./direct-motor.c *** ../legOS-0.1.7/direct-motor.c Fri Mar 19 11:34:55 1999 --- ./direct-motor.c Mon Mar 29 23:10:30 1999 *************** *** 115,120 **** --- 115,123 ---- // void dm_init(void) { dm_shutdown(); // shutdown hardware + dm_a.pattern=&dm_a_pattern; + dm_b.pattern=&dm_b_pattern; + dm_c.pattern=&dm_c_pattern; } diff -r -c ../legOS-0.1.7/include/direct-motor.h ./include/direct-motor.h *** ../legOS-0.1.7/include/direct-motor.h Fri Mar 19 11:34:55 1999 --- ./include/direct-motor.h Mon Mar 29 22:04:47 1999 *************** *** 61,66 **** --- 61,67 ---- } access; //!< provides access from C and assembler unsigned char dir; //!< output pattern when sum overflows + const unsigned char *pattern; //!< pointer to array of direction patterns } MotorState; *************** *** 127,132 **** --- 128,146 ---- dm_c.dir=dm_c_pattern[dir]; } + //! Set arbitrary motor direction + /*! \param state pointer to the state struct for the motor on which to operate + * \param dir direction to set the motor to + */ + extern const inline + void + motor_dir( + MotorState *state, + unsigned char dir + ) { + state->dir=(state->pattern)[dir]; + } + //! set motor A speed /*! \param speed the speed *************** *** 148,153 **** --- 162,194 ---- extern const inline void motor_c_speed(unsigned char speed) { dm_c.access.c.delta=speed; } + + //! Set arbitrary motor speed + /*! \param state pointer to the state struct for the motor on which to operate + * \param speed speed to set the motor to + */ + extern const inline + void + motor_speed( + MotorState *state, + unsigned char speed + ) { + state->access.c.delta=speed; + } + + + //! Get arbitrary motor speed + /*! \param state pointer to the state struct for the motor on which to operate + * \return the current speed of the motor + */ + extern const inline + unsigned char + get_motor_speed( + MotorState *state + ) { + return state->access.c.delta; + } + #endif // NO_DIRECT_MOTOR