UartOW Class
This file defines the UartOW (UART to Dallas 1-wire) interface for libmraa
Methods
UartOW
-
uart
UartOW Constructor, takes a pin number which will map directly to the linux uart number, this 'enables' the uart, nothing more
Parameters:
-
uart
Numberthe index of the uart to use
Returns:
UartOW
-
path
UartOW Constructor, takes a string to the path of the serial interface that is needed.
Parameters:
-
path
Stringthe file path for the UART to use
Returns:
getDevicePath
()
String
Get string with tty device path within Linux For example. Could point to "/dev/ttyS0"
Returns:
char pointer of device path
readByte
()
Number
Read a byte from the 1-wire bus
Returns:
the byte read
writeByte
-
byte
Write a byte to a 1-wire bus
Parameters:
-
byte
Numberthe byte to write to the bus
Returns:
the byte read back during the time slot
writeBit
-
bit
Write a bit to a 1-wire bus and read a bit corresponding to the time slot back. This is possible due to the way we wired the TX and RX together with a diode, forming a loopback.
Parameters:
-
bit
Booleanthe bit to write to the bus
Returns:
the bit read back during the time slot
search
-
start
Begin a rom code search of the 1-wire bus. This function implements the 1-wire search algorithm. See the UartOW.cpp example for an idea on how to use this function to identify all devices present on the bus.
Parameters:
-
start
Booleantrue to start a search from scratch, false to continue a previously started search
Returns:
an empty string if no [more] devices are found, or a string containing the 8-byte romcode of a detected device.
crc8
-
buffer
Perform a Dallas 1-wire compliant CRC8 computation on a std::string based buffer
Parameters:
-
buffer
Stringstd::string buffer containing the data
Returns:
the computed CRC