mraa
2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
|
This file defines the UartOW (UART to Dallas 1-wire) interface for libmraa
Public Member Functions | |
UartOW (int uart) | |
UartOW (std::string path) | |
UartOW (void *uart_ow_context) | |
~UartOW () | |
std::string | getDevicePath () |
uint8_t | readByte () |
uint8_t | writeByte (uint8_t byte) |
bool | writeBit (bool bit) |
mraa::Result | reset () |
mraa::Result | search (bool start, uint8_t *id) |
std::string | search (bool start) |
mraa::Result | command (uint8_t command, uint8_t *id) |
mraa::Result | command (uint8_t command, std::string id) |
uint8_t | crc8 (uint8_t *buffer, uint16_t length) |
uint8_t | crc8 (std::string buffer) |
|
inline |
UartOW Constructor, takes a pin number which will map directly to the linux uart number, this 'enables' the uart, nothing more
uart | the index of the uart to use |
std::invalid_argument | in case of error |
|
inline |
UartOW Constructor, takes a string to the path of the serial interface that is needed.
path | the file path for the UART to use |
std::invalid_argument | in case of error |
|
inline |
|
inline |
Get string with tty device path within Linux For example. Could point to "/dev/ttyS0"
|
inline |
Read a byte from the 1-wire bus
std::invalid_argument | in case of error |
|
inline |
Write a byte to a 1-wire bus
byte | the byte to write to the bus |
std::invalid_argument | in case of error |
|
inline |
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.
bit | the bit to write to the bus |
std::invalid_argument | in case of error |
|
inline |
Send a reset pulse to the 1-wire bus and test for device presence
|
inline |
Begin a rom code search of the 1-wire bus. This function implements the 1-wire search algorithm. See the uart_ow.c example for an idea on how to use this function to identify all devices present on the bus.
start | true to start a search from scratch, false to continue a previously started search |
id | the 8-byte rom code id of the current matched device when a device is found |
|
inline |
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.
start | true to start a search from scratch, false to continue a previously started search |
|
inline |
Send a command byte to a device on the 1-wire bus
command | the command byte to send |
id | the rom code id of the device to receive the command, NULL for all devices on the bus |
|
inline |
Send a command byte to a device on the 1-wire bus, supplying the id as a std::string
command | the command byte to send |
id | std::string representing the code id of the device to receive the command, or an empty string for all devices on the bus. This string should be 8 bytes in size. |
|
inline |
Perform a Dallas 1-wire compliant CRC8 computation on a buffer
buffer | the buffer containing the data |
length | the length of the buffer |
|
inline |
Perform a Dallas 1-wire compliant CRC8 computation on a std::string based buffer
buffer | std::string buffer containing the data |