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.
(available-bytes port)
Estimates how many bytes are available for reading right now.
Estimates how many bytes are available for reading right now.
(available-ports)
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.
Defaut values for keys and options used throughout this namespace.
Defaut values for keys and options used throughout this namespace.
(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 ::name and ::closed?.
Cf. 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 ::name and ::closed?. Cf. `serial-port`
(flush port)
Ensures written bytes are properly flushed.
Ensures written bytes are properly flushed.
(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.
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-array this)
Converts the given argument to a byte array.
Converts the given argument to a byte array.
(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.
(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.
(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.
Cf. 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. Cf. `serial-port`
(serial-port path)
(serial-port path port-options)
Opens a serial port at the given path.
The configuration map may contain :
::baud-rate Preferably a standard baud rate.
::data-bits How many bits per data char one of #{5 6 7 8}.
::flow-control Handshaking for preventing the sender from sending too much too fast, one of
:none ;; No handshaking
:rts-cts ;; Hardware flow-control
:xon-xoff ;; Software flow-control
::parity Error detection, one of :
: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 Bits sent at the end of each data char, one of #{:1 :1.5 :2}.
Ex. (serial-port "/dev/ttyUSB0" {::baud-rate 2400 ::parity :none})
Cf. defaults
for defaut values relative to these options.
Opens a serial port at the given path. The configuration map may contain : ::baud-rate Preferably a standard baud rate. ::data-bits How many bits per data char one of #{5 6 7 8}. ::flow-control Handshaking for preventing the sender from sending too much too fast, one of :none ;; No handshaking :rts-cts ;; Hardware flow-control :xon-xoff ;; Software flow-control ::parity Error detection, one of : :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 Bits sent at the end of each data char, one of #{:1 :1.5 :2}. Ex. (serial-port "/dev/ttyUSB0" {::baud-rate 2400 ::parity :none}) Cf. `defaults` for defaut values relative to these options.
(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
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close