Xiaohai Li / Mbed 2 deprecated RPi_MOT_HAT

Dependencies:   mbed

Committer:
nightseas
Date:
Tue Aug 18 01:44:45 2015 +0000
Revision:
1:a6bcf44b90df
Parent:
0:633cef71e6ba
Child:
3:171f4d0ca77b
Commit for project export

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nightseas 0:633cef71e6ba 1 #ifndef _PE_BD_LIB_
nightseas 0:633cef71e6ba 2 #define _PE_BD_LIB_
nightseas 0:633cef71e6ba 3
nightseas 0:633cef71e6ba 4 //Number of on-board devices
nightseas 0:633cef71e6ba 5 extern const int LED_NUM_MAX;
nightseas 0:633cef71e6ba 6 extern const int MOT_NUM_MAX;
nightseas 0:633cef71e6ba 7 extern const int SRV_NUM_MAX;
nightseas 0:633cef71e6ba 8 extern const int VMON_NUM_MAX;
nightseas 0:633cef71e6ba 9 //The speed difference rate of left/right side motors when the vehicle turns head
nightseas 0:633cef71e6ba 10 extern const int MOT_TURN_RATE;
nightseas 0:633cef71e6ba 11 //Fixed PWM period of servos
nightseas 0:633cef71e6ba 12 extern const int SRV_PERIOD_US;
nightseas 0:633cef71e6ba 13
nightseas 0:633cef71e6ba 14 //LEDs on mother board and daughter board
nightseas 0:633cef71e6ba 15 extern DigitalOut led_mb;
nightseas 0:633cef71e6ba 16
nightseas 0:633cef71e6ba 17 //GPIO for L293DD motor direction control
nightseas 0:633cef71e6ba 18 //Forward = 2b'01, Backward = 2b'10, Stop = 2b'00
nightseas 0:633cef71e6ba 19 extern BusOut mot1_dir, mot2_dir, mot3_dir, mot4_dir;
nightseas 0:633cef71e6ba 20
nightseas 0:633cef71e6ba 21 //Analog inputs for power voltage monitoring
nightseas 0:633cef71e6ba 22 extern AnalogIn vin_bat;
nightseas 0:633cef71e6ba 23 extern AnalogIn vin_12v;
nightseas 0:633cef71e6ba 24 extern AnalogIn vin_5v;
nightseas 0:633cef71e6ba 25 extern AnalogIn vin_3v;
nightseas 0:633cef71e6ba 26
nightseas 0:633cef71e6ba 27 //TIM3 PWM channels
nightseas 0:633cef71e6ba 28 extern PwmOut mot1_pwm;
nightseas 0:633cef71e6ba 29 extern PwmOut mot2_pwm;
nightseas 0:633cef71e6ba 30 extern PwmOut mot3_pwm;
nightseas 0:633cef71e6ba 31 extern PwmOut mot4_pwm;
nightseas 0:633cef71e6ba 32
nightseas 0:633cef71e6ba 33 //TIM15 PWM channels
nightseas 0:633cef71e6ba 34 extern PwmOut servo1_pwm;
nightseas 0:633cef71e6ba 35 extern PwmOut servo2_pwm;
nightseas 0:633cef71e6ba 36 //TIM16 PWM channels
nightseas 0:633cef71e6ba 37 extern PwmOut servo3_pwm;
nightseas 0:633cef71e6ba 38 //TIM17 PWM channels
nightseas 0:633cef71e6ba 39 extern PwmOut servo4_pwm;
nightseas 0:633cef71e6ba 40
nightseas 0:633cef71e6ba 41 //Init functions
nightseas 0:633cef71e6ba 42 extern int BoardLibInit(void);
nightseas 0:633cef71e6ba 43
nightseas 0:633cef71e6ba 44 //DC motor functions
nightseas 0:633cef71e6ba 45 extern void Mot_Init(void);
nightseas 0:633cef71e6ba 46 extern void Mot_Ctrl(char dir, char turn, float speed);
nightseas 0:633cef71e6ba 47 extern void Mot_PwmSetup(int channel, int period, float duty);
nightseas 0:633cef71e6ba 48 extern void Mot_PwmWrite(int channel, float duty);
nightseas 0:633cef71e6ba 49 extern void Mot_SetDirection(int channel, char dir);
nightseas 0:633cef71e6ba 50
nightseas 1:a6bcf44b90df 51 //Motor velocimetoer functions
nightseas 1:a6bcf44b90df 52 void Mot_StartVelocimeter(void);
nightseas 1:a6bcf44b90df 53 void Mot_StopVelocimeter(void);
nightseas 1:a6bcf44b90df 54 int Mot_GetSpeed(int channel);
nightseas 1:a6bcf44b90df 55 void Mot_SpdPluseIntHandler1(void);
nightseas 1:a6bcf44b90df 56 void Mot_SpdPluseIntHandler2(void);
nightseas 1:a6bcf44b90df 57 void Mot_SpdPluseIntHandler3(void);
nightseas 1:a6bcf44b90df 58 void Mot_SpdPluseIntHandler4(void);
nightseas 1:a6bcf44b90df 59
nightseas 0:633cef71e6ba 60 //Servo functions
nightseas 0:633cef71e6ba 61 extern void Servo_Init(void);
nightseas 0:633cef71e6ba 62 extern void Servo_SetAngle(int channel, float angle);
nightseas 0:633cef71e6ba 63 extern void Servo_PwmSetup(int channel, int pulse_us);
nightseas 0:633cef71e6ba 64 extern void Servo_PwmWrite(int channel, int pulse_us);
nightseas 0:633cef71e6ba 65
nightseas 0:633cef71e6ba 66 //Voltage monitor functions
nightseas 0:633cef71e6ba 67 extern float Vmon_ReadVolt(int channel);
nightseas 0:633cef71e6ba 68
nightseas 0:633cef71e6ba 69 //On-board LED functions
nightseas 0:633cef71e6ba 70 extern void LedOn(int ch);
nightseas 0:633cef71e6ba 71 extern void LedOff(int ch);
nightseas 0:633cef71e6ba 72 extern void LedToggle(int ch);
nightseas 0:633cef71e6ba 73 extern void LedOffAll(void);
nightseas 0:633cef71e6ba 74 extern void LedOnAll(void);
nightseas 0:633cef71e6ba 75
nightseas 0:633cef71e6ba 76 #endif