############# Device Models ############# Every device supported by Samna has a corresponding device model. The device model has two main functions. It allows you to send and receive events to/from the device via the filter system, and to apply a new configuration to the device. After obtaining a development kit object using the device controller the chip model can be retrieved. .. code-block:: python # Obtain the device model for the device on the development kit we obtained from the device controller model = my_board.get_device_model() # Devices can also be closed via the device controller. samna.device.close_device(my_board) ************* Configuration ************* Device models all have an `apply_configuration()` function that accepts a configuration object. Such a configuration object can be created in Python, for example to create and apply a DYNAP-CNN configuration .. code-block:: python # Create a default configuration config = samna.dynapcnn.configuration.DynapcnnConfiguration() # Modify some parameter of the configuration if desired config.cnn_layers[0].monitor_enable = true # Apply the configuration to a device via its device model # This will generate errors if the configuration is illegal model.apply_configuration(config) ************* Event streams ************* All models can hook into the event filtering system using their source and sink nodes. All events written to the sink node of a device model will be transmitted to the physical device and all events produced by the physical device will be broadcast from the model source node. All device models provide the :py:meth:`get_source_node` and :py:meth:`get_sink_node` functions. ********************** Common model functions ********************** .. py:class:: Model .. py:function:: get_source_node Returns a reference to the source event node which will broadcast all events produced by the device. .. py:function:: get_sink_node Returns a reference to the sink event node which will transmit all events it receives to the device. .. py:function:: get_configuration Returns a copy of the current configuration of the device. Note that this is simply a copy of configuration provided to the last successful call to :py:meth:`apply_configuration`. This function does not read physical device state. .. py:function:: apply_configuration(configuration) Attempts to apply a configuration for the device. The configuration will first be validated and the configuration will only be applied if validation is successful. If validation does not succeed this method will throw an exception containing a validation error message. :param DeviceConfiguration configuration: The configuration specific to the type of device. *************************** Supported device models *************************** .. toctree:: :maxdepth: 1 :glob: speckSeries/summary dynapCnnSeries/summary xyloSeries/summary