8.5.2. Serial Port
(packages/devices/serial.lsh)


This package provides a simple interface for writing data to a serial port. It does not yet provide functions for reading from the serial port.

8.5.2.0. low-level serial port functions
(packages/devices/serial.lsh)


These functions provide a low-level interface to the serial port.

8.5.2.0.0. (serial-close fd)
(packages/devices/serial.lsh)


close file descriptor fd .

8.5.2.0.1. (serial-open port speed bits parity stop)
(packages/devices/serial.lsh)


Open a serial port for writing. port can be any serial device, e.g. "/dev/ttyS0", or "/dev/ttyS1". speed : baud rate, which can take one of the following values: 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200. bits : number of data bits. Can be between 5 and 8. parity : parity mode, can be "N" (no parity), "E" (even), or "O" (odd). stop : number of stop bits. Can be 1 or 2.

8.5.2.0.2. (fd-write-byte fd c)
(packages/devices/serial.lsh)


write unsigned byte c to file descriptor fd .

8.5.2.0.3. (fd-write-string fd s)
(packages/devices/serial.lsh)


write string s to file descriptor fd .

8.5.2.0.4. (fd-read-byte fd c)
(packages/devices/serial.lsh)


Read one unsigned byte c from file descriptor fd . When not data is available, this function waits until at least one byte is received. Returns -1 if an error occurs.

8.5.2.0.5. (fd-read-test fd)
(packages/devices/serial.lsh)


Test if data is available for reading on file descriptor fd using the unix function select(2).

8.5.2.1. serial-port
(packages/devices/serial.lsh)


A class for writing to a serial port.

8.5.2.1.0. (new serial-port port speed bits parity stop)
[CLASS] (packages/devices/serial.lsh)


Create a new serial-port object. port can be any serial device, e.g. "/dev/ttyS0", or "/dev/ttyS1". speed : baud rate, which can take one of the following values: 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200. bits : number of data bits. Can be between 5 and 8. parity : parity mode, can be "N" (no parity), "E" (even), or "O" (odd). stop : number of stop bits. Can be 1 or 2. The serial port is closed automatically upon destruction of the object.

8.5.2.1.1. (==> serial-port write-byte b)
[MSG] (packages/devices/serial.lsh)


write unsigned byte b to serial port.

8.5.2.1.2. (==> serial-port write-string s)
[MSG] (packages/devices/serial.lsh)


write string s to serial port.