How to use the canopen.pdo.base.Variable function in canopen

To help you get started, we’ve selected a few canopen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github christiansandberg / canopen / canopen / pdo / base.py View on Github external
def _fill_map(self, needed):
        """Fill up mapping array to required length."""
        logger.info("Filling up fixed-length mapping array")
        while len(self.map) < needed:
            # Generate a dummy mapping for an invalid object with zero length.
            obj = objectdictionary.Variable('Dummy', 0, 0)
            var = Variable(obj)
            var.length = 0
            self.map.append(var)
github christiansandberg / canopen / canopen / pdo / base.py View on Github external
def _get_variable(self, index, subindex):
        obj = self.pdo_node.node.object_dictionary[index]
        if isinstance(obj, (objectdictionary.Record, objectdictionary.Array)):
            obj = obj[subindex]
        var = Variable(obj)
        var.pdo_parent = self
        return var