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
105108Example 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
117121Example 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
129134Example 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
156163Example of use:
157164
158165``` ruby
159- i2c.write ( 0x45 , 0x30 , 0xa2 )
166+ i2c.raw_write ( 0x45 , 0x30 , 0xa2 )
160167```
0 commit comments