atomik_dotnet_connector::

AtomikConnector

class

atomik_dotnet_connector.AtomikConnector

IDisposable

The AtoMik Connector class, which implements connectivity to the AtoMik test system.

Inner Classes

Variables

AtomikRpcConnector.AtomikRpcConnector.AtomikRpcConnectorClient _client

AtomikRpcConnectorManager.AtomikRpcConnectorManagerClient _managerClient

Dictionary< string, List< > > Dictionary<string, List<ISmuFuseBlownCb> > _fuseCallBacks

List< > List<IPwrEmergencyStopCb> _emergencyStopCallbacks

List< > List<IPwrLedButtonCb> _ledButtonCallbacks

List< > List<IBasLidClosedEventCb> _basLidClosedCallbacks

bool _connected

object _lock

CancellationTokenSource _cts

string _systemIdentifier

Functions

atomik_dotnet_connector.AtomikConnector.AtomikConnector

void Dispose()

Release all resources used by the current instance. Will close any ongoing connections. The object should not be called or used after calling Dispose.

void Connect(string systemIdentifier)

Connect this instance to the AtoMik Connector Service.

Parameters

string systemIdentifier

The identifier string that identifies the system configuration to use

bool SystemStatus()

Check that the system status.

Return

True if all configured devices are connected and operating normally

double DaqMeasureVoltage(string ep)

Measure analog voltage with DAQ.

Return

The voltage measured in volts

Parameters

string ep

The endpoint to perform the measurement on

void DaqSetAnalogOut(string ep, float voltage)

Configure a DAQ Analog Output endpoint.

Parameters

string ep

The endpoint to output voltage on

float voltage

The desired output voltage, in volts

void DaqDioSetOutput(string ep, float voltage, bool outputHigh)

Configure a DAQ DIO endpoint as an output.

Parameters

string ep

The endpoint to configure

float voltage

The desired output voltage indicating a logical ON signal, in volts

bool outputHigh

True if DIO should output HIGH, false if LOW.

void DaqDioSetInput(string ep, float voltage, DaqDioPinMode daqDioPinMode)

Configure a DAQ DIO endpoint as an input.

Parameters

string ep

The endpoint to configure

float voltage

The voltage logic level for the endpoint, in volts.

daqDioPinMode

Flags to set pull up or pull down modes, if desired

bool DaqDioGetInput(string ep)

Retrieve current input logical level for a DIO input.

Return

True if the logic level for the endpoint was read as HIGH, false if LOW.

Parameters

string ep

The endpoint to query

List< double > DaqDioMeasureFreq(string ep, int numSamples, float voltage, int targetFreq, int externalRefFreq)

Measure frequency on a DAQ DIO input.

Return

A list of numSamples samples in Hz, or a list of numSamples of float.NaN in case no signal was detected or other capture error occurred.

Parameters

string ep

The endpoint on which to perform the frequency measurement

int numSamples

Number of samples to query and return

float voltage

The input voltage level of the signal

int targetFreq

Target frequency that the signal is expected to have

int externalRefFreq

Set to 0 to select the DAQ internal TCXO as reference, or provide the external reference clock frequency if an external source is provided.

void DaqHighZControl(string ep, bool HighZEnable)

Control the HighZ mode of IAD-1001 DAQ boards which have I/O SSR relays mounted.

Parameters

string ep

