Merge branch 'fix/engine_def' into 'develop'
Fix/engine def See merge request !12
This commit is contained in:
commit
fb70c95121
@ -96,8 +96,8 @@ int drive_ctrl_set_speed_left(int speed_percent)
|
|||||||
{
|
{
|
||||||
unsigned int front_speed = calc_speed_front(speed_percent);
|
unsigned int front_speed = calc_speed_front(speed_percent);
|
||||||
unsigned int back_speed = calc_speed_back(speed_percent);
|
unsigned int back_speed = calc_speed_back(speed_percent);
|
||||||
int ret = drv_ioctl(drive_ctrl.left_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed);
|
int ret = drv_ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed);
|
||||||
ret |= drv_ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed);
|
ret |= drv_ioctl(drive_ctrl.left_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -106,8 +106,8 @@ int drive_ctrl_set_speed_right(int speed_percent)
|
|||||||
{
|
{
|
||||||
unsigned int front_speed = calc_speed_front(speed_percent);
|
unsigned int front_speed = calc_speed_front(speed_percent);
|
||||||
unsigned int back_speed = calc_speed_back(speed_percent);
|
unsigned int back_speed = calc_speed_back(speed_percent);
|
||||||
int ret = drv_ioctl(drive_ctrl.right_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed);
|
int ret = drv_ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed);
|
||||||
ret |= drv_ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_speed);
|
ret |= drv_ioctl(drive_ctrl.right_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -13,24 +13,24 @@ struct engine_ctrl {
|
|||||||
const struct driver *enable;
|
const struct driver *enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct engine_ctrl right_forward = {
|
|
||||||
.pwm = &pwm_2,
|
|
||||||
.enable = &gpio_c0,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct engine_ctrl right_backward = {
|
|
||||||
.pwm = &pwm_1,
|
|
||||||
.enable = &gpio_c1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct engine_ctrl left_forward = {
|
static struct engine_ctrl left_forward = {
|
||||||
.pwm = &pwm_4,
|
.pwm = &pwm_4,
|
||||||
.enable = &gpio_c2,
|
.enable = &gpio_c2,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct engine_ctrl left_backward = {
|
static struct engine_ctrl right_backward = {
|
||||||
.pwm = &pwm_3,
|
.pwm = &pwm_3,
|
||||||
.enable = &gpio_c3,
|
.enable = &gpio_c3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct engine_ctrl right_forward = {
|
||||||
|
.pwm = &pwm_2,
|
||||||
|
.enable = &gpio_c0,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct engine_ctrl left_backward = {
|
||||||
|
.pwm = &pwm_1,
|
||||||
|
.enable = &gpio_c1,
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* SOURCE_APPLICATION_INCLUDE_ENGINES_H_ */
|
#endif /* SOURCE_APPLICATION_INCLUDE_ENGINES_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user