Documentation ¶
Overview ¶
Package usbtmc uses libusb to communicate with USB Test & Measurement Class (USBTMC) compliant devices.
Index ¶
- func Register(d driver.Driver)
- type Context
- type Device
- func (d *Device) Close() error
- func (d *Device) Command(format string, a ...interface{}) error
- func (d *Device) Query(s string) (string, error)
- func (d *Device) Read(p []byte) (n int, err error)
- func (d *Device) Write(p []byte) (n int, err error)
- func (d *Device) WriteString(s string) (n int, err error)
- type VisaResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context hold the USB context for the registered driver.
func NewContext ¶
NewContext creates a new USB context using the registered driver.
func (*Context) NewDevice ¶
NewDevice creates a new USBTMC compliant device based on the given VISA address string.
func (*Context) NewDeviceByVIDPID ¶
NewDeviceByVIDPID creates new USBTMC compliant device based on the given the vendor ID and product ID. If multiple USB devices matching the VID and PID are found, only the first is returned.
func (*Context) SetDebugLevel ¶
SetDebugLevel sets the debug level for the underlying USB device using the given integer.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device models a USBTMC device, which includes a USB device and the required USBTMC attributes and methods.
func (*Device) Command ¶ added in v0.3.0
Command sends the SCPI/ASCII command to the underlying USB device. A newline character is automatically added to the end of the string.
func (*Device) Query ¶
Query writes the given string to the USBTMC device and returns the returned value as a string. A newline character is automatically added to the query command sent to the instrument.
func (*Device) Read ¶
Read creates and sends the header on the bulk out endpoint and then reads from the bulk in endpoint per USBTMC standard.
type VisaResource ¶
type VisaResource struct {
// contains filtered or unexported fields
}
VisaResource represents a VISA enabled piece of test equipment.
func NewVisaResource ¶
func NewVisaResource(resourceString string) (*VisaResource, error)
NewVisaResource creates a new VisaResource using the given VISA resourceString.