Instrument endpoint string (probably :NONE

bool HighZEnable

Set to true to enable HighZ mode, false to disable.

double SmuMeasureVoltage(string ep)

Measure voltage on a SMU Vsense endpoint.

Return

The measured voltage in volts

Parameters

string ep

The endpoint to measure

double SmuMeasureCurrent(string ep, SmuMeasurementSpeed mspeed, SmuCurrentRange range)

Measure current draw on a SMU endpoint.

Return

The measured current, in amperes.

Parameters

string ep

The endpoint to measure

mspeed

Measurement speed. Slower is better averaging and less noisy, faster is faster.

range

The current measurement range to select.

void SmuSetVoutSwitchState(string ep, bool enabled)

Control the Vout switch for a SMU endpoint.

Parameters

string ep

The smu endpoint for which the Vout switch should be controlled

bool enabled

True to close the circuit, false to disable the output

void SmuSetVoutVoltage(string ep, float voltage, int slewrate)

Control voltage settings for a SMU endpoint.

Parameters

string ep

The SMU endpoint on which to control the voltage

float voltage

The desired output voltage, in volts

int slewrate

Slew rate when ramping voltage, as the number of millivolts per millisecond.

void SmuRegisterFuseBlownCallback(string ep, ISmuFuseBlownCb cb)

Register a callback that will be called if the SMU Soft fuse is activated for a SMU endpoint.

Parameters

string ep

The SMU endpoint to register the callback on

cb

An instance of a class implementing the callback interface to register

bool SmuCheckFuseBlown(string ep)

Check if the SMU Soft fuse has been activated for a given SMU endpoint.

Return

True if soft fuse has activated, false otherwise.

Parameters

string ep

The SMU channel to request fuse status on

void SmuSetFuse(string ep, SmuFuseMode fuseMode, int fuseCurrentInmA)

Configure the soft fuse for a SMU endpoint.

Parameters

string ep

The SMU endpoint to configure

fuseMode

Select how the fuse should work

int fuseCurrentInmA

Fuse max current, in milliamperes

void PwrSetLedButton(PwrLedState red, PwrLedState green, PwrLedState blue)

Set Pwr Led button LED indicator.

Parameters

red

Red LED state

green

Red LED state

blue

Red LED state

bool PwrGetEmergencyStopState()

Check status of the emergency stop.

Return

True if the emergency stop is engaged

void PwrRegisterEmergencyStopCallback(IPwrEmergencyStopCb cb)

Register a callback for when the emergency stop is engaged.

Parameters

cb

An instance of a class implementing the callback interface to register

void PwrRegisterLedButtonCallbacks(IPwrLedButtonCb cb)

Register a callback for when the LED button is pressed.

Parameters

cb

An instance of a class implementing the callback interface to register

void PwrSetAux24V(bool on)

Set the Pwr Aux 24V output.

Parameters

bool on

Enable Aux output

void PwrSetAux5V(bool on)

Set the Pwr Aux 5V output.

Parameters

bool on

Enable Aux output

void PwrSetGPO(string endpoint, bool on)

Control the Pwr open-drain AUX GPO outputs.

Parameters

string endpoint

Which GPO to configure

bool on

If the open drain on the GPO should be on (drain, logic low)

string PrgGetComportName(string endpoint)

Get the comport name for a programmer endpoint (PRG1, PRG2, PRG3 or PRG4)

Return

A string representing the comport (i.e. COM10), or raises an exception if none could be resolved.

Parameters

string endpoint

The programmer on the PRG instrument to request comport name for

void BasPowerDomainControl(int domain, bool enable)

Control power for the different BAS Power domains.

Parameters

int domain

Domain to enable or disable. 0 is A and 1 is B.

bool enable

True to enable power, False to disable.

void BasInstrumentResetControl(int instrumentIndex, bool enable)

Control the instrument reset signal(s) for the connected instruments.

Parameters

int instrumentIndex

The instrument number to control reset for.

bool enable

True to release reset, False to pull reset.

bool BasGetLidClosedState()

Get the current state of the lid closed input on BAS.

Return

True if lid is closed, false if not.

void BasRegisterLidClosedEventCallback(IBasLidClosedEventCb cb)

Register a callback for when the BAS lid closed signal changes state.

Parameters

cb

An instance of a class implementing the callback interface to register

void ExpbusPower(string endpoint, bool on)

Enable/Disable expansion interface power.

Parameters

string endpoint

Target expansion interface

bool on

Power on or off

void ExpbusConfigure(string endpoint, bool i2cEnable=false, bool spiEnable=false, bool spi_cs0_enable=false, bool spi_cs1_enable=false, bool spi_cs2_enable=false, bool spi_cs3_enable=false, bool spi_cs4_enable=false)

Configure the expansion bus interface communication interfaces.

Parameters

string endpoint

Target expansion interface

bool i2cEnable= false

Enable the I2C interface

bool spiEnable= false

Enable the SPI interface

bool spi_cs0_enable= false

Configure CS0 as SPI CS pin

bool spi_cs1_enable= false

Configure CS1 as SPI CS pin

bool spi_cs2_enable= false

Configure CS2 as SPI CS pin

bool spi_cs3_enable= false

Configure CS3 as SPI CS pin

bool spi_cs4_enable= false

Configure CS4 as SPI CS pin

void ExpbusI2cConfigure(string endpoint, I2cFrequency frequency)

Configure the expansion bus I2C interface.

Parameters

string endpoint

Target expansion interface

frequency

I2C frequency

byte[] ExpbusI2cTransfer(string endpoint, byte[] tx, int rxLen, bool noStop=false)

Transmit (send and/or receive) data on the expansion bus I2C interface.

Return

Received data

Parameters

string endpoint

Target expansion interface

byte[] tx

Data to send

int rxLen

Expected response length

bool noStop= false

If stop condition should not be set at the end of this transaction

void ExpbusSpiConfigure(string endpoint, int frequency, int bits=8, SpiMode spiMode=SpiMode.MODE_0)

Configure the expansion bus SPI.

Parameters

string endpoint

Target expansion interface

int frequency

SPI frequency. This is the maximum frequency to select, the resulting actual frequency will be the closest match that the AtoMik device can support.

int bits= 8

Bits per word, usually 8

spiMode

SPI mode, usually mode 0

byte[] ExpbusSpiTransfer(string endpoint, byte[] tx, int rxLen, SpiCsPin csPin=SpiCsPin.SPI_CS_PIN_NONE, bool keepCs=false)

Transmit (send and/or receive) data on the expansion bus SPI.

Return

Parameters

string endpoint

Target expansion interface

byte[] tx

Data to send

int rxLen

Number of bytes to receive, starting from beginning of the transmission.

csPin

Which CS pin to use

bool keepCs= false

Set to leave the CS pin asserted when the operation ends

void ExpbusGpioConfigureInput(string endpoint, GpioInputMode mode)

Configure an Expansion Bus pin as GPIO Input.

Parameters

string endpoint

Expansion bus pin

mode

Input mode to put the pin in

void ExpbusGpioConfigureOutput(string endpoint, bool state, GpioOutputMode mode=GpioOutputMode.PUSH_PULL)

Configure an Expansion Bus pin as GPIO Ouput.

Parameters

string endpoint

Expansion bus pin

bool state

Output state for the pin. True for high, False for low

mode

Output mode for the pin

bool ExpbusGpioRead(string endpoint)

Read the logic-state of an Expansion Bus pin.

Return

True when pin is high, False when pin is low

Parameters

string endpoint

Expansion bus pin

void ExpbusGpioRelease(string endpoint)

Release a previously configured Expansion Bus pin from being a GPIO pin.

Parameters

string endpoint

Expansion Bus pin

List< > List< AtomikConnectorDeviceInfo > GetSystemDeviceInfo()

Retrieve information about devices configured in this system.

Return

A list of AtomikConnectorDeviceInfo objects describing the configured devices in this system

void virtual Dispose(bool disposing)

Parameters

bool disposing

True when called explicitly. I.e not being garbage collected

async Task ResponseStreamReaderAsync(IAsyncStreamReader< AtomikRpcConnector.ConnectorStream > stream, CancellationToken cancellationToken=default(CancellationToken))

Parameters

IAsyncStreamReader< AtomikRpcConnector.ConnectorStream > stream
CancellationToken cancellationToken= default(CancellationToken)