Nanodrop.Device
(nanodrop v0.3.1)
Copy Markdown
USB device management for NanoDrop spectrophotometers.
Handles device enumeration, connection, and low-level USB communication using the Ocean Optics USB2000 endpoints.
Summary
Functions
Closes a device connection.
Lists all connected NanoDrop/USB2000 devices.
Opens a connection to a NanoDrop device.
Reads query response from the device (bulk transfer in on EP 0x87).
Reads spectrum data from the device (bulk transfer in on EP 0x82).
Sends a command to the device (bulk transfer out).
Types
@type device_info() :: %{ vendor_id: non_neg_integer(), product_id: non_neg_integer(), bus: non_neg_integer(), address: non_neg_integer(), device_ref: reference() }
@type t() :: %Nanodrop.Device{device_info: device_info(), handle: reference()}
Functions
@spec close(t()) :: :ok
Closes a device connection.
@spec list_devices() :: [device_info()]
Lists all connected NanoDrop/USB2000 devices.
@spec open(device_info() | nil) :: {:ok, t()} | {:error, term()}
Opens a connection to a NanoDrop device.
@spec read_query(t(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
Reads query response from the device (bulk transfer in on EP 0x87).
@spec read_spectrum(t(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
Reads spectrum data from the device (bulk transfer in on EP 0x82).
Sends a command to the device (bulk transfer out).