Specifications

i2cRead(byteStr, numToRead, retries, ignoreFirstAck) – I2C Read
This function can only be used after function i2cInit() has been called.
I
2
C devices must be addressed before data can be read out of them, so this function really does a write
followed by a read.
Parameter byteStr specifies whatever “addressing” bytes must be sent to the device to get it to respond.
Parameter numToRead specifies how many bytes to read back from the external I
2
C device.
Parameter retries can be used to give slow devices extra time to respond. Try an initial retries value of
1, and increase it if needed. This controls a spin-lock count.
Some devices do not send an initial “ack” response. For these devices, set parameter ignoreFirstAck to
True. This will keep the lack of an initial acknowledgement from being counted as an I2C error.
This function returns the string of bytes read back from the external I
2
C device.
For more information about interfacing SNAP nodes to I
2
C devices, refer to section 6.
i2cWrite(byteStr, retries, ignoreFirstAck) – I
2
C Write
This function can only be used after function i2cInit() has been called.
Parameter byteStr specifies the data to be sent to the external I
2
C device, including whatever
“addressing” bytes must be sent to the device to get it to pay attention.
Parameter retries can be used to give slow devices extra time to respond. Try an initial retries value of
1, and increase it if needed.
Some devices do not send an initial “ack” response. For these devices, set parameter ignoreFirstAck to
True. This will keep the lack of an initial acknowledgement from being counted as an I
2
C error.
This function returns the number of bytes actually written.
For more information about interfacing SNAP nodes to I
2
C devices, refer to section 6.
initUart(uart, bps) – Initialize a UART (short form)
This function programs the specified uart (0 or 1) to the specified bits per second (bps).
A bps value of 0 disables the UART.
Page 58 of 202 SNAP Reference Manual Document Number 600-0007K