res =
fopen (obj) (dummy)
¶Opens I2C connection obj
This currently is a dummy function to improve compatibility to MATLAB
data =
fread (obj)
¶data =
fread (obj, size)
¶data =
fread (obj, size, precision)
¶[data,count] =
fread (obj, ...)
¶[data,count,errmsg] =
fread (obj, ...)
¶Reads data from I2C instrument
obj is a I2C object.
size Number of values to read. (Default: 100).
precision precision of data.
data data values.
count number of values read.
errmsg read operation error message.
struct =
get (i2c)
¶field =
get (i2c, property)
¶Get the properties of i2c object.
i2c - instance of octave_i2c class.
property - name of property.
When property was specified, return the value of that property.
otherwise return the values of all properties as a structure.
See also: @octave_i2c/set.
set
(obj, property,value)
¶set
(obj, property,value,…)
¶Set the properties of i2c object.
obj - instance of octave_i2c class.
property - name of property.
If property is a cell so must be value, it sets the values of all matching properties.
The function also accepts property-value pairs.
Set the name for the i2c socket.
Set the remote address for the i2c socket.
None
See also: @octave_i2c/get.
i2c =
i2c ([port_path], [address])
¶Open i2c interface.
port_path - the interface device port/path of type String. If omitted defaults to
’/dev/i2c-0’.
address - the slave device address. If omitted must be set using i2c_addr() call.
i2c - An instance of octave_i2c class.
The i2c object has the following properties:
Name of the object
the slave device address
The interface driver port (readonly)
(i2c, address)
¶addr =
i2c_addr (i2c)
¶Set new or get existing i2c slave device address.
i2c - instance of octave_i2c class.
address - i2c slave device address of type Integer.
The address is passed in the 7 or 10 lower bits of the argument.
addr - If address parameter is omitted, the i2c_addr() shall return current i2c slave device address.
(i2c)
¶Close the interface and release a file descriptor.
i2c - instance of octave_i2c class.
None
[data, count] =
i2c_read (i2c, n)
¶Read from i2c slave device.
i2c - instance of octave_i2c class.
n - number of bytes to attempt to read of type Integer.
The i2c_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.
n =
i2c_write (i2c, data)
¶Write data to a i2c slave device.
i2c - instance of octave_i2c class.
data - data, of type uint8, to be written to the slave device.
Upon successful completion, i2c_write() shall return the number of bytes written as the result n.