MRAA

MRAA is a low level skeleton library for communication on GNU/Linux platforms. See examples here.

UartOW Class

Module: mraa

This file defines the UartOW (UART to Dallas 1-wire) interface for libmraa

Methods

UartOW

(
  • uart
)
Number

UartOW Constructor, takes a pin number which will map directly to the linux uart number, this 'enables' the uart, nothing more

Parameters:

  • uart Number

    the index of the uart to use

Returns:

Number:

UartOW

(
  • path
)
Number

UartOW Constructor, takes a string to the path of the serial interface that is needed.

Parameters:

  • path String

    the file path for the UART to use

Returns:

Number:

getDevicePath

() String

Get string with tty device path within Linux For example. Could point to "/dev/ttyS0"

Returns:

String:

char pointer of device path

readByte

() Number

Read a byte from the 1-wire bus

Returns:

Number:

the byte read

writeByte

(
  • byte
)
Number

Write a byte to a 1-wire bus

Parameters:

  • byte Number

    the byte to write to the bus

Returns:

Number:

the byte read back during the time slot

writeBit

(
  • bit
)
Boolean

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 Boolean

    the bit to write to the bus

Returns:

Boolean:

the bit read back during the time slot

crc8

(
  • buffer
)
Number

Perform a Dallas 1-wire compliant CRC8 computation on a std::string based buffer

Parameters:

  • buffer String

    std::string buffer containing the data

Returns:

Number:

the computed CRC