コード例 #1
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_read_data_at_address(self, address):
     """Set the current address and read a value from it."""
     c_address = ct.ubyte(address)
     c_value = ct.ubyte()
     self._raise_on_error(
         _dll.LthsFpgaReadDataAtAddress(self._handle, c_address,
                                        ct.byref(c_value)))
     return c_value.value
コード例 #2
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_i2c_send_byte(self, address, value):
     """Send a value to an address over bit-banged I2C via FPGA register.
     
     address must be a 7-bit address, it will be left shifted internally.
     """
     c_address = ct.ubyte(address)
     c_value = ct.ubyte(value)
     self._raise_on_error(
         _dll.LthsFpgaI2cSendByte(self._handle, c_address, c_value))
コード例 #3
0
    def divide(first_operand, second_operand):
        """
        Divides the first operand by the second

        :param first_operand: The dividend
        :param second_operand: The divisor
        :return: A tuple -> (division result, remainder)
        """
        first_operand, second_operand = ubyte(first_operand).value, ubyte(second_operand).value
        return ubyte(first_operand / second_operand).value, ubyte(first_operand % second_operand).value
コード例 #4
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_i2c_receive_byte(self, address):
     """
     Receive a value from an address over bit-banged I2C via FPGA register.
     
     address must be a 7-bit address, it will be left shifted and the read
     bit will be set internally. The received value is returned.
     """
     c_address = ct.ubyte(address)
     c_value = ct.ubyte()
     self._raise_on_error(
         _dll.LthsFpgaI2cReceiveByte(self._handle, c_address,
                                     ct.byref(c_value)))
     return c_value.value
コード例 #5
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_i2c_set_bit_bang_register(self, register_address):
     """Set the FPGA register used to do bit-banged I2C.
     
     If not called, address used is 0x11.
     """
     c_register_address = ct.ubyte(register_address)
     self._raise_on_error(
         _dll.LthsFpgaI2cSetBitBangRegister(self._handle,
                                            c_register_address))
コード例 #6
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def gpio_read_low_byte(self):
     """Read the GPIO low byte and return the value"""
     c_value = ct.ubyte()
     self._raise_on_error(
         _dll.LthsGpioReadLowByte(self._handle, ct.byref(c_value)))
     return c_value.value
コード例 #7
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def gpio_write_low_byte(self, value):
     """Set the GPIO low byte to a value."""
     c_value = ct.ubyte(value)
     self._raise_on_error(_dll.LthsGpioWriteLowByte(self._handle, c_value))
コード例 #8
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def gpio_read_high_byte(self):
     """Read the GPIO high byte and return the value."""
     c_value = ct.ubyte()
     self._raise_on_error(
         _dll.LthsGpioReadHighByte(self._handle, ct.byref(c_value)))
     return c_value.value
コード例 #9
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_write_data_at_address(self, address, value):
     """Set the current address and write a value to it."""
     c_address = ct.ubyte(address)
     c_value = ct.ubyte(value)
     self._raise_on_error(
         _dll.LthsFpgaWriteDataAtAddress(self._handle, c_address, c_value))
コード例 #10
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_read_data(self):
     """Read a value from the current FPGA address and return it."""
     c_value = ct.ubyte()
     self._raise_on_error(
         _dll.LthsFpgaReadData(self._handle, ct.byref(c_value)))
     return c_value.value
コード例 #11
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_write_data(self, value):
     """Write a value to the current FPGA address."""
     c_value = ct.ubyte(value)
     self._raise_on_error(_dll.LthsFpgaWriteData(self._handle, c_value))
コード例 #12
0
ファイル: ltc_high_speed_comm.py プロジェクト: gargondoid/py
 def fpga_write_address(self, address):
     """Set the FPGA address to write or read."""
     c_address = ct.ubyte(address)
     self._raise_on_error(_dll.LthsFpgaWriteAddress(self._handle,
                                                    c_address))