Exemple #1
0
def test_i2c(proxy):
    '''
    Get metadata for all of the devices on the i2c bus.

    Parameters
    ----------
    proxy : Proxy

    Returns
    -------
    dict
        Nested dictionary (keyed by i2c address) containing metadata
        (e.g., uuid, name, software version, hardware version) for each of the
        devices on the i2c bus.


    .. versionchanged:: 1.47
        Split using byte strings to support Python 3.
    '''
    results = {}
    results['i2c_scan'] = {}
    for address in proxy.i2c_scan():
        if address in [32, 33, 34]:
            node = BaseNode(proxy, int(address))
            info = {
                'name': node.name().split(b'\0', 1)[0],
                'hardware_version': node.hardware_version().split(b'\0', 1)[0],
                'software_version': node.software_version().split(b'\0', 1)[0],
                'uuid': str(node.uuid)
            }
            results['i2c_scan'].update({int(address): info})
        elif address in [80, 81]:
            n_bytes = proxy.i2c_eeprom_read(address, 0, 1)
            data = proxy.i2c_eeprom_read(address, 1, n_bytes)
            board = metadata.Hardware.FromString(data.tobytes())
            info = {
                'name': board.name,
                'hardware_version': board.version,
                'uuid': str(uuid.UUID(bytes=board.uuid))
            }
            results['i2c_scan'].update({int(address): info})
        elif address == proxy.config.i2c_address:
            pass
        else:
            results['i2c_scan'].update({int(address): {}})
    return results
Exemple #2
0
 def __init__(self):
     """Initialization of Class object"""
     BaseNode.__init__(self)
 def __init__(self):
     """Initialization of Class object"""
     BaseNode.__init__(self)
     self.matrix_count = 0
 def __init__(self, proxy, address):
     BaseNode.__init__(self, proxy, address)
 def __init__(self):
     """Initialization of Class object"""
     BaseNode.__init__(self)
     self.thresh_count = 0
     self.thresh_val_count = 0
 def __init__(self):
     """Initialization of Class object"""
     BaseNode.__init__(self)
     self.table_lookup_count = 0
 def __init__(self, proxy, address):
     BaseNode.__init__(self, proxy, address)
Exemple #8
0
from dilate3x3 import Dilate3x3
from dilate2x2 import Dilate2x2
from erode3x3 import Erode3x3
from erode2x2 import Erode2x2
from add import Add
from multiply import Multiply
from scale_image import ScaleImage
from magnitude import Magnitude
from table_lookup import TableLookup
from or_node import Or
from and_node import And
from warp_affine import WarpAffine
from dubbel_io_test import DubbelIoTest

#Only create node classes once, when module is first loaded
DEFAULT_DUMMY_NODE = BaseNode() #Used if name of node is not in the dictionary

NODE_DICTIONARY = {'HalfScaleGaussian'  : HalfScaleGaussian(),
                   'Subtract'           : Subtract(),
                   'Threshold'          : Threshold(),
                   'Sobel3x3'           : Sobel3x3(),
                   'AbsDiff'            : AbsDiff(),
                   'ConvertDepth'       : ConvertDepth(),
                   'Dilate3x3'          : Dilate3x3(),
                   'Erode3x3'           : Erode3x3(),
                   'Add'                : Add(),
                   'Multiply'           : Multiply(),
                   'ScaleImage'         : ScaleImage(),
                   'Magnitude'          : Magnitude(),
                   'TableLookup'        : TableLookup(),
                   'Or'                 : Or(),
Exemple #9
0
 def __init__(self):
     """Initialization of Class object"""
     BaseNode.__init__(self)
     self.convert_depth_count = 0