User Tools

Site Tools


eeros_architecture:hal:configuration_file

This is an old revision of the document!


Configuration File

The external hardware is decribed by means of a configuration file in JSON format. Every available hardware must be grouped into device, subdevice and channel. A device could be a data acquisition card, an external FPGA, or a pointing device such as a mouse. The subdevice denotes a certain function such as a group of digital-to-analog outputs or a bank of digital inputs. Finally, a channel is one of such a group of inputs or outputs.
Let's consider a first example

{
  "device0": {
    "library": "libcomedieeros.so",
      "devHandle": "/dev/comedi0",
      "subdevice1": {
        "type": "DigIn",
        "channel0": {
          "signalId": "emergency"
          "inverted": true
        }
      },
      "subdevice5": {
        "type": "AnalogOut",
        "channel0": {
          "signalId": "aOut0",
          "scale": [ { "id" :    "aOut0",
                       "minIn":   2000, "maxIn":  64000,
                       "minOut":-9.787, "maxOut": 9.923 },
                   ],
          "range": [ { "id" :   "aOut0",
                       "minIn":      0, "maxIn":  65536,
                       "minOut": -10.0,	"maxOut":  10.0 },
                   ],
          "unit": "V"
        }
      }
    }
  }
}

Every element is composed of a key / value pair. The key must be unique for every hierachy level. The key for devices, subdevices, and channels contains the number of the device, subdevice, or channel, respectively.

Library

A device must contain a library key. The system can then search for the necessary library. This library must be present in the system and will be loaded dynamically upon parsing the configuration file. For available libraries check Hardware Libraries

Type

A subdevice must contain a type key. This type must coincide with the subdevice type of the hardware library in use. Some subdevices contain channels of different types, e.g. a subdevice might hold several digital i/o's. Some will work as inputs while some other will be outputs. In this case you define the subdevice as being of type DigIn. I single input channel inherits its type from the subdevice. If it is an output you can redefine the type for the channel.

  "subdevice5": {
    "type": "DigIn",
    "channel0": {
      "type": "DigOut",
      "signalId": "enableDrv"
    },
    "channel1": {
      "signalId": "readySig1"
    }
  }

SignalId

Every channel must contain a signalId key. This is an indentification string. The HAL manager registers the channel under this name and you have to request an input or output from your EEROS application with this name.

Scale and Range

Channels carrying an analog signal must be assigned a scale and range key. With these values the HAL is able to translate between the analog signal and its digital value as this digital value is necessary when accessing the hardware converter (counter, adc, dac). For examples in how to setup the scale and range properly see Scale and Range of Analog Signals

eeros_architecture/hal/configuration_file.1494493863.txt.gz · Last modified: 2017/05/11 11:11 (external edit)