RevPiDevice

This class accommodates all inputs, outputs, and mems as RevPiIO objects, which are derived from the RevPiIOBase class.

Classes inheriting from  RevPiDevice:

  • This class is used directly for DIO / DI / DO modules.
  • RevPiCore Pictures the RevPi Core module.
  • RevPiGateway Pictures one Gateway module each.

All the attributes and functions listed here are also available in the inheriting classes.

class RevPiDevice(dict_device, **kwargs)
  • dict_deviceDevice Dictionary with all IO / mems from the piCtory configuration
  • kwargsThe following optional keyword parameters can be passed:
    • autoupdateDeviate data are updated from the process image when this is caused by RevPiDeviceList.
    • simulatorLoads the module as a simulator and swaps IOs

All values are passed by the RevPiDeviceList class.

The following attributes are provided:

autoupdate

This value determines whether the process image update of this device is to be performed by the central call to readprocimg (), updateprocimg (), writeprocimg (), or syncoutputs () of the RevPiDevicelist class. The default value for instantiation is True.


length

Returns the byte length of the device in the process Image


name

Returns the Devicename from piCtory


position

Returns position of piCtory

The following functions are provided:

get_inps()

Returns a list of all inputs on this device


get_iobyabsaddress(address)

Returns a list that contains all IO objects at the specified byte. The zeroth byte is also the zeroth byte in the entire process Image!
IMPORTANT: See also get_iobyaddress()!

  • address Byteadress in Process image

get_iobyaddress(address)

Returns a list that contains all IO objects at the specified byte. The zeroth byte is also the zeroth byte on this device!
IMPORTANT: The list can be empty if there is no IO on the byte, e.g. It is also empty if an IO extends over several bytes and the specified byte is one of the overpinned bytes. It can contain exactly one element, which can also be several bytes long. It can contain exactly 8 entries if bits are defined on the byte. Defined bits are a RevPiIOBase object and undefined bits are a None () object!

  • address Byteadress on the device

get_iobyname(name)

Returns the IO object with specified names

  • name Name for the IO-Object

get_mems()

Returns a list of all mems on this device


 get_outs()

Returns a list of all outputs on this device


reg_event(inp_name, func, **kwargs)

Registers a function to be triggered when the specified input is changed. Event handling takes place only when the program is in RevPiDevicelist.mainloop ().

  • inp_nameName of the input as str (), which is to be monitored
  • funcFunction that is triggered when the intput value changes
  • kwargsThe following optional keyword parameters can be passed:
    • as_threadPerforms the function as a RevPiCallback thread
    • edge Execution by RISING,FALLING or BOTH value changes (only for BIT Inputs)

 

unreg_event(inp_name, [func, edge])

Removes the input from event handling and no longer calls its function when changing data

  • inp_nameName of the input as str (), whose monitoring is to be deactivated.
  • funcDelete only events with specified function
  • edgeDelete only events with specified function and specified edge