User Tools

Site Tools


eeros_architecture:safety_system:hal

This is an old revision of the document!


Hardware Abstraction Layer (HAL)

The safety system and the HAL are strongly coupled together. Make sure that your inputs and outputs in the HAL are all handled by your safety system.

Getting the HAL

Make an instance of the HAL with the following line:

  HAL& hal = HAL::instance();

Inputs and Outputs

All input and output should be observed by the safety system. The safety system alone decides if an input or output can be applied or not.

Define inputs and outputs

To access the digital I/O hardware within the comedi framework, you have to define the inputs and outputs and add them to the HAL.

  ComediDevice* comedi0 = new ComediDevice("/dev/comedi0");
  ComediDevice* comedi1 = new ComediDevice("/dev/comedi1");
 
  hal.addSystemInput(new ComediFqd("q0", comedi0, 11, 8, 10, 9, 6.28318530718 / (4 * 4096.0), 0, 0));  
  hal.addSystemOutput(new ComediDigOut("watchdog", comedi1, 2, 22));
  hal.addSystemOutput(new ComediDigOut("enable0", comedi0, 2, 24));
  hal.addSystemOutput(new ComediDigOut("brake0", comedi1, 2, 4, true));
  • Note: The class SystemInput<T> and SystemOutput<T> are template classes. If you define an input or an output as a boolean or a double, it should also be a boolean (on or off) or a double (e.g. voltage) on the hardware.
eeros_architecture/safety_system/hal.1427721453.txt.gz · Last modified: 2015/03/30 15:17 (external edit)