diff --git a/.test/lint.sh b/.test/lint.sh index 5ae2bd1..c445865 100755 --- a/.test/lint.sh +++ b/.test/lint.sh @@ -7,6 +7,7 @@ SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); cd ../; pwd) lint_driver () { pushd $SRC_DIR/src/drivers python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse.c + python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse.h popd } @@ -25,4 +26,4 @@ check_driver_version () { lint_driver -check_driver_version \ No newline at end of file +check_driver_version diff --git a/src/drivers/Makefile.header_from_apt b/src/drivers/Makefile.header_from_apt index 7844404..c43215a 100644 --- a/src/drivers/Makefile.header_from_apt +++ b/src/drivers/Makefile.header_from_apt @@ -5,7 +5,7 @@ clean-files:= *.o *.ko *.mod.[co] *~ LINUX_SRC_DIR:=/usr/src/linux-headers-$(shell uname -r) VERBOSE:=0 -rtmouse.ko: rtmouse.c +rtmouse.ko: rtmouse.c rtmouse.h make -C $(LINUX_SRC_DIR) M=$(shell pwd) V=$(VERBOSE) modules clean: @@ -17,4 +17,4 @@ install: rtmouse.ko uninstall: rm /etc/udev/rules.d/50-rtmouse.rules -#Reference: http://www.devdrv.co.jp/linux/kernel26-makefile.htm \ No newline at end of file +#Reference: http://www.devdrv.co.jp/linux/kernel26-makefile.htm diff --git a/src/drivers/Makefile.header_from_source b/src/drivers/Makefile.header_from_source index 2222e8d..8d43e03 100644 --- a/src/drivers/Makefile.header_from_source +++ b/src/drivers/Makefile.header_from_source @@ -5,8 +5,8 @@ clean-files:= *.o *.ko *.mod.[co] *~ LINUX_SRC_DIR:=/usr/src/linux VERBOSE:=0 -rtmouse.ko: rtmouse.c +rtmouse.ko: rtmouse.c rtmouse.h make -C $(LINUX_SRC_DIR) M=$(shell pwd) V=$(VERBOSE) modules clean: - make -C $(LINUX_SRC_DIR) M=$(shell pwd) V=$(VERBOSE) clean \ No newline at end of file + make -C $(LINUX_SRC_DIR) M=$(shell pwd) V=$(VERBOSE) clean diff --git a/src/drivers/rtmouse.c b/src/drivers/rtmouse.c index caa4270..5b2d447 100644 --- a/src/drivers/rtmouse.c +++ b/src/drivers/rtmouse.c @@ -3,9 +3,9 @@ * rtmouse.c * Raspberry Pi Mouse device driver * - * Version: 3.3.1 + * Version: 3.3.2 * - * Copyright (C) 2015-2021 RT Corporation + * Copyright (C) 2015-2024 RT Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,100 +22,13 @@ * MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// define the Raspberry Pi version here -// Raspberry Pi 1 B/A/B+/A+: 1 -// Raspberry Pi 2 B : 2 -// Raspberry Pi 3 B/A+/B+ : 2 -// Raspberry Pi 4 B : 4 -#define RASPBERRYPI 2 +#include "rtmouse.h" MODULE_AUTHOR("RT Corporation"); MODULE_LICENSE("GPL"); -MODULE_VERSION("3.3.1"); +MODULE_VERSION("3.3.2"); MODULE_DESCRIPTION("Raspberry Pi Mouse device driver"); -/* --- Device ID --- */ -#define ID_DEV_LED 0 -#define ID_DEV_SWITCH 1 -#define ID_DEV_SENSOR 2 -#define ID_DEV_BUZZER 3 -#define ID_DEV_MOTORRAWR 4 -#define ID_DEV_MOTORRAWL 5 -#define ID_DEV_MOTOREN 6 -#define ID_DEV_MOTOR 7 -#define ID_DEV_CNT 8 -#define ID_DEV_SIZE 9 - -/* --- Device Numbers --- */ -static const unsigned int NUM_DEV[ID_DEV_SIZE] = { - [ID_DEV_LED] = 4, [ID_DEV_SWITCH] = 3, [ID_DEV_SENSOR] = 1, - [ID_DEV_BUZZER] = 1, [ID_DEV_MOTORRAWR] = 1, [ID_DEV_MOTORRAWL] = 1, - [ID_DEV_MOTOREN] = 1, [ID_DEV_MOTOR] = 1, [ID_DEV_CNT] = 2}; - -#define NUM_DEV_TOTAL \ - (NUM_DEV[ID_DEV_LED] + NUM_DEV[ID_DEV_SWITCH] + \ - NUM_DEV[ID_DEV_SENSOR] + NUM_DEV[ID_DEV_BUZZER] + \ - NUM_DEV[ID_DEV_MOTORRAWR] + NUM_DEV[ID_DEV_MOTORRAWL] + \ - NUM_DEV[ID_DEV_MOTOREN] + NUM_DEV[ID_DEV_MOTOR]) - -/* --- Device Names --- */ -static const char *NAME_DEV[ID_DEV_SIZE] = { - [ID_DEV_LED] = "rtled", - [ID_DEV_SWITCH] = "rtswitch", - [ID_DEV_SENSOR] = "rtlightsensor", - [ID_DEV_BUZZER] = "rtbuzzer", - [ID_DEV_MOTORRAWR] = "rtmotor_raw_r", - [ID_DEV_MOTORRAWL] = "rtmotor_raw_l", - [ID_DEV_MOTOREN] = "rtmotoren", - [ID_DEV_MOTOR] = "rtmotor"}; - -static const char *NAME_DEV_U[ID_DEV_SIZE] = { - [ID_DEV_LED] = "rtled%u", - [ID_DEV_SWITCH] = "rtswitch%u", - [ID_DEV_SENSOR] = "rtlightsensor%u", - [ID_DEV_BUZZER] = "rtbuzzer%u", - [ID_DEV_MOTORRAWR] = "rtmotor_raw_r%u", - [ID_DEV_MOTORRAWL] = "rtmotor_raw_l%u", - [ID_DEV_MOTOREN] = "rtmotoren%u", - [ID_DEV_MOTOR] = "rtmotor%u"}; - -#define DEVNAME_SENSOR "rtlightsensor" -#define DEVNAME_CNTR "rtcounter_r" -#define DEVNAME_CNTL "rtcounter_l" - -#define DRIVER_NAME "rtmouse" - -/* --- Device Major and Minor Numbers --- */ -#define DEV_MAJOR 0 -#define DEV_MINOR 0 - -static int spi_bus_num = 0; -static int spi_chip_select = 0; - static int _major_dev[ID_DEV_SIZE] = { [ID_DEV_LED] = DEV_MAJOR, [ID_DEV_SWITCH] = DEV_MAJOR, [ID_DEV_SENSOR] = DEV_MAJOR, [ID_DEV_BUZZER] = DEV_MAJOR, @@ -144,143 +57,6 @@ static volatile int cdev_index = 0; static struct mutex lock; -/* --- GPIO Pin Definitions --- */ -#define R_AD_CH 3 -#define L_AD_CH 0 -#define RF_AD_CH 2 -#define LF_AD_CH 1 - -#define R_LED_BASE 22 -#define L_LED_BASE 4 -#define RF_LED_BASE 27 -#define LF_LED_BASE 17 - -#define LED0_BASE 25 -#define LED1_BASE 24 -#define LED2_BASE 23 -#define LED3_BASE 18 - -#define SW1_PIN 20 -#define SW2_PIN 26 -#define SW3_PIN 21 - -#define BUZZER_BASE 19 - -#define MOTCLK_L_BASE 12 -#define MOTDIR_L_BASE 16 - -#define MOTCLK_R_BASE 13 -#define MOTDIR_R_BASE 6 - -#define MOTEN_BASE 5 - -#define PWM_ORG0_BASE 40 -#define PWM_ORG1_BASE 45 - -/* --- Register Address --- */ -/* Base Addr */ -#if RASPBERRYPI == 1 -#define RPI_REG_BASE 0x20000000 -#elif RASPBERRYPI == 2 -#define RPI_REG_BASE 0x3f000000 -#elif RASPBERRYPI == 4 -#define RPI_REG_BASE 0xfe000000 -/* 2711 has a different mechanism for pin pull-up/down/enable */ -#define GPPUPPDN0 57 /* Pin pull-up/down for pins 15:0 */ -#define GPPUPPDN1 58 /* Pin pull-up/down for pins 31:16 */ -#define GPPUPPDN2 59 /* Pin pull-up/down for pins 47:32 */ -#define GPPUPPDN3 60 /* Pin pull-up/down for pins 57:48 */ -#endif - -/* GPIO Addr */ -#define RPI_GPIO_OFFSET 0x200000 -#define RPI_GPIO_SIZE 0xC0 -#define RPI_GPIO_BASE (RPI_REG_BASE + RPI_GPIO_OFFSET) -#define REG_GPIO_NAME "RPi mouse GPIO" - -/* Pwm Addr */ -#define RPI_PWM_OFFSET 0x20C000 -#define RPI_PWM_SIZE 0xC0 -#define RPI_PWM_BASE (RPI_REG_BASE + RPI_PWM_OFFSET) -#define REG_PWM_NAME "RPi mouse PWM" - -/* Clock Addr */ -#define RPI_CLK_OFFSET 0x101000 -#define RPI_CLK_SIZE 0x100 -#define RPI_CLK_BASE (RPI_REG_BASE + RPI_CLK_OFFSET) -#define REG_CLK_NAME "RPi mouse CLK" - -/* --- General Options --- */ -/* Clock Offset */ -#define CLK_PWM_INDEX 0xa0 -#define CLK_PWMDIV_INDEX 0xa4 - -/* GPIO PUPD select */ -#if RASPBERRYPI == 4 -#define GPIO_PULLNONE 0x0 -#define GPIO_PULLUP 0x1 -#define GPIO_PULLDOWN 0x2 -#else -#define GPIO_PULLNONE 0x0 -#define GPIO_PULLDOWN 0x1 -#define GPIO_PULLUP 0x2 -#endif - -/* GPIO Function */ -#define RPI_GPF_INPUT 0x00 -#define RPI_GPF_OUTPUT 0x01 -#define RPI_GPF_ALT0 0x04 -#define RPI_GPF_ALT5 0x02 - -/* GPIO Register Index */ -#define RPI_GPFSEL0_INDEX 0 -#define RPI_GPFSEL1_INDEX 1 -#define RPI_GPFSEL2_INDEX 2 -#define RPI_GPFSEL3_INDEX 3 - -#define RPI_GPSET0_INDEX 7 -#define RPI_GPCLR0_INDEX 10 - -/* GPIO Mask */ -#define RPI_GPIO_P1MASK \ - (uint32_t)((0x01 << 2) | (0x01 << 3) | (0x01 << 4) | (0x01 << 7) | \ - (0x01 << 8) | (0x01 << 9) | (0x01 << 10) | (0x01 << 11) | \ - (0x01 << 14) | (0x01 << 15) | (0x01 << 17) | (0x01 << 18) | \ - (0x01 << 22) | (0x01 << 23) | (0x01 << 24) | (0x01 << 25) | \ - (0x01 << 27)) -#define RPI_GPIO_P2MASK (uint32_t)0xffffffff - -/* PWM Index */ -#define RPI_PWM_CTRL 0x0 -#define RPI_PWM_STA 0x4 -#define RPI_PWM_DMAC 0x8 -#define RPI_PWM_RNG1 0x10 -#define RPI_PWM_DAT1 0x14 -#define RPI_PWM_FIF1 0x18 -#define RPI_PWM_RNG2 0x20 -#define RPI_PWM_DAT2 0x24 - -#if RASPBERRYPI == 4 -#define PWM_BASECLK 27000000 -#else -#define PWM_BASECLK 9600000 -#endif - -/* A/D Parameter */ -#define MCP320X_PACKET_SIZE 3 -#define MCP320X_DIFF 0 -#define MCP320X_SINGLE 1 -#define MCP3204_CHANNELS 4 - -/* I2C Parameter */ -#define DEV_ADDR_CNTL 0x10 -#define DEV_ADDR_CNTR 0x11 -#define CNT_ADDR_MSB 0x10 -#define CNT_ADDR_LSB 0x11 - -/* Motor Parameter */ -#define MOTOR_UNCONTROLLABLE_FREQ 5 - /* --- Function Declarations --- */ static void set_motor_r_freq(int freq); static void set_motor_l_freq(int freq); @@ -366,8 +142,6 @@ static struct i2c_client *i2c_client_r = NULL; static struct i2c_client *i2c_client_l = NULL; static unsigned int motor_l_freq_is_positive = 1; static unsigned int motor_r_freq_is_positive = 1; -#define SIGNED_COUNT_SIZE 32767 -#define MAX_PULSE_COUNT 65535 /* I2C Device ID */ static struct i2c_device_id i2c_counter_id[] = { @@ -390,67 +164,8 @@ static struct i2c_driver i2c_counter_driver = { /* -- Device Addition -- */ MODULE_DEVICE_TABLE(spi, mcp3204_id); - MODULE_DEVICE_TABLE(i2c, i2c_counter_id); -/* -- Buffer -- */ -#define MAX_BUFLEN 64 -// static int buflen = 0; - -#define MOTOR_MOTION 0 -#if MOTOR_MOTION -/* Variable Type Definition for motor motion */ -typedef struct { - signed int r_hz; - signed int l_hz; - unsigned int time; -} t_motor_motion; - -#define MAX_MOTORBUFLEN 16 -static t_motor_motion motor_motion[MAX_MOTORBUFLEN]; -static unsigned int motor_motion_head = 0, motor_motion_tail = 0; - -static int motor_motion_push(int r_hz, int l_hz, int time) -{ - unsigned int next_tail = motor_motion_tail + 1; - - if (next_tail >= MAX_MOTORBUFLEN) { - next_tail = 0; - } - - if (next_tail == motor_motion_head) { - return -1; - } - - motor_motion[motor_motion_tail].r_hz = r_hz; - motor_motion[motor_motion_tail].l_hz = l_hz; - motor_motion[motor_motion_tail].time = time; - - motor_motion_tail = next_tail; - - return 0; -} - -static int motor_motion_pop(t_motor_motion **ret) -{ - unsigned int next_head = motor_motion_head + 1; - - if (motor_motion_tail == motor_motion_head) { - return -1; - } - - if (next_head >= MAX_MOTORBUFLEN) { - next_head = 0; - } - - *ret = (motor_motion + motor_motion_head); - - motor_motion_head = next_head; - - return 0; -} -#endif - /* --- GPIO Operation --- */ /* getPWMCount function for GPIO Operation */ static int getPWMCount(int freq) @@ -1531,8 +1246,8 @@ static int mcp3204_init(void) spi_register_driver(&mcp3204_driver); - mcp3204_info.bus_num = spi_bus_num; - mcp3204_info.chip_select = spi_chip_select; + mcp3204_info.bus_num = SPI_BUS_NUM; + mcp3204_info.chip_select = SPI_CHIP_SELECT; master = spi_busnum_to_master(mcp3204_info.bus_num); diff --git a/src/drivers/rtmouse.h b/src/drivers/rtmouse.h new file mode 100644 index 0000000..573e762 --- /dev/null +++ b/src/drivers/rtmouse.h @@ -0,0 +1,257 @@ +/* + * + * rtmouse.h + * Raspberry Pi Mouse device driver header + * + * Copyright (C) 2024 RT Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#ifndef RTMOUSE_H +#define RTMOUSE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// define the Raspberry Pi version here +// Raspberry Pi 1 B/A/B+/A+: 1 +// Raspberry Pi 2 B : 2 +// Raspberry Pi 3 B/A+/B+ : 2 +// Raspberry Pi 4 B : 4 +#define RASPBERRYPI 4 + +/* --- Device ID --- */ +#define ID_DEV_LED 0 +#define ID_DEV_SWITCH 1 +#define ID_DEV_SENSOR 2 +#define ID_DEV_BUZZER 3 +#define ID_DEV_MOTORRAWR 4 +#define ID_DEV_MOTORRAWL 5 +#define ID_DEV_MOTOREN 6 +#define ID_DEV_MOTOR 7 +#define ID_DEV_CNT 8 +#define ID_DEV_SIZE 9 + +/* --- Device Numbers --- */ +const unsigned int NUM_DEV[ID_DEV_SIZE] = { + [ID_DEV_LED] = 4, [ID_DEV_SWITCH] = 3, [ID_DEV_SENSOR] = 1, + [ID_DEV_BUZZER] = 1, [ID_DEV_MOTORRAWR] = 1, [ID_DEV_MOTORRAWL] = 1, + [ID_DEV_MOTOREN] = 1, [ID_DEV_MOTOR] = 1, [ID_DEV_CNT] = 2}; + +/* --- Device Names --- */ +const char *NAME_DEV[ID_DEV_SIZE] = {[ID_DEV_LED] = "rtled", + [ID_DEV_SWITCH] = "rtswitch", + [ID_DEV_SENSOR] = "rtlightsensor", + [ID_DEV_BUZZER] = "rtbuzzer", + [ID_DEV_MOTORRAWR] = "rtmotor_raw_r", + [ID_DEV_MOTORRAWL] = "rtmotor_raw_l", + [ID_DEV_MOTOREN] = "rtmotoren", + [ID_DEV_MOTOR] = "rtmotor"}; + +const char *NAME_DEV_U[ID_DEV_SIZE] = {[ID_DEV_LED] = "rtled%u", + [ID_DEV_SWITCH] = "rtswitch%u", + [ID_DEV_SENSOR] = "rtlightsensor%u", + [ID_DEV_BUZZER] = "rtbuzzer%u", + [ID_DEV_MOTORRAWR] = "rtmotor_raw_r%u", + [ID_DEV_MOTORRAWL] = "rtmotor_raw_l%u", + [ID_DEV_MOTOREN] = "rtmotoren%u", + [ID_DEV_MOTOR] = "rtmotor%u"}; + +#define NUM_DEV_TOTAL \ + (NUM_DEV[ID_DEV_LED] + NUM_DEV[ID_DEV_SWITCH] + \ + NUM_DEV[ID_DEV_SENSOR] + NUM_DEV[ID_DEV_BUZZER] + \ + NUM_DEV[ID_DEV_MOTORRAWR] + NUM_DEV[ID_DEV_MOTORRAWL] + \ + NUM_DEV[ID_DEV_MOTOREN] + NUM_DEV[ID_DEV_MOTOR]) + +#define DEVNAME_SENSOR "rtlightsensor" +#define DEVNAME_CNTR "rtcounter_r" +#define DEVNAME_CNTL "rtcounter_l" +#define DRIVER_NAME "rtmouse" + +/* SPI */ +#define SPI_BUS_NUM 0 +#define SPI_CHIP_SELECT 0 + +/* --- Device Major and Minor Numbers --- */ +#define DEV_MAJOR 0 +#define DEV_MINOR 0 + +/* --- GPIO Pin Definitions --- */ +#define R_AD_CH 3 +#define L_AD_CH 0 +#define RF_AD_CH 2 +#define LF_AD_CH 1 + +#define R_LED_BASE 22 +#define L_LED_BASE 4 +#define RF_LED_BASE 27 +#define LF_LED_BASE 17 + +#define LED0_BASE 25 +#define LED1_BASE 24 +#define LED2_BASE 23 +#define LED3_BASE 18 + +#define SW1_PIN 20 +#define SW2_PIN 26 +#define SW3_PIN 21 + +#define BUZZER_BASE 19 + +#define MOTCLK_L_BASE 12 +#define MOTDIR_L_BASE 16 + +#define MOTCLK_R_BASE 13 +#define MOTDIR_R_BASE 6 + +#define MOTEN_BASE 5 + +#define PWM_ORG0_BASE 40 +#define PWM_ORG1_BASE 45 + +/* --- Register Address --- */ +/* Base Addr */ +#if RASPBERRYPI == 1 +#define RPI_REG_BASE 0x20000000 +#elif RASPBERRYPI == 2 +#define RPI_REG_BASE 0x3f000000 +#elif RASPBERRYPI == 4 +#define RPI_REG_BASE 0xfe000000 +/* 2711 has a different mechanism for pin pull-up/down/enable */ +#define GPPUPPDN0 57 /* Pin pull-up/down for pins 15:0 */ +#define GPPUPPDN1 58 /* Pin pull-up/down for pins 31:16 */ +#define GPPUPPDN2 59 /* Pin pull-up/down for pins 47:32 */ +#define GPPUPPDN3 60 /* Pin pull-up/down for pins 57:48 */ +#endif + +/* GPIO Addr */ +#define RPI_GPIO_OFFSET 0x200000 +#define RPI_GPIO_SIZE 0xC0 +#define RPI_GPIO_BASE (RPI_REG_BASE + RPI_GPIO_OFFSET) +#define REG_GPIO_NAME "RPi mouse GPIO" + +/* Pwm Addr */ +#define RPI_PWM_OFFSET 0x20C000 +#define RPI_PWM_SIZE 0xC0 +#define RPI_PWM_BASE (RPI_REG_BASE + RPI_PWM_OFFSET) +#define REG_PWM_NAME "RPi mouse PWM" + +/* Clock Addr */ +#define RPI_CLK_OFFSET 0x101000 +#define RPI_CLK_SIZE 0x100 +#define RPI_CLK_BASE (RPI_REG_BASE + RPI_CLK_OFFSET) +#define REG_CLK_NAME "RPi mouse CLK" + +/* --- General Options --- */ +/* Clock Offset */ +#define CLK_PWM_INDEX 0xa0 +#define CLK_PWMDIV_INDEX 0xa4 + +/* GPIO PUPD select */ +#if RASPBERRYPI == 4 +#define GPIO_PULLNONE 0x0 +#define GPIO_PULLUP 0x1 +#define GPIO_PULLDOWN 0x2 +#else +#define GPIO_PULLNONE 0x0 +#define GPIO_PULLDOWN 0x1 +#define GPIO_PULLUP 0x2 +#endif + +/* GPIO Function */ +#define RPI_GPF_INPUT 0x00 +#define RPI_GPF_OUTPUT 0x01 +#define RPI_GPF_ALT0 0x04 +#define RPI_GPF_ALT5 0x02 + +/* GPIO Register Index */ +#define RPI_GPFSEL0_INDEX 0 +#define RPI_GPFSEL1_INDEX 1 +#define RPI_GPFSEL2_INDEX 2 +#define RPI_GPFSEL3_INDEX 3 + +#define RPI_GPSET0_INDEX 7 +#define RPI_GPCLR0_INDEX 10 + +/* GPIO Mask */ +#define RPI_GPIO_P1MASK \ + (uint32_t)((0x01 << 2) | (0x01 << 3) | (0x01 << 4) | (0x01 << 7) | \ + (0x01 << 8) | (0x01 << 9) | (0x01 << 10) | (0x01 << 11) | \ + (0x01 << 14) | (0x01 << 15) | (0x01 << 17) | (0x01 << 18) | \ + (0x01 << 22) | (0x01 << 23) | (0x01 << 24) | (0x01 << 25) | \ + (0x01 << 27)) +#define RPI_GPIO_P2MASK (uint32_t)0xffffffff + +/* PWM Index */ +#define RPI_PWM_CTRL 0x0 +#define RPI_PWM_STA 0x4 +#define RPI_PWM_DMAC 0x8 +#define RPI_PWM_RNG1 0x10 +#define RPI_PWM_DAT1 0x14 +#define RPI_PWM_FIF1 0x18 +#define RPI_PWM_RNG2 0x20 +#define RPI_PWM_DAT2 0x24 + +#if RASPBERRYPI == 4 +#define PWM_BASECLK 27000000 +#else +#define PWM_BASECLK 9600000 +#endif + +/* A/D Parameter */ +#define MCP320X_PACKET_SIZE 3 +#define MCP320X_DIFF 0 +#define MCP320X_SINGLE 1 +#define MCP3204_CHANNELS 4 + +/* I2C Parameter */ +#define DEV_ADDR_CNTL 0x10 +#define DEV_ADDR_CNTR 0x11 +#define CNT_ADDR_MSB 0x10 +#define CNT_ADDR_LSB 0x11 + +/* Motor Parameter */ +#define MOTOR_UNCONTROLLABLE_FREQ 5 + +/* I2C */ +#define SIGNED_COUNT_SIZE 32767 +#define MAX_PULSE_COUNT 65535 + +/* -- Buffer -- */ +#define MAX_BUFLEN 64 + +#endif // RTMOUSE_H diff --git a/utils/build_install_header_from_apt_raspi4.bash b/utils/build_install_header_from_apt_raspi4.bash index 482d675..5977601 100755 --- a/utils/build_install_header_from_apt_raspi4.bash +++ b/utils/build_install_header_from_apt_raspi4.bash @@ -11,7 +11,7 @@ rm Makefile ln -s Makefile.header_from_apt Makefile make clean # Update for Raspberry Pi 4 -sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.c +sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.h make sudo insmod rtmouse.ko diff --git a/utils/build_install_header_from_source_raspi4.bash b/utils/build_install_header_from_source_raspi4.bash index a09aabb..9a14ecf 100755 --- a/utils/build_install_header_from_source_raspi4.bash +++ b/utils/build_install_header_from_source_raspi4.bash @@ -11,7 +11,7 @@ rm Makefile ln -s Makefile.header_from_source Makefile make clean # Update for Raspberry Pi 4 -sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.c +sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.h make sudo insmod rtmouse.ko pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy