Antilatency Hardware Extension Interface Library

Antilatency Hardware Extension Interface Library

This is a library for working with devices that supports the Antilatency Hardware Extension Interface.

How to use a library

  1. Load a library;
  2. Launch a Task with ​startTask​;
  3. Declare the operating modes of the necessary pins with:
  4. Switch the task in Run mode with ​run​;
  5. Work with the received interfaces (IInputPin, IOutputPin, etc.).

IInputPin

}

IOutputPin

}

IAnalogPin

}

IPulseCounterPin

}

IPwmPin

interface IPwmPin : InterfaceContract.IInterface {
void setDuty(​float value);
float getDuty(​);
uint getFrequency(​);
}
The higher frequency the more grades duty will have. Here is the list of the recommended frequencies:
To find out the actual frequency and duty, use getFrequency and getDuty.
Before the task enters Run state, all methods of these interfaces will have default values.

ICotask

interface ICotask : DeviceNetwork.ICotask {
IAnalogPin createAnalogPin(​Interop.Pins pin, uint refreshIntervalMs);
IPulseCounterPin createPulseCounterPin(​Interop.Pins pin, uint refreshIntervalMs);
IPwmPin createPwmPin(​Interop.Pins pin, uint frequency, float initialDuty);
void run(​);
}
ICotaskMethods for creating pins from an initialization table only. The table will be sent to the device via the run method.
The task is in Init​ state right after being launched. In this state only methods for creating pins work.

Run

run sends the initialization table to the device and waits for confirmation. The Task then enters ​Run mode. After exiting the method, the current states of all pins in input and analog input modes will be obtained, as well as the initial states of all pins in output mode will be set.
After switching to ​Run mode, you can use the necessary methods from the previously obtained interfaces (IInputPin, IOutputPin, etc.).
When the Task stops, all pins are de-initialized and enter a high-impedance state (Hi-Z).

Reasons of exceptions for methods for creating pins

  1. The run​ method has already been called.
  2. The specified pin is already in use.
  3. The specified pin does not support the required mode.
  4. Refresh interval ​is not in the valid range (see Constants).
  5. The maximum number of this type of pin has already been created.
  6. Different ​refresh interval​ for pins in pulse counter mode.