MTRCTL - Sets initial frequency of DC motors. - Controls motor speed according to IC specifications. - Handles motors in order to help the car during curved paths.
Dependents: frdm_MasterVehicle
Diff: mtrctl.h
- Revision:
- 0:4fc76af15d0e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtrctl.h Tue Oct 14 03:55:04 2014 +0000 @@ -0,0 +1,44 @@ +#ifndef _MTRCTL_H_ +#define _MTRCTL_H_ + +#include "mbed.h" + +/********************************************************************************** +* Servo parameters +***********************************************************************************/ +#define OP_PERIOD 90900/* us +* Description: operation period to control propulsion motors +*/ + +#define MAX_POWER 1000/* +* Description: logical, max value allowed for a PWM channel +*/ + +#define MIN_POWER 100/* +* Description: logical, min value allowed for a PWM channel +*/ + +#define MAX_DIRECTION_VAL 128/* +* Description: Maximum direction value, it means totally right, 0 means totally left +*/ + +#define SCALE_DIR2SPEED (uint16_t)(MAX_POWER/MAX_DIRECTION_VAL) + +/********************************************************************************** +* Variable types definition +***********************************************************************************/ +typedef enum +{ + nLeftMotor = 0, + nRightMotor, + nNoOfMotors +}MTRCTL_tenMotors; +/********************************************************************************** +* Global functions +***********************************************************************************/ +void MTRCTL_vInit( void ); +void MTRCTL_vSetMaxSpeed( uint16_t u16MaxSpeed ); +void MTRCTL_vSetMotorPower( uint16_t u16InPwr, MTRCTL_tenMotors enMotor ); +void MTRCTL_vSetSystemSpeed( uint16_t u16Speed, uint8_t u8Direction ); + +#endif \ No newline at end of file