From 64519e5c4b20ca05aaa8ce5f808f8481543bd0f9 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Sat, 27 Aug 2016 11:58:44 +0200 Subject: [PATCH] engine definitions and directions corrected --- source/application/drive_ctrl.c | 8 ++++---- source/application/include/engines.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/application/drive_ctrl.c b/source/application/drive_ctrl.c index c232a1d..7acc498 100644 --- a/source/application/drive_ctrl.c +++ b/source/application/drive_ctrl.c @@ -96,8 +96,8 @@ int drive_ctrl_set_speed_left(int speed_percent) { unsigned int front_speed = calc_speed_front(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); - ret |= drv_ioctl(drive_ctrl.left_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_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_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed); 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 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); - ret |= drv_ioctl(drive_ctrl.right_forward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&front_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_backward->pwm, IOCTL_PWM_SET_DUTY_CYCLE, (const void *)&back_speed); return ret; } diff --git a/source/application/include/engines.h b/source/application/include/engines.h index b0db92c..6a955ed 100644 --- a/source/application/include/engines.h +++ b/source/application/include/engines.h @@ -13,7 +13,7 @@ struct engine_ctrl { const struct driver *enable; }; -static struct engine_ctrl right_forward = { +static struct engine_ctrl left_forward = { .pwm = &pwm_4, .enable = &gpio_c2, }; @@ -23,7 +23,7 @@ static struct engine_ctrl right_backward = { .enable = &gpio_c3, }; -static struct engine_ctrl left_forward = { +static struct engine_ctrl right_forward = { .pwm = &pwm_2, .enable = &gpio_c0, };