Esp32.UART (esp32 v0.2.0)

Copy Markdown View Source

Serial transport for the bootloader: a Circuits.UART opened with SLIP framing, so reads yield whole decoded frames.

Summary

Functions

Drops pending input, including frames Circuits.UART has already queued.

Reads the next decoded frame.

USB vendor and product id of port, if it is a USB device.

Writes one packet; the framing adds the SLIP delimiters and escapes.

Functions

close(pid)

@spec close(pid()) :: :ok

flush(pid)

@spec flush(pid()) :: :ok

Drops pending input, including frames Circuits.UART has already queued.

open(port, baud)

@spec open(String.t(), pos_integer()) :: {:ok, pid()} | {:error, term()}

read_frame(pid, timeout)

@spec read_frame(pid(), non_neg_integer()) :: {:ok, term()} | {:error, term()}

Reads the next decoded frame.

set_baud(pid, baud)

@spec set_baud(pid(), pos_integer()) :: :ok | {:error, term()}

set_dtr(pid, value)

@spec set_dtr(pid(), boolean()) :: :ok | {:error, term()}

set_rts(pid, value)

@spec set_rts(pid(), boolean()) :: :ok | {:error, term()}

usb_ids(port, ports \\ Circuits.UART.enumerate())

@spec usb_ids(String.t(), map()) :: {non_neg_integer(), non_neg_integer()} | nil

USB vendor and product id of port, if it is a USB device.

write(pid, packet)

@spec write(pid(), binary()) :: :ok | {:error, term()}

Writes one packet; the framing adds the SLIP delimiters and escapes.