Documentation
¶
Index ¶
- Constants
- Variables
- func ListPorts() ([]string, error)
- type ADC
- type Calib
- type Color
- type CommandNumber
- type DAC
- type DevicePort
- type HwFeatures
- type HwModel
- type Message
- type ModelM
- type ModelN
- type ModelS
- type OpenDAQ
- func (daq *OpenDAQ) Close() error
- func (daq *OpenDAQ) ConfigureADC(posInput, negInput, gainId uint, nSamples uint8) error
- func (daq *OpenDAQ) GetCalib(isOutput, diffMode, secondStage bool, n, gainId uint) Calib
- func (daq *OpenDAQ) GetInfo() (model, version uint8, serial string, err error)
- func (daq *OpenDAQ) ReadADC() (int16, error)
- func (daq *OpenDAQ) ReadAnalog() (float32, error)
- func (daq *OpenDAQ) ReadPIO(n uint) (uint8, error)
- func (daq *OpenDAQ) ReadPort() (uint8, error)
- func (daq *OpenDAQ) SetAnalog(n uint, val float32) error
- func (daq *OpenDAQ) SetDAC(n uint, val int) error
- func (daq *OpenDAQ) SetId(id uint32) (uint16, error)
- func (daq *OpenDAQ) SetLED(n uint, c Color) error
- func (daq *OpenDAQ) SetPIO(n uint, value bool) error
- func (daq *OpenDAQ) SetPIODir(n uint, out bool) error
- func (daq *OpenDAQ) SetPort(value_port uint8) error
- func (daq *OpenDAQ) SetPortDir(dir_port uint8) error
Constants ¶
View Source
const ( AIN = 1 AIN_CFG = 2 PIO = 3 AIN_ALL = 4 PIO_DIR = 5 PORT = 7 PORT_DIR = 9 SET_DAC = 13 LED_W = 18 SET_ANALOG = 24 GET_CALIB = 36 ID_CONFIG = 39 GET_AIN_CFG = 40 )
View Source
const ModelMId = 1
View Source
const ModelNId = 3
View Source
const ModelSId = 2
Variables ¶
View Source
var ( ErrUnknownModel = errors.New("Unknown device model number") ErrInvalidLed = errors.New("Invalid LED number") ErrInvalidInput = errors.New("Invalid input number") ErrInvalidOutput = errors.New("Invalid output number") ErrInvalidPIO = errors.New("Invalid PIO number") ErrInvalidGainID = errors.New("Invalid gain ID") ErrInvalidID = errors.New("ID out of range") ErrInvalidPIOValue = errors.New("Invalid PIO value") )
Functions ¶
Types ¶
type CommandNumber ¶
type CommandNumber uint8
type DevicePort ¶
func ListDevicePorts ¶
func ListDevicePorts() ([]DevicePort, error)
type HwFeatures ¶
type Message ¶
type Message struct {
Number CommandNumber
Body []byte
}
type ModelM ¶
type ModelM struct {
HwFeatures
}
func (*ModelM) CheckValidInputs ¶
func (*ModelM) GetCalibIndex ¶
Get the index of a calibration register. Each register contains a pair of calibration values: a gain and and offset.
isOutput: Obtain the calibration values of an output diffMode: Some models have different calibration values depending on the input mode (single-ended or differential) secondStage: The inputs with a PGA need two calibration registers. One is applied before the PGA and the other is applied after the PGA (second stage)
func (*ModelM) GetFeatures ¶
func (m *ModelM) GetFeatures() HwFeatures
type ModelN ¶
type ModelN struct {
HwFeatures
}
func (*ModelN) CheckValidInputs ¶
func (*ModelN) GetCalibIndex ¶
func (*ModelN) GetFeatures ¶
func (m *ModelN) GetFeatures() HwFeatures
type ModelS ¶
type ModelS struct {
HwFeatures
}
func (*ModelS) CheckValidInputs ¶
func (*ModelS) GetCalibIndex ¶
func (*ModelS) GetFeatures ¶
func (m *ModelS) GetFeatures() HwFeatures
type OpenDAQ ¶
type OpenDAQ struct {
HwFeatures
sync.Mutex
// contains filtered or unexported fields
}
func (*OpenDAQ) ConfigureADC ¶
func (*OpenDAQ) GetCalib ¶
Return the calibration values for a given input or output. The gain ID and the input mode (single-ended or differential) are needed. Different device models use different calibration schemas.
func (*OpenDAQ) ReadAnalog ¶
Read a value in volts from the ADC
func (*OpenDAQ) SetPortDir ¶
Configure all PIO direction.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.