TMiletusRaspberryUART
Out of the box, the Raspberry Pi is also equipped with the good old serial port, or called UART
.
For serial communications, the baud rate, the bit count and parity can all be set via properties of TMiletusRaspberryUART
. Below is a list of available properties and methods for TMiletusRaspberryUART
.
Properties for TMiletusRaspberryUART
Property |
Description |
BaudRate: Integer |
Set the baud rate |
PortNum: TMiletusRaspberryUARTPortNum |
Select the UART port. Possible values are miniUART , firstPL011 and devUSB |
Parity: TMiletusRaspberryUARTParity |
Select the parity. Accepted values are upNone , upOdd , upEven , upMark and upSpace . The default values is upNone |
BitCount: Integer |
Number of bits in the communication |
StopBit: TMiletusRaspberryUARTStopBit |
Select the number of stop bits. Accepted values are sb1 (1) , sb1andHalf (1.5) and sb2 (2) . |
USBDevice: string |
The USB device path to connect to. When PortNum is set to devUSB . For example: /dev/ttyUSB0 |
Methods for TMiletusRaspberryUART
Property |
Description |
Open |
Open the connection |
Close |
Close the connection |
WriteBuffer(ABuffer: TBytes; ALength: Integer): TJSPromise |
Write a buffer of data |
ReadBuffer(var ABuffer: TBytes; ALength: Integer): TJSPromise |
Read a buffer of data |
CanRead(ATimeout: Integer): TJSPromise |
Check if data can be read from the port. Resolves to a Boolean |
CanWrite(ATimeout: Integer): TJSPromise |
Check if data can be written to the port. Resolves to a Boolean |
EnableRTSToggle(AValue: Boolean) |
Enable/disable RTS driven communication |
WaitingData: TJSPromise |
Check the number of bytes waiting for reading. Resolves to an Integer |
SendingData: TJSPromise |
Check the number of bytes waiting for sending. Resolves to an Integer |
ModemStatus: TJSPromise |
Check the modem status code. Resolves to an Integer |
SetRTS(AValue: Boolean): TJSPromise |
Set the value of the RTS signal |
GetCTS: TJSPromise |
Get the value of the CTS signal |
SetDTR(AValue: Boolean) |
Set the value of the DTR signal |
GetDSR: TJSPromise |
Get the value of the DSR signal |
Events for TMiletusRaspberryUART
Event |
Description |
OnOpen |
Event triggered when the connection is opened |
OnClose |
Event triggered when the connection is closed |