Liking cljdoc? Tell your friends :D

helins.rxtx

IO on serial ports based on jRXTX.

Any IO operation will throw an exception in case of failure.

IO on serial ports based on jRXTX.

Any IO operation will throw an exception in case of failure.
raw docstring

available-byte+clj

(available-byte+ port)

Estimates how many bytes are available for reading right now.

Estimates how many bytes are available for reading right now.
sourceraw docstring

available-port+clj

(available-port+)

Gets a set of available serial ports.

Prints an error if a port is already locked but does not throw.

Gets a set of available serial ports.

Prints an error if a port is already locked but does not throw.
sourceraw docstring

closeclj

(close port)

Closes a serial port.

Closes a serial port.
sourceraw docstring

default+clj

Defaut values for keys and options used throughout this namespace.

Defaut values for keys and options used throughout this namespace.
sourceraw docstring

describeclj

(describe port)

Describes the current status of the given serial port by providing a map containing the same keys as the option for opening a serial port as well as a :rxtx/name and :rxtx/closed?.

See serial-port.

Describes the current status of the given serial port by providing a map containing
the same keys as the option for opening a serial port as well as a :rxtx/name and :rxtx/closed?.

See [[serial-port]].
sourceraw docstring

flushclj

(flush port)

Ensures written bytes are properly flushed.

Ensures written bytes are properly flushed.
sourceraw docstring

input-streamclj

(input-stream port)

Given an open serial port, retrieves the associated java.io.InputStream.

Should not be needed unless really needed.

Given an open serial port, retrieves the associated `java.io.InputStream`.

Should not be needed unless really needed.
sourceraw docstring

IWritablecljprotocol

Anything that can be converted to a byte-array and then be written using a serial port.

Anything that can be converted to a byte-array and then be written using a serial port.

to-byte-arrayclj

(to-byte-array this)

Converts the given argument to a byte array.

Converts the given argument to a byte array.
sourceraw docstring

output-streamclj

(output-stream port)

Given an open serial port, retrieves the associated java.io.OutputStream.

Should not be needed unless really needed.

Given an open serial port, retrieves the associated `java.io.OutputStream`.

Should not be needed unless really needed.
sourceraw docstring

readclj

(read port n)
(read port n timeout-ms)

Reads an arbitrary amount of unsigned bytes from the serial port and returns them as a sequence.

If a timeout is provided, unblocks once it is up and returns what has been read up to this point. It not, blocks until n have been read, no less.

Reads an arbitrary amount of unsigned bytes from the serial port and returns them as a sequence.

If a timeout is provided, unblocks once it is up and returns what has been read up to this point.
It not, blocks until `n` have been read, no less.
sourceraw docstring

reconfigureclj

(reconfigure port port-options)

Reconfigures the given serial port on the fly by providing a map containing the same options as for opening a new port.

Missing options will not resolve to default values.

See serial-port.

Reconfigures the given serial port on the fly by providing a map containing the same options as for
opening a new port.

Missing options will not resolve to default values.

See [[serial-port]].
sourceraw docstring

serial-portclj

(serial-port path)
(serial-port path port-options)

Opens a serial port at the given path.

The configuration map may contain:

KeyDescription
:rxtx/baud-ratePreferably a standard baud rate
:rxtx/data-bitsHow many bits per data char one of #{5 6 7 8}
:rxtx/flow-controlHandshaking for preventing the sender from sending too much too fast, see below
:rxtx/parityError detection, see below
:rxtx/stop-bitsBits sent at the end of each data char, see below

Flow control is one of:

KeywordDescription
:noneNo handshaking
:rts-ctsHardware flow-control
:xon-xoffSoftware flow-control

Parity is one of:

KeywordDescription
:evenAn even parity bit will be sent for each data char
:markMark parity bit
:noneNo parity bit
:oddOdd parity will be sent for each data char
:spaceSpace parity

Stop-bits is one of:

  • :stop-bits-1
  • :stop-bits-1.5
  • :stop-bits-2

See default+ for default values relative to these options.

(serial-port "/dev/ttyUSB0"
             {:rxtx/baud-rate 2400
              :rxtx/parity    :none})
Opens a serial port at the given path.

The configuration map may contain:

| Key | Description |
|---|---|
| :rxtx/baud-rate | Preferably a standard baud rate |
| :rxtx/data-bits | How many bits per data char one of #{5 6 7 8} |
| :rxtx/flow-control | Handshaking for preventing the sender from sending too much too fast, see below |
| :rxtx/parity | Error detection, see below |
| :rxtx/stop-bits | Bits sent at the end of each data char, see below |

Flow control is one of:

| Keyword | Description |
|---|---|
| :none | No handshaking |
| :rts-cts | Hardware flow-control |
| :xon-xoff | Software flow-control |

Parity is one of:

| Keyword | Description |
|---|---|
| :even | An even parity bit will be sent for each data char |
| :mark | Mark parity bit |
| :none | No parity bit |
| :odd | Odd parity will be sent for each data char |
| :space |Space parity |

Stop-bits is one of:

- :stop-bits-1
- :stop-bits-1.5
- :stop-bits-2

See [[default+]] for default values relative to these options.


```clojure
(serial-port "/dev/ttyUSB0"
             {:rxtx/baud-rate 2400
              :rxtx/parity    :none})
```
sourceraw docstring

writeclj

(write port writable)

Writes to the serial port anything satisfying the IWritable protocol.

Are already available:

  • Byte arrays
  • Characters
  • Sequences of any sort (seqables)
  • Number converted to a single unsigned byte
  • Strings
Writes to the serial port anything satisfying the [[IWritable]] protocol.

Are already available:

- Byte arrays
- Characters
- Sequences of any sort (seqables)
- Number converted to a single unsigned byte
- Strings
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close