55This repository has the source code and kernel objects
66for the Raspberry Pi Mouse.
77
8- ## インストール
8+ ## Installation
9+
10+ Run the installation script ([ ` ./utils/build_install.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash ) ).
911
1012インストール用のシェルスクリプト([ ` ./utils/build_install.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash ) )を実行します。
1113
12- ### Raspbianの場合
14+ ### for Raspbian
1315
1416``` sh
1517$ git clone https://github.com/rt-net/RaspberryPiMouse.git
@@ -18,7 +20,7 @@ $ sudo apt install raspberrypi-kernel-headers build-essential
1820$ ./build_install.bash
1921```
2022
21- ### Ubuntuの場合
23+ ### for Ubuntu
2224
2325``` sh
2426$ git clone https://github.com/rt-net/RaspberryPiMouse.git
@@ -27,7 +29,7 @@ $ sudo apt install linux-headers-$(uname -r) build-essential
2729$ ./build_install.bash
2830```
2931
30- ## マニュアルインストール
32+ ### Manual installation
3133
3234``` sh
3335$ git clone https://github.com/rt-net/RaspberryPiMouse.git
@@ -36,9 +38,11 @@ $ make
3638$ sudo insmod rtmouse.ko
3739```
3840
39- ## ドライバの導入の際の注意
41+ ## Notes for the installation (ドライバの導入の際の注意)
42+
43+ ### for Raspbian
4044
41- ### Raspbian
45+ Enable SPI and I2C functions via ` raspi-config ` command.
4246
4347以下の設定を確認ください。
4448` raspi-config ` コマンドで設定します。
@@ -51,7 +55,12 @@ rtmouseをインストールして不具合が出た場合のみ以下の設定
5155
5256* Device Tree機能を「切」にする。
5357
54- ### arm64版Ubuntu18.04
58+ ### for arm64 Ubuntu18.04
59+
60+ According to
61+ [ issues #13 ] ( https://github.com/rt-net/RaspberryPiMouse/issues/13 ) ,
62+ it may be necessary to set the I2C baudrate lower than the default value.
63+ Add a following new line in ` /boot/firmware/config.txt ` to change the i2c_baudrate to 62.5 kHz.
5564
5665I2Cのbaudrateをデフォルト値より下げる必要があります([ issues #13 ] ( https://github.com/rt-net/RaspberryPiMouse/issues/13 ) )。
5766
@@ -61,13 +70,17 @@ I2Cのbaudrateをデフォルト値より下げる必要があります([issue
6170dtparam=i2c_baudrate=62500
6271```
6372
73+ The following command shows current i2c baudrate value.
74+
6475現在設定されているI2Cのbaudrateは以下のコマンドを実行することで確認できます。
6576
6677```
6778$ printf "%d\n" 0x$(xxd -ps /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency)
6879```
6980
70- ### Raspberry Pi 4
81+ ### for Raspberry Pi 4
82+
83+ Edit [ ` rtmouse.c ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54 ) to change the defined value ` RASPBERRYPI ` from '2' to '4'.
7184
7285Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります([ issues #21 ] ( https://github.com/rt-net/RaspberryPiMouse/issues/21 ) )。
7386Raspberry Pi 4で本ドライバを使用する際には` rtmouse.c ` の以下の行(2020年4月13日現在の最新版のv2.1.0では[ 54行目] ( https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54 ) )を` RASPBERRYPI 4 ` に書き換えて手動でビルドする必要があります。
@@ -81,7 +94,118 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の
8194#define RASPBERRYPI 2
8295```
8396
84- ### その他
97+ ## Device files
98+
99+ For example code of device files, please refer to [SampleProgram](./SampleProgram/README.md).
100+
101+ デバイスファイルの使用例は[サンプルプログラム](./SampleProgram/README.md)を参考にしてください。
102+
103+ ### Light sensor x4 (Input)
104+
105+ Read `/dev/rtlightsensor0` to get proximity (0:far ~ 4095:close) of objects detected by light sensors.
106+
107+ `/dev/rtlightsensor0`を読み取り、光センサで検出された物体の近接度 (0:遠い ~ 4095:近い)を取得します。
108+
109+ ```sh
110+ # cat /dev/rtlightsensor0
111+ # Return value: [front right] [right] [left] [front left]
112+ $ cat /dev/rtlightsensor0
113+ 9 2 13 3
114+ ```
115+
116+ ### Switch x3 (Input)
117+
118+ Read ` /dev/rtswitch0 ` ~ ` /dev/rtswitch2 ` to get the switches on/off state.
119+
120+ ` /dev/rtswitch0 ` ~ ` /dev/rtswitch2 ` を読み取りスイッチのON/OFF状態を取得します。
121+
122+ ``` sh
123+ # cat /dev/rtswitch[0,1]
124+ # Return value: 1(Open), 0(Pressed)
125+ $ cat /dev/rtswitch0
126+ ```
127+
128+ ### Buzzer (Output)
129+
130+ Write 0 ~ 20000 to ` /dev/rtbuzzer0 ` to beep the buzzer.
131+
132+ ` /dev/rtbuzzer0 ` に0 ~ 20000を書き込みブザーを鳴らします。
133+
134+ ``` sh
135+ # echo 0 ~ 20000(Hz) > /dev/rtbuzzer0
136+ $ echo 440 > /dev/rtbuzzer0
137+ $ echo 0 > /dev/rtbuzzer0
138+ ```
139+
140+ ### LED x4 (Output)
141+
142+ Write 1/0 to ` /dev/rtled0 ` ~ ` /dev/rtled3 ` to turn on/off the LEDs.
143+
144+ ` /dev/rtled0 ` ~ ` /dev/rtled3 ` に1/0を書き込みLEDを点灯/消灯します。
145+
146+ ``` sh
147+ # echo 0(OFF) or 1(ON) > /dev/rtled[0,1,2,3]
148+ $ echo 1 > /dev/rtled0
149+ $ echo 0 > /dev/rtled1
150+ ```
151+
152+ ### Motor enable (Output)
153+
154+ Write 1/0 to ` /dev/rtmotoren0 ` to enable/disable motors control.
155+
156+ ` /dev/rtmotoren0 ` に 1/0 を書き込みモータ操作を有効/無効にします。
157+
158+ ``` sh
159+ # echo 0(disable) or 1(enable) > /dev/rtmotoren0
160+ $ echo 1 > /dev/rtmotoren0
161+ ```
162+
163+ ### PWM frequency for left/right motor driver (Output)
164+
165+ Write 0 ~ 10000 to ` /dev/rtmotor_raw_l0 ` or ` /dev/rtmotor_raw_r0 ` to set PWM frequency for motor drivers.
166+
167+ ` /dev/rtmotor_raw_l0 ` または ` /dev/rtmotor_raw_r0 ` に 0 ~ 10000 を書き込み、モータドライバへのPWM周波数を設定します。
168+
169+ ``` sh
170+ # echo 0 ~ 10000(Hz) > /dev/rtmotor_raw_[l0, r0]
171+ $ echo 1 > /dev/rtmotoren0
172+ $ echo 400 > /dev/rtmotor_raw_l0
173+ ```
174+
175+ ### PWM frequencies and drive duration (Output)
176+
177+ Write left and right PWM frequencies and drive duration to ` /dev/rtmotor0 ` to drive both motors.
178+
179+ ` /dev/rtmotor0 ` に左右のPWM周波数と動作時間を書き込み、左右のモータを回します。
180+
181+ ``` sh
182+ # echo [left_freq Hz] [right_freq Hz] [duration ms] > /dev/rtmotor0
183+ $ echo 1 > /dev/rtmotoren0
184+ $ echo 400 800 1000 > /dev/rtmotor0
185+ ```
186+
187+ ### Pulse counter x2 (Input/Output)
188+
189+ Read ` /dev/rtcounter_* ` to get pulse counts of PWM for motor drivers or write values to reset counts.
190+
191+ ` /dev/rtcounter_* ` を読み取りモータドライバへのPWMパルス数を取得します。また、値を書き込みカウントをリセットします。
192+
193+ - unsigned counters : ` /dev/rtcounter_l0 ` , ` /dev/rtcounter_r0 `
194+ - signed counters : ` /dev/rtcounter_l1 ` , ` /dev/rtcounter_r1 `
195+
196+ ``` sh
197+ # cat /dev/rtcounter_[l0, r0]
198+ # Return value: 0 ~ 65565 (counts of PWM pulse)
199+ # cat /dev/rtcounter_[l1, r1]
200+ # Return value: -32767 ~ 32767 (counts of PWM pulse)
201+ $ cat /dev/rtcounter_l0
202+ 1104
203+ $ echo 0 > /dev/rtcounter_l0
204+ $ cat /dev/rtcounter_l0
205+ 0
206+ ```
207+
208+ ## その他
85209
86210その他のよくある質問については[ wiki] ( https://github.com/rt-net/RaspberryPiMouse/wiki#%E3%82%88%E3%81%8F%E3%81%82%E3%82%8B%E8%B3%AA%E5%95%8F ) にまとめています。
87211
0 commit comments