From 98045cc188b7c0a36e1e72128f5fd9ea66a7b92f Mon Sep 17 00:00:00 2001 From: YusukeKato Date: Tue, 19 Nov 2024 17:12:30 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3&=E5=AE=9F=E6=A9=9F=E3=81=A7?= =?UTF-8?q?=E5=8B=95=E4=BD=9C=E7=A2=BA=E8=AA=8D=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drivers/rtmouse_dev.c | 1 + src/drivers/rtmouse_i2c.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/drivers/rtmouse_dev.c b/src/drivers/rtmouse_dev.c index bb056f5..57ca4a6 100644 --- a/src/drivers/rtmouse_dev.c +++ b/src/drivers/rtmouse_dev.c @@ -270,6 +270,7 @@ static void set_motor_freq(int freq, const int dev_side) if (dev_side == DEV_LEFT) { motor_l_freq_is_positive = 0; rpi_gpio_set32(RPI_GPIO_P2MASK, 1 << MOTDIR_L_BASE); + freq = -freq; } else if (dev_side == DEV_RIGHT) { motor_r_freq_is_positive = 0; rpi_gpio_set32(RPI_GPIO_P2MASK, 1 << MOTDIR_R_BASE); diff --git a/src/drivers/rtmouse_i2c.c b/src/drivers/rtmouse_i2c.c index 76b07e4..e219212 100644 --- a/src/drivers/rtmouse_i2c.c +++ b/src/drivers/rtmouse_i2c.c @@ -215,10 +215,10 @@ static int rtcnt_i2c_probe(struct i2c_client *client, /* create character device */ if ((int)(id->driver_data) == 0) { - if (rtcnt_i2c_create_cdev(dev_info, DEVNAME_CNTL)) + if (rtcnt_i2c_create_cdev(dev_info, DEV_LEFT)) return -ENOMEM; } else if ((int)(id->driver_data) == 1) { - if (rtcnt_i2c_create_cdev(dev_info, DEVNAME_CNTR)) + if (rtcnt_i2c_create_cdev(dev_info, DEV_RIGHT)) return -ENOMEM; } @@ -256,10 +256,10 @@ static int rtcnt_i2c_probe(struct i2c_client *client) /* create character device */ if ((int)(id->driver_data) == 0) { - if (rtcnt_i2c_create_cdev(dev_info, DEVNAME_CNTL)) + if (rtcnt_i2c_create_cdev(dev_info, DEV_LEFT)) return -ENOMEM; } else if ((int)(id->driver_data) == 1) { - if (rtcnt_i2c_create_cdev(dev_info, DEVNAME_CNTR)) + if (rtcnt_i2c_create_cdev(dev_info, DEV_RIGHT)) return -ENOMEM; }