Documentation ¶
Index ¶
- Constants
- func CheckSerialPort(port string) error
- func EnumerateSerialPorts() ([]string, []string, error)
- func FindSerialPort(id string, baudrate int, eol eol) string
- func SetupDiDestroyDeviceInfoList(DeviceInfoSet DevInfo) (err error)
- func SetupDiEnumDeviceInfo(DeviceInfoSet DevInfo, MemberIndex int, data *DevInfoData) (err error)
- func SetupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP) (value interface{}, err error)
- func TimeToStr(t float64) string
- func ToString(buf []byte) string
- func VoltToStr(v float64) string
- type Chan
- type Connection
- func (i *Connection) Ask(query string, args ...interface{}) (string, error)
- func (i *Connection) Close()
- func (i *Connection) Flush()
- func (i *Connection) Open(portName string) error
- func (i *Connection) PollFloat(query string, args ...interface{}) (float64, error)
- func (i *Connection) QueryIdn() (string, error)
- func (i *Connection) Read(b []byte) int
- func (i *Connection) ReadByte() byte
- func (i *Connection) ReadString() string
- func (i *Connection) SetTimeout(t time.Duration)
- func (i *Connection) Write(s string, args ...interface{}) error
- type Coupling
- type DIGCF
- type DevInfo
- type DevInfoData
- type Dmm
- type EngUnit
- type Psu
- type SPDRP
- type SampleMode
- type Scope
- type Setup
- type Slope
Constants ¶
const ( Lf eol = iota Cr CrLf LfCr None )
Character constants for line terminators
const ( OFF = iota DC AC GND HfReject LfReject NoiseReject )
Coupling constants are normal scope types
Variables ¶
This section is empty.
Functions ¶
func CheckSerialPort ¶
CheckSerialPort takes a serial port name and test if it exists and are not used already. It returns nil if the port is ok, and an error message if not
func EnumerateSerialPorts ¶
EnumerateSerialPorts will return a list of port names and a list of descriptions
func FindSerialPort ¶
FindSerialPort will return the name of the last (highest numbered) serial port that is not in use already
func SetupDiEnumDeviceInfo ¶
func SetupDiEnumDeviceInfo(DeviceInfoSet DevInfo, MemberIndex int, data *DevInfoData) (err error)
SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set.
func SetupDiGetDeviceRegistryProperty ¶
func SetupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP) (value interface{}, err error)
SetupDiGetDeviceRegistryProperty function retrieves a specified Plug and Play device property.
Types ¶
type Chan ¶
type Chan int
Chan is used for channel numbers. Note that Channel 1 is number 1 (the Ch1 constant).
type Connection ¶
type Connection struct { Port string Eol eol // Command string terminator Timeout time.Duration // Timeout on read operations Baudrate int // Baudrate for serial ports Name string // Identifier read from the instrument by *IDN? or similar // contains filtered or unexported fields }
Connection contains the local data for the connection to an instrument.
func (*Connection) Ask ¶
func (i *Connection) Ask(query string, args ...interface{}) (string, error)
Ask will query the instrument for a string response
func (*Connection) Close ¶
func (i *Connection) Close()
Close will close a connection already opened
func (*Connection) Open ¶
func (i *Connection) Open(portName string) error
Open will open a connection defined by portName The parameter is a TCP/IP address or a com port name
func (*Connection) PollFloat ¶
func (i *Connection) PollFloat(query string, args ...interface{}) (float64, error)
PollFloat will read a float64 value
func (*Connection) QueryIdn ¶
func (i *Connection) QueryIdn() (string, error)
QueryIdn will read the instrument identification string It uses *IDN? which most instruments implement
func (*Connection) Read ¶
func (i *Connection) Read(b []byte) int
ReadBinary will return an array of bytes
func (*Connection) ReadByte ¶
func (i *Connection) ReadByte() byte
ReadByte will return a single byte
func (*Connection) ReadString ¶
func (i *Connection) ReadString() string
ReadString will read any response from the instrument, with given timeout
func (*Connection) SetTimeout ¶
func (i *Connection) SetTimeout(t time.Duration)
SetTimeout sets the read timeout
func (*Connection) Write ¶
func (i *Connection) Write(s string, args ...interface{}) error
Write will send a commend to the instrument, adding end of line characters
type DIGCF ¶
type DIGCF uint32
DIGCF flags controll what is included in the device information set built by SetupDiGetClassDevs
type DevInfo ¶
DevInfo holds reference to device information set
func SetupDiGetClassDevsEx ¶
func SetupDiGetClassDevsEx(ClassGUID *windows.GUID, Enumerator string, hwndParent uintptr, Flags DIGCF, DeviceInfoSet DevInfo, MachineName string) (handle DevInfo, err error)
SetupDiGetClassDevsEx function returns a handle to a device information set that contains requested device information elements for a local or a remote computer.
type DevInfoData ¶
type DevInfoData struct { ClassGUID windows.GUID DevInst uint32 // handle // contains filtered or unexported fields }
DevInfoData is a device information structure (references a device instance that is a member of a device information set)
type Dmm ¶
type Dmm interface { Close() Configure(setup Setup) error Measure() (float64, error) QueryIdn() (string, error) }
Dmm is the interface for a digital multilmeter
type Psu ¶
type Psu interface { SetOutput(c Chan, voltage float64, current float64) error GetOutput(c Chan) (float64, float64, error) GetSetpoint(c Chan) (float64, float64, error) Disable(c Chan) QueryIdn() (string, error) Close() ChannelCount() int }
Psu is a generic power supply interface
type SampleMode ¶
type SampleMode int
SampleMode indicates the decimation mode going from the raw sampling interval to the time between stored samples
const ( // MinMax uses two samples for the minimum or maximum sample values MinMax SampleMode = iota // Sample uses a single sample for each sample interval Sample // Average will average all samples in the sample interval Average )
type Scope ¶
type Scope interface { // GetName will return the *IDN? string QueryIdn() (string, error) // DisableChannel will turn off channel (will no longer be sampled or returned by Curve()) DisableChannel(ch Chan) // SetupChannel where rng is 10*volt/div SetupChannel(ch Chan, rng float64, offset float64, coupling Coupling) error // GetChanInfo is.. GetChanInfo() []string // SetupTime will set sampling time and offset // sample time is typicaly timePrDiv/samplesPrDiv or f.ex. 10e-6/250 for 10uS/div // mode is SetupTime(sampleTime float64, offs float64, sampleMode SampleMode, sampleCount int) error // SetupTrigger will set main trigger parameters SetupTrigger(sourceChan Chan, coupling Coupling, slope Slope, trigLevel float64, auto bool, xPos float64) error // Measure data on channel. Type may vary, typical FREQUENCY, CRMS etc Measure(ch Chan, typ string) (float64, error) // Return the data points for a single scan on selected channels GetSamples() ([][]float64, error) // GetTime will return horizontal settings GetTime() (sampleIntervalSec float64, xPosSec float64) // Close will close communication channel Close() // ChannelCount is the maximum number of channels on this instrument ChannelCount() int }
Scope is an oscilloscope definition