Skip to content

Commit 5232133

Browse files
Add comment about method level for I2C. (#1)
add comment about method level and fix small mistake.
1 parent df109f2 commit 5232133

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

mruby_io_I2C_en.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- A class that supports I2C bus.
44
- This specification supports only master devices with 7-bit addresses.
5+
- Define two types of methods: convenience methods, which are easy to use, and low-level methods, which provide detailed control.
6+
- The low-level methods should be implemented on an as-needed basis, since it is unlikely that they will be needed in most cases.
57

68
---
79

@@ -100,6 +102,7 @@ S -- adrs W A -- data_1 A -- ... -- data_n N -- P
100102

101103
### send_start()
102104

105+
- Low level method.
103106
- Outputs a StartCondition to the I2C bus.
104107

105108
Example of use:
@@ -112,7 +115,8 @@ i2c.send_start
112115

113116
### send_restart()
114117

115-
- Outputs a RestartCondition to the I2C bus.
118+
- Low level method.
119+
- Outputs a Restart (RepeatedStart) Condition to the I2C bus.
116120

117121
Example of use:
118122

@@ -124,6 +128,7 @@ i2c.send_restart
124128

125129
### send_stop()
126130

131+
- Low level method.
127132
- Outputs a StopCondition to the I2C bus.
128133

129134
Example of use:
@@ -136,6 +141,7 @@ i2c.send_stop
136141

137142
### raw_read( read_bytes, ack_nack = false ) -> String
138143

144+
- Low level method.
139145
- Reads read_bytes bytes from the I2C bus and returns them.
140146
- ack_nack = true outputs ACK at the last byte reading, and false outputs NACK.
141147

@@ -149,12 +155,13 @@ str = i2c.raw_read( 20 )
149155

150156
### raw_write( *outputs ) -> Integer
151157

158+
- Low level method.
152159
- Writes data specified in outputs to the I2C bus.
153160
- The number of bytes successfully written is returned as the return value.
154161
- outputs can be specified as an Integer, Array<Integer>, or String.
155162

156163
Example of use:
157164

158165
```ruby
159-
i2c.write( 0x45, 0x30, 0xa2 )
166+
i2c.raw_write( 0x45, 0x30, 0xa2 )
160167
```

mruby_io_I2C_ja.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- I2C バスをサポートするクラス。
44
- この仕様書ではマスターデバイス、7ビットアドレスのみをサポートしている。
5+
- 容易に使う事ができるコンビニエンスメソッドと、細かな制御ができる低レベルメソッドを定義する。
6+
- 低レベルメソッドは、ほとんどの場合必要ないと思われるので、必要に応じて実装すれば良い。
57

68
---
79

@@ -100,6 +102,7 @@ S -- adrs W A -- data_1 A -- ... -- data_n N -- P
100102

101103
### send_start()
102104

105+
- Low level method.
103106
- I2Cバスに StartCondition を出力する。
104107

105108
使用例
@@ -112,7 +115,8 @@ i2c.send_start
112115

113116
### send_restart()
114117

115-
- I2Cバスに RestartCondition を出力する。
118+
- Low level method.
119+
- I2Cバスに Restart (RepeatedStart) Condition を出力する。
116120

117121
使用例
118122

@@ -124,6 +128,7 @@ i2c.send_restart
124128

125129
### send_stop()
126130

131+
- Low level method.
127132
- I2Cバスに StopCondition を出力する。
128133

129134
使用例
@@ -136,6 +141,7 @@ i2c.send_stop
136141

137142
### raw_read( read_bytes, ack_nack = false ) -> String
138143

144+
- Low level method.
139145
- I2Cバスから read_bytes バイト読み込んで返す。
140146
- ack_nack = true で最後のバイト読み込み時に ACK を、false で NACK 出力する。
141147

@@ -149,12 +155,13 @@ str = i2c.raw_read( 20 )
149155

150156
### raw_write( *outputs ) -> Integer
151157

158+
- Low level method.
152159
- I2Cバスへ outputs で指定したデータを書き込む。
153160
- 書き込みできたバイト数が戻り値として返る。
154161
- outputsは、Integer, Array\<Integer\> および String で指定する。
155162

156163
使用例
157164

158165
```ruby
159-
i2c.write( 0x45, 0x30, 0xa2 )
166+
i2c.raw_write( 0x45, 0x30, 0xa2 )
160167
```

0 commit comments

Comments
 (0)