def rawDIO(self, D15toD8Directions = 0, D7toD0Directions = 0, D15toD8States = 0, D7toD0States = 0, IO3toIO0DirectionsAndStates = 0, UpdateDigital = False):
        """
        Name: U12.rawDIO(D15toD8Directions = 0, D7toD0Directions = 0,
                         D15toD8States = 0, D7toD0States = 0,
                         IO3toIO0DirectionsAndStates = 0, UpdateDigital = 1)
        
        Args: D15toD8Directions, A byte where 0 = Output, 1 = Input for D15-8
              D7toD0Directions, A byte where 0 = Output, 1 = Input for D7-0
              D15toD8States, A byte where 0 = Low, 1 = High for D15-8
              D7toD0States, A byte where 0 = Low, 1 = High for D7-0
              IO3toIO0DirectionsAndStates, Bits 7-4: Direction, 3-0: State
              UpdateDigital, True if you want to update the IO/D line. False to 
                             False to just read their values.
        
        Desc: This commands reads the direction and state of all the digital
              I/O. See Section 5.2 of the U12 User's Guide.
        
              By default, it just reads the directions and states.
        
        Returns: A dictionary with the following keys:
            D15toD8Directions, a BitField representing the directions of D15-D8
            D7toD0Directions, a BitField representing the directions of D7-D0.
            D15toD8States, a BitField representing the states of D15-D8.
            D7toD0States, a BitField representing the states of D7-D0.
            IO3toIO0States, a BitField representing the states of IO3-IO0.
            D15toD8OutputLatchStates, BitField of output latch states for D15-8
            D7toD0OutputLatchStates, BitField of output latch states for D7-0
        
        Example:
        >>> import u12
        >>> d = u12.U12()
        >>> d.rawDIO()
        {
          
          'D15toD8Directions':
            <BitField object: [ D15 = Input (1), D14 = Input (1),
                                D13 = Input (1), D12 = Input (1),
                                D11 = Input (1), D10 = Input (1),
                                D9 = Input (1), D8 = Input (1) ] >,
                                
          'D7toD0Directions':
            <BitField object: [ D7 = Input (1), D6 = Input (1), D5 = Input (1),
                                D4 = Input (1), D3 = Input (1), D2 = Input (1),
                                D1 = Input (1), D0 = Input (1) ] >,
                                
          'D15toD8States':
            <BitField object: [ D15 = Low (0), D14 = Low (0), D13 = Low (0),
                                D12 = Low (0), D11 = Low (0), D10 = Low (0),
                                D9 = Low (0), D8 = Low (0) ] >,
        
          'D7toD0States':
            <BitField object: [ D7 = Low (0), D6 = Low (0), D5 = Low (0),
                                D4 = Low (0), D3 = Low (0), D2 = Low (0),
                                D1 = Low (0), D0 = Low (0) ] >,
        
          'IO3toIO0States':
            <BitField object: [ IO3 = Low (0), IO2 = Low (0), IO1 = Low (0),
                                IO0 = Low (0) ] >,

          'D15toD8OutputLatchStates':
            <BitField object: [ D15 = 0 (0), D14 = 0 (0), D13 = 0 (0),
                                D12 = 0 (0), D11 = 0 (0), D10 = 0 (0),
                                D9 = 0 (0), D8 = 0 (0) ] >,
          
          'D7toD0OutputLatchStates':
            <BitField object: [ D7 = 0 (0), D6 = 0 (0), D5 = 0 (0), D4 = 0 (0),
                                D3 = 0 (0), D2 = 0 (0), D1 = 0 (0),
                                D0 = 0 (0) ] >
        }

        """
        command = [ 0 ] * 8
        
        # Bits for D15 through D8 Direction
        command[0] = int(D15toD8Directions)
        
        # Bits for D7 through D0 Direction ( 0 = Output, 1 = Input)
        command[1] = int(D7toD0Directions)
        
        # Bits for D15 through D8 State ( 0 = Low, 1 = High)
        command[2] = int(D15toD8States)
        
        # Bits for D7 through D0 State ( 0 = Low, 1 = High)
        command[3] = int(D7toD0States)
        
        # Bits 7-4: Bits for IO3 through IO0 Direction
        # Bits 3-0: Bits for IO3 through IO0 State
        command[4] = int(IO3toIO0DirectionsAndStates)
        
        # 01X10111 (DIO)
        command[5] = 0x57 # 0b01010111
        
        # Bit 0: Update Digital
        command[6] = int(bool(UpdateDigital))
        
        #XXXXXXXX
        # command[7] = XXXXXXXX
        
        self.write(command)
        results = self.read()
        
        returnDict = {}
        
        if results[0] != 87:
            raise U12Exception(results[0] % "Expected a DIO response, got %s instead.")
        
        returnDict['D15toD8States'] = BitField(results[1], "D", list(range(15, 7, -1)), "Low", "High")
        returnDict['D7toD0States'] = BitField(results[2], "D", list(range(7, -1, -1)), "Low", "High")
        
        returnDict['D15toD8Directions'] = BitField(results[4], "D", list(range(15, 7, -1)), "Output", "Input")
        returnDict['D7toD0Directions'] = BitField(results[5], "D", list(range(7, -1, -1)), "Output", "Input")
        
        returnDict['D15toD8OutputLatchStates'] = BitField(results[6], "D", list(range(15, 7, -1)))
        returnDict['D7toD0OutputLatchStates'] = BitField(results[7], "D", list(range(7, -1, -1)))
        
        returnDict['IO3toIO0States'] = BitField((results[3] >> 4), "IO", list(range(3, -1, -1)), "Low", "High")
        
        return returnDict
dataset/ETHPy150Open LabPy/lantz/lantz/drivers/labjack/_internal/u12.py/U12.rawDIO/swapped operands of `%`