#define SET_A GPIO_SetBits(GPIOB, GPIO_Pin_7)
#define RESET_A GPIO_ResetBits(GPIOB, GPIO_Pin_7)
#define SET_B GPIO_SetBits(GPIOB, GPIO_Pin_9)
#define RESET_B GPIO_ResetBits(GPIOB, GPIO_Pin_9)
void smallGo(int n, bool left)
{
int i;
if(left == TRUE)
{
for(i = 0; i < n; i++)
{
SET_A;
RESET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
SET_A;
SET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
RESET_A;
SET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
RESET_A;
RESET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
}
}
else
{
for(i = 0; i < n; i++)
{
RESET_A;
SET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
SET_A;
SET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
SET_A;
RESET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
RESET_A;
RESET_B;
OSTimeDlyHMSM(0, 0, 0, DelaySmall);
}
}
}
|